3 // Todo: Move the logic and code to the plugin
4 // This is very experimental and the read-only part an ugly hack so far.
5 foreach (explode(',','errmsg,isForm') as $var) {
6 if (empty($$var)) $$var = false;
9 $plugin = $request->getArg('pagename');
10 if (isActionPage($request->getArg('pagename'))
11 and $isForm and $plugin == _("PreferencesInfo")) {
15 $user =& $request->getUser();
16 $pref =& $request->_prefs;
19 $offset = $pref->get('timeOffset');
20 $serverTime = $time - $offset * 3600;
22 $timeOffsetInput = HTML::input(array('type' => "text",
25 'name' => "pref[timeOffset]",
29 $timeOffsetInput = $pref->get('timeOffset');
31 $OwnModificationsCB = HTML::input(array('type' => 'checkbox',
32 'name' => 'pref[ownModifications]',
34 'checked' => (bool) $pref->get('ownModifications')));
35 $MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox',
36 'name' => 'pref[majorModificationsOnly]',
38 'checked' => (bool) $pref->get('majorModificationsOnly')));
39 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
40 'name' => 'pref[relativeDates]',
42 'checked' => (bool) $pref->get('relativeDates')));
43 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
44 'name' => 'pref[noLinkIcons]',
46 'checked' => (bool) $pref->get('noLinkIcons')));
47 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
48 'name' => 'pref[googleLink]',
50 'checked' => (bool) $pref->get('googleLink')));
51 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
52 'name' => 'pref[doubleClickEdit]',
54 'checked' => (bool) $pref->get('doubleClickEdit')));
55 if (!function_exists('selectedOption')) {
56 function selectedOption ($value, $label = false) {
57 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
59 function unselectedOption ($value, $label = false) {
60 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
64 $SelectThemes = ''; $SelectLanguages = '';
65 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
67 $SelectOptions = HTML();
68 if (!empty($available_themes) and is_array($available_themes)) {
69 if (!$pref->get('theme') or $pref->get('theme') == THEME)
70 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
72 $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));
79 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
81 $SelectThemesDesc = _("Personal theme:");
84 $SelectOptions = HTML();
85 if (!empty($available_languages) and is_array($available_languages)) {
86 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
87 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
89 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
90 foreach ($available_languages as $lang) {
91 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
92 $SelectOptions->pushContent(selectedOption($lang));
94 $SelectOptions->pushContent(unselectedOption($lang));
96 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
98 $SelectLanguagesDesc = _("Personal language:");
100 if ($SelectThemes == '') {
102 $SelectThemesDesc = '';
103 $SelectLanguagesDesc = '';
107 $SelectThemesDesc = _("Personal theme:");
108 $SelectLanguagesDesc = _("Personal language:");
109 $SelectThemes = $pref->get('theme');
110 $SelectLanguages = $pref->get('lang');
114 <?php echo $errmsg ?>
116 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
118 <?php if ($isForm) { ?>
119 <form action="<?php echo $request->getPostURL()?>" method="post">
122 // See also plugin _AuthInfo
123 $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
125 <?php echo HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
126 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
127 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
128 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
129 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
130 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
131 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
132 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
133 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
134 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
139 <?php if ($isForm and $user->mayChangePass()) { ?>
140 <tr><td colspan="2"><h2><?php echo ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h2></td></tr>
142 <tr><td align="right"><?php echo _("New password") . _(":")?></td>
143 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
145 <tr><td align="right"><?php echo _("Type it again") . _(":")?></td>
146 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
150 <?php if (ENABLE_USER_NEW) { ?>
151 <tr><td colspan="2"><h2><?php echo _("E-mail")?></h2></td></tr>
155 <?php echo _("Your E-Mail"). _(":")?>
156 <?php if ($isForm) { ?>
157 <input type="text" name="pref[email]" size="30" maxlength="60"
158 value="<?php echo $pref->get('email')?>" />
160 '<?php echo $pref->get('email') ?>'
164 <?php echo _("Status") . _(":") ?>
165 <?php if ($pref->get('emailVerified')) { ?>
166 <?php echo _("Email verified.") ?>
168 <?php echo _("Email not yet verified.") ?>
171 </td><td><p class="hint"><?php echo _("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
174 <?php echo _("Get an email notification at changes of the following pages:")?>
177 <?php if ($isForm) { ?>
178 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
179 <td><p class="hint"><?php echo _("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
181 <td><?php echo $pref->get('notifyPages')?></td>
188 <?php echo $OwnModificationsCB ?>
189 <?php echo _("Do not send my own modifications")?>
193 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
200 <?php echo $MajorModificationsOnlyCB ?>
201 <?php echo _("Do not send minor modifications")?>
205 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
211 <tr><td colspan="2"><h2><?php echo _("Appearance")?></h2></td></tr>
213 <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
214 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
216 <?php echo $SelectThemesDesc?>
217 <?php echo $SelectThemes ?>
219 <td><p class="hint"><?php echo _("System default:")?> <?php echo THEME ?></p></td></tr>
221 <?php echo $SelectLanguagesDesc?>
222 <?php echo $SelectLanguages ?>
224 <td><p class="hint"><?php echo _("System default:")?> <?php echo DEFAULT_LANGUAGE ?></p></td></tr>
226 <?php echo $NoLinkIconsCB?>
227 <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
229 <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>
231 <?php echo $GoogleLinkCB?>
232 <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
234 <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>
236 <?php echo $DoubleClickCB?>
237 <?php echo fmt("Enable DoubleClick Edit")?>
239 <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>
241 <tr><td colspan="2"><h2><?php echo _("Edit Area Size")?></h2></td></tr>
244 <?php echo _("Height") . _(":")?>
245 <?php if ($isForm) { ?>
246 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
247 value="<?php echo $pref->get('editHeight')?>" />
249 <?php echo $pref->get('editHeight')?>
251 <?php echo _("Width") . _(":")?>
252 <?php if ($isForm) { ?>
253 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
254 value="<?php echo $pref->get('editWidth')?>" />
256 <?php echo $pref->get('editWidth')?>
260 <?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>
263 <tr><td colspan="2"><h2><?php echo _("Time Zone")?></h2></td></tr>
266 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
270 <?php echo fmt("The current time at the server is %s.",
271 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
272 <?php echo fmt("With the current offset, this would be reported as %s.",
273 HTML::strong($WikiTheme->formatDateTime($time)))?>
277 <tr><td colspan="2"><h2><?php echo _("Date Format")?></h2></td></tr>
281 <?php echo $RelativeDatesCB ?>
282 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
287 <?php if ($isForm) { ?>
289 <p><?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
290 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
291 <?php echo Button("submit:cancel", _("Cancel"), 'button')?></p>
293 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>