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