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 $DiffMenuItem = HTML::input(array('type' => 'checkbox',
40 'name' => 'pref[diffMenuItem]',
42 'checked' => (bool) $pref->get('diffMenuItem')));
43 $PageInfoMenuItem = HTML::input(array('type' => 'checkbox',
44 'name' => 'pref[pageInfoMenuItem]',
46 'checked' => (bool) $pref->get('pageInfoMenuItem')));
47 $PDFMenuItem = HTML::input(array('type' => 'checkbox',
48 'name' => 'pref[pdfMenuItem]',
50 'checked' => (bool) $pref->get('pdfMenuItem')));
51 $ChownMenuItem = HTML::input(array('type' => 'checkbox',
52 'name' => 'pref[chownMenuItem]',
54 'checked' => (bool) $pref->get('chownMenuItem')));
55 $SetaclMenuItem = HTML::input(array('type' => 'checkbox',
56 'name' => 'pref[setaclMenuItem]',
58 'checked' => (bool) $pref->get('setaclMenuItem')));
59 $RemoveMenuItem = HTML::input(array('type' => 'checkbox',
60 'name' => 'pref[removeMenuItem]',
62 'checked' => (bool) $pref->get('removeMenuItem')));
63 $RenameMenuItem = HTML::input(array('type' => 'checkbox',
64 'name' => 'pref[renameMenuItem]',
66 'checked' => (bool) $pref->get('renameMenuItem')));
67 $RevertMenuItem = HTML::input(array('type' => 'checkbox',
68 'name' => 'pref[revertMenuItem]',
70 'checked' => (bool) $pref->get('revertMenuItem')));
71 $LockMenuItem = HTML::input(array('type' => 'checkbox',
72 'name' => 'pref[lockMenuItem]',
74 'checked' => (bool) $pref->get('lockMenuItem')));
75 $BackLinksMenuItem = HTML::input(array('type' => 'checkbox',
76 'name' => 'pref[backLinksMenuItem]',
78 'checked' => (bool) $pref->get('backLinksMenuItem')));
79 $WatchPageMenuItem = HTML::input(array('type' => 'checkbox',
80 'name' => 'pref[watchPageMenuItem]',
82 'checked' => (bool) $pref->get('watchPageMenuItem')));
83 $RecentChangesMenuItem = HTML::input(array('type' => 'checkbox',
84 'name' => 'pref[recentChangesMenuItem]',
86 'checked' => (bool) $pref->get('recentChangesMenuItem')));
87 $RandomPageMenuItem = HTML::input(array('type' => 'checkbox',
88 'name' => 'pref[randomPageMenuItem]',
90 'checked' => (bool) $pref->get('randomPageMenuItem')));
91 $LikePagesPageMenuItem = HTML::input(array('type' => 'checkbox',
92 'name' => 'pref[likePagesMenuItem]',
94 'checked' => (bool) $pref->get('likePagesMenuItem')));
95 $SpecialPagesMenuItem = HTML::input(array('type' => 'checkbox',
96 'name' => 'pref[specialPagesMenuItem]',
98 'checked' => (bool) $pref->get('specialPagesMenuItem')));
99 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
100 'name' => 'pref[relativeDates]',
102 'checked' => (bool) $pref->get('relativeDates')));
103 $PageTrailCB = HTML::input(array('type' => 'checkbox',
104 'name' => 'pref[pageTrail]',
106 'checked' => (bool) $pref->get('pageTrail')));
107 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
108 'name' => 'pref[noLinkIcons]',
110 'checked' => (bool) $pref->get('noLinkIcons')));
111 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
112 'name' => 'pref[googleLink]',
114 'checked' => (bool) $pref->get('googleLink')));
115 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
116 'name' => 'pref[doubleClickEdit]',
118 'checked' => (bool) $pref->get('doubleClickEdit')));
119 if (!function_exists('selectedOption')) {
120 function selectedOption ($value, $label = false) {
121 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
123 function unselectedOption ($value, $label = false) {
124 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
128 $SelectThemes = ''; $SelectLanguages = '';
129 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
131 $SelectOptions = HTML();
132 if (!empty($available_themes) and is_array($available_themes)) {
133 if (!$pref->get('theme') or $pref->get('theme') == THEME)
134 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
136 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
137 foreach ($available_themes as $theme) {
138 if ($theme == $pref->get('theme') and $theme != THEME)
139 $SelectOptions->pushContent(selectedOption($theme));
141 $SelectOptions->pushContent(unselectedOption($theme));
143 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
145 $SelectThemesDesc = _("Personal theme:");
148 $SelectOptions = HTML();
149 if (!empty($available_languages) and is_array($available_languages)) {
150 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
151 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
153 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
154 foreach ($available_languages as $lang) {
155 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
156 $SelectOptions->pushContent(selectedOption($lang));
158 $SelectOptions->pushContent(unselectedOption($lang));
160 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
162 $SelectLanguagesDesc = _("Personal language:");
164 if ($SelectThemes == '') {
166 $SelectThemesDesc = '';
167 $SelectLanguagesDesc = '';
171 $SelectThemesDesc = _("Personal theme:");
172 $SelectLanguagesDesc = _("Personal language:");
173 $SelectThemes = $pref->get('theme');
174 $SelectLanguages = $pref->get('lang');
178 <?php echo $errmsg ?>
181 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
184 <?php if ($isForm) { ?>
185 <form action="<?php echo $request->getPostURL()?>" method="post">
188 <fieldset style="margin-bottom: 1em;">
189 <legend><strong><?php echo _("User preferences for this project")?></strong></legend>
190 <table class="fullwidth">
192 <tr><td colspan="2"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
195 <?php echo _("Get an email notification at changes of the following pages:")?>
199 <?php if ($isForm) { ?>
200 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
201 <td><p class="hint"><?php echo _("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
203 <td colspan="2"><?php echo $pref->get('notifyPages')?></td>
210 <fieldset style="margin-bottom: 1em;">
211 <legend><strong><?php echo _("Global user preferences (for all projects)")?></strong></legend>
213 <table class="fullwidth">
215 <tr><td colspan="2"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
220 <?php echo $OwnModificationsCB ?>
221 <?php echo _("Do not send my own modifications")?>
225 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
232 <?php echo $MajorModificationsOnlyCB ?>
233 <?php echo _("Do not send minor modifications")?>
237 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
241 <tr><td colspan="2"><h3><?php echo _("Menus")?></h3></td></tr>
245 <legend><?php echo _("Top Menu")?></legend>
249 <p class="nowrap"><?php echo $DiffMenuItem ?> <?php echo _("Last Difference")?></p>
254 <p class="nowrap"><?php echo $RevertMenuItem ?> <?php echo _("Revert")?></p>
257 <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
260 <p class="nowrap"><?php echo $PDFMenuItem ?> <?php echo _("PDF")?></p>
266 <p class="nowrap"><?php echo $LockMenuItem ?> <?php echo _("Lock")?></p>
271 <p class="nowrap"><?php echo $ChownMenuItem ?> <?php echo _("Change Owner")?></p>
276 <p class="nowrap"><?php echo $SetaclMenuItem ?> <?php echo _("Access Rights")?></p>
283 <p class="hint"><?php echo _("Check menu items to display.")?></p>
290 <legend><?php echo _("Left Menu")?></legend>
294 <p class="nowrap"><?php echo $RandomPageMenuItem ?> <?php echo _("Random Page")?></p>
299 <p class="nowrap"><?php echo $LikePagesPageMenuItem ?> <?php echo _("Like Pages")?></p>
309 <tr><td colspan="2"><h3><?php echo _("Appearance")?></h3></td></tr>
311 <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
315 <?php echo $PageTrailCB?>
316 <?php echo _("Show Page Trail")?>
319 <td><p class="hint"><?php echo _("Show Page Trail at top of page.")?></p></td>
324 <?php echo $NoLinkIconsCB?>
325 <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
328 <td><p class="hint"><?php echo _("Hide or show LinkIcons.")?></p></td>
333 <?php echo $GoogleLinkCB?>
334 <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
337 <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>
340 <tr><td colspan="2"><h3><?php echo _("Edit Area Size")?></h3></td></tr>
343 <?php echo _("Height") . _(":")?>
344 <?php if ($isForm) { ?>
345 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
346 value="<?php echo $pref->get('editHeight')?>" />
348 <?php echo $pref->get('editHeight')?>
350 <?php echo _("Width") . _(":")?>
351 <?php if ($isForm) { ?>
352 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
353 value="<?php echo $pref->get('editWidth')?>" />
355 <?php echo $pref->get('editWidth')?>
359 <?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>
362 <tr><td colspan="2"><h3><?php echo _("Time Zone")?></h3></td></tr>
365 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
369 <?php echo fmt("The current time at the server is %s.",
370 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
371 <?php echo fmt("With the current offset, this would be reported as %s.",
372 HTML::strong($WikiTheme->formatDateTime($time)))?>
376 <tr><td colspan="2"><h3><?php echo _("Date Format")?></h3></td></tr>
380 <?php echo $RelativeDatesCB ?>
381 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
387 <?php if ($isForm) { ?>
389 <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
390 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
391 <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
392 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>