]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
Normalize headers
[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 ($request->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 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
116 ?>
117 <?= $errmsg ?>
118
119 <?= fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
120
121 <?php if ($isForm) { ?>
122 <form action="<?=$request->getPostURL()?>" method="post">
123 <?php } else { 
124   $fill = "&nbsp;";
125   // See also plugin _AuthInfo
126   $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
127 ?>
128 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
129               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
130               //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
131               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
132                       _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
133               sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
134               sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
135               //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
136               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
137               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
138               ) ?>
139 <?php } ?>
140
141 <table border="0">
142 <?php if ($isForm and $user->mayChangePass()) { ?>
143   <tr><td colspan="3"><h2><?= ($request->getPref('passwd') ?  _("Change Password") :  _("Set Password")) ?></h2></td></tr>
144
145     <tr><td align="right"><?=_("New password")?>:</td>
146         <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
147         <td></td></tr>
148     <tr><td align="right"><?=_("Type it again")?>:</td>
149         <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
150         <td></td></tr>
151 <?php } ?>
152
153 <?php if (ENABLE_USER_NEW) { ?>
154   <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
155
156   <tr><td><?=_("Your E-Mail:")?></td>
157   <td>
158   <?php if ($isForm) { ?>
159      <input type="text" name="pref[email]" size="30" maxlength="60"
160             value="<?=$pref->get('email')?>" />
161   <?php } else { ?>
162      '<?= $pref->get('email') ?>'
163   <?php } ?>
164   &nbsp;&nbsp;<?= _("Status:") ?>&nbsp;&nbsp;
165   <?php if ($pref->get('emailVerified')) { ?>
166     <?= _("Email verified.") ?>
167   <?php } else { ?>
168     <?= _("Email not yet verified.") ?>
169   <?php } ?>
170   </td><td><p class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
171
172   <tr><td colspan="3">
173     <?=_("Get an email notification at changes of the following pages:")?>
174   </td></tr>
175   <tr>
176     <?php if ($isForm) { ?>
177       <td colspan="2"><textarea name="pref[notifyPages]" cols="40" rows="6"><?=$pref->get('notifyPages')?></textarea></td>
178     <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
179     <?php } else { ?>
180      <td colspan="3"><?=$pref->get('notifyPages')?></td>
181     <?php } ?>
182   </tr>
183
184   <tr>
185       <td>
186          <p><?=_("Do not send my own modifications:")?></p>
187       </td>
188       <td>
189          <p><?= $OwnModificationsCB ?></p>
190       </td>
191       <td>
192          <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p>
193       </td>
194   </tr>
195
196   <tr>
197       <td>
198          <p><?=_("Do not send minor modifications:")?></p>
199       </td>
200       <td>
201          <p><?= $MajorModificationsOnlyCB ?></p>
202       </td>
203       <td>
204          <p class="hint"><?=_("Check if you do not want to be notified of minor modifications.")?></p>
205       </td>
206   </tr>
207
208 <?php } ?>
209
210   <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
211
212   <tr><td colspan="3"><?=_("Here you can override site-specific default values.") ?></td></tr>
213   <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
214       <tr><td align="right"><?=$SelectThemesDesc?></td>
215           <td><?= $SelectThemes ?></td>
216           <td><p class="hint"><?=_("System default:")?> <?= THEME ?></p></td></tr>
217       <tr><td align="right"><?=$SelectLanguagesDesc?></td>
218           <td><?= $SelectLanguages ?></td>
219           <td><p class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></p></td></tr>
220       <tr><td align="right"><?=fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
221           <td><?=$NoLinkIconsCB?></td>
222           <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>
223       <tr><td align="right"><?=fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
224           <td><?=$GoogleLinkCB?></td>
225           <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>
226       <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
227           <td><?=$DoubleClickCB?></td>
228   <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>
229
230
231   <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
232
233   <tr><td colspan="2">
234     <?=_("Height")?>:&nbsp;
235     <?php if ($isForm) { ?>
236      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
237             value="<?=$pref->get('editHeight')?>" />
238     <?php } else { ?>
239       <?=$pref->get('editHeight')?>
240     <?php } ?>
241     &nbsp;&nbsp;<?=_("Width")?>:&nbsp;
242     <?php if ($isForm) { ?>
243      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
244             value="<?=$pref->get('editWidth')?>" />
245     <?php } else { ?>
246       <?=$pref->get('editWidth')?>
247     <?php } ?>
248     </td>
249     <td><p class="hint">
250       <?=_("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>
251     </td></tr>
252
253   <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
254
255   <tr><td colspan="2"><p>
256     <?=fmt("Add %s hours to the server's local time when reporting times.",
257            $timeOffsetInput)?>
258   </p></td><td>
259   <p class="hint">
260     <?=fmt("The current time at the server is %s.",
261             HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
262     <?=fmt("With the current offset, this would be reported as %s.",
263            HTML::strong($WikiTheme->formatDateTime($time)))?>
264   </p>
265   </td></tr>
266
267   <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
268
269   <tr><td colspan="2"><p>
270     <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
271     <?= $RelativeDatesCB ?>
272   </p></td><td></td></tr>
273 </table>
274
275 <?php if ($isForm) { ?>
276   <hr />
277   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
278   <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
279   <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
280
281 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>
282 </form>
283 <?php } ?>