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 $RandomPageMenuItem = HTML::input(array('type' => 'checkbox',
89 'name' => 'pref[randomPageMenuItem]',
91 'checked' => (bool) $pref->get('randomPageMenuItem')));
92 $LikePagesPageMenuItem = HTML::input(array('type' => 'checkbox',
93 'name' => 'pref[likePagesMenuItem]',
95 'checked' => (bool) $pref->get('likePagesMenuItem')));
96 $SpecialPagesMenuItem = HTML::input(array('type' => 'checkbox',
97 'name' => 'pref[specialPagesMenuItem]',
99 'checked' => (bool) $pref->get('specialPagesMenuItem')));
100 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
101 'name' => 'pref[relativeDates]',
103 'checked' => (bool) $pref->get('relativeDates')));
104 $PageTrailCB = HTML::input(array('type' => 'checkbox',
105 'name' => 'pref[pageTrail]',
107 'checked' => (bool) $pref->get('pageTrail')));
108 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
109 'name' => 'pref[noLinkIcons]',
111 'checked' => (bool) $pref->get('noLinkIcons')));
112 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
113 'name' => 'pref[googleLink]',
115 'checked' => (bool) $pref->get('googleLink')));
116 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
117 'name' => 'pref[doubleClickEdit]',
119 'checked' => (bool) $pref->get('doubleClickEdit')));
120 if (!function_exists('selectedOption')) {
121 function selectedOption ($value, $label = false) {
122 return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
124 function unselectedOption ($value, $label = false) {
125 return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
129 $SelectThemes = ''; $SelectLanguages = '';
130 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
132 $SelectOptions = HTML();
133 if (!empty($available_themes) and is_array($available_themes)) {
134 if (!$pref->get('theme') or $pref->get('theme') == THEME)
135 $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
137 $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
138 foreach ($available_themes as $theme) {
139 if ($theme == $pref->get('theme') and $theme != THEME)
140 $SelectOptions->pushContent(selectedOption($theme));
142 $SelectOptions->pushContent(unselectedOption($theme));
144 $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
146 $SelectThemesDesc = _("Personal theme:");
149 $SelectOptions = HTML();
150 if (!empty($available_languages) and is_array($available_languages)) {
151 if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
152 $SelectOptions->pushContent(selectedOption("",_("<system language>")));
154 $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
155 foreach ($available_languages as $lang) {
156 if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
157 $SelectOptions->pushContent(selectedOption($lang));
159 $SelectOptions->pushContent(unselectedOption($lang));
161 $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
163 $SelectLanguagesDesc = _("Personal language:");
165 if ($SelectThemes == '') {
167 $SelectThemesDesc = '';
168 $SelectLanguagesDesc = '';
172 $SelectThemesDesc = _("Personal theme:");
173 $SelectLanguagesDesc = _("Personal language:");
174 $SelectThemes = $pref->get('theme');
175 $SelectLanguages = $pref->get('lang');
178 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
183 <?= fmt("User preferences for user %s", WikiLink($user->UserName())) ?>
186 <?php if ($isForm) { ?>
187 <form action="<?=$request->getPostURL()?>" method="post">
191 <legend><strong>User preferences for this project</strong></legend>
192 <table border="0" width="100%">
194 <tr><td colspan="3"><h3><?=_("E-mail Notification")?></h3></td></tr>
197 <?=_("Get an email notification at changes of the following pages:")?>
200 <?php if ($isForm) { ?>
201 <td><textarea name="pref[notifyPages]" cols="40" rows="6"><?=$pref->get('notifyPages')?></textarea></td>
202 <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
204 <td><?=$pref->get('notifyPages')?></td><td></td>
212 <legend><strong>Global user preferences (for all projects)</strong></legend>
214 <table border="0" width="100%">
216 <tr><td colspan="3"><h3><?=_("E-mail Notification")?></h3></td></tr>
220 <p><?=_("Do not send my own modifications:")?></p>
223 <p><?= $OwnModificationsCB ?></p>
226 <p class="hint"><?=_("Check if you do not want to be notified of your own modifications.")?></p>
232 <p><?=_("Do not send minor modifications:")?></p>
235 <p><?= $MajorModificationsOnlyCB ?></p>
238 <p class="hint"><?=_("Check if you do not want to be notified of minor modifications.")?></p>
242 <tr><td colspan="3"><h3><?=_("Menus")?></h3></td></tr>
246 <legend>Top Menu</legend>
247 <table cellpadding="0" cellspacing="0">
250 <p><?= $DiffMenuItem ?> <?=_("Last Difference")?></p>
255 <p><?= $RevertMenuItem ?> <?=_("Revert")?></p>
258 <?php if (defined('USE_EXTERNAL_HTML2PDF') and USE_EXTERNAL_HTML2PDF) { ?>
261 <p><?= $PDFMenuItem ?> <?=_("PDF")?></p>
267 <p><?= $LockMenuItem ?> <?=_("Lock")?></p>
272 <p><?= $ChownMenuItem ?> <?=_("Change Owner")?></p>
277 <p><?= $SetaclMenuItem ?> <?=_("Access Rights")?></p>
286 <legend>Left Menu</legend>
287 <table cellpadding="0" cellspacing="0">
290 <p><?= $RandomPageMenuItem ?> <?=_("Random Page")?></p>
295 <p><?= $LikePagesPageMenuItem ?> <?=_("Like Pages")?></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="3"><?=_("Here you can override site-specific default values.") ?></td></tr>
310 <tr><td align="right"><?= _("Show Page Trail")?></td>
311 <td><?=$PageTrailCB?></td>
312 <td><p class="hint"><?=_("Show Page Trail at top of page.")?></p></td></tr>
313 <tr><td align="right"><?=fmt("Hide %s:", WikiLink("Help:LinkIcons"))?></td>
314 <td><?=$NoLinkIconsCB?></td>
315 <td><p class="hint"><?=_("Hide or show LinkIcons.")?></p></td></tr>
316 <tr><td align="right"><?=fmt("Add %s:", WikiLink("Help:GoogleLink"))?></td>
317 <td><?=$GoogleLinkCB?></td>
318 <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>
320 <tr><td colspan="3"><h3><?=_("Edit Area Size")?></h3></td></tr>
323 <?=_("Height")?>:
324 <?php if ($isForm) { ?>
325 <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
326 value="<?=$pref->get('editHeight')?>" />
328 <?=$pref->get('editHeight')?>
330 <?=_("Width")?>:
331 <?php if ($isForm) { ?>
332 <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
333 value="<?=$pref->get('editWidth')?>" />
335 <?=$pref->get('editWidth')?>
339 <?=_("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>
342 <tr><td colspan="3"><h3><?=_("Time Zone")?></h3></td></tr>
344 <tr><td colspan="2"><p>
345 <?=fmt("Add %s hours to the server's local time when reporting times.",
349 <?=fmt("The current time at the server is %s.",
350 HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
351 <?=fmt("With the current offset, this would be reported as %s.",
352 HTML::strong($WikiTheme->formatDateTime($time)))?>
356 <tr><td colspan="3"><h3><?=_("Date Format")?></h3></td></tr>
358 <tr><td colspan="2"><p>
359 <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
360 <?= $RelativeDatesCB ?>
361 </p></td><td></td></tr>
365 <?php if ($isForm) { ?>
367 <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
368 <?=Button("submit:delete", _("Reset Preferences"), 'wikiadmin')?>
369 <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
371 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>