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