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 $OwnModificationsCB = HTML::input(array('type' => 'checkbox',
33 'name' => 'pref[ownModifications]',
35 'checked' => (bool) $pref->get('ownModifications')));
36 $MajorModificationsOnlyCB = HTML::input(array('type' => 'checkbox',
37 'name' => 'pref[majorModificationsOnly]',
39 'checked' => (bool) $pref->get('majorModificationsOnly')));
40 $DiffMenuItem = HTML::input(array('type' => 'checkbox',
41 'name' => 'pref[diffMenuItem]',
43 'checked' => (bool) $pref->get('diffMenuItem')));
44 $PageInfoMenuItem = HTML::input(array('type' => 'checkbox',
45 'name' => 'pref[pageInfoMenuItem]',
47 'checked' => (bool) $pref->get('pageInfoMenuItem')));
48 $PDFMenuItem = HTML::input(array('type' => 'checkbox',
49 'name' => 'pref[pdfMenuItem]',
51 'checked' => (bool) $pref->get('pdfMenuItem')));
52 $ChownMenuItem = HTML::input(array('type' => 'checkbox',
53 'name' => 'pref[chownMenuItem]',
55 'checked' => (bool) $pref->get('chownMenuItem')));
56 $SetaclMenuItem = HTML::input(array('type' => 'checkbox',
57 'name' => 'pref[setaclMenuItem]',
59 'checked' => (bool) $pref->get('setaclMenuItem')));
60 $RemoveMenuItem = HTML::input(array('type' => 'checkbox',
61 'name' => 'pref[removeMenuItem]',
63 'checked' => (bool) $pref->get('removeMenuItem')));
64 $RenameMenuItem = HTML::input(array('type' => 'checkbox',
65 'name' => 'pref[renameMenuItem]',
67 'checked' => (bool) $pref->get('renameMenuItem')));
68 $RevertMenuItem = HTML::input(array('type' => 'checkbox',
69 'name' => 'pref[revertMenuItem]',
71 'checked' => (bool) $pref->get('revertMenuItem')));
72 $LockMenuItem = HTML::input(array('type' => 'checkbox',
73 'name' => 'pref[lockMenuItem]',
75 'checked' => (bool) $pref->get('lockMenuItem')));
76 $BackLinksMenuItem = HTML::input(array('type' => 'checkbox',
77 'name' => 'pref[backLinksMenuItem]',
79 'checked' => (bool) $pref->get('backLinksMenuItem')));
80 $WatchPageMenuItem = HTML::input(array('type' => 'checkbox',
81 'name' => 'pref[watchPageMenuItem]',
83 'checked' => (bool) $pref->get('watchPageMenuItem')));
84 $RecentChangesMenuItem = HTML::input(array('type' => 'checkbox',
85 'name' => 'pref[recentChangesMenuItem]',
87 'checked' => (bool) $pref->get('recentChangesMenuItem')));
88 $SearchMenuItem = HTML::input(array('type' => 'checkbox',
89 'name' => 'pref[searchMenuItem]',
91 'checked' => (bool) $pref->get('searchMenuItem')));
92 $SpecialPagesMenuItem = HTML::input(array('type' => 'checkbox',
93 'name' => 'pref[specialPagesMenuItem]',
95 'checked' => (bool) $pref->get('specialPagesMenuItem')));
96 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
97 'name' => 'pref[relativeDates]',
99 'checked' => (bool) $pref->get('relativeDates')));
100 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
101 'name' => 'pref[noLinkIcons]',
103 'checked' => (bool) $pref->get('noLinkIcons')));
104 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
105 'name' => 'pref[googleLink]',
107 'checked' => (bool) $pref->get('googleLink')));
108 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
109 'name' => 'pref[doubleClickEdit]',
111 'checked' => (bool) $pref->get('doubleClickEdit')));
112 if (!function_exists('selectedOption')) {
113 function selectedOption ($value, $label = false) {
114 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
116 function unselectedOption ($value, $label = false) {
117 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
121 $SelectThemes = ''; $SelectLanguages = '';
122 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
124 $SelectOptions = HTML();
125 if (!empty($available_themes) and is_array($available_themes)) {
126 if (!$pref->get('theme') or $pref->get('theme') == THEME)
127 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
129 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
130 foreach ($available_themes as $theme) {
131 if ($theme == $pref->get('theme') and $theme != THEME)
132 $SelectOptions->pushContent(selectedOption($theme));
134 $SelectOptions->pushContent(unselectedOption($theme));
136 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
138 $SelectThemesDesc = _("Personal theme:");
141 $SelectOptions = HTML();
142 if (!empty($available_languages) and is_array($available_languages)) {
143 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
144 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
146 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
147 foreach ($available_languages as $lang) {
148 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
149 $SelectOptions->pushContent(selectedOption($lang));
151 $SelectOptions->pushContent(unselectedOption($lang));
153 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
155 $SelectLanguagesDesc = _("Personal language:");
157 if ($SelectThemes == '') {
159 $SelectThemesDesc = '';
160 $SelectLanguagesDesc = '';
164 $SelectThemesDesc = _("Personal theme:");
165 $SelectLanguagesDesc = _("Personal language:");
166 $SelectThemes = $pref->get('theme');
167 $SelectLanguages = $pref->get('lang');
170 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
175 <?= fmt("User preferences for user '%s'", $user->UserName()) ?>
178 <?php if ($isForm) { ?>
179 <form action="<?=$request->getPostURL()?>" method="post">
182 // See also plugin _AuthInfo
183 $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
185 <?= HTML::pre(sprintf("%12s: [% 10s] %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
186 sprintf("%12s: [% 10s] %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
187 //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
188 sprintf("%12s: [% 10s] %15s: [% 8s]\n",
189 _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
190 sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
191 sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
192 //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
193 sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
198 <legend><strong>User preferences for this project</strong></legend>
200 <?php if ($isForm and $user->mayChangePass()) { ?>
201 <tr><td colspan="3"><h3><?= ($request->getPref('passwd') ? _("Change Password") : _("Set Password")) ?></h3></td></tr>
203 <tr><td align="right"><?=_("New password")?>:</td>
204 <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
206 <tr><td align="right"><?=_("Type it again")?>:</td>
207 <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
211 <?php if (ENABLE_USER_NEW) { ?>
212 <tr><td colspan="3"><h3><?=_("E-mail Notification")?></h3></td></tr>
215 <?=_("Get an email notification at changes of the following pages:")?><br />
216 <?php if ($isForm) { ?>
217 <blockquote><textarea name="pref[notifyPages]" cols="30" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote></td>
218 <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
220 <td><?=$pref->get('notifyPages')?></td><td></td>
229 <legend><strong>Global user preferences (for all projects)</strong></legend>
233 <tr><td colspan="3"><h3><?=_("E-mail Notification")?></h3></td></tr>
237 <p><?=_("Do not send my own modifications:")?></p>
240 <p><?= $OwnModificationsCB ?></p>
243 <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p>
247 <tr><td colspan="3"><h3><?=_("Menus")?></h3></td></tr>
251 <legend>Top Menu</legend>
252 <table cellpadding="0" cellspacing="0">
255 <p><?= $DiffMenuItem ?> <?=_("Last Difference")?></p>
260 <p><?= $RevertMenuItem ?> <?=_("Revert")?></p>
263 <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
266 <p><?= $PDFMenuItem ?> <?=_("PDF")?></p>
272 <p><?= $LockMenuItem ?> <?=_("Lock")?></p>
277 <p><?= $ChownMenuItem ?> <?=_("Change Owner")?></p>
282 <p><?= $SetaclMenuItem ?> <?=_("Access Rights")?></p>
291 <legend>Left Menu</legend>
292 <table cellpadding="0" cellspacing="0">
295 <p><?= $SearchMenuItem ?> <?=_("Search")?></p>
303 <p class="hint"><?=_("Check menu items to display.")?></p>
307 <tr><td colspan="3"><h3><?=_("Appearance")?></h3></td></tr>
309 <tr><td colspan="2"><?=_("Here you can override site-specific default values.") ?></td>
310 <td><p class="hint"><?= _("Currently not recommended!") ?></p></td></tr>
311 <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
312 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
313 <td><?=$NoLinkIconsCB?></td>
314 <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>
315 <tr><td align="right"><?=fmt("Add %s:", WikiLink("GoogleLink"))?></td>
316 <td><?=$GoogleLinkCB?></td>
317 <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>
318 <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
319 <td><?=$DoubleClickCB?></td>
320 <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>
323 <tr><td colspan="3"><h3><?=_("Edit Area Size")?></h3></td></tr>
326 <?=_("Height")?>:
327 <?php if ($isForm) { ?>
328 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
329 value="<?=$pref->get('editHeight')?>" />
331 <?=$pref->get('editHeight')?>
333 <?=_("Width")?>:
334 <?php if ($isForm) { ?>
335 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
336 value="<?=$pref->get('editWidth')?>" />
338 <?=$pref->get('editWidth')?>
342 <?=_("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>
345 <tr><td colspan="3"><h3><?=_("Time Zone")?></h3></td></tr>
347 <tr><td colspan="2"><p>
348 <?=fmt("Add %s hours to the server's local time when reporting times.",
352 <?=fmt("The current time at the server is %s.",
353 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
354 <?=fmt("With the current offset, this would be reported as %s.",
355 HTML::strong($WikiTheme->formatDateTime($time)))?>
359 <tr><td colspan="3"><h3><?=_("Date Format")?></h3></td></tr>
361 <tr><td colspan="2"><p>
362 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
363 <?= $RelativeDatesCB ?>
364 </p></td><td></td></tr>
368 <?php if ($isForm) { ?>
370 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
371 <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
372 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
374 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>