Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 jpm 1
<?
2
//------------------------------------------------------------------------------
3
// FICHIER : $RCSfile: adsi_style.fonct.php,v $
4
// AUTEUR  : $Author: jpm $
5
// VERSION : $Revision: 1.1 $
6
// DATE    : $Date: 2004-06-16 14:29:01 $
7
//------------------------------------------------------------------------------
8
// GSite - Web site management in PHP - gus module
9
//
10
// Copyright (C) 2001 COUDOUNEAU Laurent (lc@gsite.org)
11
//
12
// This library is free software; you can redistribute it and/or
13
// modify it under the terms of the GNU Lesser General Public
14
// License as published by the Free Software Foundation; either
15
// version 2.1 of the License, or (at your option) any later version.
16
//
17
// This library is distributed in the hope that it will be useful,
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20
// Lesser General Public License for more details.
21
//
22
// You should have received a copy of the GNU Lesser General Public
23
// License along with this library; if not, write to the Free Software
24
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
//------------------------------------------------------------------------------
26
//------------------------------------------------------------------------------
27
 
28
//==============================================================================
29
//==============================================================================
30
 
31
function addStyle ($db, $link) {
32
  $styleName = substr (md5 (uniqid (rand ())), 0, 16);
33
 
34
  $query = "insert into $db.STYLE set S_NAME='$styleName'";
35
 
36
  $result = mysql_query ($query, $link);
37
 
38
  if (! $result) {
39
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
40
  }
41
}
42
 
43
//==============================================================================
44
//==============================================================================
45
 
46
function delStyle ($db, $link, $gusstyid) {
47
  $query = "delete from $db.STYLE where S_NAME='$gusstyid'";
48
 
49
  $result = mysql_query ($query, $link);
50
 
51
  if (! $result) {
52
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
53
  }
54
}
55
 
56
//==============================================================================
57
//==============================================================================
58
 
59
function updStyle ($db, $link, $locale, $gusstyid, $baseURL, $baseHidden, $msg = '') {
60
  //----------------------------------------------------------------------------
61
  // Get style.
62
 
63
  $query = "select * from $db.STYLE where S_NAME='$gusstyid'";
64
 
65
  $result = mysql_query ($query, $link);
66
 
67
  if (! $result) {
68
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
69
  }
70
 
71
  $row = mysql_fetch_object ($result);
72
 
73
  mysql_free_result ($result);
74
 
75
  if (! $row) return '';
76
 
77
  //----------------------------------------------------------------------------
78
  // Labels.
79
 
80
  $nameLabel      = gs_getLabel ($db, $link, 'gus_name',          $locale, 'gus').'&nbsp;:&nbsp;';
81
  $txtcolLabel    = gs_getLabel ($db, $link, 'gus_col_txt',       $locale, 'gus').'&nbsp;:&nbsp;';
82
  $col1Label      = gs_getLabel ($db, $link, 'gus_col_1',         $locale, 'gus').'&nbsp;:&nbsp;';
83
  $col2Label      = gs_getLabel ($db, $link, 'gus_col_2',         $locale, 'gus').'&nbsp;:&nbsp;';
84
  $col3Label      = gs_getLabel ($db, $link, 'gus_col_3',         $locale, 'gus').'&nbsp;:&nbsp;';
85
  $col4Label      = gs_getLabel ($db, $link, 'gus_col_4',         $locale, 'gus').'&nbsp;:&nbsp;';
86
  $col5Label      = gs_getLabel ($db, $link, 'gus_col_5',         $locale, 'gus').'&nbsp;:&nbsp;';
87
  $col6Label      = gs_getLabel ($db, $link, 'gus_col_6',         $locale, 'gus').'&nbsp;:&nbsp;';
88
  $col7Label      = gs_getLabel ($db, $link, 'gus_col_7',         $locale, 'gus').'&nbsp;:&nbsp;';
89
  $txtinvcolLabel = gs_getLabel ($db, $link, 'gus_col_txt_inv',   $locale, 'gus').'&nbsp;:&nbsp;';
90
  $txtaltcolLabel = gs_getLabel ($db, $link, 'gus_col_txt_alert', $locale, 'gus').'&nbsp;:&nbsp;';
91
  $fontfLabel     = gs_getLabel ($db, $link, 'gus_font_fam',      $locale, 'gus').'&nbsp;:&nbsp;';
92
  $fonttLabel     = gs_getLabel ($db, $link, 'gus_font_tiny',     $locale, 'gus').'&nbsp;:&nbsp;';
93
  $fontsLabel     = gs_getLabel ($db, $link, 'gus_font_small',    $locale, 'gus').'&nbsp;:&nbsp;';
94
  $fontbLabel     = gs_getLabel ($db, $link, 'gus_font_big',      $locale, 'gus').'&nbsp;:&nbsp;';
95
 
96
  //----------------------------------------------------------------------------
97
  // Dump data.
98
 
99
  $outputText = '';
100
 
101
  $outputText .= "\n".'<TR>';
102
  $outputText .= "\n".'  <TD><FORM name="updform" action="document.php" method="POST">'.
103
                    '<TABLE align="center" summary="" cellspacing="0" cellpadding="0" border="0">';
104
 
105
  if ($msg != '') {
106
    $outputText .= "\n".'    <TR><TD class="gusError" colspan="6">'.$msg.'</TD></TR>';
107
  }
108
 
109
  $outputText .= "\n".'    <TR>';
110
  $outputText .= "\n".'      <TD class="gusLabel">'.$nameLabel.'</TD>';
111
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
112
  $outputText .= "\n".'         class="gusInput"';
113
  $outputText .= "\n".'         type="text"';
114
  $outputText .= "\n".'         name="gusname"';
115
  $outputText .= "\n".'         size="16"';
116
  $outputText .= "\n".'         maxlength="16"';
117
  $outputText .= "\n".'         value="'.htmlentities ($row->S_NAME).'"></TD>';
118
  $outputText .= "\n".'    </TR>';
119
 
120
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
121
 
122
  $outputText .= "\n".'    <TR>';
123
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtcolLabel.'</TD>';
124
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
125
  $outputText .= "\n".'         class="gusInput"';
126
  $outputText .= "\n".'         type="text"';
127
  $outputText .= "\n".'         name="guscoltxt"';
128
  $outputText .= "\n".'         size="10"';
129
  $outputText .= "\n".'         maxlength="16"';
130
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT).'"></TD>';
131
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
132
  $outputText .= "\n".'    </TR>';
133
 
134
  $outputText .= "\n".'    <TR>';
135
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtinvcolLabel.'</TD>';
136
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
137
  $outputText .= "\n".'         class="gusInput"';
138
  $outputText .= "\n".'         type="text"';
139
  $outputText .= "\n".'         name="guscolinvtxt"';
140
  $outputText .= "\n".'         size="10"';
141
  $outputText .= "\n".'         maxlength="16"';
142
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT_INVERSE).'"></TD>';
143
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT_INVERSE.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
144
  $outputText .= "\n".'      <TD class="gusLabel">'.$txtaltcolLabel.'</TD>';
145
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
146
  $outputText .= "\n".'         class="gusInput"';
147
  $outputText .= "\n".'         type="text"';
148
  $outputText .= "\n".'         name="guscolalttxt"';
149
  $outputText .= "\n".'         size="10"';
150
  $outputText .= "\n".'         maxlength="16"';
151
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_TEXT_ALERT).'"></TD>';
152
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_TEXT_ALERT.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
153
  $outputText .= "\n".'    </TR>';
154
 
155
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
156
 
157
  $outputText .= "\n".'    <TR>';
158
  $outputText .= "\n".'      <TD class="gusLabel">'.$col1Label.'</TD>';
159
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
160
  $outputText .= "\n".'         class="gusInput"';
161
  $outputText .= "\n".'         type="text"';
162
  $outputText .= "\n".'         name="guscol1"';
163
  $outputText .= "\n".'         size="10"';
164
  $outputText .= "\n".'         maxlength="16"';
165
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_1).'"></TD>';
166
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_1.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
167
  $outputText .= "\n".'      <TD class="gusLabel">'.$col2Label.'</TD>';
168
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
169
  $outputText .= "\n".'         class="gusInput"';
170
  $outputText .= "\n".'         type="text"';
171
  $outputText .= "\n".'         name="guscol2"';
172
  $outputText .= "\n".'         size="10"';
173
  $outputText .= "\n".'         maxlength="16"';
174
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_2).'"></TD>';
175
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_2.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
176
  $outputText .= "\n".'    </TR>';
177
 
178
  $outputText .= "\n".'    <TR>';
179
  $outputText .= "\n".'      <TD class="gusLabel">'.$col3Label.'</TD>';
180
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
181
  $outputText .= "\n".'         class="gusInput"';
182
  $outputText .= "\n".'         type="text"';
183
  $outputText .= "\n".'         name="guscol3"';
184
  $outputText .= "\n".'         size="10"';
185
  $outputText .= "\n".'         maxlength="16"';
186
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_3).'"></TD>';
187
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_3.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
188
  $outputText .= "\n".'    </TR>';
189
 
190
  $outputText .= "\n".'    <TR>';
191
  $outputText .= "\n".'      <TD class="gusLabel">'.$col7Label.'</TD>';
192
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
193
  $outputText .= "\n".'         class="gusInput"';
194
  $outputText .= "\n".'         type="text"';
195
  $outputText .= "\n".'         name="guscol7"';
196
  $outputText .= "\n".'         size="10"';
197
  $outputText .= "\n".'         maxlength="16"';
198
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_7).'"></TD>';
199
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_7.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
200
  $outputText .= "\n".'      <TD class="gusLabel">'.$col4Label.'</TD>';
201
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
202
  $outputText .= "\n".'         class="gusInput"';
203
  $outputText .= "\n".'         type="text"';
204
  $outputText .= "\n".'         name="guscol4"';
205
  $outputText .= "\n".'         size="10"';
206
  $outputText .= "\n".'         maxlength="16"';
207
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_4).'"></TD>';
208
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_4.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
209
  $outputText .= "\n".'    </TR>';
210
 
211
  $outputText .= "\n".'    <TR>';
212
  $outputText .= "\n".'      <TD class="gusLabel">'.$col5Label.'</TD>';
213
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
214
  $outputText .= "\n".'         class="gusInput"';
215
  $outputText .= "\n".'         type="text"';
216
  $outputText .= "\n".'         name="guscol5"';
217
  $outputText .= "\n".'         size="10"';
218
  $outputText .= "\n".'         maxlength="16"';
219
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_5).'"></TD>';
220
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_5.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
221
  $outputText .= "\n".'      <TD class="gusLabel">'.$col6Label.'</TD>';
222
  $outputText .= "\n".'      <TD class="gusInput"><INPUT';
223
  $outputText .= "\n".'         class="gusInput"';
224
  $outputText .= "\n".'         type="text"';
225
  $outputText .= "\n".'         name="guscol6"';
226
  $outputText .= "\n".'         size="10"';
227
  $outputText .= "\n".'         maxlength="16"';
228
  $outputText .= "\n".'         value="'.htmlentities ($row->S_COLOR_6).'"></TD>';
229
  $outputText .= "\n".'      <TD bgcolor="'.$row->S_COLOR_6.'"><IMG src="Local/vide.gif" alt="" width="20" height="20"></TD>';
230
  $outputText .= "\n".'    </TR>';
231
 
232
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="5"></TD></TR>';
233
 
234
  $outputText .= "\n".'    <TR>';
235
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontfLabel.'</TD>';
236
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
237
  $outputText .= "\n".'         class="gusInput"';
238
  $outputText .= "\n".'         type="text"';
239
  $outputText .= "\n".'         name="gusfontf"';
240
  $outputText .= "\n".'         size="64"';
241
  $outputText .= "\n".'         maxlength="255"';
242
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_FAMILY).'"></TD>';
243
  $outputText .= "\n".'    </TR>';
244
 
245
  $outputText .= "\n".'    <TR>';
246
  $outputText .= "\n".'      <TD class="gusLabel">'.$fonttLabel.'</TD>';
247
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
248
  $outputText .= "\n".'         class="gusInput"';
249
  $outputText .= "\n".'         type="text"';
250
  $outputText .= "\n".'         name="gusfontt"';
251
  $outputText .= "\n".'         size="8"';
252
  $outputText .= "\n".'         maxlength="8"';
253
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_TINY).'"></TD>';
254
  $outputText .= "\n".'    </TR>';
255
 
256
  $outputText .= "\n".'    <TR>';
257
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontsLabel.'</TD>';
258
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
259
  $outputText .= "\n".'         class="gusInput"';
260
  $outputText .= "\n".'         type="text"';
261
  $outputText .= "\n".'         name="gusfonts"';
262
  $outputText .= "\n".'         size="8"';
263
  $outputText .= "\n".'         maxlength="8"';
264
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_SMALL).'"></TD>';
265
  $outputText .= "\n".'    </TR>';
266
 
267
  $outputText .= "\n".'    <TR>';
268
  $outputText .= "\n".'      <TD class="gusLabel">'.$fontbLabel.'</TD>';
269
  $outputText .= "\n".'      <TD class="gusInput" colspan="5"><INPUT';
270
  $outputText .= "\n".'         class="gusInput"';
271
  $outputText .= "\n".'         type="text"';
272
  $outputText .= "\n".'         name="gusfontb"';
273
  $outputText .= "\n".'         size="8"';
274
  $outputText .= "\n".'         maxlength="8"';
275
  $outputText .= "\n".'         value="'.htmlentities ($row->S_FONT_SIZE_BIG).'"></TD>';
276
  $outputText .= "\n".'    </TR>';
277
 
278
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD></TR>';
279
 
280
  $bodyStyle =
281
    "background-color: $row->S_COLOR_1;";
282
 
283
  $frameStyle =
284
    "background-color: $row->S_COLOR_2;";
285
 
286
  $backStyle =
287
    "background-color: $row->S_COLOR_3;";
288
 
289
  $onStyle =
290
    "font-family:$row->S_FONT_FAMILY;".
291
    "font-size:$row->S_FONT_SIZE_SMALL;".
292
    "text-align:center; vertical-align=middle;".
293
    "color:$row->S_COLOR_TEXT;".
294
    "background-color:$row->S_COLOR_7;";
295
 
296
  $offStyle =
297
    "font-family:$row->S_FONT_FAMILY;".
298
    "font-size:$row->S_FONT_SIZE_SMALL;".
299
    "text-align:center; vertical-align=middle;".
300
    "color:$row->S_COLOR_TEXT;".
301
    "background-color:$row->S_COLOR_4;";
302
 
303
  $texttStyle =
304
    "font-family:$row->S_FONT_FAMILY;".
305
    "font-size:$row->S_FONT_SIZE_TINY;".
306
    "text-align:left; vertical-align=top;".
307
    "color:$row->S_COLOR_TEXT;".
308
    "background-color:$row->S_COLOR_3;";
309
 
310
  $textsStyle =
311
    "font-family:$row->S_FONT_FAMILY;".
312
    "font-size:$row->S_FONT_SIZE_SMALL;".
313
    "text-align:left; vertical-align=top;".
314
    "color:$row->S_COLOR_TEXT;".
315
    "background-color:$row->S_COLOR_3;";
316
 
317
  $textbStyle =
318
    "font-family:$row->S_FONT_FAMILY;".
319
    "font-size:$row->S_FONT_SIZE_BIG;".
320
    "text-align:left; vertical-align=top;".
321
    "color:$row->S_COLOR_TEXT;".
322
    "background-color:$row->S_COLOR_3;";
323
 
324
  $alertStyle =
325
    "font-family:$row->S_FONT_FAMILY;".
326
    "font-size:$row->S_FONT_SIZE_SMALL;font-weight:bold;".
327
    "text-align:left; vertical-align=top;".
328
    "color:$row->S_COLOR_TEXT_ALERT;".
329
    "background-color:$row->S_COLOR_3;";
330
 
331
  $labelStyle =
332
    "font-family:$row->S_FONT_FAMILY;".
333
    "font-size:$row->S_FONT_SIZE_SMALL;font-weight:bold;".
334
    "text-align:left; vertical-align=top;".
335
    "color:$row->S_COLOR_TEXT;".
336
    "background-color:$row->S_COLOR_5;";
337
 
338
  $inputStyle =
339
    "font-family:$row->S_FONT_FAMILY;".
340
    "font-size:$row->S_FONT_SIZE_SMALL;".
341
    "text-align:left; vertical-align=top;".
342
    "color:$row->S_COLOR_TEXT;".
343
    "background-color:$row->S_COLOR_6;";
344
 
345
  $outputText .= "\n".'    <TR>';
346
  $outputText .= "\n".'      <TD colspan="6" style="'.$bodyStyle.'"><BR><TABLE align="center" summary="" cellspacing="0" cellpadding="0" border="0">';
347
  $outputText .= "\n".'          <TR>';
348
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
349
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="78" height="1"></TD>';
350
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
351
 
352
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="10" height="1"></TD>';
353
 
354
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
355
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="78" height="1"></TD>';
356
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
357
 
358
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="229" height="1"></TD>';
359
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="1" height="1"></TD>';
360
  $outputText .= "\n".'          </TR>';
361
 
362
  $outputText .= "\n".'          <TR>';
363
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
364
  $outputText .= "\n".'            <TD style="'.$onStyle.'">Azerty</TD>';
365
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
366
 
367
  $outputText .= "\n".'            <TD><IMG src="Local/vide.gif" alt="" width="10" height="1"></TD>';
368
 
369
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
370
  $outputText .= "\n".'            <TD style="'.$offStyle.'">Qwerty</TD>';
371
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="15"></TD>';
372
  $outputText .= "\n".'          </TR>';
373
 
374
  $outputText .= "\n".'          <TR>';
375
  $outputText .= "\n".'            <TD style="'.$frameStyle.'" colspan="9"><IMG src="Local/vide.gif" alt="" width="400" height="1"></TD>';
376
  $outputText .= "\n".'          </TR>';
377
 
378
  $outputText .= "\n".'          <TR>';
379
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
380
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
381
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
382
  $outputText .= "\n".'          </TR>';
383
 
384
  $outputText .= "\n".'          <TR>';
385
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
386
  $outputText .= "\n".'            <TD style="'.$texttStyle.'" colspan="7">&nbsp;text tiny</TD>';
387
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
388
  $outputText .= "\n".'          </TR>';
389
 
390
  $outputText .= "\n".'          <TR>';
391
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
392
  $outputText .= "\n".'            <TD style="'.$textsStyle.'" colspan="7">&nbsp;text medium</TD>';
393
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
394
  $outputText .= "\n".'          </TR>';
395
 
396
  $outputText .= "\n".'          <TR>';
397
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
398
  $outputText .= "\n".'            <TD style="'.$textbStyle.'" colspan="7">&nbsp;text big</TD>';
399
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
400
  $outputText .= "\n".'          </TR>';
401
 
402
  $outputText .= "\n".'          <TR>';
403
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
404
  $outputText .= "\n".'            <TD style="'.$alertStyle.'" colspan="7">&nbsp;text alert</TD>';
405
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
406
  $outputText .= "\n".'          </TR>';
407
 
408
  $outputText .= "\n".'          <TR>';
409
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
410
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
411
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
412
  $outputText .= "\n".'          </TR>';
413
 
414
  $outputText .= "\n".'          <TR>';
415
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
416
  $outputText .= "\n".'            <TD style="'.$labelStyle.'" colspan="7">&nbsp;label</TD>';
417
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
418
  $outputText .= "\n".'          </TR>';
419
 
420
  $outputText .= "\n".'          <TR>';
421
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
422
  $outputText .= "\n".'            <TD style="'.$inputStyle.'" colspan="7">&nbsp;input</TD>';
423
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
424
  $outputText .= "\n".'          </TR>';
425
 
426
  $outputText .= "\n".'          <TR>';
427
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
428
  $outputText .= "\n".'            <TD style="'.$backStyle.'" colspan="7"><IMG src="Local/vide.gif" alt="" width="398" height="1"></TD>';
429
  $outputText .= "\n".'            <TD style="'.$frameStyle.'"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD>';
430
  $outputText .= "\n".'          </TR>';
431
 
432
  $outputText .= "\n".'          <TR>';
433
  $outputText .= "\n".'            <TD style="'.$frameStyle.'" colspan="9"><IMG src="Local/vide.gif" alt="" width="400" height="1"></TD>';
434
  $outputText .= "\n".'          </TR>';
435
 
436
  $outputText .= "\n".'        </TABLE><BR></TD>';
437
  $outputText .= "\n".'    </TR>';
438
 
439
  $outputText .= "\n".'    <TR><TD colspan="6"><IMG src="Local/vide.gif" alt="" width="1" height="10"></TD></TR>';
440
 
441
  $outputText .= "\n".'    <TR>';
442
  $outputText .= "\n".'      <TD align="center" colspan="6"><TABLE border="0" summary="" width="100%" cellpadding="0" cellspacing="0">';
443
  $outputText .= "\n".'          <TR>';
444
  $outputText .= "\n".'            <TD align="center"><INPUT type="image" src="Local/icons/validate.gif"></TD>';
445
  $outputText .= "\n".'            <TD align="center"><A href="'.$baseURL.'"><IMG '.
446
                          'border="0" src="Local/icons/cancel.gif" alt="" width="16" height="16"></A></TD>';
447
  $outputText .= "\n".'          </TR>';
448
  $outputText .= "\n".'        </TABLE></TD>';
449
  $outputText .= "\n".'    </TR>';
450
  $outputText .= "\n".'    </TABLE>';
451
 
452
  $outputText .= "\n".'    <INPUT type="hidden" name="guscmd"   value="commitupdsty">';
453
  $outputText .= "\n".'    <INPUT type="hidden" name="gusstyid" value="'.$gusstyid.'">';
454
  $outputText .= $baseHidden;
455
 
456
  $outputText .= "\n".'  </FORM></TD>';
457
  $outputText .= "\n".'</TR>';
458
 
459
  return $outputText;
460
}
461
 
462
//==============================================================================
463
//==============================================================================
464
 
465
function commitUpdStyle ($db, $link, $locale, $gusstyid, &$msg) {
466
  //----------------------------------------------------------------------------
467
  // Form variables.
468
 
469
  global $gusname;
470
  global $guscoltxt;
471
  global $guscolinvtxt;
472
  global $guscolalttxt;
473
  global $guscol1;
474
  global $guscol2;
475
  global $guscol3;
476
  global $guscol4;
477
  global $guscol5;
478
  global $guscol6;
479
  global $guscol7;
480
  global $gusfontf;
481
  global $gusfontt;
482
  global $gusfonts;
483
  global $gusfontb;
484
 
485
  //----------------------------------------------------------------------------
486
  // We have to update the name ?
487
 
488
  if ($gusname != $gusstyid) {
489
    $query = "select * from $db.STYLE where S_NAME='$gusname'";
490
 
491
    $result = mysql_query ($query, $link);
492
 
493
    if (! $result) {
494
      die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
495
    }
496
 
497
    $row = mysql_fetch_row ($result);
498
 
499
    mysql_free_result ($result);
500
 
501
    if ($row) {
502
      $msg =
503
        gs_getLabel ($db, $link, 'gus_duplicate_sty', $locale, 'gus').
504
        "&nbsp;($gusname)";
505
 
506
      return $gusstyid;
507
    }
508
  }
509
 
510
  $query =
511
    "update $db.STYLE set".
512
    "  S_NAME='$gusname'".
513
    ", S_COLOR_TEXT='$guscoltxt'".
514
    ", S_COLOR_TEXT_INVERSE='$guscolinvtxt'".
515
    ", S_COLOR_TEXT_ALERT='$guscolalttxt'".
516
    ", S_COLOR_1='$guscol1'".
517
    ", S_COLOR_2='$guscol2'".
518
    ", S_COLOR_3='$guscol3'".
519
    ", S_COLOR_4='$guscol4'".
520
    ", S_COLOR_5='$guscol5'".
521
    ", S_COLOR_6='$guscol6'".
522
    ", S_COLOR_7='$guscol7'".
523
    ", S_FONT_FAMILY='$gusfontf'".
524
    ", S_FONT_SIZE_TINY='$gusfontt'".
525
    ", S_FONT_SIZE_SMALL='$gusfonts'".
526
    ", S_FONT_SIZE_BIG='$gusfontb'".
527
    " where S_NAME='$gusstyid'";
528
 
529
  $result = mysql_query ($query, $link);
530
 
531
  if (! $result) {
532
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
533
  }
534
 
535
  return $gusname;
536
}
537
 
538
//==============================================================================
539
//==============================================================================
540
 
541
function listStyles ($db, $link, $project, $locale,
542
                     $baseURL, $baseURLjs,
543
                     $msg) {
544
  //----------------------------------------------------------------------------
545
  // Javascript.
546
 
547
  $goMsg = addslashes (gs_getLabel ($db, $link, 'delete', $locale, 'gsite', false));
548
 
549
  js_register ('modifyStyle',
550
    "  function modifyStyle (oSelect) {"."\n".
551
    "    var url = '$baseURLjs'+'&guscmd=updsty';"."\n".
552
    "    if (oSelect.selectedIndex != -1) {"."\n".
553
    "      url += '&gusstyid='+oSelect.options[oSelect.selectedIndex].value;"."\n".
554
    "      document.location = url;"."\n".
555
    "    }"."\n".
556
    "  }"."\n"
557
  );
558
 
559
  js_register ('deleteStyle',
560
    "  function deleteStyle (oSelect) {"."\n".
561
    "    var url = '$baseURLjs'+'&guscmd=delsty';"."\n".
562
    "    if (oSelect.selectedIndex != -1) {"."\n".
563
    "      url += '&gusstyid='+oSelect.options[oSelect.selectedIndex].value;"."\n".
564
    "      if (window.confirm ('$goMsg')) {"."\n".
565
    "        document.location = url;"."\n".
566
    "      }"."\n".
567
    "    }"."\n".
568
    "  }"."\n"
569
  );
570
 
571
  //----------------------------------------------------------------------------
572
  // Buttons.
573
 
574
  $i = 0;
575
 
576
  //-- Modify style.
577
  $btInfos1[$i++] = array (
578
                     'text' => 'gus_mod',
579
                     'appl' => 'gus',
580
                     'url'  => 'javascript:modifyStyle (document.gform.gselect)');
581
 
582
  //-- Add style.
583
  $btInfos1[$i++] = array (
584
                     'text' => 'gus_add',
585
                     'appl' => 'gus',
586
                     'url'  => $baseURL.'&amp;guscmd=addsty');
587
 
588
  //-- Delete style.
589
  $btInfos1[$i++] = array (
590
                     'text' => 'gus_del',
591
                     'appl' => 'gus',
592
                     'url'  => 'javascript:deleteStyle (document.gform.gselect)');
593
 
594
  $btInfos1[$i++] = array ('space' => true);
595
 
596
  //-- Logout.
597
  $btInfos1[$i++] = array (
598
                     'text' => 'logout',
599
                     'appl' => 'gsite',
600
                     'url'  => $baseURL.'&amp;auth_logout=1');
601
 
602
  $button1 =
603
    gs_genericButtons ($db, $link, $locale,
604
                       $btInfos1,
605
                       false);
606
 
607
  //----------------------------------------------------------------------------
608
  // List styles.
609
 
610
  $query = "select * from $db.STYLE order by S_NAME";
611
 
612
  $STYresult = mysql_query ($query, $link);
613
 
614
  if (! $STYresult) {
615
    die ("Unable to perform query ($query / " . mysql_error ($link) . ")");
616
  }
617
 
618
  //----------------------------------------------------------------------------
619
  // Build form.
620
 
621
  $text = '';
622
  $text .= "\n".'<FORM name="gform" action="document.php" method="get">';
623
  $text .= "\n".'  <SELECT class="gusInput" name="gselect" size="20" ondblclick="javascript:modifyStyle (document.gform.gselect)">';
624
 
625
  while ($row = mysql_fetch_object ($STYresult)) {
626
    $text .= "\n".'    <OPTION value="'.htmlentities ($row->S_NAME).'">';
627
    $text .= htmlentities ($row->S_NAME);
628
    $text .= '</OPTION>';
629
  }
630
 
631
  $text .= "\n".'  </SELECT>';
632
 
633
  $text .= "\n".'</FORM>';
634
 
635
  mysql_free_result ($STYresult);
636
 
637
  //----------------------------------------------------------------------------
638
  // Build page.
639
 
640
  $title = gs_getLabel ($db, $link, 'gus_title3', $locale, 'gus');
641
 
642
  return
643
    buildPage (
644
      $button1,
645
      '',
646
      $title,
647
      $text,
648
      $msg);
649
}
650
 
651
//------------------------------------------------------------------------------
652
// $Log: not supported by cvs2svn $
653
// Revision 1.1  2003/10/10 09:58:21  alex
654
// installation
655
//
656
// Revision 1.1.1.1  2002/10/02 07:32:21  root
657
// initialisation site de Tela
658
//
659
// Revision 1.3  2002/06/14 07:23:23  lc
660
// Bug LC0021 : use js_register
661
//
662
// Revision 1.2  2002/05/30 14:49:39  lc
663
// Admin of tiny font size.
664
//
665
// Revision 1.1  2002/02/25 16:35:57  lc
666
// First revision.
667
//
668
//-- End of source  ------------------------------------------------------------
669
?>