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