]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/fusionforge/templates/userprefs.tmpl
Translate ":"
[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><?php echo _("User preferences for this project")?></strong></legend>
190 <table class="fullwidth">
191
192    <tr><td colspan="2"><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
198    <tr>
199     <?php if ($isForm) { ?>
200       <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
201       <td><p class="hint"><?php echo _("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
202     <?php } else { ?>
203      <td colspan="2"><?php echo $pref->get('notifyPages')?></td>
204     <?php } ?>
205    </tr>
206
207 </table>
208 </fieldset>
209
210 <fieldset style="margin-bottom: 1em;">
211 <legend><strong><?php echo _("Global user preferences (for all projects)")?></strong></legend>
212
213 <table class="fullwidth">
214
215   <tr><td colspan="2"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
216
217   <tr>
218       <td>
219          <p class="nowrap">
220              <?php echo $OwnModificationsCB ?>
221              <?php echo _("Do not send my own modifications")?>
222          </p>
223       </td>
224       <td>
225          <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
226       </td>
227   </tr>
228
229   <tr>
230       <td>
231          <p class="nowrap">
232              <?php echo $MajorModificationsOnlyCB ?>
233              <?php echo _("Do not send minor modifications")?>
234          </p>
235       </td>
236       <td>
237          <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
238       </td>
239   </tr>
240
241   <tr><td colspan="2"><h3><?php echo _("Menus")?></h3></td></tr>
242   <tr>
243      <td>
244        <fieldset>
245        <legend><?php echo _("Top Menu")?></legend>
246        <table>
247          <tr>
248             <td>
249                <p class="nowrap"><?php echo $DiffMenuItem ?> <?php echo _("Last Difference")?></p>
250             </td>
251          </tr>
252          <tr>
253             <td>
254                <p class="nowrap"><?php echo $RevertMenuItem ?> <?php echo _("Revert")?></p>
255             </td>
256          </tr>
257          <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
258            <tr>
259              <td>
260                 <p class="nowrap"><?php echo $PDFMenuItem ?> <?php echo _("PDF")?></p>
261              </td>
262            </tr>
263          <?php } ?>
264          <tr>
265             <td>
266                <p class="nowrap"><?php echo $LockMenuItem ?> <?php echo _("Lock")?></p>
267             </td>
268          </tr>
269          <tr>
270             <td>
271                <p class="nowrap"><?php echo $ChownMenuItem ?> <?php echo _("Change Owner")?></p>
272             </td>
273          </tr>
274          <tr>
275             <td>
276                <p class="nowrap"><?php echo $SetaclMenuItem ?> <?php echo _("Access Rights")?></p>
277             </td>
278          </tr>
279        </table>
280        </fieldset>
281     </td>
282     <td class="top">
283       <p class="hint"><?php echo _("Check menu items to display.")?></p>
284     </td>
285     </tr>
286
287     <tr>
288     <td class="top">
289        <fieldset>
290        <legend><?php echo _("Left Menu")?></legend>
291        <table>
292          <tr>
293             <td>
294                <p class="nowrap"><?php echo $RandomPageMenuItem ?> <?php echo _("Random Page")?></p>
295             </td>
296          </tr>
297          <tr>
298             <td>
299                <p class="nowrap"><?php echo $LikePagesPageMenuItem ?> <?php echo _("Like Pages")?></p>
300             </td>
301          </tr>
302        </table>
303        </fieldset>
304     </td>
305     <td>
306     </td>
307   </tr>
308
309   <tr><td colspan="2"><h3><?php echo _("Appearance")?></h3></td></tr>
310
311   <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
312       <tr>
313           <td>
314              <p class="nowrap">
315                <?php echo $PageTrailCB?>
316                <?php echo _("Show Page Trail")?>
317              </p>
318           </td>
319           <td><p class="hint"><?php echo _("Show Page Trail at top of page.")?></p></td>
320       </tr>
321       <tr>
322           <td>
323              <p class="nowrap">
324                <?php echo $NoLinkIconsCB?>
325                <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
326              </p>
327           </td>
328           <td><p class="hint"><?php echo _("Hide or show LinkIcons.")?></p></td>
329       </tr>
330       <tr>
331           <td>
332              <p class="nowrap">
333                <?php echo $GoogleLinkCB?>
334                <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
335              </p>
336           </td>
337           <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>
338       </tr>
339
340   <tr><td colspan="2"><h3><?php echo _("Edit Area Size")?></h3></td></tr>
341
342   <tr><td>
343     <?php echo _("Height") . _(":")?>
344     <?php if ($isForm) { ?>
345      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
346             value="<?php echo $pref->get('editHeight')?>" />
347     <?php } else { ?>
348       <?php echo $pref->get('editHeight')?>
349     <?php } ?>
350     <?php echo _("Width") . _(":")?>
351     <?php if ($isForm) { ?>
352      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
353             value="<?php echo $pref->get('editWidth')?>" />
354     <?php } else { ?>
355       <?php echo $pref->get('editWidth')?>
356     <?php } ?>
357     </td>
358     <td><p class="hint">
359       <?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>
360     </td></tr>
361
362   <tr><td colspan="2"><h3><?php echo _("Time Zone")?></h3></td></tr>
363
364   <tr><td><p>
365     <?php echo fmt("Add %s hours to the server's local time when reporting times.",
366            $timeOffsetInput)?>
367   </p></td><td>
368   <p class="hint">
369     <?php echo fmt("The current time at the server is %s.",
370             HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
371     <?php echo fmt("With the current offset, this would be reported as %s.",
372            HTML::strong($WikiTheme->formatDateTime($time)))?>
373   </p>
374   </td></tr>
375
376   <tr><td colspan="2"><h3><?php echo _("Date Format")?></h3></td></tr>
377
378   <tr><td colspan="2">
379     <p>
380       <?php echo $RelativeDatesCB ?>
381       <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
382     </p>
383   </td></tr>
384 </table>
385 </fieldset>
386
387 <?php if ($isForm) { ?>
388 <p>
389   <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
390   <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
391   <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
392   <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>
393 </p>
394 </form>
395 <?php } ?>