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 border="0" width="100%">
192 <tr><td colspan="3"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
195 <?php echo _("Get an email 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 seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
202 <td><?php echo $pref->get('notifyPages')?></td><td></td>
209 <fieldset style="margin-bottom: 1em;">
210 <legend><strong><?php echo _("Global user preferences (for all projects)")?></strong></legend>
212 <table border="0" width="100%">
214 <tr><td colspan="3"><h3><?php echo _("E-mail Notification")?></h3></td></tr>
218 <p><?php echo _("Do not send my own modifications:")?></p>
221 <p><?php echo $OwnModificationsCB ?></p>
224 <p class="hint"><?php echo _("Check if you do not want to be notified of your own modifications.")?></p>
230 <p><?php echo _("Do not send minor modifications:")?></p>
233 <p><?php echo $MajorModificationsOnlyCB ?></p>
236 <p class="hint"><?php echo _("Check if you do not want to be notified of minor modifications.")?></p>
240 <tr><td colspan="3"><h3><?php echo _("Menus")?></h3></td></tr>
244 <legend><?php echo _("Top Menu")?></legend>
245 <table cellpadding="0" cellspacing="0">
248 <p><?php echo $DiffMenuItem ?> <?php echo _("Last Difference")?></p>
253 <p><?php echo $RevertMenuItem ?> <?php echo _("Revert")?></p>
256 <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
259 <p><?php echo $PDFMenuItem ?> <?php echo _("PDF")?></p>
265 <p><?php echo $LockMenuItem ?> <?php echo _("Lock")?></p>
270 <p><?php echo $ChownMenuItem ?> <?php echo _("Change Owner")?></p>
275 <p><?php echo $SetaclMenuItem ?> <?php echo _("Access Rights")?></p>
284 <legend><?php echo _("Left Menu")?></legend>
285 <table cellpadding="0" cellspacing="0">
288 <p><?php echo $RandomPageMenuItem ?> <?php echo _("Random Page")?></p>
293 <p><?php echo $LikePagesPageMenuItem ?> <?php echo _("Like Pages")?></p>
301 <p class="hint"><?php echo _("Check menu items to display.")?></p>
305 <tr><td colspan="3"><h3><?php echo _("Appearance")?></h3></td></tr>
307 <tr><td colspan="3"><?php echo _("Here you can override site-specific default values.") ?></td></tr>
308 <tr><td align="right"><?php echo _("Show Page Trail")?></td>
309 <td><?php echo $PageTrailCB?></td>
310 <td><p class="hint"><?php echo _("Show Page Trail at top of page.")?></p></td></tr>
311 <tr><td align="right"><?php echo fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
312 <td><?php echo $NoLinkIconsCB?></td>
313 <td><p class="hint"><?php echo _("Hide or show LinkIcons.")?></p></td></tr>
314 <tr><td align="right"><?php echo fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
315 <td><?php echo $GoogleLinkCB?></td>
316 <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>
318 <tr><td colspan="3"><h3><?php echo _("Edit Area Size")?></h3></td></tr>
321 <?php echo _("Height")?>:
322 <?php if ($isForm) { ?>
323 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
324 value="<?php echo $pref->get('editHeight')?>" />
326 <?php echo $pref->get('editHeight')?>
328 <?php echo _("Width")?>:
329 <?php if ($isForm) { ?>
330 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
331 value="<?php echo $pref->get('editWidth')?>" />
333 <?php echo $pref->get('editWidth')?>
337 <?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>
340 <tr><td colspan="3"><h3><?php echo _("Time Zone")?></h3></td></tr>
342 <tr><td colspan="2"><p>
343 <?php echo fmt("Add %s hours to the server's local time when reporting times.",
347 <?php echo fmt("The current time at the server is %s.",
348 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
349 <?php echo fmt("With the current offset, this would be reported as %s.",
350 HTML::strong($WikiTheme->formatDateTime($time)))?>
354 <tr><td colspan="3"><h3><?php echo _("Date Format")?></h3></td></tr>
356 <tr><td colspan="2"><p>
357 <?php echo _("Show relative dates using 'Today' and 'Yesterday'")?>:
358 <?php echo $RelativeDatesCB ?>
359 </p></td><td></td></tr>
363 <?php if ($isForm) { ?>
365 <?php echo Button("submit:", _("Update Preferences"), 'wikiadmin')?>
366 <?php echo Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
367 <?php echo Button("submit:cancel", _("Cancel"), 'button')?>
368 <?php echo HiddenInputs($request->getArgs(), false, array('pref')) ?>