2 <!-- $Id: userprefs.tmpl,v 1.37 2003-12-01 22:54:56 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'];
33 if (empty($pref['relativeDates']))
34 $pref['relativeDates'] = false;
35 $RelativeDatesCB = HTML(HTML::input(array('type' => 'hidden',
36 'name' => 'pref[relativeDates][]',
38 HTML::input(array('type' => 'checkbox',
39 'name' => 'pref[relativeDates][]',
41 'checked' => (bool) $pref['relativeDates'])));
42 if (empty($pref['noLinkIcons']))
43 $pref['noLinkIcons'] = false;
44 $NoLinkIconsCB = HTML(HTML::input(array('type' => 'hidden',
45 'name' => 'pref[noLinkIcons][]',
47 HTML::input(array('type' => 'checkbox',
48 'name' => 'pref[noLinkIcons][]',
50 'checked' => (bool) $pref['noLinkIcons'])));
52 function selectedOption ($value, $label = false) {
53 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
55 function unselectedOption ($value, $label = false) {
56 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
59 $SelectThemes = ''; $SelectLanguages = '';
60 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
62 $SelectOptions = HTML();
63 if (!empty($available_themes) and is_array($available_themes)) {
64 if (empty($pref['theme']))
65 $SelectOptions->pushContent(selectedOption('',_("<system theme>")));
67 $SelectOptions->pushContent(unselectedOption('',_("<system theme>")));
68 foreach ($available_themes as $theme) {
69 if (!empty($pref['theme']) && $theme == $pref['theme'] and $theme != THEME)
70 $SelectOptions->pushContent(selectedOption($theme));
72 $SelectOptions->pushContent(unselectedOption($theme));
74 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
76 $SelectThemesDesc = _("Select your personal theme:");
79 $SelectOptions = HTML();
80 if (!empty($available_languages) and is_array($available_languages)) {
81 if (empty($pref['lang']))
82 $SelectOptions->pushContent(selectedOption('',_("<system language>")));
84 $SelectOptions->pushContent(unselectedOption('',_("<system language>")));
85 foreach ($available_languages as $lang) {
86 if (!empty($pref['lang']) && $lang == $pref['lang'] and $lang != DEFAULT_LANGUAGE)
87 $SelectOptions->pushContent(selectedOption($lang));
89 $SelectOptions->pushContent(unselectedOption($lang));
91 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
93 $SelectLanguagesDesc = _("Select your personal language:");
95 if ($SelectThemes == '') {
97 $SelectThemesDesc = '';
98 $SelectLanguagesDesc = '';
102 $SelectThemesDesc = _("Personal theme:");
103 $SelectLanguagesDesc = _("Personal language:");
104 $SelectThemes = $pref['theme'];
105 $SelectLanguages = $pref['lang'];
108 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
112 <?php if ($isForm) { ?>
113 <form action="<?=$request->getPostURL()?>" method="post">
115 $user = $request->_user;
118 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref['userid'], " from " . $request->_user->auth_how()),
119 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
120 //sprintf("%12s: [% 10s]\n",_("Password"),$pref['passwd']),
121 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
122 _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
123 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->homePage() ? $user->_homepage->_pagename : ''),
124 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref['email']),
125 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref['notifyPages']),
126 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref['theme'], _("Current Theme"),$Theme->_name),
127 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref['lang'],_("Current Language"),$GLOBALS['LANG'])
131 <?php /* if ($isForm and !$user->isAdmin()) { ?>
132 <h2><?=_("Change Password")?></h2>
133 <input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /> <?=_("New password")?>.<br />
134 <input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /> <?=_("Type it again")?>.
137 <h2><?=_("E-mail")?></h2>
138 <p><?=_("Your E-Mail:")?>
139 <?php if ($isForm) { ?>
140 <input type="text" name="pref[email]" size="30" maxlength="60"
141 value="<?=$pref['email']?>" />
143 '<?= $pref['email'] ?>'
145 <?= _("Status:") ?>
146 <?php if (!empty($pref['emailVerified']) && $pref['emailVerified']) { ?>
147 <?= _("Email verified.") ?>
149 <?= _("Email not yet verified.") ?>
152 <p class="hint">(<?=_("Note, that user accounts with bouncing emails will be disabled.")?>)</p>
154 Related code for this doesn't seem to function yet.
155 Commented out for now until it can be finished or removed. --CarstenKlapp
156 <p><?=_("Get an email notification at changes of the following pages:")?><br />
158 <?php /*if ($isForm) { ?>
159 <textarea name="pref[notifyPages]" cols="50" rows="5"><?=$pref['notifyPages']?></textarea>
160 <p class="hint">(<?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?>)</p>
163 <?=$pref['notifyPages']?>
165 <h2><?=_("Appearance")?></h2>
166 <p class="hint"><?=_("Here you can override site-specific default values. Currently not recommended!")?></p>
167 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
168 <p><?=$SelectThemesDesc?><br /> <?= $SelectThemes ?> <span class="hint"><?=_("System default:")?> <?= THEME ?></span></p>
169 <p><?=$SelectLanguagesDesc?><br /> <?= $SelectLanguages ?> <span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></p>
170 <p><?=$NoLinkIconsCB?> <?=fmt("Hide %s.", WikiLink("LinkIcons"))?></p>
171 <p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p>
173 <h2><?=_("Edit Area Size")?></h2>
175 <?php if ($isForm) { ?>
176 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
177 value="<?=$pref['editHeight']?>" />
179 <?=$pref['editHeight']?>
182 <?php if ($isForm) { ?>
183 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
184 value="<?=$pref['editWidth']?>" />
186 <?=$pref['editWidth']?>
189 <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>
191 <h2><?=_("Time Zone")?></h2>
193 <?=fmt("Add %s hours to the server's local time when reporting times.",
197 <?=fmt("The current time at the server is %s.",
198 HTML::strong($Theme->formatDateTime($serverTime)))?>
199 <?=fmt("With the current offset, this would be reported as %s.",
200 HTML::strong($Theme->formatDateTime($time)))?>
203 <h2><?=_("Date Format")?></h2>
204 <p><?=$RelativeDatesCB?>
205 <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
208 <?php if ($isForm) { ?>
210 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?><?=Button("submit:cancel", _("Cancel"), 'button')?></p>
212 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>