]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
LANG still broken, working on better locale handling.
[SourceForge/phpwiki.git] / themes / default / templates / userprefs.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: userprefs.tmpl,v 1.26 2002-08-27 21:51:31 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")) {
13     $isForm = true;
14 }
15
16 $time = time();
17 $offset = $request->getPref('timeOffset') * 3600;
18 $serverTime = $time - $offset;
19 if ( $isForm )
20     $timeOffsetInput = HTML::input(array('type' => "text",
21                                          'size' => 6,
22                                          'maxlength' => 6,
23                                          'name' => "pref[timeOffset]",
24                                          'class' => "numeric",
25                                          'value' => $request->getPref('timeOffset')));
26 else
27     $timeOffsetInput = $request->getPref('timeOffset');
28
29
30 $RelativeDatesCB = HTML(HTML::input(array('type' => 'hidden',
31                                           'name' => 'pref[relativeDates][]',
32                                           'value' => '0')),
33                         HTML::input(array('type' => 'checkbox',
34                                           'name' => 'pref[relativeDates][]',
35                                           'value' => '1',
36                                           'checked' => (bool) $request->getPref('relativeDates'))));
37
38 function selectedOption ($value, $label = false) {
39     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
40 }
41 function unselectedOption ($value, $label = false) {
42     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
43 }
44
45 $SelectThemes = ''; $SelectLanguages = '';
46 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
47 if ( $isForm ) {
48     $SelectOptions = HTML(); 
49     if (!empty($available_themes) and is_array($available_themes)) {
50         if (! $request->getPref('theme'))
51             $SelectOptions->pushContent(selectedOption('',_("<default>")));
52         else
53             $SelectOptions->pushContent(unselectedOption('',_("<default>")));
54         foreach ($available_themes as $theme) {
55             if ($theme == $request->getPref('theme') and $theme != $GLOBALS['Theme']->_name)
56                 $SelectOptions->pushContent(selectedOption($theme));
57             else
58                 $SelectOptions->pushContent(unselectedOption($theme));
59         }
60         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
61                                      $SelectOptions);
62         $SelectThemesDesc = _("Select your personal theme");
63     }
64     
65     $SelectOptions = HTML();
66     if (!empty($available_languages) and is_array($available_languages)) {
67         if (! $request->getPref('lang') )
68             $SelectOptions->pushContent(selectedOption('',_("<default>")));
69         else
70             $SelectOptions->pushContent(unselectedOption('',_("<default>")));
71         foreach ($available_languages as $lang) {
72             if ($lang == $request->getPref('lang') and $lang != $GLOBALS['LANG'])
73                 $SelectOptions->pushContent(selectedOption($lang));
74             else
75                 $SelectOptions->pushContent(unselectedOption($lang));
76         }
77         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
78                                         $SelectOptions);
79         $SelectLanguagesDesc = _("Select your personal language");
80     } else {
81         if ($SelectThemes == '') {
82             $appearance = false;
83             $SelectThemesDesc = '';
84             $SelectLanguagesDesc = '';
85         }
86     }
87 } else {
88     $SelectThemesDesc = _("Personal theme");
89     $SelectLanguagesDesc = _("Personal language");
90     $SelectThemes = $request->getPref('theme');
91     $SelectLanguages = $request->getPref('lang');
92 }
93
94 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
95 ?>
96 <?= $errmsg ?>
97
98 <?php if ($isForm) { ?>
99 <form action="<?=$request->getURLtoSelf()?>" method="post">
100 <?php } else { 
101   $user = $request->_user; 
102   $fill = "&nbsp;";
103 ?>
104 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$request->getPref('userid'), " from " . $request->_user->auth_how()),
105               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
106               sprintf("%12s: [% 10s]\n",_("Password"),$request->getPref('passwd')),
107               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
108                       _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
109               sprintf("%12s: [% 10s]\n",_("Homepage"),$user->homePage() ? $user->_homepage->_pagename : ''),
110               sprintf("%12s: [% 10s]\n",_("E-Mail"),$request->getPref('email')),
111               sprintf("%12s: [% 10s]\n",_("Notify"),$request->getPref('notifyPages')),
112               sprintf("%12s: [% 10s] %s %8s: [% 10s] \n",_("Theme"), $request->getPref('theme'), _("Current"),_("Theme"),$Theme->_name),
113               sprintf("%12s: [% 10s] %s %8s: [% 10s] \n",_("Language"),$request->getPref('lang'),_("Current"),_("Language"),$GLOBALS['LANG'])
114               ) ?>
115 <?php } ?>
116
117 <?php if ($isForm) { ?>
118   <h2><?=_("Change Password")?></h2>
119      <input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /> <?=_("New password")?>.<br />
120      <input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /> <?=_("Type it again")?>.
121 <?php } ?>
122
123   <h2><?=_("Email Notification")?></h2>
124   <p><?=_("Your E-Mail:")?>
125   <?php if ($isForm) { ?>
126      <input type="text" name="pref[email]" size="30" maxlength="60"
127             value="<?=$request->getPref('email')?>" />
128   <?php } else { ?>
129      '<?= $request->getPref('email') ?>'
130   <?php } ?>
131   &nbsp;&nbsp;<?= _("Status") ?>:&nbsp;&nbsp;
132   <?php if ($request->getPref('emailVerified')) { ?>
133     <?= _("Email verified.") ?>
134   <?php } else { ?>
135     <?= _("Email not yet verified.") ?>
136   <?php } ?>
137   </p>
138      <p class="hint">(<?=_("Note, that user accounts with bouncing emails will be disabled.")?>)</p>
139    <p><?=_("Get an email notification at changes of the following pages")?>:<br />
140
141   <?php if ($isForm) { ?>
142      &nbsp;<textarea name="pref[notifyPages]" cols="50" rows="5"><?=$request->getPref('notifyPages')?></textarea>
143      <p class="hint">(<?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?>)</p>
144    </p>
145   <?php } else { ?>
146     <?=$request->getPref('notifyPages')?>
147   <?php } ?>
148
149   <h2><?=_("Appearance")?></h2>
150    <table cellspacing="5" border="1">
151      <tr class="hint"><td><?= _("Current <default> theme") ?>:</td><td><?=_("Current <default> language")?>:</td></tr>
152      <tr align="center"><td><?= $Theme->_name ?></td>    <td><?= $GLOBALS['LANG'] ?></td></tr>
153      <tr class="hint"><td><?= $SelectThemesDesc?>:</td><td><?=$SelectLanguagesDesc?>:</td></tr>
154      <tr align="center"><td><?= $SelectThemes ?></td>    <td><?= $SelectLanguages ?></td></tr>
155    </table>
156      <p class="hint"><?=_("Here you can override site-specific <default> values. Currently not recommended!")?></p>
157
158   <h2><?=_("Edit Area Size")?></h2>
159   <p><?=_("Height")?>
160     <?php if ($isForm) { ?>
161      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
162             value="<?=$request->getPref('editHeight')?>" />
163     <?php } else { ?>
164       <?=$request->getPref('editHeight')?>
165     <?php } ?>
166     <?=_("Width")?>
167     <?php if ($editAreaSize) { ?>
168      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
169             value="<?=$request->getPref('editWidth')?>" />
170     <?php } else { ?>
171       <?=$request->getPref('editWidth')?>
172     <?php } ?>
173   </p>
174   <p class="hint"><?=_("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>
175
176   <h2><?=_("Time Zone")?></h2>
177   <p>
178     <?=fmt("Add %s hours to the server's local time when reporting times.",
179            $timeOffsetInput)?>
180   </p>
181   <p class="hint">
182     <?=fmt("The current time at the server is %s.",
183             HTML::strong($Theme->formatDateTime($serverTime)))?>
184     <?=fmt("With the current offset, this would be reported as %s.",
185            HTML::strong($Theme->formatDateTime($time)))?>
186   </p>
187
188   <h2><?=_("Date Format")?></h2>
189   <p><?=$RelativeDatesCB?>
190      <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
191   </p>
192
193 <?php if ($isForm) { ?>
194   <hr />
195   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?><?=Button("submit:cancel", _("Cancel"), 'button')?></p>
196 <input type="hidden" name="action" value="<?=$request->getArg('pagename')?>">
197 <?= HiddenGets(array('pref')) ?>
198 </form>
199 <?php } ?>