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