2 <!-- $Id: userprefs.tmpl,v 1.28 2002-09-01 15:52:50 rurban Exp $ -->
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;
10 $plugin = $request->getArg('pagename');
11 if ($request->isActionPage($request->getArg('pagename')) and
12 $plugin != _("PreferencesInfo")) {
17 $offset = $request->getPref('timeOffset') * 3600;
18 $serverTime = $time - $offset;
20 $timeOffsetInput = HTML::input(array('type' => "text",
23 'name' => "pref[timeOffset]",
25 'value' => $request->getPref('timeOffset')));
27 $timeOffsetInput = $request->getPref('timeOffset');
30 $RelativeDatesCB = HTML(HTML::input(array('type' => 'hidden',
31 'name' => 'pref[relativeDates][]',
33 HTML::input(array('type' => 'checkbox',
34 'name' => 'pref[relativeDates][]',
36 'checked' => (bool) $request->getPref('relativeDates'))));
38 function selectedOption ($value, $label = false) {
39 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
41 function unselectedOption ($value, $label = false) {
42 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
45 $SelectThemes = ''; $SelectLanguages = '';
46 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
48 $SelectOptions = HTML();
49 if (!empty($available_themes) and is_array($available_themes)) {
50 if (! $request->getPref('theme'))
51 $SelectOptions->pushContent(selectedOption('',_("<default>")));
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));
58 $SelectOptions->pushContent(unselectedOption($theme));
60 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
62 $SelectThemesDesc = _("Select your personal theme");
65 $SelectOptions = HTML();
66 if (!empty($available_languages) and is_array($available_languages)) {
67 if (! $request->getPref('lang') )
68 $SelectOptions->pushContent(selectedOption('',_("<default>")));
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));
75 $SelectOptions->pushContent(unselectedOption($lang));
77 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
79 $SelectLanguagesDesc = _("Select your personal language");
81 if ($SelectThemes == '') {
83 $SelectThemesDesc = '';
84 $SelectLanguagesDesc = '';
88 $SelectThemesDesc = _("Personal theme");
89 $SelectLanguagesDesc = _("Personal language");
90 $SelectThemes = $request->getPref('theme');
91 $SelectLanguages = $request->getPref('lang');
94 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
98 <?php if ($isForm) { ?>
99 <form action="<?=$request->getURLtoSelf()?>" method="post">
101 $user = $request->_user;
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'])
117 <?php if ($isForm and !$user->isAdmin()) { ?>
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")?>.
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')?>" />
129 '<?= $request->getPref('email') ?>'
131 <?= _("Status") ?>:
132 <?php if ($request->getPref('emailVerified')) { ?>
133 <?= _("Email verified.") ?>
135 <?= _("Email not yet verified.") ?>
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 />
141 <?php if ($isForm) { ?>
142 <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>
146 <?=$request->getPref('notifyPages')?>
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>
156 <p class="hint"><?=_("Here you can override site-specific <default> values. Currently not recommended!")?></p>
158 <h2><?=_("Edit Area Size")?></h2>
160 <?php if ($isForm) { ?>
161 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
162 value="<?=$request->getPref('editHeight')?>" />
164 <?=$request->getPref('editHeight')?>
167 <?php if ($isForm) { ?>
168 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
169 value="<?=$request->getPref('editWidth')?>" />
171 <?=$request->getPref('editWidth')?>
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>
176 <h2><?=_("Time Zone")?></h2>
178 <?=fmt("Add %s hours to the server's local time when reporting times.",
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)))?>
188 <h2><?=_("Date Format")?></h2>
189 <p><?=$RelativeDatesCB?>
190 <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
193 <?php if ($isForm) { ?>
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')) ?>