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