2 <!-- $Id: userprefs.tmpl,v 1.36 2003-12-01 22:23:01 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")) {
17 $user = &$request->getUser();
18 $_upo = $user->getPreferences();
19 $pref = $_upo->_prefs;
21 $offset = $pref['timeOffset'];
22 $serverTime = $time - $offset * 3600;
24 $timeOffsetInput = HTML::input(array('type' => "text",
27 'name' => "pref[timeOffset]",
31 $timeOffsetInput = $pref['timeOffset'];
34 $RelativeDatesCB = HTML(HTML::input(array('type' => 'hidden',
35 'name' => 'pref[relativeDates][]',
37 HTML::input(array('type' => 'checkbox',
38 'name' => 'pref[relativeDates][]',
40 'checked' => (bool) $pref['relativeDates'])));
42 $NoLinkIconsCB = HTML(HTML::input(array('type' => 'hidden',
43 'name' => 'pref[noLinkIcons][]',
45 HTML::input(array('type' => 'checkbox',
46 'name' => 'pref[noLinkIcons][]',
48 'checked' => (bool) $pref['noLinkIcons'])));
50 function selectedOption ($value, $label = false) {
51 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
53 function unselectedOption ($value, $label = false) {
54 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
57 $SelectThemes = ''; $SelectLanguages = '';
58 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
60 $SelectOptions = HTML();
61 if (!empty($available_themes) and is_array($available_themes)) {
63 $SelectOptions->pushContent(selectedOption('',_("<system theme>")));
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));
70 $SelectOptions->pushContent(unselectedOption($theme));
72 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
74 $SelectThemesDesc = _("Select your personal theme:");
77 $SelectOptions = HTML();
78 if (!empty($available_languages) and is_array($available_languages)) {
80 $SelectOptions->pushContent(selectedOption('',_("<system language>")));
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));
87 $SelectOptions->pushContent(unselectedOption($lang));
89 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
91 $SelectLanguagesDesc = _("Select your personal language:");
93 if ($SelectThemes == '') {
95 $SelectThemesDesc = '';
96 $SelectLanguagesDesc = '';
100 $SelectThemesDesc = _("Personal theme:");
101 $SelectLanguagesDesc = _("Personal language:");
102 $SelectThemes = $pref['theme'];
103 $SelectLanguages = $pref['lang'];
106 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
110 <?php if ($isForm) { ?>
111 <form action="<?=$request->getPostURL()?>" method="post">
113 $user = $request->_user;
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'])
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")?>.
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']?>" />
141 '<?= $pref['email'] ?>'
143 <?= _("Status:") ?>
144 <?php if (!empty($pref['emailVerified']) && $pref['emailVerified']) { ?>
145 <?= _("Email verified.") ?>
147 <?= _("Email not yet verified.") ?>
150 <p class="hint">(<?=_("Note, that user accounts with bouncing emails will be disabled.")?>)</p>
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 />
156 <?php /*if ($isForm) { ?>
157 <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>
161 <?=$pref['notifyPages']?>
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>
171 <h2><?=_("Edit Area Size")?></h2>
173 <?php if ($isForm) { ?>
174 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
175 value="<?=$pref['editHeight']?>" />
177 <?=$pref['editHeight']?>
180 <?php if ($isForm) { ?>
181 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
182 value="<?=$pref['editWidth']?>" />
184 <?=$pref['editWidth']?>
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>
189 <h2><?=_("Time Zone")?></h2>
191 <?=fmt("Add %s hours to the server's local time when reporting times.",
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)))?>
201 <h2><?=_("Date Format")?></h2>
202 <p><?=$RelativeDatesCB?>
203 <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
206 <?php if ($isForm) { ?>
208 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?><?=Button("submit:cancel", _("Cancel"), 'button')?></p>
210 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>