2 <!-- $Id: userprefs.tmpl,v 1.41 2004-03-12 23:21:35 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 = $user->_prefs; //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::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')));
41 function selectedOption ($value, $label = false) {
42 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
44 function unselectedOption ($value, $label = false) {
45 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
48 $SelectThemes = ''; $SelectLanguages = '';
49 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
51 $SelectOptions = HTML();
52 if (!empty($available_themes) and is_array($available_themes)) {
53 if (!$pref->get('theme') or $pref->get('theme') == THEME)
54 $SelectOptions->pushContent(selectedOption('',_("<system theme>")));
56 $SelectOptions->pushContent(unselectedOption('',_("<system theme>")));
57 foreach ($available_themes as $theme) {
58 if ($theme == $pref->get('theme') and $theme != THEME)
59 $SelectOptions->pushContent(selectedOption($theme));
61 $SelectOptions->pushContent(unselectedOption($theme));
63 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
65 $SelectThemesDesc = _("Personal theme:");
68 $SelectOptions = HTML();
69 if (!empty($available_languages) and is_array($available_languages)) {
70 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
71 $SelectOptions->pushContent(selectedOption('',_("<system language>")));
73 $SelectOptions->pushContent(unselectedOption('',_("<system language>")));
74 foreach ($available_languages as $lang) {
75 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
76 $SelectOptions->pushContent(selectedOption($lang));
78 $SelectOptions->pushContent(unselectedOption($lang));
80 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
82 $SelectLanguagesDesc = _("Personal language:");
84 if ($SelectThemes == '') {
86 $SelectThemesDesc = '';
87 $SelectLanguagesDesc = '';
91 $SelectThemesDesc = _("Personal theme:");
92 $SelectLanguagesDesc = _("Personal language:");
93 $SelectThemes = $pref->get('theme');
94 $SelectLanguages = $pref->get('lang');
97 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
101 <?php if ($isForm) { ?>
102 <form action="<?=$request->getPostURL()?>" method="post">
104 $user = $request->_user;
106 // See also plugin _AuthInfo
108 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $request->_user->auth_how()),
109 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
110 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
111 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
112 _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
113 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->homePage() ? $user->_homepage->_pagename : ''),
114 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
115 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
116 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$Theme->_name),
117 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
121 <?php if ($isForm and $user->mayChangePass()) { ?>
122 <h2><?=_("Change Password")?></h2>
124 <tr><td align="right"><?=_("New password")?>:</td>
125 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td></tr>
126 <tr><td align="right"><?=_("Type it again")?>:</td>
127 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td></tr>
131 <h2><?=_("E-mail")?></h2>
132 <p><?=_("Your E-Mail:")?>
133 <?php if ($isForm) { ?>
134 <input type="text" name="pref[email]" size="30" maxlength="60"
135 value="<?=$pref->get('email')?>" />
137 '<?= $pref->get('email') ?>'
139 <?= _("Status:") ?>
140 <?php if ($pref->get('emailVerified')) { ?>
141 <?= _("Email verified.") ?>
143 <?= _("Email not yet verified.") ?>
146 <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
152 <p><?=_("Get an email notification at changes of the following pages:")?><br />
153 <?php if ($isForm) { ?>
154 <blockquote><textarea name="pref[notifyPages]" cols="50" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote>
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>. */ ?>
164 <tr><td align="right"><?=$SelectThemesDesc?></td>
165 <td><?= $SelectThemes ?></td>
166 <td><span class="hint"><?=_("System default:")?> <?= THEME ?></span></td></tr>
167 <tr><td align="right"><?=$SelectLanguagesDesc?></td>
168 <td><?= $SelectLanguages ?></td>
169 <td><span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></td></tr>
170 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
171 <td><?=$NoLinkIconsCB?></td>
172 <td><p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></tr>
175 <h2><?=_("Edit Area Size")?></h2>
176 <p><?=_("Height")?>:
177 <?php if ($isForm) { ?>
178 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
179 value="<?=$pref->get('editHeight')?>" />
181 <?=$pref->get('editHeight')?>
183 <?=_("Width")?>:
184 <?php if ($isForm) { ?>
185 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
186 value="<?=$pref->get('editWidth')?>" />
188 <?=$pref->get('editWidth')?>
191 <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>
193 <h2><?=_("Time Zone")?></h2>
195 <?=fmt("Add %s hours to the server's local time when reporting times.",
199 <?=fmt("The current time at the server is %s.",
200 HTML::strong($Theme->formatDateTime($serverTime)))?>
201 <?=fmt("With the current offset, this would be reported as %s.",
202 HTML::strong($Theme->formatDateTime($time)))?>
205 <h2><?=_("Date Format")?></h2>
207 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
208 <?= $RelativeDatesCB ?>
211 <?php if ($isForm) { ?>
213 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
214 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
216 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>