]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/fusionforge/templates/userprefs.tmpl
Translate legends
[SourceForge/phpwiki.git] / themes / fusionforge / templates / userprefs.tmpl
1 <?php // -*-php-*-
2 // $Id$'
3 // Todo: Move the logic and code to the plugin
4 // This is very experimental and the read-only part an ugly hack so far.
5 foreach (explode(',','errmsg,isForm') as $var) {
6     if (empty($$var)) $$var = false;
7 }
8
9 $plugin = $request->getArg('pagename');
10 if (isActionPage($request->getArg('pagename'))
11     and $isForm and $plugin == _("PreferencesInfo")) {
12     $isForm = false;
13 }
14 $time = time();
15 $user =& $request->getUser();
16 $pref =& $request->_prefs;
17
18 if (!$pref) return;
19 $offset = $pref->get('timeOffset');
20 $serverTime = $time - $offset * 3600;
21 if ( $isForm )
22     $timeOffsetInput = HTML::input(array('type' => "text",
23                                          'size' => 6,
24                                          'maxlength' => 6,
25                                          'name' => "pref[timeOffset]",
26                                          'class' => "numeric",
27                                          'value' => $offset));
28 else
29     $timeOffsetInput = $pref->get('timeOffset');
30
31 $OwnModificationsCB = HTML::input(array('type' => 'checkbox',
32                                      'name' => 'pref[ownModifications]',
33                                      'value' => '1',
34                                      'checked' => (bool) $pref->get('ownModifications')));
35 $MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox',
36                                      'name' => 'pref[majorModificationsOnly]',
37                                      'value' => '1',
38                                      'checked' => (bool) $pref->get('majorModificationsOnly')));
39 $DiffMenuItem = HTML::input(array('type' => 'checkbox',
40                                      'name' => 'pref[diffMenuItem]',
41                                      'value' => '1',
42                                      'checked' => (bool) $pref->get('diffMenuItem')));
43 $PageInfoMenuItem = HTML::input(array('type' => 'checkbox',
44                                      'name' => 'pref[pageInfoMenuItem]',
45                                      'value' => '1',
46                                      'checked' => (bool) $pref->get('pageInfoMenuItem')));
47 $PDFMenuItem = HTML::input(array('type' => 'checkbox',
48                                      'name' => 'pref[pdfMenuItem]',
49                                      'value' => '1',
50                                      'checked' => (bool) $pref->get('pdfMenuItem')));
51 $ChownMenuItem = HTML::input(array('type' => 'checkbox',
52                                      'name' => 'pref[chownMenuItem]',
53                                      'value' => '1',
54                                      'checked' => (bool) $pref->get('chownMenuItem')));
55 $SetaclMenuItem = HTML::input(array('type' => 'checkbox',
56                                      'name' => 'pref[setaclMenuItem]',
57                                      'value' => '1',
58                                      'checked' => (bool) $pref->get('setaclMenuItem')));
59 $RemoveMenuItem = HTML::input(array('type' => 'checkbox',
60                                      'name' => 'pref[removeMenuItem]',
61                                      'value' => '1',
62                                      'checked' => (bool) $pref->get('removeMenuItem')));
63 $RenameMenuItem = HTML::input(array('type' => 'checkbox',
64                                      'name' => 'pref[renameMenuItem]',
65                                      'value' => '1',
66                                      'checked' => (bool) $pref->get('renameMenuItem')));
67 $RevertMenuItem = HTML::input(array('type' => 'checkbox',
68                                      'name' => 'pref[revertMenuItem]',
69                                      'value' => '1',
70                                      'checked' => (bool) $pref->get('revertMenuItem')));
71 $LockMenuItem = HTML::input(array('type' => 'checkbox',
72                                      'name' => 'pref[lockMenuItem]',
73                                      'value' => '1',
74                                      'checked' => (bool) $pref->get('lockMenuItem')));
75 $BackLinksMenuItem = HTML::input(array('type' => 'checkbox',
76                                      'name' => 'pref[backLinksMenuItem]',
77                                      'value' => '1',
78                                      'checked' => (bool) $pref->get('backLinksMenuItem')));
79 $WatchPageMenuItem = HTML::input(array('type' => 'checkbox',
80                                      'name' => 'pref[watchPageMenuItem]',
81                                      'value' => '1',
82                                      'checked' => (bool) $pref->get('watchPageMenuItem')));
83 $RecentChangesMenuItem = HTML::input(array('type' => 'checkbox',
84                                      'name' => 'pref[recentChangesMenuItem]',
85                                      'value' => '1',
86                                      'checked' => (bool) $pref->get('recentChangesMenuItem')));
87 $RandomPageMenuItem = HTML::input(array('type' => 'checkbox',
88                                      'name' => 'pref[randomPageMenuItem]',
89                                      'value' => '1',
90                                      'checked' => (bool) $pref->get('randomPageMenuItem')));
91 $LikePagesPageMenuItem = HTML::input(array('type' => 'checkbox',
92                                      'name' => 'pref[likePagesMenuItem]',
93                                      'value' => '1',
94                                      'checked' => (bool) $pref->get('likePagesMenuItem')));
95 $SpecialPagesMenuItem = HTML::input(array('type' => 'checkbox',
96                                      'name' => 'pref[specialPagesMenuItem]',
97                                      'value' => '1',
98                                      'checked' => (bool) $pref->get('specialPagesMenuItem')));
99 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
100                                      'name' => 'pref[relativeDates]',
101                                      'value' => '1',
102                                      'checked' => (bool) $pref->get('relativeDates')));
103 $PageTrailCB = HTML::input(array('type' => 'checkbox',
104                                  'name' => 'pref[pageTrail]',
105                                  'value' => '1',
106                                  'checked' => (bool) $pref->get('pageTrail')));
107 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
108                                    'name' => 'pref[noLinkIcons]',
109                                    'value' => '1',
110                                    'checked' => (bool) $pref->get('noLinkIcons')));
111 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
112                                   'name' => 'pref[googleLink]',
113                                   'value' => '1',
114                                   'checked' => (bool) $pref->get('googleLink')));
115 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
116                                   'name' => 'pref[doubleClickEdit]',
117                                   'value' => '1',
118                                   'checked' => (bool) $pref->get('doubleClickEdit')));
119 if (!function_exists('selectedOption')) {
120   function selectedOption ($value, $label = false) {
121     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
122   }
123   function unselectedOption ($value, $label = false) {
124     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
125   }
126 }
127
128 $SelectThemes = ''; $SelectLanguages = '';
129 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
130 if ( $isForm ) {
131     $SelectOptions = HTML();
132     if (!empty($available_themes) and is_array($available_themes)) {
133         if (!$pref->get('theme') or $pref->get('theme') == THEME)
134             $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
135         else
136             $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
137         foreach ($available_themes as $theme) {
138             if ($theme == $pref->get('theme') and $theme != THEME)
139                 $SelectOptions->pushContent(selectedOption($theme));
140             else
141                 $SelectOptions->pushContent(unselectedOption($theme));
142         }
143         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
144                                      $SelectOptions);
145         $SelectThemesDesc = _("Personal theme:");
146     }
147
148     $SelectOptions = HTML();
149     if (!empty($available_languages) and is_array($available_languages)) {
150         if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
151             $SelectOptions->pushContent(selectedOption("",_("<system language>")));
152         else
153             $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
154         foreach ($available_languages as $lang) {
155             if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
156                 $SelectOptions->pushContent(selectedOption($lang));
157             else
158                 $SelectOptions->pushContent(unselectedOption($lang));
159         }
160         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
161                                         $SelectOptions);
162         $SelectLanguagesDesc = _("Personal language:");
163     } else {
164         if ($SelectThemes == '') {
165             $appearance = false;
166             $SelectThemesDesc = '';
167             $SelectLanguagesDesc = '';
168         }
169     }
170 } else {
171     $SelectThemesDesc = _("Personal theme:");
172     $SelectLanguagesDesc = _("Personal language:");
173     $SelectThemes = $pref->get('theme');
174     $SelectLanguages = $pref->get('lang');
175 }
176
177 ?>
178 <?php echo $errmsg ?>
179
180 <h2>
181 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
182 </h2>
183
184 <?php if ($isForm) { ?>
185 <form action="<?php echo $request->getPostURL()?>" method="post">
186 <?php } ?>
187
188 <fieldset style="margin-bottom: 1em;">
189 <legend><strong>User preferences for this project</strong></legend>
190 <table border="0" width="100%">
191
192   <tr><td colspan="3"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
193
194    <tr><td colspan="2">
195     <?php echo _("Get an email notification at changes of the following pages:")?>
196    </td></tr>
197    <tr>
198     <?php if ($isForm) { ?>
199       <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
200     <td><p class="hint"><?php echo _("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
201     <?php } else { ?>
202      <td><?php echo $pref->get('notifyPages')?></td><td></td>
203     <?php } ?>
204    </tr>
205
206 </table>
207 </fieldset>
208
209 <fieldset style="margin-bottom: 1em;">
210 <legend><strong>Global user preferences (for all projects)</strong></legend>
211
212 <table border="0" width="100%">
213
214   <tr><td colspan="3"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
215
216   <tr>
217       <td>
218          <p><?php echo _("Do not send my own modifications:")?></p>
219       </td>
220       <td>
221          <p><?php echo $OwnModificationsCB ?></p>
222       </td>
223       <td>
224          <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
225       </td>
226   </tr>
227
228   <tr>
229       <td>
230          <p><?php echo _("Do not send minor modifications:")?></p>
231       </td>
232       <td>
233          <p><?php echo $MajorModificationsOnlyCB ?></p>
234       </td>
235       <td>
236          <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
237       </td>
238   </tr>
239
240   <tr><td colspan="3"><h3><?php echo _("Menus")?></h3></td></tr>
241   <tr>
242      <td>
243        <fieldset>
244        <legend><?php echo _("Top Menu")?></legend>
245        <table cellpadding="0" cellspacing="0">
246          <tr>
247             <td>
248                <p><?php echo $DiffMenuItem ?> <?php echo _("Last Difference")?></p>
249             </td>
250          </tr>
251          <tr>
252             <td>
253                <p><?php echo $RevertMenuItem ?> <?php echo _("Revert")?></p>
254             </td>
255          </tr>
256          <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
257            <tr>
258              <td>
259                 <p><?php echo $PDFMenuItem ?> <?php echo _("PDF")?></p>
260              </td>
261            </tr>
262          <?php } ?>
263          <tr>
264             <td>
265                <p><?php echo $LockMenuItem ?> <?php echo _("Lock")?></p>
266             </td>
267          </tr>
268          <tr>
269             <td>
270                <p><?php echo $ChownMenuItem ?> <?php echo _("Change Owner")?></p>
271             </td>
272          </tr>
273          <tr>
274             <td>
275                <p><?php echo $SetaclMenuItem ?> <?php echo _("Access Rights")?></p>
276             </td>
277          </tr>
278        </table>
279        </fieldset>
280     </td>
281
282      <td valign="top">
283        <fieldset>
284        <legend><?php echo _("Left Menu")?></legend>
285        <table cellpadding="0" cellspacing="0">
286          <tr>
287             <td>
288                <p><?php echo $RandomPageMenuItem ?> <?php echo _("Random Page")?></p>
289             </td>
290          </tr>
291          <tr>
292             <td>
293                <p><?php echo $LikePagesPageMenuItem ?> <?php echo _("Like Pages")?></p>
294             </td>
295          </tr>
296        </table>
297        </fieldset>
298     </td>
299
300     <td valign="top">
301       <p class="hint"><?php echo _("Check menu items to display.")?></p>
302     </td>
303   </tr>
304
305   <tr><td colspan="3"><h3><?php echo _("Appearance")?></h3></td></tr>
306
307   <tr><td colspan="3"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
308       <tr><td align="right"><?php echo _("Show Page Trail")?></td>
309           <td><?php echo $PageTrailCB?></td>
310           <td><p class="hint"><?php echo _("Show Page Trail at top of page.")?></p></td></tr>
311       <tr><td align="right"><?php echo fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
312           <td><?php echo $NoLinkIconsCB?></td>
313           <td><p class="hint"><?php echo _("Hide or show LinkIcons.")?></p></td></tr>
314       <tr><td align="right"><?php echo fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
315           <td><?php echo $GoogleLinkCB?></td>
316           <td><p class="hint"><?php echo fmt("Add Google links to unknown pages behind the '?', and the create action behind the pagename instead. See %s.", WikiLink("MeatBall:GooglePrompt"))?></p></td></tr>
317
318   <tr><td colspan="3"><h3><?php echo _("Edit Area Size")?></h3></td></tr>
319
320   <tr><td colspan="2">
321     <?php echo _("Height")?>:&nbsp;
322     <?php if ($isForm) { ?>
323      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
324             value="<?php echo $pref->get('editHeight')?>" />
325     <?php } else { ?>
326       <?php echo $pref->get('editHeight')?>
327     <?php } ?>
328     &nbsp;&nbsp;<?php echo _("Width")?>:&nbsp;
329     <?php if ($isForm) { ?>
330      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
331             value="<?php echo $pref->get('editWidth')?>" />
332     <?php } else { ?>
333       <?php echo $pref->get('editWidth')?>
334     <?php } ?>
335     </td>
336     <td><p class="hint">
337       <?php echo _("Note that many browsers will automatically adjust the width of the editing area so that it fills the browser window.  In this case, the width preference will be ignored.")?></p>
338     </td></tr>
339
340   <tr><td colspan="3"><h3><?php echo _("Time Zone")?></h3></td></tr>
341
342   <tr><td colspan="2"><p>
343     <?php echo fmt("Add %s hours to the server's local time when reporting times.",
344            $timeOffsetInput)?>
345   </p></td><td>
346   <p class="hint">
347     <?php echo fmt("The current time at the server is %s.",
348             HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
349     <?php echo fmt("With the current offset, this would be reported as %s.",
350            HTML::strong($WikiTheme->formatDateTime($time)))?>
351   </p>
352   </td></tr>
353
354   <tr><td colspan="3"><h3><?php echo _("Date Format")?></h3></td></tr>
355
356   <tr><td colspan="2"><p>
357     <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>:
358     <?php echo $RelativeDatesCB ?>
359   </p></td><td></td></tr>
360 </table>
361 </fieldset>
362
363 <?php if ($isForm) { ?>
364 <p>
365   <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
366   <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
367   <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
368   <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>
369 </p>
370 </form>
371 <?php } ?>