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