2 <!-- $Id: userprefs.tmpl,v 1.38 2003-12-04 19:21:10 carstenklapp 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 = $user->getPreferences();
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(HTML::input(array('type' => 'hidden',
33 'name' => 'pref[relativeDates][]',
35 HTML::input(array('type' => 'checkbox',
36 'name' => 'pref[relativeDates][]',
38 'checked' => (bool) $pref->get('relativeDates'))));
39 $NoLinkIconsCB = HTML(HTML::input(array('type' => 'hidden',
40 'name' => 'pref[noLinkIcons][]',
42 HTML::input(array('type' => 'checkbox',
43 'name' => 'pref[noLinkIcons][]',
45 'checked' => (bool) $pref->get('noLinkIcons'))));
47 function selectedOption ($value, $label = false) {
48 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
50 function unselectedOption ($value, $label = false) {
51 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
54 $SelectThemes = ''; $SelectLanguages = '';
55 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
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>")));
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));
67 $SelectOptions->pushContent(unselectedOption($theme));
69 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
71 $SelectThemesDesc = _("Select your personal theme:");
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>")));
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));
84 $SelectOptions->pushContent(unselectedOption($lang));
86 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
88 $SelectLanguagesDesc = _("Select your personal language:");
90 if ($SelectThemes == '') {
92 $SelectThemesDesc = '';
93 $SelectLanguagesDesc = '';
97 $SelectThemesDesc = _("Personal theme:");
98 $SelectLanguagesDesc = _("Personal language:");
99 $SelectThemes = $pref->get('theme');
100 $SelectLanguages = $pref->get('lang');
103 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
107 <?php if ($isForm) { ?>
108 <form action="<?=$request->getPostURL()?>" method="post">
110 $user = $request->_user;
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'])
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")?>.
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')?>" />
138 '<?= $pref->get('email') ?>'
140 <?= _("Status:") ?>
141 <?php if ($pref->get('emailVerified')) { ?>
142 <?= _("Email verified.") ?>
144 <?= _("Email not yet verified.") ?>
147 <p class="hint">(<?=_("Note, that user accounts with bouncing emails will be disabled.")?>)</p>
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 />
153 <?php /*if ($isForm) { ?>
154 <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>
158 <?=$pref->get('notifyPages')?>
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>
168 <h2><?=_("Edit Area Size")?></h2>
170 <?php if ($isForm) { ?>
171 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
172 value="<?=$pref->get('editHeight')?>" />
174 <?=$pref->get('editHeight')?>
177 <?php if ($isForm) { ?>
178 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
179 value="<?=$pref->get('editWidth')?>" />
181 <?=$pref->get('editWidth')?>
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>
186 <h2><?=_("Time Zone")?></h2>
188 <?=fmt("Add %s hours to the server's local time when reporting times.",
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)))?>
198 <h2><?=_("Date Format")?></h2>
199 <p><?=$RelativeDatesCB?>
200 <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
203 <?php if ($isForm) { ?>
205 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
206 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
208 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>