2 // Todo: Move the logic and code to the plugin
3 // This is very experimental and the read-only part an ugly hack so far.
4 foreach (explode(',','errmsg,isForm') as $var) {
5 if (empty($$var)) $$var = false;
8 $plugin = $request->getArg('pagename');
9 if (isActionPage($request->getArg('pagename'))
10 and $isForm and $plugin == _("PreferencesInfo")) {
14 $user =& $request->getUser();
15 $pref =& $request->_prefs;
18 $offset = $pref->get('timeOffset');
19 $serverTime = $time - $offset * 3600;
21 $timeOffsetInput = HTML::input(array('type' => "text",
24 'name' => "pref[timeOffset]",
28 $timeOffsetInput = $pref->get('timeOffset');
30 $OwnModificationsCB = HTML::input(array('type' => 'checkbox',
31 'name' => 'pref[ownModifications]',
33 'checked' => (bool) $pref->get('ownModifications')));
34 $MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox',
35 'name' => 'pref[majorModificationsOnly]',
37 'checked' => (bool) $pref->get('majorModificationsOnly')));
38 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
39 'name' => 'pref[relativeDates]',
41 'checked' => (bool) $pref->get('relativeDates')));
42 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
43 'name' => 'pref[noLinkIcons]',
45 'checked' => (bool) $pref->get('noLinkIcons')));
46 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
47 'name' => 'pref[googleLink]',
49 'checked' => (bool) $pref->get('googleLink')));
50 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
51 'name' => 'pref[doubleClickEdit]',
53 'checked' => (bool) $pref->get('doubleClickEdit')));
54 if (!function_exists('selectedOption')) {
55 function selectedOption ($value, $label = false) {
56 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
58 function unselectedOption ($value, $label = false) {
59 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
63 $SelectThemes = ''; $SelectLanguages = '';
64 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
66 $SelectOptions = HTML();
67 if (!empty($available_themes) and is_array($available_themes)) {
68 if (!$pref->get('theme') or $pref->get('theme') == THEME)
69 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
71 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
72 foreach ($available_themes as $theme) {
73 if ($theme == $pref->get('theme') and $theme != THEME)
74 $SelectOptions->pushContent(selectedOption($theme));
76 $SelectOptions->pushContent(unselectedOption($theme));
78 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
80 $SelectThemesDesc = _("Personal theme:");
83 $SelectOptions = HTML();
84 if (!empty($available_languages) and is_array($available_languages)) {
85 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
86 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
88 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
89 foreach ($available_languages as $lang) {
90 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
91 $SelectOptions->pushContent(selectedOption($lang));
93 $SelectOptions->pushContent(unselectedOption($lang));
95 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
97 $SelectLanguagesDesc = _("Personal language:");
99 if ($SelectThemes == '') {
101 $SelectThemesDesc = '';
102 $SelectLanguagesDesc = '';
106 $SelectThemesDesc = _("Personal theme:");
107 $SelectLanguagesDesc = _("Personal language:");
108 $SelectThemes = $pref->get('theme');
109 $SelectLanguages = $pref->get('lang');
113 <?php echo $errmsg ?>
115 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
117 <?php if ($isForm) { ?>
118 <form action="<?php echo $request->getPostURL()?>" method="post">
121 // See also plugin _AuthInfo
122 $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
124 <?php echo HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
125 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
126 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
127 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
128 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
129 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
130 sprintf("%12s: [% 10s]\n",_("E-mail"),$pref->get('email')),
131 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
132 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
133 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
138 <?php if ($isForm and $user->mayChangePass()) { ?>
139 <tr><td colspan="2"><h2><?php echo ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h2></td></tr>
141 <tr><td align="right"><?php echo _("New password") . _(":")?></td>
142 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
144 <tr><td align="right"><?php echo _("Type it again") . _(":")?></td>
145 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
149 <?php if (ENABLE_USER_NEW) { ?>
150 <tr><td colspan="2"><h2><?php echo _("E-mail")?></h2></td></tr>
154 <?php echo _("Your e-mail"). _(": ")?>
155 <?php if ($isForm) { ?>
156 <input type="text" name="pref[email]" size="30" maxlength="60"
157 value="<?php echo $pref->get('email')?>" />
159 '<?php echo $pref->get('email') ?>'
163 <?php echo _("Status") . _(": ") ?>
164 <?php if ($pref->get('emailVerified')) { ?>
165 <?php echo _("e-mail verified.") ?>
167 <?php echo _("e-mail not yet verified.") ?>
170 </td><td><p class="hint"><?php echo _("Note, that user accounts with bouncing e-mails will be disabled.")?></p></td></tr>
173 <?php echo _("Get an e-mail notification at changes of the following pages:")?>
176 <?php if ($isForm) { ?>
177 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
178 <td><p class="hint"><?php echo _("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
180 <td><?php echo $pref->get('notifyPages')?></td>
187 <?php echo $OwnModificationsCB ?>
188 <?php echo _("Do not send my own modifications")?>
192 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
199 <?php echo $MajorModificationsOnlyCB ?>
200 <?php echo _("Do not send minor modifications")?>
204 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
210 <tr><td colspan="2"><h2><?php echo _("Appearance")?></h2></td></tr>
212 <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
213 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
215 <?php echo $SelectThemesDesc?>
216 <?php echo $SelectThemes ?>
218 <td><p class="hint"><?php echo _("System default:")?> <?php echo THEME ?></p></td></tr>
220 <?php echo $SelectLanguagesDesc?>
221 <?php echo $SelectLanguages ?>
223 <td><p class="hint"><?php echo _("System default:")?> <?php echo DEFAULT_LANGUAGE ?></p></td></tr>
225 <?php echo $NoLinkIconsCB?>
226 <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
228 <td><p class="hint"><?php echo _("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p></td></tr>
230 <?php echo $GoogleLinkCB?>
231 <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
233 <td><p class="hint"><?php echo 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>
235 <?php echo $DoubleClickCB?>
236 <?php echo fmt("Enable DoubleClick Edit")?>
238 <td><p class="hint"><?php echo fmt("Enabled makes it hard to double-click words and sentences for cut and paste. See %s.", WikiLink("PhpWiki:DoubleClickToEditPage"))?></p></td></tr>
240 <tr><td colspan="2"><h2><?php echo _("Edit Area Size")?></h2></td></tr>
243 <?php echo _("Height") . _(":")?>
244 <?php if ($isForm) { ?>
245 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
246 value="<?php echo $pref->get('editHeight')?>" />
248 <?php echo $pref->get('editHeight')?>
250 <?php echo _("Width") . _(":")?>
251 <?php if ($isForm) { ?>
252 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
253 value="<?php echo $pref->get('editWidth')?>" />
255 <?php echo $pref->get('editWidth')?>
259 <?php echo _("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>
262 <tr><td colspan="2"><h2><?php echo _("Time Zone")?></h2></td></tr>
265 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
269 <?php echo fmt("The current time at the server is %s.",
270 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
271 <?php echo fmt("With the current offset, this would be reported as %s.",
272 HTML::strong($WikiTheme->formatDateTime($time)))?>
276 <tr><td colspan="2"><h2><?php echo _("Date Format")?></h2></td></tr>
280 <?php echo $RelativeDatesCB ?>
281 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
286 <?php if ($isForm) { ?>
288 <p><?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
289 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
290 <?php echo Button("submit:cancel", _("Cancel"), 'button')?></p>
292 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>