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