5 // Todo: Move the logic and code to the plugin
6 // This is very experimental and the read-only part an ugly hack so far.
7 foreach (explode(',','errmsg,isForm') as $var) {
8 if (empty($$var)) $$var = false;
11 $plugin = $request->getArg('pagename');
12 if (isActionPage($request->getArg('pagename'))
13 and $isForm and $plugin == _("PreferencesInfo")) {
17 $user =& $request->getUser();
18 $pref =& $request->_prefs;
21 $offset = $pref->get('timeOffset');
22 $serverTime = $time - $offset * 3600;
24 $timeOffsetInput = HTML::input(array('type' => "text",
27 'name' => "pref[timeOffset]",
31 $timeOffsetInput = $pref->get('timeOffset');
33 $OwnModificationsCB = HTML::input(array('type' => 'checkbox',
34 'name' => 'pref[ownModifications]',
36 'checked' => (bool) $pref->get('ownModifications')));
37 $MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox',
38 'name' => 'pref[majorModificationsOnly]',
40 'checked' => (bool) $pref->get('majorModificationsOnly')));
41 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
42 'name' => 'pref[relativeDates]',
44 'checked' => (bool) $pref->get('relativeDates')));
45 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
46 'name' => 'pref[noLinkIcons]',
48 'checked' => (bool) $pref->get('noLinkIcons')));
49 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
50 'name' => 'pref[googleLink]',
52 'checked' => (bool) $pref->get('googleLink')));
53 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
54 'name' => 'pref[doubleClickEdit]',
56 'checked' => (bool) $pref->get('doubleClickEdit')));
57 if (!function_exists('selectedOption')) {
58 function selectedOption ($value, $label = false) {
59 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
61 function unselectedOption ($value, $label = false) {
62 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
66 $SelectThemes = ''; $SelectLanguages = '';
67 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
69 $SelectOptions = HTML();
70 if (!empty($available_themes) and is_array($available_themes)) {
71 if (!$pref->get('theme') or $pref->get('theme') == THEME)
72 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
74 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
75 foreach ($available_themes as $theme) {
76 if ($theme == $pref->get('theme') and $theme != THEME)
77 $SelectOptions->pushContent(selectedOption($theme));
79 $SelectOptions->pushContent(unselectedOption($theme));
81 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
83 $SelectThemesDesc = _("Personal theme:");
86 $SelectOptions = HTML();
87 if (!empty($available_languages) and is_array($available_languages)) {
88 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
89 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
91 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
92 foreach ($available_languages as $lang) {
93 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
94 $SelectOptions->pushContent(selectedOption($lang));
96 $SelectOptions->pushContent(unselectedOption($lang));
98 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
100 $SelectLanguagesDesc = _("Personal language:");
102 if ($SelectThemes == '') {
104 $SelectThemesDesc = '';
105 $SelectLanguagesDesc = '';
109 $SelectThemesDesc = _("Personal theme:");
110 $SelectLanguagesDesc = _("Personal language:");
111 $SelectThemes = $pref->get('theme');
112 $SelectLanguages = $pref->get('lang');
118 <?= fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
120 <?php if ($isForm) { ?>
121 <form action="<?=$request->getPostURL()?>" method="post">
124 // See also plugin _AuthInfo
125 $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
127 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
128 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
129 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
130 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
131 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
132 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
133 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
134 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
135 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
136 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
141 <?php if ($isForm and $user->mayChangePass()) { ?>
142 <tr><td colspan="3"><h2><?= ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h2></td></tr>
144 <tr><td align="right"><?=_("New password")?>:</td>
145 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
147 <tr><td align="right"><?=_("Type it again")?>:</td>
148 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
152 <?php if (ENABLE_USER_NEW) { ?>
153 <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
155 <tr><td><?=_("Your E-Mail:")?></td>
157 <?php if ($isForm) { ?>
158 <input type="text" name="pref[email]" size="30" maxlength="60"
159 value="<?=$pref->get('email')?>" />
161 '<?= $pref->get('email') ?>'
163 <?= _("Status:") ?>
164 <?php if ($pref->get('emailVerified')) { ?>
165 <?= _("Email verified.") ?>
167 <?= _("Email not yet verified.") ?>
169 </td><td><p class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
172 <?=_("Get an email notification at changes of the following pages:")?>
175 <?php if ($isForm) { ?>
176 <td colspan="2"><textarea name="pref[notifyPages]" cols="40" rows="6"><?=$pref->get('notifyPages')?></textarea></td>
177 <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
179 <td colspan="3"><?=$pref->get('notifyPages')?></td>
185 <p><?=_("Do not send my own modifications:")?></p>
188 <p><?= $OwnModificationsCB ?></p>
191 <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p>
197 <p><?=_("Do not send minor modifications:")?></p>
200 <p><?= $MajorModificationsOnlyCB ?></p>
203 <p class="hint"><?=_("Check if you do not want to be notified of minor modifications.")?></p>
209 <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
211 <tr><td colspan="3"><?=_("Here you can override site-specific default values.") ?></td></tr>
212 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
213 <tr><td align="right"><?=$SelectThemesDesc?></td>
214 <td><?= $SelectThemes ?></td>
215 <td><p class="hint"><?=_("System default:")?> <?= THEME ?></p></td></tr>
216 <tr><td align="right"><?=$SelectLanguagesDesc?></td>
217 <td><?= $SelectLanguages ?></td>
218 <td><p class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></p></td></tr>
219 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
220 <td><?=$NoLinkIconsCB?></td>
221 <td><p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p></td></tr>
222 <tr><td align="right"><?=fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
223 <td><?=$GoogleLinkCB?></td>
224 <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></td></tr>
225 <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
226 <td><?=$DoubleClickCB?></td>
227 <td><p class="hint"><?=fmt("Enabled makes it hard to double-click words and sentences for cut and paste. See %s.", WikiLink("PhpWiki:DoubleClickToEditPage"))?></p></td></tr>
230 <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
233 <?=_("Height")?>:
234 <?php if ($isForm) { ?>
235 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
236 value="<?=$pref->get('editHeight')?>" />
238 <?=$pref->get('editHeight')?>
240 <?=_("Width")?>:
241 <?php if ($isForm) { ?>
242 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
243 value="<?=$pref->get('editWidth')?>" />
245 <?=$pref->get('editWidth')?>
249 <?=_("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>
252 <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
254 <tr><td colspan="2"><p>
255 <?=fmt("Add %s hours to the server's local time when reporting times.",
259 <?=fmt("The current time at the server is %s.",
260 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
261 <?=fmt("With the current offset, this would be reported as %s.",
262 HTML::strong($WikiTheme->formatDateTime($time)))?>
266 <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
268 <tr><td colspan="2"><p>
269 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
270 <?= $RelativeDatesCB ?>
271 </p></td><td></td></tr>
274 <?php if ($isForm) { ?>
276 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
277 <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
278 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
280 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>