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