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'))
12 and $isForm and $plugin == _("PreferencesInfo")) {
16 $user =& $request->getUser();
17 $pref =& $request->_prefs;
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')));
40 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
41 'name' => 'pref[googleLink]',
43 'checked' => (bool) $pref->get('googleLink')));
44 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
45 'name' => 'pref[doubleClickEdit]',
47 'checked' => (bool) $pref->get('doubleClickEdit')));
48 if (!function_exists('selectedOption')) {
49 function selectedOption ($value, $label = false) {
50 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
52 function unselectedOption ($value, $label = false) {
53 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
57 $SelectThemes = ''; $SelectLanguages = '';
58 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
60 $SelectOptions = HTML();
61 if (!empty($available_themes) and is_array($available_themes)) {
62 if (!$pref->get('theme') or $pref->get('theme') == THEME)
63 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
65 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
66 foreach ($available_themes as $theme) {
67 if ($theme == $pref->get('theme') and $theme != THEME)
68 $SelectOptions->pushContent(selectedOption($theme));
70 $SelectOptions->pushContent(unselectedOption($theme));
72 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
74 $SelectThemesDesc = _("Personal theme:");
77 $SelectOptions = HTML();
78 if (!empty($available_languages) and is_array($available_languages)) {
79 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
80 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
82 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
83 foreach ($available_languages as $lang) {
84 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
85 $SelectOptions->pushContent(selectedOption($lang));
87 $SelectOptions->pushContent(unselectedOption($lang));
89 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
91 $SelectLanguagesDesc = _("Personal language:");
93 if ($SelectThemes == '') {
95 $SelectThemesDesc = '';
96 $SelectLanguagesDesc = '';
100 $SelectThemesDesc = _("Personal theme:");
101 $SelectLanguagesDesc = _("Personal language:");
102 $SelectThemes = $pref->get('theme');
103 $SelectLanguages = $pref->get('lang');
106 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
110 <?= fmt("User preferences for user '%s':", $user->UserName()) ?>
112 <?php if ($isForm) { ?>
113 <form action="<?=$request->getPostURL()?>" method="post">
116 // See also plugin _AuthInfo
117 $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
119 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
120 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
121 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
122 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
123 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
124 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
125 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
126 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
127 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
128 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
133 <?php if ($isForm and $user->mayChangePass()) { ?>
134 <tr><td colspan="3"><h2><?= ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h2></td></tr>
136 <tr><td align="right"><?=_("New password")?>:</td>
137 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
139 <tr><td align="right"><?=_("Type it again")?>:</td>
140 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
144 <?php if (ENABLE_USER_NEW) { ?>
145 <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
147 <tr><td><?=_("Your E-Mail:")?></td>
149 <?php if ($isForm) { ?>
150 <input type="text" name="pref[email]" size="30" maxlength="60"
151 value="<?=$pref->get('email')?>" />
153 '<?= $pref->get('email') ?>'
155 <?= _("Status:") ?>
156 <?php if ($pref->get('emailVerified')) { ?>
157 <?= _("Email verified.") ?>
159 <?= _("Email not yet verified.") ?>
161 </td><td><p class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
164 <?=_("Get an email notification at changes of the following pages:")?><br />
165 <?php if ($isForm) { ?>
166 <blockquote><textarea name="pref[notifyPages]" cols="50" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote></td>
167 <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
169 <td><?=$pref->get('notifyPages')?></td><td></td>
174 <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
176 <tr><td colspan="3"><?=_("Here you can override site-specific default values.") ?></td></tr>
177 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
178 <tr><td align="right"><?=$SelectThemesDesc?></td>
179 <td><?= $SelectThemes ?></td>
180 <td><p class="hint"><?=_("System default:")?> <?= THEME ?></span></td></tr>
181 <tr><td align="right"><?=$SelectLanguagesDesc?></td>
182 <td><?= $SelectLanguages ?></td>
183 <td><p class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></td></tr>
184 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
185 <td><?=$NoLinkIconsCB?></td>
186 <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>
187 <tr><td align="right"><?=fmt("Add %s:", WikiLink("GoogleLink"))?></td>
188 <td><?=$GoogleLinkCB?></td>
189 <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>
190 <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
191 <td><?=$DoubleClickCB?></td>
192 <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>
195 <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
198 <?=_("Height")?>:
199 <?php if ($isForm) { ?>
200 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
201 value="<?=$pref->get('editHeight')?>" />
203 <?=$pref->get('editHeight')?>
205 <?=_("Width")?>:
206 <?php if ($isForm) { ?>
207 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
208 value="<?=$pref->get('editWidth')?>" />
210 <?=$pref->get('editWidth')?>
214 <?=_("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>
217 <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
219 <tr><td colspan="2"><p>
220 <?=fmt("Add %s hours to the server's local time when reporting times.",
224 <?=fmt("The current time at the server is %s.",
225 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
226 <?=fmt("With the current offset, this would be reported as %s.",
227 HTML::strong($WikiTheme->formatDateTime($time)))?>
231 <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
233 <tr><td colspan="2"><p>
234 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
235 <?= $RelativeDatesCB ?>
236 </p></td><td></td></tr>
239 <?php if ($isForm) { ?>
241 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
242 <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
243 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
245 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>