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