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>")));
73 foreach ($available_themes as $theme) {
74 if ($theme == $pref->get('theme') and $theme != THEME) {
75 $SelectOptions->pushContent(selectedOption($theme));
77 $SelectOptions->pushContent(unselectedOption($theme));
80 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
82 $SelectThemesDesc = _("Personal theme:");
85 $SelectOptions = HTML();
86 if (!empty($available_languages) and is_array($available_languages)) {
87 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE) {
88 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
90 $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));
99 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
101 $SelectLanguagesDesc = _("Personal language:");
103 if ($SelectThemes == '') {
105 $SelectThemesDesc = '';
106 $SelectLanguagesDesc = '';
110 $SelectThemesDesc = _("Personal theme:");
111 $SelectLanguagesDesc = _("Personal language:");
112 $SelectThemes = $pref->get('theme');
113 $SelectLanguages = $pref->get('lang');
117 <?php echo $errmsg ?>
119 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
121 <?php if ($isForm) { ?>
122 <form action="<?php echo $request->getPostURL()?>" method="post">
125 // See also plugin DebugAuthInfo
126 $authmethod = @$user->_authmethod;
128 <?php echo HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
129 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
130 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
131 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
132 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
133 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? $user->_HomePagehandle->_pagename : ''),
134 sprintf("%12s: [% 10s]\n",_("E-mail"),$pref->get('email')),
135 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
136 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current theme"),$WikiTheme->_name),
137 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current language"),$GLOBALS['LANG'])
142 <?php if ($isForm and $user->mayChangePass()) { ?>
143 <tr><td colspan="2"><h2><?php echo ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h2></td></tr>
145 <tr><td class="align-right"><?php echo _("New password") . _(":")?></td>
146 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
148 <tr><td class="align-right"><?php echo _("Type it again") . _(":")?></td>
149 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
153 <tr><td colspan="2"><h2><?php echo _("E-mail")?></h2></td></tr>
157 <?php echo _("Your e-mail"). _(": ")?>
158 <?php if ($isForm) { ?>
159 <input type="text" name="pref[email]" size="30" maxlength="60"
160 value="<?php echo $pref->get('email')?>" />
162 '<?php echo $pref->get('email') ?>'
166 <?php echo _("Status") . _(": ") ?>
167 <?php if ($pref->get('emailVerified')) { ?>
168 <?php echo _("e-mail verified.") ?>
170 <?php echo _("e-mail not yet verified.") ?>
173 </td><td><p class="hint"><?php echo _("Note, that user accounts with bouncing e-mails will be disabled.")?></p></td></tr>
176 <?php echo _("Get an e-mail notification at changes of the following pages:")?>
180 <?php if ($isForm) { ?>
181 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
182 <td><p class="hint"><?php echo _("Enter pages separated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
184 <td><?php echo $pref->get('notifyPages')?></td>
191 <?php echo $OwnModificationsCB ?>
192 <?php echo _("Do not send my own modifications")?>
196 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
203 <?php echo $MajorModificationsOnlyCB ?>
204 <?php echo _("Do not send minor modifications")?>
208 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
212 <tr><td colspan="2"><h2><?php echo _("Appearance")?></h2></td></tr>
214 <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
215 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
217 <?php echo $SelectThemesDesc?>
218 <?php echo $SelectThemes ?>
220 <td><p class="hint"><?php echo _("System default:")?> <?php echo THEME ?></p></td></tr>
222 <?php echo $SelectLanguagesDesc?>
223 <?php echo $SelectLanguages ?>
225 <td><p class="hint"><?php echo _("System default:")?> <?php echo DEFAULT_LANGUAGE ?></p></td></tr>
227 <?php echo $NoLinkIconsCB?>
228 <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
230 <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>
232 <?php echo $GoogleLinkCB?>
233 <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
235 <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>
237 <?php echo $DoubleClickCB?>
238 <?php echo fmt("Enable DoubleClick Edit")?>
240 <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>
242 <tr><td colspan="2"><h2><?php echo _("Edit Area Size")?></h2></td></tr>
245 <?php echo _("Height") . _(":")?>
246 <?php if ($isForm) { ?>
247 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
248 value="<?php echo $pref->get('editHeight')?>" />
250 <?php echo $pref->get('editHeight')?>
252 <?php echo _("Width") . _(":")?>
253 <?php if ($isForm) { ?>
254 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
255 value="<?php echo $pref->get('editWidth')?>" />
257 <?php echo $pref->get('editWidth')?>
261 <?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>
264 <tr><td colspan="2"><h2><?php echo _("Time Zone")?></h2></td></tr>
267 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
271 <?php echo fmt("The current time at the server is %s.",
272 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
273 <?php echo fmt("With the current offset, this would be reported as %s.",
274 HTML::strong($WikiTheme->formatDateTime($time)))?>
278 <tr><td colspan="2"><h2><?php echo _("Date Format")?></h2></td></tr>
282 <?php echo $RelativeDatesCB ?>
283 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
288 <?php if ($isForm) { ?>
291 <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
292 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
293 <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
294 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>