Subversion Repositories Applications.papyrus

Rev

Blame | Last modification | View Log | RSS feed

<?
//------------------------------------------------------------------------------
// FICHIER : $RCSfile: adsi_style.fonct.php,v $
// AUTEUR  : $Author: jpm $
// VERSION : $Revision: 1.1 $
// DATE    : $Date: 2004-06-16 14:29:01 $
//------------------------------------------------------------------------------
// GSite - Web site management in PHP - gus module
//
// Copyright (C) 2001 COUDOUNEAU Laurent (lc@gsite.org)
// 
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------

//==============================================================================
//==============================================================================

function addStyle ($db, $link) {
  $styleName = substr (md5 (uniqid (rand ())), 0, 16);
  
  $query = "insert into $db.STYLE set S_NAME='$styleName'";
  
  $result = mysql_query ($query, $link);

  if (! $result) {
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
  }
}

//==============================================================================
//==============================================================================

function delStyle ($db, $link, $gusstyid) {
  $query = "delete from $db.STYLE where S_NAME='$gusstyid'";
  
  $result = mysql_query ($query, $link);

  if (! $result) {
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
  }
}

//==============================================================================
//==============================================================================

function updStyle ($db, $link, $locale, $gusstyid, $baseURL, $baseHidden, $msg = '') {
  //----------------------------------------------------------------------------
  // Get style.
  
  $query = "select * from $db.STYLE where S_NAME='$gusstyid'";
  
  $result = mysql_query ($query, $link);

  if (! $result) {
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
  }
  
  $row = mysql_fetch_object ($result);
  
  mysql_free_result ($result);
  
  if (! $row) return '';
  
  //----------------------------------------------------------------------------
  // Labels.
  
  $nameLabel      = gs_getLabel ($db, $link, 'gus_name',          $locale, 'gus').'&nbsp;:&nbsp;';
  $txtcolLabel    = gs_getLabel ($db, $link, 'gus_col_txt',       $locale, 'gus').'&nbsp;:&nbsp;';
  $col1Label      = gs_getLabel ($db, $link, 'gus_col_1',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col2Label      = gs_getLabel ($db, $link, 'gus_col_2',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col3Label      = gs_getLabel ($db, $link, 'gus_col_3',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col4Label      = gs_getLabel ($db, $link, 'gus_col_4',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col5Label      = gs_getLabel ($db, $link, 'gus_col_5',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col6Label      = gs_getLabel ($db, $link, 'gus_col_6',         $locale, 'gus').'&nbsp;:&nbsp;';
  $col7Label      = gs_getLabel ($db, $link, 'gus_col_7',         $locale, 'gus').'&nbsp;:&nbsp;';
  $txtinvcolLabel = gs_getLabel ($db, $link, 'gus_col_txt_inv',   $locale, 'gus').'&nbsp;:&nbsp;';
  $txtaltcolLabel = gs_getLabel ($db, $link, 'gus_col_txt_alert', $locale, 'gus').'&nbsp;:&nbsp;';
  $fontfLabel     = gs_getLabel ($db, $link, 'gus_font_fam',      $locale, 'gus').'&nbsp;:&nbsp;';
  $fonttLabel     = gs_getLabel ($db, $link, 'gus_font_tiny',     $locale, 'gus').'&nbsp;:&nbsp;';
  $fontsLabel     = gs_getLabel ($db, $link, 'gus_font_small',    $locale, 'gus').'&nbsp;:&nbsp;';
  $fontbLabel     = gs_getLabel ($db, $link, 'gus_font_big',      $locale, 'gus').'&nbsp;:&nbsp;';
  
  //----------------------------------------------------------------------------
  // Dump data.
  
  $outputText = '';
  
  $outputText .= "\n".'<TR>';
  $outputText .= "\n".'  <TD><FORM name="updform" action="document.php" method="POST">'.
                    '<TABLE align="center" summary="" cellspacing="0" cellpadding="0" border="0">';
  
  if ($msg != '') {
    $outputText .= "\n".'    <TR><TD class="gusError" colspan="6">'.$msg.'</TD></TR>';
  }
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$nameLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="gusname"';
  $outputText .= "\n".'         size="16"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_NAME).'"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtcolLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscoltxt"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtinvcolLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscolinvtxt"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT_INVERSE).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT_INVERSE.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtaltcolLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscolalttxt"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT_ALERT).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT_ALERT.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col1Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol1"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_1).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_1.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col2Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol2"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_2).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_2.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col3Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol3"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_3).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_3.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col7Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol7"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_7).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_7.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col4Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol4"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_4).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_4.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col5Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol5"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_5).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_5.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$col6Label.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="guscol6"';
  $outputText .= "\n".'         size="10"';
  $outputText .= "\n".'         maxlength="16"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_6).'"></TD>';
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_6.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontfLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="gusfontf"';
  $outputText .= "\n".'         size="64"';
  $outputText .= "\n".'         maxlength="255"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_FAMILY).'"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$fonttLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="gusfontt"';
  $outputText .= "\n".'         size="8"';
  $outputText .= "\n".'         maxlength="8"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_TINY).'"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontsLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="gusfonts"';
  $outputText .= "\n".'         size="8"';
  $outputText .= "\n".'         maxlength="8"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_SMALL).'"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontbLabel.'</TD>';
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
  $outputText .= "\n".'         class="gusInput"';
  $outputText .= "\n".'         type="text"';
  $outputText .= "\n".'         name="gusfontb"';
  $outputText .= "\n".'         size="8"';
  $outputText .= "\n".'         maxlength="8"';
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_BIG).'"></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD></TR>';
  
  $bodyStyle =
    "background-color: $row->S_COLOR_1;";
  
  $frameStyle =
    "background-color: $row->S_COLOR_2;";
  
  $backStyle =
    "background-color: $row->S_COLOR_3;";
  
  $onStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;".
    "text-align:center; vertical-align=middle;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_7;";
  
  $offStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;".
    "text-align:center; vertical-align=middle;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_4;";
  
  $texttStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_TINY;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_3;";
  
  $textsStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_3;";
  
  $textbStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_BIG;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_3;";
  
  $alertStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;font-weight:bold;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT_ALERT;".
    "background-color:$row->S_COLOR_3;";
  
  $labelStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;font-weight:bold;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_5;";
  
  $inputStyle =
    "font-family:$row->S_FONT_FAMILY;".
    "font-size:$row->S_FONT_SIZE_SMALL;".
    "text-align:left; vertical-align=top;".
    "color:$row->S_COLOR_TEXT;".
    "background-color:$row->S_COLOR_6;";
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD colspan="6" style="'.$bodyStyle.'"><BR><TABLE align="center" summary="" cellspacing="0" cellpadding="0" border="0">';
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="78" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
  
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="10" height="1"></TD>';
  
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="78" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
  
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="229" height="1"></TD>';
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
  $outputText .= "\n".'            <TD style="'.$onStyle.'">Azerty</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
  
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="10" height="1"></TD>';
  
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
  $outputText .= "\n".'            <TD style="'.$offStyle.'">Qwerty</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'" colspan="9"><IMG src="Local/vide.gif" alt="" width="400" height="1"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$texttStyle.'" colspan="7">&nbsp;text tiny</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$textsStyle.'" colspan="7">&nbsp;text medium</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$textbStyle.'" colspan="7">&nbsp;text big</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$alertStyle.'" colspan="7">&nbsp;text alert</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$labelStyle.'" colspan="7">&nbsp;label</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$inputStyle.'" colspan="7">&nbsp;input</TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD style="'.$frameStyle.'" colspan="9"><IMG src="Local/vide.gif" alt="" width="400" height="1"></TD>';
  $outputText .= "\n".'          </TR>';
  
  $outputText .= "\n".'        </TABLE><BR></TD>';
  $outputText .= "\n".'    </TR>';
  
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD></TR>';
  
  $outputText .= "\n".'    <TR>';
  $outputText .= "\n".'      <TD align="center" colspan="6"><TABLE border="0" summary="" width="100%" cellpadding="0" cellspacing="0">';
  $outputText .= "\n".'          <TR>';
  $outputText .= "\n".'            <TD align="center"><INPUT type="image" src="Local/icons/validate.gif"></TD>';
  $outputText .= "\n".'            <TD align="center"><A href="'.$baseURL.'"><IMG '.
                          'border="0" src="Local/icons/cancel.gif" alt="" width="16" height="16"></A></TD>';
  $outputText .= "\n".'          </TR>';
  $outputText .= "\n".'        </TABLE></TD>';
  $outputText .= "\n".'    </TR>';
  $outputText .= "\n".'    </TABLE>';
  
  $outputText .= "\n".'    <INPUT type="hidden" name="guscmd"   value="commitupdsty">';
  $outputText .= "\n".'    <INPUT type="hidden" name="gusstyid" value="'.$gusstyid.'">';
  $outputText .= $baseHidden;
  
  $outputText .= "\n".'  </FORM></TD>';
  $outputText .= "\n".'</TR>';
  
  return $outputText;
}

//==============================================================================
//==============================================================================

function commitUpdStyle ($db, $link, $locale, $gusstyid, &$msg) {
  //----------------------------------------------------------------------------
  // Form variables.
  
  global $gusname;
  global $guscoltxt;
  global $guscolinvtxt;
  global $guscolalttxt;
  global $guscol1;
  global $guscol2;
  global $guscol3;
  global $guscol4;
  global $guscol5;
  global $guscol6;
  global $guscol7;
  global $gusfontf;
  global $gusfontt;
  global $gusfonts;
  global $gusfontb;
  
  //----------------------------------------------------------------------------
  // We have to update the name ?
  
  if ($gusname != $gusstyid) {
    $query = "select * from $db.STYLE where S_NAME='$gusname'";
    
    $result = mysql_query ($query, $link);
    
    if (! $result) {
      die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
    }
    
    $row = mysql_fetch_row ($result);
    
    mysql_free_result ($result);
    
    if ($row) {
      $msg =
        gs_getLabel ($db, $link, 'gus_duplicate_sty', $locale, 'gus').
        "&nbsp;($gusname)";
      
      return $gusstyid;
    }
  }
  
  $query =
    "update $db.STYLE set".
    "  S_NAME='$gusname'".
    ", S_COLOR_TEXT='$guscoltxt'".
    ", S_COLOR_TEXT_INVERSE='$guscolinvtxt'".
    ", S_COLOR_TEXT_ALERT='$guscolalttxt'".
    ", S_COLOR_1='$guscol1'".
    ", S_COLOR_2='$guscol2'".
    ", S_COLOR_3='$guscol3'".
    ", S_COLOR_4='$guscol4'".
    ", S_COLOR_5='$guscol5'".
    ", S_COLOR_6='$guscol6'".
    ", S_COLOR_7='$guscol7'".
    ", S_FONT_FAMILY='$gusfontf'".
    ", S_FONT_SIZE_TINY='$gusfontt'".
    ", S_FONT_SIZE_SMALL='$gusfonts'".
    ", S_FONT_SIZE_BIG='$gusfontb'".
    " where S_NAME='$gusstyid'";
  
  $result = mysql_query ($query, $link);
  
  if (! $result) {
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
  }
  
  return $gusname;
}

//==============================================================================
//==============================================================================

function listStyles ($db, $link, $project, $locale,
                     $baseURL, $baseURLjs,
                     $msg) {
  //----------------------------------------------------------------------------
  // Javascript.
  
  $goMsg = addslashes (gs_getLabel ($db, $link, 'delete', $locale, 'gsite', false));
  
  js_register ('modifyStyle',
    "  function modifyStyle (oSelect) {"."\n".
    "    var url = '$baseURLjs'+'&guscmd=updsty';"."\n".
    "    if (oSelect.selectedIndex != -1) {"."\n".
    "      url += '&gusstyid='+oSelect.options[oSelect.selectedIndex].value;"."\n".
    "      document.location = url;"."\n".
    "    }"."\n".
    "  }"."\n"
  );
  
  js_register ('deleteStyle',
    "  function deleteStyle (oSelect) {"."\n".
    "    var url = '$baseURLjs'+'&guscmd=delsty';"."\n".
    "    if (oSelect.selectedIndex != -1) {"."\n".
    "      url += '&gusstyid='+oSelect.options[oSelect.selectedIndex].value;"."\n".
    "      if (window.confirm ('$goMsg')) {"."\n".
    "        document.location = url;"."\n".
    "      }"."\n".
    "    }"."\n".
    "  }"."\n"
  );
  
  //----------------------------------------------------------------------------
  // Buttons.
  
  $i = 0;
  
  //-- Modify style.
  $btInfos1[$i++] = array (
                     'text' => 'gus_mod',
                     'appl' => 'gus',
                     'url'  => 'javascript:modifyStyle (document.gform.gselect)');
  
  //-- Add style.
  $btInfos1[$i++] = array (
                     'text' => 'gus_add',
                     'appl' => 'gus',
                     'url'  => $baseURL.'&amp;guscmd=addsty');
  
  //-- Delete style.
  $btInfos1[$i++] = array (
                     'text' => 'gus_del',
                     'appl' => 'gus',
                     'url'  => 'javascript:deleteStyle (document.gform.gselect)');
  
  $btInfos1[$i++] = array ('space' => true);
  
  //-- Logout.
  $btInfos1[$i++] = array (
                     'text' => 'logout',
                     'appl' => 'gsite',
                     'url'  => $baseURL.'&amp;auth_logout=1');
  
  $button1 =
    gs_genericButtons ($db, $link, $locale,
                       $btInfos1,
                       false);
  
  //----------------------------------------------------------------------------
  // List styles.
  
  $query = "select * from $db.STYLE order by S_NAME";
  
  $STYresult = mysql_query ($query, $link);

  if (! $STYresult) {
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
  }
  
  //----------------------------------------------------------------------------
  // Build form.
  
  $text = '';
  $text .= "\n".'<FORM name="gform" action="document.php" method="get">';
  $text .= "\n".'  <SELECT class="gusInput" name="gselect" size="20" ondblclick="javascript:modifyStyle (document.gform.gselect)">';
  
  while ($row = mysql_fetch_object ($STYresult)) {
    $text .= "\n".'    <OPTION value="'.htmlentities ($row->S_NAME).'">';
    $text .= htmlentities ($row->S_NAME);
    $text .= '</OPTION>';
  }
  
  $text .= "\n".'  </SELECT>';
  
  $text .= "\n".'</FORM>';
  
  mysql_free_result ($STYresult);
  
  //----------------------------------------------------------------------------
  // Build page.
  
  $title = gs_getLabel ($db, $link, 'gus_title3', $locale, 'gus');
  
  return
    buildPage (
      $button1,
      '',
      $title,
      $text,
      $msg);
}

//------------------------------------------------------------------------------
// $Log: not supported by cvs2svn $
// Revision 1.1  2003/10/10 09:58:21  alex
// installation
//
// Revision 1.1.1.1  2002/10/02 07:32:21  root
// initialisation site de Tela
//
// Revision 1.3  2002/06/14 07:23:23  lc
// Bug LC0021 : use js_register
//
// Revision 1.2  2002/05/30 14:49:39  lc
// Admin of tiny font size.
//
// Revision 1.1  2002/02/25 16:35:57  lc
// First revision.
//
//-- End of source  ------------------------------------------------------------
?>