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 $DiffMenuItem = HTML::input(array('type' => 'checkbox',
39 'name' => 'pref[diffMenuItem]',
41 'checked' => (bool) $pref->get('diffMenuItem')));
42 $PageInfoMenuItem = HTML::input(array('type' => 'checkbox',
43 'name' => 'pref[pageInfoMenuItem]',
45 'checked' => (bool) $pref->get('pageInfoMenuItem')));
46 $PDFMenuItem = HTML::input(array('type' => 'checkbox',
47 'name' => 'pref[pdfMenuItem]',
49 'checked' => (bool) $pref->get('pdfMenuItem')));
50 $ChownMenuItem = HTML::input(array('type' => 'checkbox',
51 'name' => 'pref[chownMenuItem]',
53 'checked' => (bool) $pref->get('chownMenuItem')));
54 $SetaclMenuItem = HTML::input(array('type' => 'checkbox',
55 'name' => 'pref[setaclMenuItem]',
57 'checked' => (bool) $pref->get('setaclMenuItem')));
58 $RemoveMenuItem = HTML::input(array('type' => 'checkbox',
59 'name' => 'pref[removeMenuItem]',
61 'checked' => (bool) $pref->get('removeMenuItem')));
62 $RenameMenuItem = HTML::input(array('type' => 'checkbox',
63 'name' => 'pref[renameMenuItem]',
65 'checked' => (bool) $pref->get('renameMenuItem')));
66 $RevertMenuItem = HTML::input(array('type' => 'checkbox',
67 'name' => 'pref[revertMenuItem]',
69 'checked' => (bool) $pref->get('revertMenuItem')));
70 $LockMenuItem = HTML::input(array('type' => 'checkbox',
71 'name' => 'pref[lockMenuItem]',
73 'checked' => (bool) $pref->get('lockMenuItem')));
74 $BackLinksMenuItem = HTML::input(array('type' => 'checkbox',
75 'name' => 'pref[backLinksMenuItem]',
77 'checked' => (bool) $pref->get('backLinksMenuItem')));
78 $WatchPageMenuItem = HTML::input(array('type' => 'checkbox',
79 'name' => 'pref[watchPageMenuItem]',
81 'checked' => (bool) $pref->get('watchPageMenuItem')));
82 $RecentChangesMenuItem = HTML::input(array('type' => 'checkbox',
83 'name' => 'pref[recentChangesMenuItem]',
85 'checked' => (bool) $pref->get('recentChangesMenuItem')));
86 $RandomPageMenuItem = HTML::input(array('type' => 'checkbox',
87 'name' => 'pref[randomPageMenuItem]',
89 'checked' => (bool) $pref->get('randomPageMenuItem')));
90 $LikePagesPageMenuItem = HTML::input(array('type' => 'checkbox',
91 'name' => 'pref[likePagesMenuItem]',
93 'checked' => (bool) $pref->get('likePagesMenuItem')));
94 $SpecialPagesMenuItem = HTML::input(array('type' => 'checkbox',
95 'name' => 'pref[specialPagesMenuItem]',
97 'checked' => (bool) $pref->get('specialPagesMenuItem')));
98 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
99 'name' => 'pref[relativeDates]',
101 'checked' => (bool) $pref->get('relativeDates')));
102 $PageTrailCB = HTML::input(array('type' => 'checkbox',
103 'name' => 'pref[pageTrail]',
105 'checked' => (bool) $pref->get('pageTrail')));
106 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
107 'name' => 'pref[noLinkIcons]',
109 'checked' => (bool) $pref->get('noLinkIcons')));
110 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
111 'name' => 'pref[googleLink]',
113 'checked' => (bool) $pref->get('googleLink')));
114 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
115 'name' => 'pref[doubleClickEdit]',
117 'checked' => (bool) $pref->get('doubleClickEdit')));
118 if (!function_exists('selectedOption')) {
119 function selectedOption ($value, $label = false) {
120 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
122 function unselectedOption ($value, $label = false) {
123 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
127 $SelectThemes = ''; $SelectLanguages = '';
128 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
130 $SelectOptions = HTML();
131 if (!empty($available_themes) and is_array($available_themes)) {
132 if (!$pref->get('theme') or $pref->get('theme') == THEME)
133 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
135 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
136 foreach ($available_themes as $theme) {
137 if ($theme == $pref->get('theme') and $theme != THEME)
138 $SelectOptions->pushContent(selectedOption($theme));
140 $SelectOptions->pushContent(unselectedOption($theme));
142 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
144 $SelectThemesDesc = _("Personal theme:");
147 $SelectOptions = HTML();
148 if (!empty($available_languages) and is_array($available_languages)) {
149 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
150 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
152 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
153 foreach ($available_languages as $lang) {
154 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
155 $SelectOptions->pushContent(selectedOption($lang));
157 $SelectOptions->pushContent(unselectedOption($lang));
159 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
161 $SelectLanguagesDesc = _("Personal language:");
163 if ($SelectThemes == '') {
165 $SelectThemesDesc = '';
166 $SelectLanguagesDesc = '';
170 $SelectThemesDesc = _("Personal theme:");
171 $SelectLanguagesDesc = _("Personal language:");
172 $SelectThemes = $pref->get('theme');
173 $SelectLanguages = $pref->get('lang');
177 <?php echo $errmsg ?>
180 <?php echo fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
183 <?php if ($isForm) { ?>
184 <form action="<?php echo $request->getPostURL()?>" method="post">
187 <fieldset style="margin-bottom: 1em;">
188 <legend><strong><?php echo _("User preferences for this project")?></strong></legend>
189 <table class="fullwidth">
191 <tr><td colspan="2"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
194 <?php echo _("Get an e-mail notification at changes of the following pages:")?>
198 <?php if ($isForm) { ?>
199 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?php echo $pref->get('notifyPages')?></textarea></td>
200 <td><p class="hint"><?php echo _("Enter pages separated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
202 <td colspan="2"><?php echo $pref->get('notifyPages')?></td>
209 <fieldset style="margin-bottom: 1em;">
210 <legend><strong><?php echo _("Global user preferences (for all projects)")?></strong></legend>
212 <table class="fullwidth">
214 <tr><td colspan="2"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
219 <?php echo $OwnModificationsCB ?>
220 <?php echo _("Do not send my own modifications")?>
224 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
231 <?php echo $MajorModificationsOnlyCB ?>
232 <?php echo _("Do not send minor modifications")?>
236 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
240 <tr><td colspan="2"><h3><?php echo _("Menus")?></h3></td></tr>
244 <legend><?php echo _("Top Menu")?></legend>
248 <p class="nowrap"><?php echo $DiffMenuItem ?> <?php echo _("Last Difference")?></p>
253 <p class="nowrap"><?php echo $RevertMenuItem ?> <?php echo _("Revert")?></p>
256 <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
259 <p class="nowrap"><?php echo $PDFMenuItem ?> <?php echo _("PDF")?></p>
265 <p class="nowrap"><?php echo $LockMenuItem ?> <?php echo _("Lock")?></p>
270 <p class="nowrap"><?php echo $ChownMenuItem ?> <?php echo _("Change Owner")?></p>
275 <p class="nowrap"><?php echo $SetaclMenuItem ?> <?php echo _("Access Rights")?></p>
282 <p class="hint"><?php echo _("Check menu items to display.")?></p>
289 <legend><?php echo _("Left Menu")?></legend>
293 <p class="nowrap"><?php echo $RandomPageMenuItem ?> <?php echo _("Random Page")?></p>
298 <p class="nowrap"><?php echo $LikePagesPageMenuItem ?> <?php echo _("Like Pages")?></p>
308 <tr><td colspan="2"><h3><?php echo _("Appearance")?></h3></td></tr>
310 <tr><td colspan="2"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
314 <?php echo $PageTrailCB?>
315 <?php echo _("Show Page Trail")?>
318 <td><p class="hint"><?php echo _("Show Page Trail at top of page.")?></p></td>
323 <?php echo $NoLinkIconsCB?>
324 <?php echo fmt("Hide %s", WikiLink("Help:LinkIcons"))?>
327 <td><p class="hint"><?php echo _("Hide or show LinkIcons.")?></p></td>
332 <?php echo $GoogleLinkCB?>
333 <?php echo fmt("Add %s", WikiLink("Help:GoogleLink"))?>
336 <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>
339 <tr><td colspan="2"><h3><?php echo _("Edit Area Size")?></h3></td></tr>
342 <?php echo _("Height") . _(":")?>
343 <?php if ($isForm) { ?>
344 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
345 value="<?php echo $pref->get('editHeight')?>" />
347 <?php echo $pref->get('editHeight')?>
349 <?php echo _("Width") . _(":")?>
350 <?php if ($isForm) { ?>
351 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
352 value="<?php echo $pref->get('editWidth')?>" />
354 <?php echo $pref->get('editWidth')?>
358 <?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>
361 <tr><td colspan="2"><h3><?php echo _("Time Zone")?></h3></td></tr>
364 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
368 <?php echo fmt("The current time at the server is %s.",
369 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
370 <?php echo fmt("With the current offset, this would be reported as %s.",
371 HTML::strong($WikiTheme->formatDateTime($time)))?>
375 <tr><td colspan="2"><h3><?php echo _("Date Format")?></h3></td></tr>
379 <?php echo $RelativeDatesCB ?>
380 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>
386 <?php if ($isForm) { ?>
388 <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
389 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
390 <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
391 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>