2 <!-- $Id: userprefs.tmpl,v 1.50 2004-05-07 10:26:14 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") and $plugin != _("_PreferencesInfo")) {
17 $user = &$request->getUser();
18 $pref = &$request->_prefs;
20 $offset = $pref->get('timeOffset');
21 $serverTime = $time - $offset * 3600;
23 $timeOffsetInput = HTML::input(array('type' => "text",
26 'name' => "pref[timeOffset]",
30 $timeOffsetInput = $pref->get('timeOffset');
32 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
33 'name' => 'pref[relativeDates]',
35 'checked' => (bool) $pref->get('relativeDates')));
36 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
37 'name' => 'pref[noLinkIcons]',
39 'checked' => (bool) $pref->get('noLinkIcons')));
40 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
41 'name' => 'pref[googleLink]',
43 'checked' => (bool) $pref->get('googleLink')));
45 function selectedOption ($value, $label = false) {
46 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
48 function unselectedOption ($value, $label = false) {
49 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
52 $SelectThemes = ''; $SelectLanguages = '';
53 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
55 $SelectOptions = HTML();
56 if (!empty($available_themes) and is_array($available_themes)) {
57 if (!$pref->get('theme') or $pref->get('theme') == THEME)
58 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
60 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
61 foreach ($available_themes as $theme) {
62 if ($theme == $pref->get('theme') and $theme != THEME)
63 $SelectOptions->pushContent(selectedOption($theme));
65 $SelectOptions->pushContent(unselectedOption($theme));
67 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
69 $SelectThemesDesc = _("Personal theme:");
72 $SelectOptions = HTML();
73 if (!empty($available_languages) and is_array($available_languages)) {
74 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
75 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
77 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
78 foreach ($available_languages as $lang) {
79 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
80 $SelectOptions->pushContent(selectedOption($lang));
82 $SelectOptions->pushContent(unselectedOption($lang));
84 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
86 $SelectLanguagesDesc = _("Personal language:");
88 if ($SelectThemes == '') {
90 $SelectThemesDesc = '';
91 $SelectLanguagesDesc = '';
95 $SelectThemesDesc = _("Personal theme:");
96 $SelectLanguagesDesc = _("Personal language:");
97 $SelectThemes = $pref->get('theme');
98 $SelectLanguages = $pref->get('lang');
101 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
105 <?= fmt("User preferences for user '%s':", $user->UserName()) ?>
107 <?php if ($isForm) { ?>
108 <form action="<?=$request->getPostURL()?>" method="post">
110 $user = $request->_user;
112 // See also plugin _AuthInfo
114 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . (ENABLE_USER_NEW ? $request->_user->_authmethod : $request->_user->auth_how)),
115 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
116 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
117 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
118 _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
119 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
120 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
121 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
122 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$Theme->_name),
123 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
128 <?php if ($isForm and $user->mayChangePass()) { ?>
129 <tr><td colspan="3"><h2><?=_("Change Password")?></h2></td></tr>
131 <tr><td align="right"><?=_("New password")?>:</td>
132 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
134 <tr><td align="right"><?=_("Type it again")?>:</td>
135 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
139 <?php if (ENABLE_USER_NEW) { ?>
140 <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
142 <tr><td><?=_("Your E-Mail:")?></td>
144 <?php if ($isForm) { ?>
145 <input type="text" name="pref[email]" size="30" maxlength="60"
146 value="<?=$pref->get('email')?>" />
148 '<?= $pref->get('email') ?>'
150 <?= _("Status:") ?>
151 <?php if ($pref->get('emailVerified')) { ?>
152 <?= _("Email verified.") ?>
154 <?= _("Email not yet verified.") ?>
157 <span class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></span>
161 <?=_("Get an email notification at changes of the following pages:")?><br />
162 <?php if ($isForm) { ?>
163 <blockquote><textarea name="pref[notifyPages]" cols="50" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote></td>
164 <td><span class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></span></td>
166 <td><?=$pref->get('notifyPages')?></td><td></td>
171 <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
173 <tr><td colspan="2"><?=_("Here you can override site-specific default values.") ?></td>
174 <td><span class="hint"><?= _("Currently not recommended!") ?></span></td></tr>
175 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
176 <tr><td align="right"><?=$SelectThemesDesc?></td>
177 <td><?= $SelectThemes ?></td>
178 <td><span class="hint"><?=_("System default:")?> <?= THEME ?></span></td></tr>
179 <tr><td align="right"><?=$SelectLanguagesDesc?></td>
180 <td><?= $SelectLanguages ?></td>
181 <td><span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></td></tr>
182 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
183 <td><?=$NoLinkIconsCB?></td>
184 <td><p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p></tr>
185 <tr><td align="right"><?=fmt("Add %s:", WikiLink("GoogleLink"))?></td>
186 <td><?=$GoogleLinkCB?></td>
187 <td><p class="hint"><?=fmt("Add Google links to unknown pages behind the '?', and the create action behind the pagename instead. See %s.",WikiLink("MeatBall:GooglePrompt"))?></p></tr>
190 <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
193 <?=_("Height")?>:
194 <?php if ($isForm) { ?>
195 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
196 value="<?=$pref->get('editHeight')?>" />
198 <?=$pref->get('editHeight')?>
200 <?=_("Width")?>:
201 <?php if ($isForm) { ?>
202 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
203 value="<?=$pref->get('editWidth')?>" />
205 <?=$pref->get('editWidth')?>
209 <?=_("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>
212 <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
214 <tr><td colspan="2"><p>
215 <?=fmt("Add %s hours to the server's local time when reporting times.",
219 <?=fmt("The current time at the server is %s.",
220 HTML::strong($Theme->formatDateTime($serverTime)))?>
221 <?=fmt("With the current offset, this would be reported as %s.",
222 HTML::strong($Theme->formatDateTime($time)))?>
226 <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
228 <tr><td colspan="2"><p>
229 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
230 <?= $RelativeDatesCB ?>
231 </p></td><td></td></tr>
234 <?php if ($isForm) { ?>
236 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
237 <?=Button("submit:delete", _("Remove Preferences"), 'wikiadmin')?>
238 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
240 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>