]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
rcs_id no longer makes sense with Subversion global version number
[SourceForge/phpwiki.git] / themes / default / 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 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
42                                      'name' => 'pref[relativeDates]',
43                                      'value' => '1',
44                                      'checked' => (bool) $pref->get('relativeDates')));
45 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
46                                    'name' => 'pref[noLinkIcons]',
47                                    'value' => '1',
48                                    'checked' => (bool) $pref->get('noLinkIcons')));
49 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
50                                   'name' => 'pref[googleLink]',
51                                   'value' => '1',
52                                   'checked' => (bool) $pref->get('googleLink')));
53 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
54                                   'name' => 'pref[doubleClickEdit]',
55                                   'value' => '1',
56                                   'checked' => (bool) $pref->get('doubleClickEdit')));
57 if (!function_exists('selectedOption')) {
58   function selectedOption ($value, $label = false) {
59     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
60   }
61   function unselectedOption ($value, $label = false) {
62     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
63   }
64 }
65
66 $SelectThemes = ''; $SelectLanguages = '';
67 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
68 if ( $isForm ) {
69     $SelectOptions = HTML(); 
70     if (!empty($available_themes) and is_array($available_themes)) {
71         if (!$pref->get('theme') or $pref->get('theme') == THEME)
72             $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
73         else
74             $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
75         foreach ($available_themes as $theme) {
76             if ($theme == $pref->get('theme') and $theme != THEME)
77                 $SelectOptions->pushContent(selectedOption($theme));
78             else
79                 $SelectOptions->pushContent(unselectedOption($theme));
80         }
81         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
82                                      $SelectOptions);
83         $SelectThemesDesc = _("Personal theme:");
84     }
85     
86     $SelectOptions = HTML();
87     if (!empty($available_languages) and is_array($available_languages)) {
88         if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
89             $SelectOptions->pushContent(selectedOption("",_("<system language>")));
90         else
91             $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
92         foreach ($available_languages as $lang) {
93             if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
94                 $SelectOptions->pushContent(selectedOption($lang));
95             else
96                 $SelectOptions->pushContent(unselectedOption($lang));
97         }
98         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
99                                         $SelectOptions);
100         $SelectLanguagesDesc = _("Personal language:");
101     } else {
102         if ($SelectThemes == '') {
103             $appearance = false;
104             $SelectThemesDesc = '';
105             $SelectLanguagesDesc = '';
106         }
107     }
108 } else {
109     $SelectThemesDesc = _("Personal theme:");
110     $SelectLanguagesDesc = _("Personal language:");
111     $SelectThemes = $pref->get('theme');
112     $SelectLanguages = $pref->get('lang');
113 }
114
115 ?>
116 <?= $errmsg ?>
117
118 <?= fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
119
120 <?php if ($isForm) { ?>
121 <form action="<?=$request->getPostURL()?>" method="post">
122 <?php } else { 
123   $fill = "&nbsp;";
124   // See also plugin _AuthInfo
125   $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
126 ?>
127 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
128               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
129               //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
130               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
131                       _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
132               sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
133               sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
134               //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
135               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
136               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
137               ) ?>
138 <?php } ?>
139
140 <table border="0">
141 <?php if ($isForm and $user->mayChangePass()) { ?>
142   <tr><td colspan="3"><h2><?= ($request->getPref('passwd') ?  _("Change Password") :  _("Set Password")) ?></h2></td></tr>
143
144     <tr><td align="right"><?=_("New password")?>:</td>
145         <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
146         <td></td></tr>
147     <tr><td align="right"><?=_("Type it again")?>:</td>
148         <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
149         <td></td></tr>
150 <?php } ?>
151
152 <?php if (ENABLE_USER_NEW) { ?>
153   <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
154
155   <tr><td><?=_("Your E-Mail:")?></td>
156   <td>
157   <?php if ($isForm) { ?>
158      <input type="text" name="pref[email]" size="30" maxlength="60"
159             value="<?=$pref->get('email')?>" />
160   <?php } else { ?>
161      '<?= $pref->get('email') ?>'
162   <?php } ?>
163   &nbsp;&nbsp;<?= _("Status:") ?>&nbsp;&nbsp;
164   <?php if ($pref->get('emailVerified')) { ?>
165     <?= _("Email verified.") ?>
166   <?php } else { ?>
167     <?= _("Email not yet verified.") ?>
168   <?php } ?>
169   </td><td><p class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
170
171   <tr><td colspan="3">
172     <?=_("Get an email notification at changes of the following pages:")?>
173   </td></tr>
174   <tr>
175     <?php if ($isForm) { ?>
176       <td colspan="2"><textarea name="pref[notifyPages]" cols="40" rows="6"><?=$pref->get('notifyPages')?></textarea></td>
177     <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
178     <?php } else { ?>
179      <td colspan="3"><?=$pref->get('notifyPages')?></td>
180     <?php } ?>
181   </tr>
182
183   <tr>
184       <td>
185          <p><?=_("Do not send my own modifications:")?></p>
186       </td>
187       <td>
188          <p><?= $OwnModificationsCB ?></p>
189       </td>
190       <td>
191          <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p>
192       </td>
193   </tr>
194
195   <tr>
196       <td>
197          <p><?=_("Do not send minor modifications:")?></p>
198       </td>
199       <td>
200          <p><?= $MajorModificationsOnlyCB ?></p>
201       </td>
202       <td>
203          <p class="hint"><?=_("Check if you do not want to be notified of minor modifications.")?></p>
204       </td>
205   </tr>
206
207 <?php } ?>
208
209   <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
210
211   <tr><td colspan="3"><?=_("Here you can override site-specific default values.") ?></td></tr>
212   <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
213       <tr><td align="right"><?=$SelectThemesDesc?></td>
214           <td><?= $SelectThemes ?></td>
215           <td><p class="hint"><?=_("System default:")?> <?= THEME ?></p></td></tr>
216       <tr><td align="right"><?=$SelectLanguagesDesc?></td>
217           <td><?= $SelectLanguages ?></td>
218           <td><p class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></p></td></tr>
219       <tr><td align="right"><?=fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
220           <td><?=$NoLinkIconsCB?></td>
221           <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>
222       <tr><td align="right"><?=fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
223           <td><?=$GoogleLinkCB?></td>
224           <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>
225       <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
226           <td><?=$DoubleClickCB?></td>
227   <td><p class="hint"><?=fmt("Enabled makes it hard to double-click words and sentences for cut and paste. See %s.", WikiLink("PhpWiki:DoubleClickToEditPage"))?></p></td></tr>
228
229
230   <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
231
232   <tr><td colspan="2">
233     <?=_("Height")?>:&nbsp;
234     <?php if ($isForm) { ?>
235      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
236             value="<?=$pref->get('editHeight')?>" />
237     <?php } else { ?>
238       <?=$pref->get('editHeight')?>
239     <?php } ?>
240     &nbsp;&nbsp;<?=_("Width")?>:&nbsp;
241     <?php if ($isForm) { ?>
242      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
243             value="<?=$pref->get('editWidth')?>" />
244     <?php } else { ?>
245       <?=$pref->get('editWidth')?>
246     <?php } ?>
247     </td>
248     <td><p class="hint">
249       <?=_("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>
250     </td></tr>
251
252   <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
253
254   <tr><td colspan="2"><p>
255     <?=fmt("Add %s hours to the server's local time when reporting times.",
256            $timeOffsetInput)?>
257   </p></td><td>
258   <p class="hint">
259     <?=fmt("The current time at the server is %s.",
260             HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
261     <?=fmt("With the current offset, this would be reported as %s.",
262            HTML::strong($WikiTheme->formatDateTime($time)))?>
263   </p>
264   </td></tr>
265
266   <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
267
268   <tr><td colspan="2"><p>
269     <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
270     <?= $RelativeDatesCB ?>
271   </p></td><td></td></tr>
272 </table>
273
274 <?php if ($isForm) { ?>
275   <hr />
276   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
277   <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
278   <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
279
280 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>
281 </form>
282 <?php } ?>