]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
fixed old WikiUser
[SourceForge/phpwiki.git] / themes / default / templates / userprefs.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: userprefs.tmpl,v 1.46 2004-04-10 02:55:49 rurban Exp $ -->
3 <?php
4 // Todo: Move the logic and code to the plugin
5 // This is very experimental and the read-only part an ugly hack so far.
6 foreach (explode(',','errmsg,isForm') as $var) {
7     if (empty($$var)) $$var = false;
8 }
9
10 $plugin = $request->getArg('pagename');
11 if ($request->isActionPage($request->getArg('pagename')) and 
12     $plugin != _("PreferencesInfo") and $plugin != _("_PreferencesInfo")) {
13     $isForm = true;
14 }
15
16 $time = time();
17 $user = &$request->getUser();
18 $pref = &$request->_prefs;
19
20 $offset = $pref->get('timeOffset');
21 $serverTime = $time - $offset * 3600;
22 if ( $isForm )
23     $timeOffsetInput = HTML::input(array('type' => "text",
24                                          'size' => 6,
25                                          'maxlength' => 6,
26                                          'name' => "pref[timeOffset]",
27                                          'class' => "numeric",
28                                          'value' => $offset));
29 else
30     $timeOffsetInput = $pref->get('timeOffset');
31
32 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
33                                           'name' => 'pref[relativeDates]',
34                                           'value' => '1',
35                                           'checked' => (bool) $pref->get('relativeDates')));
36 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
37                                           'name' => 'pref[noLinkIcons]',
38                                           'value' => '1',
39                                           'checked' => (bool) $pref->get('noLinkIcons')));
40
41 function selectedOption ($value, $label = false) {
42     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
43 }
44 function unselectedOption ($value, $label = false) {
45     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
46 }
47
48 $SelectThemes = ''; $SelectLanguages = '';
49 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
50 if ( $isForm ) {
51     $SelectOptions = HTML(); 
52     if (!empty($available_themes) and is_array($available_themes)) {
53         if (!$pref->get('theme') or $pref->get('theme') == THEME)
54             $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
55         else
56             $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
57         foreach ($available_themes as $theme) {
58             if ($theme == $pref->get('theme') and $theme != THEME)
59                 $SelectOptions->pushContent(selectedOption($theme));
60             else
61                 $SelectOptions->pushContent(unselectedOption($theme));
62         }
63         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
64                                      $SelectOptions);
65         $SelectThemesDesc = _("Personal theme:");
66     }
67     
68     $SelectOptions = HTML();
69     if (!empty($available_languages) and is_array($available_languages)) {
70         if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
71             $SelectOptions->pushContent(selectedOption("",_("<system language>")));
72         else
73             $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
74         foreach ($available_languages as $lang) {
75             if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
76                 $SelectOptions->pushContent(selectedOption($lang));
77             else
78                 $SelectOptions->pushContent(unselectedOption($lang));
79         }
80         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
81                                         $SelectOptions);
82         $SelectLanguagesDesc = _("Personal language:");
83     } else {
84         if ($SelectThemes == '') {
85             $appearance = false;
86             $SelectThemesDesc = '';
87             $SelectLanguagesDesc = '';
88         }
89     }
90 } else {
91     $SelectThemesDesc = _("Personal theme:");
92     $SelectLanguagesDesc = _("Personal language:");
93     $SelectThemes = $pref->get('theme');
94     $SelectLanguages = $pref->get('lang');
95 }
96
97 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
98 ?>
99 <?= $errmsg ?>
100
101 <?= fmt("User preferences for user '%s':", $pref->get('userid')) ?>
102
103 <?php if ($isForm) { ?>
104 <form action="<?=$request->getPostURL()?>" method="post">
105 <?php } else { 
106   $user = $request->_user; 
107   $fill = "&nbsp;";
108   // See also plugin _AuthInfo
109 ?>
110 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$pref->get('userid'), " from " . (ENABLE_USER_NEW ? $request->_user->_authmethod : $request->_user->auth_how)),
111               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
112               //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
113               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
114                       _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
115               sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
116               sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
117               //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
118               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$Theme->_name),
119               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
120               ) ?>
121 <?php } ?>
122
123 <table border="0">
124 <?php if ($isForm and $user->mayChangePass()) { ?>
125   <tr><td colspan="3"><h2><?=_("Change Password")?></h2></td></tr>
126
127     <tr><td align="right"><?=_("New password")?>:</td>
128         <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
129         <td></td></tr>
130     <tr><td align="right"><?=_("Type it again")?>:</td>
131         <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
132         <td></td></tr>
133 <?php } ?>
134
135 <?php if (ENABLE_USER_NEW) { ?>
136   <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
137
138   <tr><td><?=_("Your E-Mail:")?></td>
139   <td>
140   <?php if ($isForm) { ?>
141      <input type="text" name="pref[email]" size="30" maxlength="60"
142             value="<?=$pref->get('email')?>" />
143   <?php } else { ?>
144      '<?= $pref->get('email') ?>'
145   <?php } ?>
146   &nbsp;&nbsp;<?= _("Status:") ?>&nbsp;&nbsp;
147   <?php if ($pref->get('emailVerified')) { ?>
148     <?= _("Email verified.") ?>
149   <?php } else { ?>
150     <?= _("Email not yet verified.") ?>
151   <?php } ?>
152   </td><td>
153      <span class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></span>
154    </td></tr>
155
156    <tr><td colspan="2">
157     <?=_("Get an email notification at changes of the following pages:")?><br />
158     <?php if ($isForm) { ?>
159       <blockquote><textarea name="pref[notifyPages]" cols="50" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote></td>
160     <td><span class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></span></td>
161     <?php } else { ?>
162      <td><?=$pref->get('notifyPages')?></td><td></td>
163     <?php } ?>
164    </tr>
165 <?php } ?>
166
167   <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
168
169   <tr><td colspan="2"><?=_("Here you can override site-specific default values.") ?></td>
170       <td><span class="hint"><?= _("Currently not recommended!") ?></span></td></tr>
171   <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
172       <tr><td align="right"><?=$SelectThemesDesc?></td>
173           <td><?= $SelectThemes ?></td>
174           <td><span class="hint"><?=_("System default:")?> <?= THEME ?></span></td></tr>
175       <tr><td align="right"><?=$SelectLanguagesDesc?></td>
176           <td><?= $SelectLanguages ?></td>
177           <td><span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></td></tr>
178       <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
179           <td><?=$NoLinkIconsCB?></td>
180           <td><p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p></tr>
181
182   <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
183
184   <tr><td colspan="2">
185     <?=_("Height")?>:&nbsp;
186     <?php if ($isForm) { ?>
187      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
188             value="<?=$pref->get('editHeight')?>" />
189     <?php } else { ?>
190       <?=$pref->get('editHeight')?>
191     <?php } ?>
192     &nbsp;&nbsp;<?=_("Width")?>:&nbsp;
193     <?php if ($isForm) { ?>
194      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
195             value="<?=$pref->get('editWidth')?>" />
196     <?php } else { ?>
197       <?=$pref->get('editWidth')?>
198     <?php } ?>
199     </td>
200     <td><p class="hint">
201       <?=_("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>
202     </td></tr>
203
204   <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
205
206   <tr><td colspan="2"><p>
207     <?=fmt("Add %s hours to the server's local time when reporting times.",
208            $timeOffsetInput)?>
209   </p></td><td>
210   <p class="hint">
211     <?=fmt("The current time at the server is %s.",
212             HTML::strong($Theme->formatDateTime($serverTime)))?>
213     <?=fmt("With the current offset, this would be reported as %s.",
214            HTML::strong($Theme->formatDateTime($time)))?>
215   </p>
216   </td></tr>
217
218   <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
219
220   <tr><td colspan="2"><p>
221     <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
222     <?= $RelativeDatesCB ?>
223   </p></td><td></td></tr>
224 </table>
225
226 <?php if ($isForm) { ?>
227   <hr />
228   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
229   <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
230
231 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>
232 </form>
233 <?php } ?>