]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
Default ENABLE_DOUBLECLICKEDIT = false. Moved to UserPreferences
[SourceForge/phpwiki.git] / themes / default / templates / userprefs.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: userprefs.tmpl,v 1.57 2005-06-05 05:38:02 rurban Exp $ -->
3 <?php
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;
8 }
9
10 $plugin = $request->getArg('pagename');
11 if ($request->isActionPage($request->getArg('pagename')) 
12     and $isForm and $plugin == _("PreferencesInfo")) {
13     $isForm = false;
14 }
15 $time = time();
16 $user = &$request->getUser();
17 $pref = &$request->_prefs;
18
19 $offset = $pref->get('timeOffset');
20 $serverTime = $time - $offset * 3600;
21 if ( $isForm )
22     $timeOffsetInput = HTML::input(array('type' => "text",
23                                          'size' => 6,
24                                          'maxlength' => 6,
25                                          'name' => "pref[timeOffset]",
26                                          'class' => "numeric",
27                                          'value' => $offset));
28 else
29     $timeOffsetInput = $pref->get('timeOffset');
30
31 $RelativeDatesCB = HTML::input(array('type' => 'checkbox',
32                                      'name' => 'pref[relativeDates]',
33                                      'value' => '1',
34                                      'checked' => (bool) $pref->get('relativeDates')));
35 $NoLinkIconsCB = HTML::input(array('type' => 'checkbox',
36                                    'name' => 'pref[noLinkIcons]',
37                                    'value' => '1',
38                                    'checked' => (bool) $pref->get('noLinkIcons')));
39 $GoogleLinkCB = HTML::input(array('type' => 'checkbox',
40                                   'name' => 'pref[googleLink]',
41                                   'value' => '1',
42                                   'checked' => (bool) $pref->get('googleLink')));
43 $DoubleClickCB = HTML::input(array('type' => 'checkbox',
44                                   'name' => 'pref[doubleClickEdit]',
45                                   'value' => '1',
46                                   'checked' => (bool) $pref->get('doubleClickEdit')));
47 if (!function_exists('selectedOption')) {
48   function selectedOption ($value, $label = false) {
49     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
50   }
51   function unselectedOption ($value, $label = false) {
52     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
53   }
54 }
55
56 $SelectThemes = ''; $SelectLanguages = '';
57 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
58 if ( $isForm ) {
59     $SelectOptions = HTML(); 
60     if (!empty($available_themes) and is_array($available_themes)) {
61         if (!$pref->get('theme') or $pref->get('theme') == THEME)
62             $SelectOptions->pushContent(selectedOption("",_("<system theme>")));
63         else
64             $SelectOptions->pushContent(unselectedOption("",_("<system theme>")));
65         foreach ($available_themes as $theme) {
66             if ($theme == $pref->get('theme') and $theme != THEME)
67                 $SelectOptions->pushContent(selectedOption($theme));
68             else
69                 $SelectOptions->pushContent(unselectedOption($theme));
70         }
71         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
72                                      $SelectOptions);
73         $SelectThemesDesc = _("Personal theme:");
74     }
75     
76     $SelectOptions = HTML();
77     if (!empty($available_languages) and is_array($available_languages)) {
78         if (!$pref->get('lang') or $pref->get('lang') == DEFAULT_LANGUAGE)
79             $SelectOptions->pushContent(selectedOption("",_("<system language>")));
80         else
81             $SelectOptions->pushContent(unselectedOption("",_("<system language>")));
82         foreach ($available_languages as $lang) {
83             if ($lang == $pref->get('lang') and $lang != DEFAULT_LANGUAGE)
84                 $SelectOptions->pushContent(selectedOption($lang));
85             else
86                 $SelectOptions->pushContent(unselectedOption($lang));
87         }
88         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
89                                         $SelectOptions);
90         $SelectLanguagesDesc = _("Personal language:");
91     } else {
92         if ($SelectThemes == '') {
93             $appearance = false;
94             $SelectThemesDesc = '';
95             $SelectLanguagesDesc = '';
96         }
97     }
98 } else {
99     $SelectThemesDesc = _("Personal theme:");
100     $SelectLanguagesDesc = _("Personal language:");
101     $SelectThemes = $pref->get('theme');
102     $SelectLanguages = $pref->get('lang');
103 }
104
105 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
106 ?>
107 <?= $errmsg ?>
108
109 <?= fmt("User preferences for user '%s':", $user->UserName()) ?>
110
111 <?php if ($isForm) { ?>
112 <form action="<?=$request->getPostURL()?>" method="post">
113 <?php } else { 
114   $fill = "&nbsp;";
115   // See also plugin _AuthInfo
116   $authmethod = ENABLE_USER_NEW ? @$user->_authmethod : @$user->auth_how;
117 ?>
118 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$pref->get('userid'), " from " . $authmethod),
119               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
120               //sprintf("%12s: [% 10s]\n",_("Password"),empty($pref->get('passwd')) ? _("<empty>") : _("<not empty>")),
121               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
122                       _("Auth Level"),$user->_level,_("Auth Method"),$authmethod),
123               sprintf("%12s: [% 10s]\n",_("HomePage"),$user->hasHomePage() ? (ENABLE_USER_NEW ? $user->_HomePagehandle->_pagename : $user->_homepage->_pagename ) : ''),
124               sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref->get('email')),
125               //sprintf("%12s: [% 10s]\n",_("Notify"),$pref->get('notifyPages')),
126               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref->get('theme'), _("Current Theme"),$WikiTheme->_name),
127               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref->get('lang'),_("Current Language"),$GLOBALS['LANG'])
128               ) ?>
129 <?php } ?>
130
131 <table border="0">
132 <?php if ($isForm and $user->mayChangePass()) { ?>
133   <tr><td colspan="3"><h2><?= ($request->getPref('passwd') ?  _("Change Password") :  _("Set Password")) ?></h2></td></tr>
134
135     <tr><td align="right"><?=_("New password")?>:</td>
136         <td><input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /></td>
137         <td></td></tr>
138     <tr><td align="right"><?=_("Type it again")?>:</td>
139         <td><input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /></td>
140         <td></td></tr>
141 <?php } ?>
142
143 <?php if (ENABLE_USER_NEW) { ?>
144   <tr><td colspan="3"><h2><?=_("E-mail")?></h2></td></tr>
145
146   <tr><td><?=_("Your E-Mail:")?></td>
147   <td>
148   <?php if ($isForm) { ?>
149      <input type="text" name="pref[email]" size="30" maxlength="60"
150             value="<?=$pref->get('email')?>" />
151   <?php } else { ?>
152      '<?= $pref->get('email') ?>'
153   <?php } ?>
154   &nbsp;&nbsp;<?= _("Status:") ?>&nbsp;&nbsp;
155   <?php if ($pref->get('emailVerified')) { ?>
156     <?= _("Email verified.") ?>
157   <?php } else { ?>
158     <?= _("Email not yet verified.") ?>
159   <?php } ?>
160   </td><td><p class="hint"><?=_("Note, that user accounts with bouncing emails will be disabled.")?></p></td></tr>
161
162    <tr><td colspan="2">
163     <?=_("Get an email notification at changes of the following pages:")?><br />
164     <?php if ($isForm) { ?>
165       <blockquote><textarea name="pref[notifyPages]" cols="50" rows="4"><?=$pref->get('notifyPages')?></textarea></blockquote></td>
166     <td><p class="hint"><?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?></p></td>
167     <?php } else { ?>
168      <td><?=$pref->get('notifyPages')?></td><td></td>
169     <?php } ?>
170    </tr>
171 <?php } ?>
172
173   <tr><td colspan="3"><h2><?=_("Appearance")?></h2></td></tr>
174
175   <tr><td colspan="2"><?=_("Here you can override site-specific default values.") ?></td>
176       <td><span class="hint"><?= _("Currently not recommended!") ?></span></td></tr>
177   <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
178       <tr><td align="right"><?=$SelectThemesDesc?></td>
179           <td><?= $SelectThemes ?></td>
180           <td><span class="hint"><?=_("System default:")?> <?= THEME ?></span></td></tr>
181       <tr><td align="right"><?=$SelectLanguagesDesc?></td>
182           <td><?= $SelectLanguages ?></td>
183           <td><span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></td></tr>
184       <tr><td align="right"><?=fmt("Hide %s:", WikiLink("LinkIcons"))?></td>
185           <td><?=$NoLinkIconsCB?></td>
186           <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>
187       <tr><td align="right"><?=fmt("Add %s:", WikiLink("GoogleLink"))?></td>
188           <td><?=$GoogleLinkCB?></td>
189           <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>
190       <tr><td align="right"><?=fmt("Enable DoubleClick Edit")?></td>
191           <td><?=$DoubleClickCB?></td>
192   <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>
193
194
195   <tr><td colspan="3"><h2><?=_("Edit Area Size")?></h2></td></tr>
196
197   <tr><td colspan="2">
198     <?=_("Height")?>:&nbsp;
199     <?php if ($isForm) { ?>
200      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
201             value="<?=$pref->get('editHeight')?>" />
202     <?php } else { ?>
203       <?=$pref->get('editHeight')?>
204     <?php } ?>
205     &nbsp;&nbsp;<?=_("Width")?>:&nbsp;
206     <?php if ($isForm) { ?>
207      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
208             value="<?=$pref->get('editWidth')?>" />
209     <?php } else { ?>
210       <?=$pref->get('editWidth')?>
211     <?php } ?>
212     </td>
213     <td><p class="hint">
214       <?=_("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>
215     </td></tr>
216
217   <tr><td colspan="3"><h2><?=_("Time Zone")?></h2></td></tr>
218
219   <tr><td colspan="2"><p>
220     <?=fmt("Add %s hours to the server's local time when reporting times.",
221            $timeOffsetInput)?>
222   </p></td><td>
223   <p class="hint">
224     <?=fmt("The current time at the server is %s.",
225             HTML::strong($WikiTheme->formatDateTime($serverTime)))?>
226     <?=fmt("With the current offset, this would be reported as %s.",
227            HTML::strong($WikiTheme->formatDateTime($time)))?>
228   </p>
229   </td></tr>
230
231   <tr><td colspan="3"><h2><?=_("Date Format")?></h2></td></tr>
232
233   <tr><td colspan="2"><p>
234     <?=_("Show relative dates using 'Today' and 'Yesterday'")?>:
235     <?= $RelativeDatesCB ?>
236   </p></td><td></td></tr>
237 </table>
238
239 <?php if ($isForm) { ?>
240   <hr />
241   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?>
242   <?=Button("submit:delete", _("Remove Preferences"), 'wikiadmin')?>
243   <?=Button("submit:cancel", _("Cancel"), 'button')?></p>
244
245 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>
246 </form>
247 <?php } ?>