]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - themes/default/templates/userprefs.tmpl
Cleaned up php empty var warnings.
[SourceForge/phpwiki.git] / themes / default / templates / userprefs.tmpl
1 <?php // -*-html-*- ?>
2 <!-- $Id: userprefs.tmpl,v 1.37 2003-12-01 22:54:56 carstenklapp 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')) and 
12     $plugin != _("PreferencesInfo")) {
13     $isForm = true;
14 }
15
16 $time = time();
17 $user = &$request->getUser();
18 $_upo = $user->getPreferences();
19 $pref = $_upo->_prefs;
20
21 $offset = $pref['timeOffset'];
22 $serverTime = $time - $offset * 3600;
23 if ( $isForm )
24     $timeOffsetInput = HTML::input(array('type' => "text",
25                                          'size' => 6,
26                                          'maxlength' => 6,
27                                          'name' => "pref[timeOffset]",
28                                          'class' => "numeric",
29                                          'value' => $offset));
30 else
31     $timeOffsetInput = $pref['timeOffset'];
32
33 if (empty($pref['relativeDates']))
34     $pref['relativeDates'] = false;
35 $RelativeDatesCB = HTML(HTML::input(array('type' => 'hidden',
36                                           'name' => 'pref[relativeDates][]',
37                                           'value' => '0')),
38                         HTML::input(array('type' => 'checkbox',
39                                           'name' => 'pref[relativeDates][]',
40                                           'value' => '1',
41                                           'checked' => (bool) $pref['relativeDates'])));
42 if (empty($pref['noLinkIcons']))
43     $pref['noLinkIcons'] = false;
44 $NoLinkIconsCB = HTML(HTML::input(array('type' => 'hidden',
45                                           'name' => 'pref[noLinkIcons][]',
46                                           'value' => '0')),
47                         HTML::input(array('type' => 'checkbox',
48                                           'name' => 'pref[noLinkIcons][]',
49                                           'value' => '1',
50                                           'checked' => (bool) $pref['noLinkIcons'])));
51
52 function selectedOption ($value, $label = false) {
53     return HTML::option(array('value' => $value,'selected'=>"selected"), ($label ? $label : $value) . "\n");
54 }
55 function unselectedOption ($value, $label = false) {
56     return HTML::option(array('value' => $value), ($label ? $label : $value) . "\n");
57 }
58
59 $SelectThemes = ''; $SelectLanguages = '';
60 $SelectThemesDesc = ''; $SelectLanguagesDesc = '';
61 if ( $isForm ) {
62     $SelectOptions = HTML(); 
63     if (!empty($available_themes) and is_array($available_themes)) {
64         if (empty($pref['theme']))
65             $SelectOptions->pushContent(selectedOption('',_("<system theme>")));
66         else
67             $SelectOptions->pushContent(unselectedOption('',_("<system theme>")));
68         foreach ($available_themes as $theme) {
69             if (!empty($pref['theme']) && $theme == $pref['theme'] and $theme != THEME)
70                 $SelectOptions->pushContent(selectedOption($theme));
71             else
72                 $SelectOptions->pushContent(unselectedOption($theme));
73         }
74         $SelectThemes = HTML::select(array('name' => "pref[theme]",'id' => 'theme'),
75                                      $SelectOptions);
76         $SelectThemesDesc = _("Select your personal theme:");
77     }
78     
79     $SelectOptions = HTML();
80     if (!empty($available_languages) and is_array($available_languages)) {
81         if (empty($pref['lang']))
82             $SelectOptions->pushContent(selectedOption('',_("<system language>")));
83         else
84             $SelectOptions->pushContent(unselectedOption('',_("<system language>")));
85         foreach ($available_languages as $lang) {
86             if (!empty($pref['lang']) && $lang == $pref['lang'] and $lang != DEFAULT_LANGUAGE)
87                 $SelectOptions->pushContent(selectedOption($lang));
88             else
89                 $SelectOptions->pushContent(unselectedOption($lang));
90         }
91         $SelectLanguages = HTML::select(array('name' => "pref[lang]",'id' => 'lang'),
92                                         $SelectOptions);
93         $SelectLanguagesDesc = _("Select your personal language:");
94     } else {
95         if ($SelectThemes == '') {
96             $appearance = false;
97             $SelectThemesDesc = '';
98             $SelectLanguagesDesc = '';
99         }
100     }
101 } else {
102     $SelectThemesDesc = _("Personal theme:");
103     $SelectLanguagesDesc = _("Personal language:");
104     $SelectThemes = $pref['theme'];
105     $SelectLanguages = $pref['lang'];
106 }
107
108 if ($errmsg) $msg = HTML(HTML::h4(array('class' => 'errors'), $errmsg),HTML::hr());
109 ?>
110 <?= $errmsg ?>
111
112 <?php if ($isForm) { ?>
113 <form action="<?=$request->getPostURL()?>" method="post">
114 <?php } else { 
115   $user = $request->_user; 
116   $fill = "&nbsp;";
117 ?>
118 <?= HTML::pre(sprintf("%12s: [% 10s]  %s\n",_("UserId"),$pref['userid'], " from " . $request->_user->auth_how()),
119               sprintf("%12s: [% 10s]  %16s: [% 10s] | %8s: [%2s]\n","getId",$user->getId(),"getAuthenticatedId",$user->getAuthenticatedId(),"isSignedIn", $user->isSignedIn()),
120               //sprintf("%12s: [% 10s]\n",_("Password"),$pref['passwd']),
121               sprintf("%12s: [% 10s]  %15s: [% 8s]\n",
122                       _("Auth Level"),$user->_level,_("Auth Method"),$user->_authmethod),
123               sprintf("%12s: [% 10s]\n",_("HomePage"),$user->homePage() ? $user->_homepage->_pagename : ''),
124               sprintf("%12s: [% 10s]\n",_("E-Mail"),$pref['email']),
125               //sprintf("%12s: [% 10s]\n",_("Notify"),$pref['notifyPages']),
126               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Theme"), $pref['theme'], _("Current Theme"),$Theme->_name),
127               sprintf("%12s: [% 10s] %16s: [% 10s] \n",_("Language"),$pref['lang'],_("Current Language"),$GLOBALS['LANG'])
128               ) ?>
129 <?php } ?>
130
131 <?php /* if ($isForm and !$user->isAdmin()) { ?>
132   <h2><?=_("Change Password")?></h2>
133      <input type="password" name="pref[passwd]" size="16" maxlength="16" class="text" value="" /> <?=_("New password")?>.<br />
134      <input type="password" name="pref[passwd2]" size="16" maxlength="16" class="text" value="" /> <?=_("Type it again")?>.
135 <?php } */?>
136
137   <h2><?=_("E-mail")?></h2>
138   <p><?=_("Your E-Mail:")?>
139   <?php if ($isForm) { ?>
140      <input type="text" name="pref[email]" size="30" maxlength="60"
141             value="<?=$pref['email']?>" />
142   <?php } else { ?>
143      '<?= $pref['email'] ?>'
144   <?php } ?>
145   &nbsp;&nbsp;<?= _("Status:") ?>&nbsp;&nbsp;
146   <?php if (!empty($pref['emailVerified']) && $pref['emailVerified']) { ?>
147     <?= _("Email verified.") ?>
148   <?php } else { ?>
149     <?= _("Email not yet verified.") ?>
150   <?php } ?>
151   </p>
152      <p class="hint">(<?=_("Note, that user accounts with bouncing emails will be disabled.")?>)</p>
153      <?php /*
154      Related code for this doesn't seem to function yet.
155      Commented out for now until it can be finished or removed. --CarstenKlapp
156    <p><?=_("Get an email notification at changes of the following pages:")?><br />
157 /* ?>
158   <?php /*if ($isForm) { ?>
159      &nbsp;<textarea name="pref[notifyPages]" cols="50" rows="5"><?=$pref['notifyPages']?></textarea>
160      <p class="hint">(<?=_("Enter pages seperated by space or comma. Wildcards (fileglobbing) allowed.")?>)</p>
161    </p>
162   <?php } else { ?>
163     <?=$pref['notifyPages']?>
164   <?php } */ ?>
165   <h2><?=_("Appearance")?></h2>
166   <p class="hint"><?=_("Here you can override site-specific default values. Currently not recommended!")?></p>
167   <?php /* Alternatively this could be done with <fieldset> and <legend>. */ ?>
168   <p><?=$SelectThemesDesc?><br /> <?= $SelectThemes ?> <span class="hint"><?=_("System default:")?> <?= THEME ?></span></p>
169   <p><?=$SelectLanguagesDesc?><br /> <?= $SelectLanguages ?> <span class="hint"><?=_("System default:")?> <?= DEFAULT_LANGUAGE ?></span></p>
170   <p><?=$NoLinkIconsCB?> <?=fmt("Hide %s.", WikiLink("LinkIcons"))?></p>
171   <p class="hint"><?=_("Hide or show LinkIcons (if supported by the current theme). Useful for text-only browsers or slow connections.")?></p>
172
173   <h2><?=_("Edit Area Size")?></h2>
174   <p><?=_("Height")?>
175     <?php if ($isForm) { ?>
176      <input type="text" name="pref[editHeight]" size="4" maxlength="4" class="numeric"
177             value="<?=$pref['editHeight']?>" />
178     <?php } else { ?>
179       <?=$pref['editHeight']?>
180     <?php } ?>
181     <?=_("Width")?>
182     <?php if ($isForm) { ?>
183      <input type="text" name="pref[editWidth]" size="4" maxlength="4" class="numeric"
184             value="<?=$pref['editWidth']?>" />
185     <?php } else { ?>
186       <?=$pref['editWidth']?>
187     <?php } ?>
188   </p>
189   <p class="hint"><?=_("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>
190
191   <h2><?=_("Time Zone")?></h2>
192   <p>
193     <?=fmt("Add %s hours to the server's local time when reporting times.",
194            $timeOffsetInput)?>
195   </p>
196   <p class="hint">
197     <?=fmt("The current time at the server is %s.",
198             HTML::strong($Theme->formatDateTime($serverTime)))?>
199     <?=fmt("With the current offset, this would be reported as %s.",
200            HTML::strong($Theme->formatDateTime($time)))?>
201   </p>
202
203   <h2><?=_("Date Format")?></h2>
204   <p><?=$RelativeDatesCB?>
205      <?=_("Show relative dates using 'Today' and 'Yesterday'.")?>
206   </p>
207
208 <?php if ($isForm) { ?>
209   <hr />
210   <p><?=Button("submit:", _("Update Preferences"), 'wikiadmin')?><?=Button("submit:cancel", _("Cancel"), 'button')?></p>
211
212 <?= HiddenInputs($request->getArgs(), false, array('pref')) ?>
213 </form>
214 <?php } ?>