1 | <?php |
---|
2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
---|
3 | # |
---|
4 | # This file is part of Dotclear 2. |
---|
5 | # |
---|
6 | # Copyright (c) 2003-2011 Olivier Meunier & Association Dotclear |
---|
7 | # Licensed under the GPL version 2.0 license. |
---|
8 | # See LICENSE file or |
---|
9 | # http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
---|
10 | # |
---|
11 | # -- END LICENSE BLOCK ----------------------------------------- |
---|
12 | |
---|
13 | require dirname(__FILE__).'/../inc/admin/prepend.php'; |
---|
14 | |
---|
15 | dcPage::check('usage,contentadmin'); |
---|
16 | |
---|
17 | $page_title = __('My preferences'); |
---|
18 | |
---|
19 | $user_name = $core->auth->getInfo('user_name'); |
---|
20 | $user_firstname = $core->auth->getInfo('user_firstname'); |
---|
21 | $user_displayname = $core->auth->getInfo('user_displayname'); |
---|
22 | $user_email = $core->auth->getInfo('user_email'); |
---|
23 | $user_url = $core->auth->getInfo('user_url'); |
---|
24 | $user_lang = $core->auth->getInfo('user_lang'); |
---|
25 | $user_tz = $core->auth->getInfo('user_tz'); |
---|
26 | $user_post_status = $core->auth->getInfo('user_post_status'); |
---|
27 | |
---|
28 | $user_options = $core->auth->getOptions(); |
---|
29 | |
---|
30 | $core->auth->user_prefs->addWorkspace('dashboard'); |
---|
31 | $user_dm_doclinks = $core->auth->user_prefs->dashboard->doclinks; |
---|
32 | $user_dm_dcnews = $core->auth->user_prefs->dashboard->dcnews; |
---|
33 | $user_dm_quickentry = $core->auth->user_prefs->dashboard->quickentry; |
---|
34 | |
---|
35 | $core->auth->user_prefs->addWorkspace('accessibility'); |
---|
36 | $user_acc_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; |
---|
37 | |
---|
38 | $core->auth->user_prefs->addWorkspace('interface'); |
---|
39 | $user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; |
---|
40 | if ($core->auth->isSuperAdmin()) { |
---|
41 | $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; |
---|
42 | } |
---|
43 | |
---|
44 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
---|
45 | |
---|
46 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || !empty($_GET['replaced'])) { |
---|
47 | $default_tab = 'user-favorites'; |
---|
48 | } elseif (!empty($_GET['updated'])) { |
---|
49 | $default_tab = 'user-options'; |
---|
50 | } |
---|
51 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
---|
52 | $default_tab = 'user-profile'; |
---|
53 | } |
---|
54 | |
---|
55 | foreach ($core->getFormaters() as $v) { |
---|
56 | $formaters_combo[$v] = $v; |
---|
57 | } |
---|
58 | |
---|
59 | foreach ($core->blog->getAllPostStatus() as $k => $v) { |
---|
60 | $status_combo[$v] = $k; |
---|
61 | } |
---|
62 | |
---|
63 | # Language codes |
---|
64 | $langs = l10n::getISOcodes(1,1); |
---|
65 | foreach ($langs as $k => $v) { |
---|
66 | $lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT.'/'.$v); |
---|
67 | $lang_combo[] = new formSelectOption($k,$v,$lang_avail ? 'avail10n' : ''); |
---|
68 | } |
---|
69 | |
---|
70 | # Add or update user |
---|
71 | if (isset($_POST['user_name'])) |
---|
72 | { |
---|
73 | try |
---|
74 | { |
---|
75 | $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd'])); |
---|
76 | |
---|
77 | if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { |
---|
78 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
79 | } |
---|
80 | |
---|
81 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
82 | |
---|
83 | $cur->user_name = $user_name = $_POST['user_name']; |
---|
84 | $cur->user_firstname = $user_firstname = $_POST['user_firstname']; |
---|
85 | $cur->user_displayname = $user_displayname = $_POST['user_displayname']; |
---|
86 | $cur->user_email = $user_email = $_POST['user_email']; |
---|
87 | $cur->user_url = $user_url = $_POST['user_url']; |
---|
88 | $cur->user_lang = $user_lang = $_POST['user_lang']; |
---|
89 | $cur->user_tz = $user_tz = $_POST['user_tz']; |
---|
90 | |
---|
91 | $cur->user_options = new ArrayObject($user_options); |
---|
92 | |
---|
93 | if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) |
---|
94 | { |
---|
95 | if (!$pwd_check) { |
---|
96 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
---|
97 | } |
---|
98 | |
---|
99 | if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { |
---|
100 | throw new Exception(__("Passwords don't match")); |
---|
101 | } |
---|
102 | |
---|
103 | $cur->user_pwd = $_POST['new_pwd']; |
---|
104 | } |
---|
105 | |
---|
106 | # --BEHAVIOR-- adminBeforeUserUpdate |
---|
107 | $core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID()); |
---|
108 | |
---|
109 | # Udate user |
---|
110 | $core->updUser($core->auth->userID(),$cur); |
---|
111 | |
---|
112 | # --BEHAVIOR-- adminAfterUserUpdate |
---|
113 | $core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID()); |
---|
114 | |
---|
115 | http::redirect('preferences.php?upd=1'); |
---|
116 | } |
---|
117 | catch (Exception $e) |
---|
118 | { |
---|
119 | $core->error->add($e->getMessage()); |
---|
120 | } |
---|
121 | } |
---|
122 | |
---|
123 | # Update user options |
---|
124 | if (isset($_POST['user_post_format'])) { |
---|
125 | try |
---|
126 | { |
---|
127 | $cur = $core->con->openCursor($core->prefix.'user'); |
---|
128 | |
---|
129 | $cur->user_name = $user_name; |
---|
130 | $cur->user_firstname = $user_firstname; |
---|
131 | $cur->user_displayname = $user_displayname; |
---|
132 | $cur->user_email = $user_email; |
---|
133 | $cur->user_url = $user_url; |
---|
134 | $cur->user_lang = $user_lang; |
---|
135 | $cur->user_tz = $user_tz; |
---|
136 | |
---|
137 | $cur->user_post_status = $user_post_status = $_POST['user_post_status']; |
---|
138 | |
---|
139 | $user_options['edit_size'] = (integer) $_POST['user_edit_size']; |
---|
140 | if ($user_options['edit_size'] < 1) { |
---|
141 | $user_options['edit_size'] = 10; |
---|
142 | } |
---|
143 | $user_options['post_format'] = $_POST['user_post_format']; |
---|
144 | $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); |
---|
145 | |
---|
146 | $cur->user_options = new ArrayObject($user_options); |
---|
147 | |
---|
148 | # --BEHAVIOR-- adminBeforeUserUpdate |
---|
149 | $core->callBehavior('adminBeforeUserUpdate',$cur,$core->auth->userID()); |
---|
150 | |
---|
151 | # Update user prefs |
---|
152 | $core->auth->user_prefs->dashboard->put('doclinks',!empty($_POST['user_dm_doclinks']),'boolean'); |
---|
153 | $core->auth->user_prefs->dashboard->put('dcnews',!empty($_POST['user_dm_dcnews']),'boolean'); |
---|
154 | $core->auth->user_prefs->dashboard->put('quickentry',!empty($_POST['user_dm_quickentry']),'boolean'); |
---|
155 | $core->auth->user_prefs->accessibility->put('nodragdrop',!empty($_POST['user_acc_nodragdrop']),'boolean'); |
---|
156 | $core->auth->user_prefs->interface->put('enhanceduploader',!empty($_POST['user_ui_enhanceduploader']),'boolean'); |
---|
157 | if ($core->auth->isSuperAdmin()) { |
---|
158 | # Applied to all users |
---|
159 | $core->auth->user_prefs->interface->put('hide_std_favicon',!empty($_POST['user_ui_hide_std_favicon']),'boolean',null,true,true); |
---|
160 | } |
---|
161 | |
---|
162 | # Udate user |
---|
163 | $core->updUser($core->auth->userID(),$cur); |
---|
164 | |
---|
165 | # --BEHAVIOR-- adminAfterUserUpdate |
---|
166 | $core->callBehavior('adminAfterUserUpdate',$cur,$core->auth->userID()); |
---|
167 | |
---|
168 | http::redirect('preferences.php?updated=1'); |
---|
169 | } |
---|
170 | catch (Exception $e) |
---|
171 | { |
---|
172 | $core->error->add($e->getMessage()); |
---|
173 | } |
---|
174 | } |
---|
175 | |
---|
176 | # Add selected favorites |
---|
177 | if (!empty($_POST['appendaction']) && !empty($_POST['append'])) { |
---|
178 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
179 | $user_favs = $ws->DumpLocalPrefs(); |
---|
180 | $count = count($user_favs); |
---|
181 | foreach ($_POST['append'] as $k => $v) |
---|
182 | { |
---|
183 | try { |
---|
184 | $found = false; |
---|
185 | foreach ($user_favs as $f) { |
---|
186 | $f = unserialize($f['value']); |
---|
187 | if ($f['name'] == $v) { |
---|
188 | $found = true; |
---|
189 | break; |
---|
190 | } |
---|
191 | } |
---|
192 | if (!$found) { |
---|
193 | $uid = sprintf("u%03s",$count); |
---|
194 | $fav = array('name' => $_fav[$v][0],'title' => $_fav[$v][1],'url' => $_fav[$v][2],'small-icon' => $_fav[$v][3], |
---|
195 | 'large-icon' => $_fav[$v][4],'permissions' => $_fav[$v][5],'id' => $_fav[$v][6],'class' => $_fav[$v][7]); |
---|
196 | $core->auth->user_prefs->favorites->put($uid,serialize($fav),'string'); |
---|
197 | $count++; |
---|
198 | } |
---|
199 | } catch (Exception $e) { |
---|
200 | $core->error->add($e->getMessage()); |
---|
201 | break; |
---|
202 | } |
---|
203 | } |
---|
204 | |
---|
205 | if (!$core->error->flag()) { |
---|
206 | http::redirect('preferences.php?append=1'); |
---|
207 | } |
---|
208 | } |
---|
209 | |
---|
210 | # Delete selected favorites |
---|
211 | if (!empty($_POST['removeaction']) && !empty($_POST['remove'])) { |
---|
212 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
213 | foreach ($_POST['remove'] as $k => $v) |
---|
214 | { |
---|
215 | try { |
---|
216 | $core->auth->user_prefs->favorites->drop($v); |
---|
217 | } catch (Exception $e) { |
---|
218 | $core->error->add($e->getMessage()); |
---|
219 | break; |
---|
220 | } |
---|
221 | } |
---|
222 | // Update pref_id values |
---|
223 | try { |
---|
224 | $user_favs = $ws->DumpLocalPrefs(); |
---|
225 | $core->auth->user_prefs->favorites->dropAll(); |
---|
226 | $count = 0; |
---|
227 | foreach ($user_favs as $k => $v) |
---|
228 | { |
---|
229 | $uid = sprintf("u%03s",$count); |
---|
230 | $f = unserialize($v['value']); |
---|
231 | $fav = array('name' => $f['name'],'title' => $f['title'],'url' => $f['url'],'small-icon' => $f['small-icon'], |
---|
232 | 'large-icon' => $f['large-icon'],'permissions' => $f['permissions'],'id' => $f['id'],'class' => $f['class']); |
---|
233 | $core->auth->user_prefs->favorites->put($uid,serialize($fav),'string'); |
---|
234 | $count++; |
---|
235 | } |
---|
236 | } catch (Exception $e) { |
---|
237 | $core->error->add($e->getMessage()); |
---|
238 | } |
---|
239 | |
---|
240 | if (!$core->error->flag()) { |
---|
241 | http::redirect('preferences.php?removed=1'); |
---|
242 | } |
---|
243 | } |
---|
244 | |
---|
245 | # Order favs |
---|
246 | $order = array(); |
---|
247 | if (empty($_POST['favs_order']) && !empty($_POST['order'])) { |
---|
248 | $order = $_POST['order']; |
---|
249 | asort($order); |
---|
250 | $order = array_keys($order); |
---|
251 | } elseif (!empty($_POST['favs_order'])) { |
---|
252 | $order = explode(',',$_POST['favs_order']); |
---|
253 | } |
---|
254 | |
---|
255 | if (!empty($_POST['saveorder']) && !empty($order)) |
---|
256 | { |
---|
257 | try { |
---|
258 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
259 | $user_favs = $ws->DumpLocalPrefs(); |
---|
260 | $core->auth->user_prefs->favorites->dropAll(); |
---|
261 | $count = 0; |
---|
262 | foreach ($order as $i => $k) { |
---|
263 | $uid = sprintf("u%03s",$count); |
---|
264 | $f = unserialize($user_favs[$k]['value']); |
---|
265 | $fav = array('name' => $f['name'],'title' => $f['title'],'url' => $f['url'],'small-icon' => $f['small-icon'], |
---|
266 | 'large-icon' => $f['large-icon'],'permissions' => $f['permissions'],'id' => $f['id'],'class' => $f['class']); |
---|
267 | $core->auth->user_prefs->favorites->put($uid,serialize($fav),'string'); |
---|
268 | $count++; |
---|
269 | } |
---|
270 | } catch (Exception $e) { |
---|
271 | $core->error->add($e->getMessage()); |
---|
272 | } |
---|
273 | |
---|
274 | if (!$core->error->flag()) { |
---|
275 | http::redirect('preferences.php?&neworder=1'); |
---|
276 | } |
---|
277 | } |
---|
278 | |
---|
279 | # Replace default favorites by current set (super admin only) |
---|
280 | if (!empty($_POST['replace']) && $core->auth->isSuperAdmin()) { |
---|
281 | try { |
---|
282 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
283 | $user_favs = $ws->DumpLocalPrefs(); |
---|
284 | $core->auth->user_prefs->favorites->dropAll(true); |
---|
285 | $count = 0; |
---|
286 | foreach ($user_favs as $k => $v) |
---|
287 | { |
---|
288 | $uid = sprintf("g%03s",$count); |
---|
289 | $f = unserialize($v['value']); |
---|
290 | $fav = array('name' => $f['name'],'title' => $f['title'],'url' => $f['url'],'small-icon' => $f['small-icon'], |
---|
291 | 'large-icon' => $f['large-icon'],'permissions' => $f['permissions'],'id' => $f['id'],'class' => $f['class']); |
---|
292 | $core->auth->user_prefs->favorites->put($uid,serialize($fav),'string',null,null,true); |
---|
293 | $count++; |
---|
294 | } |
---|
295 | } catch (Exception $e) { |
---|
296 | $core->error->add($e->getMessage()); |
---|
297 | } |
---|
298 | |
---|
299 | if (!$core->error->flag()) { |
---|
300 | http::redirect('preferences.php?&replaced=1'); |
---|
301 | } |
---|
302 | } |
---|
303 | |
---|
304 | /* DISPLAY |
---|
305 | -------------------------------------------------------- */ |
---|
306 | dcPage::open($page_title, |
---|
307 | dcPage::jsLoad('js/_preferences.js'). |
---|
308 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
---|
309 | dcPage::jsLoad('js/jquery/jquery-ui-1.8.12.custom.min.js'). |
---|
310 | dcPage::jsPageTabs($default_tab). |
---|
311 | dcPage::jsConfirmClose('user-form'). |
---|
312 | |
---|
313 | # --BEHAVIOR-- adminPreferencesHeaders |
---|
314 | $core->callBehavior('adminPreferencesHeaders') |
---|
315 | ); |
---|
316 | |
---|
317 | if (!empty($_GET['upd'])) { |
---|
318 | echo '<p class="message">'.__('Personal information has been successfully updated.').'</p>'; |
---|
319 | } |
---|
320 | if (!empty($_GET['updated'])) { |
---|
321 | echo '<p class="message">'.__('Personal options has been successfully updated.').'</p>'; |
---|
322 | } |
---|
323 | if (!empty($_GET['append'])) { |
---|
324 | echo '<p class="message">'.__('Favorites have been successfully added.').'</p>'; |
---|
325 | } |
---|
326 | if (!empty($_GET['neworder'])) { |
---|
327 | echo '<p class="message">'.__('Favorites have been successfully updated.').'</p>'; |
---|
328 | } |
---|
329 | if (!empty($_GET['removed'])) { |
---|
330 | echo '<p class="message">'.__('Favorites have been successfully removed.').'</p>'; |
---|
331 | } |
---|
332 | if (!empty($_GET['replaced'])) { |
---|
333 | echo '<p class="message">'.__('Default favorites have been successfully updated.').'</p>'; |
---|
334 | } |
---|
335 | |
---|
336 | echo '<h2>'.$page_title.'</h2>'; |
---|
337 | |
---|
338 | $tabindex = 2; |
---|
339 | |
---|
340 | # User profile |
---|
341 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
---|
342 | |
---|
343 | echo |
---|
344 | '<form action="preferences.php" method="post" id="user-form">'. |
---|
345 | '<fieldset><legend>'.__('My profile').'</legend>'. |
---|
346 | '<div class="two-cols">'. |
---|
347 | '<div class="col">'. |
---|
348 | '<p><label for="user_name">'.__('Last Name:'). |
---|
349 | form::field('user_name',20,255,html::escapeHTML($user_name),'',$tabindex++).'</label></p>'. |
---|
350 | |
---|
351 | '<p><label for="user_firstname">'.__('First Name:'). |
---|
352 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname),'',$tabindex++).'</label></p>'. |
---|
353 | |
---|
354 | '<p><label for="user_displayname">'.__('Display name:'). |
---|
355 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname),'',$tabindex++).'</label></p>'. |
---|
356 | |
---|
357 | '<p><label for="user_email">'.__('Email:'). |
---|
358 | form::field('user_email',20,255,html::escapeHTML($user_email),'',$tabindex++).'</label></p>'. |
---|
359 | |
---|
360 | '<p><label for="user_url">'.__('URL:'). |
---|
361 | form::field('user_url',30,255,html::escapeHTML($user_url),'',$tabindex++).'</label></p>'. |
---|
362 | |
---|
363 | '</div>'. |
---|
364 | |
---|
365 | '<div class="col">'. |
---|
366 | |
---|
367 | '<p><label for="user_lang">'.__('User language:'). |
---|
368 | form::combo('user_lang',$lang_combo,$user_lang,'l10n',$tabindex++).'</label></p>'. |
---|
369 | |
---|
370 | '<p><label for="user_tz">'.__('User timezone:'). |
---|
371 | form::combo('user_tz',dt::getZones(true,true),$user_tz,'',$tabindex++).'</label></p>'. |
---|
372 | |
---|
373 | '</div>'. |
---|
374 | '</div>'. |
---|
375 | '<br class="clear" />'. //Opera sucks |
---|
376 | '</fieldset>'; |
---|
377 | |
---|
378 | if ($core->auth->allowPassChange()) |
---|
379 | { |
---|
380 | echo |
---|
381 | '<fieldset>'. |
---|
382 | '<legend>'.__('Change your password').'</legend>'. |
---|
383 | |
---|
384 | '<p><label for="new_pwd">'.__('New password:'). |
---|
385 | form::password('new_pwd',20,255,'','',$tabindex++).'</label></p>'. |
---|
386 | |
---|
387 | '<p><label for="new_pwd_c">'.__('Confirm password:'). |
---|
388 | form::password('new_pwd_c',20,255,'','',$tabindex++).'</label></p>'. |
---|
389 | '</fieldset>'. |
---|
390 | |
---|
391 | '<fieldset>'. |
---|
392 | '<p>'.__('If you want to change your email or password you must provide your current password.').'</p>'. |
---|
393 | '<p><label for="cur_pwd">'.__('Your password:'). |
---|
394 | form::password('cur_pwd',20,255,'','',$tabindex++).'</label></p>'. |
---|
395 | '</fieldset>'; |
---|
396 | } |
---|
397 | |
---|
398 | echo |
---|
399 | '<p class="clear">'. |
---|
400 | $core->formNonce(). |
---|
401 | '<input type="submit" accesskey="s" value="'.__('Save').'" tabindex="33" /></p>'. |
---|
402 | '</form>'; |
---|
403 | |
---|
404 | echo '</div>'; |
---|
405 | |
---|
406 | # User options : some from actual user profile, dashboard modules, ... |
---|
407 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
---|
408 | |
---|
409 | echo |
---|
410 | '<form action="preferences.php" method="post" id="opts-forms">'. |
---|
411 | '<fieldset><legend>'.__('My options').'</legend>'. |
---|
412 | |
---|
413 | '<p><label for="user_post_format">'.__('Preferred format:'). |
---|
414 | form::combo('user_post_format',$formaters_combo,$user_options['post_format'],'',$tabindex++).'</label></p>'. |
---|
415 | |
---|
416 | '<p><label for="user_post_status">'.__('Default entry status:'). |
---|
417 | form::combo('user_post_status',$status_combo,$user_post_status,'',$tabindex++).'</label></p>'. |
---|
418 | |
---|
419 | '<p><label for="user_edit_size">'.__('Entry edit field height:'). |
---|
420 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size'],'',$tabindex++).'</label></p>'. |
---|
421 | |
---|
422 | '<p><label for="user_wysiwyg" class="classic">'. |
---|
423 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg'],'',$tabindex++).' '. |
---|
424 | __('Enable WYSIWYG mode').'</label></p>'. |
---|
425 | |
---|
426 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
---|
427 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader,'',$tabindex++).' '. |
---|
428 | __('Activate enhanced uploader in media manager').'</label></p>'; |
---|
429 | |
---|
430 | if ($core->auth->isSuperAdmin()) { |
---|
431 | echo |
---|
432 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
---|
433 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon,'',$tabindex++).' '. |
---|
434 | __('Do not use standard favicon').'</label></p>'. |
---|
435 | '<p class="clear form-note info">'.__('This will be applied for all users').'</p>'; |
---|
436 | } |
---|
437 | |
---|
438 | echo |
---|
439 | '<br class="clear" />'. //Opera sucks |
---|
440 | '</fieldset>'; |
---|
441 | |
---|
442 | echo |
---|
443 | '<fieldset><legend>'.__('Accessibility options').'</legend>'. |
---|
444 | |
---|
445 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
---|
446 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop,'',$tabindex++).' '. |
---|
447 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
---|
448 | |
---|
449 | '<p class="clear form-note info">'.__('Numeric fields will allow to type the elements\' ordering number.').'</p>'. |
---|
450 | '</fieldset>'; |
---|
451 | |
---|
452 | echo |
---|
453 | '<fieldset><legend>'.__('Dashboard modules').'</legend>'. |
---|
454 | |
---|
455 | '<p><label for="user_dm_doclinks" class="classic">'. |
---|
456 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks,'',$tabindex++).' '. |
---|
457 | __('Display documentation links').'</label></p>'. |
---|
458 | |
---|
459 | '<p><label for="user_dm_dcnews" class="classic">'. |
---|
460 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews,'',$tabindex++).' '. |
---|
461 | __('Display Dotclear news').'</label></p>'. |
---|
462 | |
---|
463 | '<p><label for="user_dm_quickentry" class="classic">'. |
---|
464 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry,'',$tabindex++).' '. |
---|
465 | __('Display quick entry form').'</label></p>'. |
---|
466 | |
---|
467 | '<br class="clear" />'. //Opera sucks |
---|
468 | '</fieldset>'; |
---|
469 | |
---|
470 | # --BEHAVIOR-- adminPreferencesForm |
---|
471 | $core->callBehavior('adminPreferencesForm',$core); |
---|
472 | |
---|
473 | echo |
---|
474 | '<p class="clear">'. |
---|
475 | $core->formNonce(). |
---|
476 | '<input type="submit" accesskey="s" value="'.__('Save').'" tabindex="33" /></p>'. |
---|
477 | '</form>'; |
---|
478 | |
---|
479 | echo '</div>'; |
---|
480 | |
---|
481 | # User favorites |
---|
482 | echo '<div class="multi-part" id="user-favorites" title="'.__('My favorites').'">'; |
---|
483 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
---|
484 | echo '<form action="preferences.php" method="post" id="favs-form">'; |
---|
485 | echo '<div class="two-cols">'; |
---|
486 | echo '<div class="col70">'; |
---|
487 | echo '<fieldset id="my-favs"><legend>'.__('My favorites').'</legend>'; |
---|
488 | |
---|
489 | $count = 0; |
---|
490 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
491 | // User favorites only |
---|
492 | if (!$v['global']) { |
---|
493 | $fav = unserialize($v['value']); |
---|
494 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
495 | if ($count == 0) echo '<ul>'; |
---|
496 | $count++; |
---|
497 | echo '<li id="fu-'.$k.'">'. |
---|
498 | '<img src="'.$fav['large-icon'].'" alt="" /> '. |
---|
499 | form::field(array('order['.$k.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
---|
500 | form::hidden(array('dynorder[]','dynorder-'.$k.''),$k). |
---|
501 | '<label for="fuk-'.$k.'">'.form::checkbox(array('remove[]','fuk-'.$k),$k).$fav['title'].'</label>'. |
---|
502 | '</li>'; |
---|
503 | } |
---|
504 | } |
---|
505 | } |
---|
506 | if ($count > 0) echo '</ul>'; |
---|
507 | if ($count > 0) { |
---|
508 | echo |
---|
509 | '<div class="clear">'. |
---|
510 | '<p>'.form::hidden('favs_order',''). |
---|
511 | $core->formNonce(). |
---|
512 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
---|
513 | |
---|
514 | '<input type="submit" class="delete" name="removeaction" '. |
---|
515 | 'value="'.__('Delete selected favorites').'" '. |
---|
516 | 'onclick="return window.confirm(\''.html::escapeJS( |
---|
517 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
---|
518 | |
---|
519 | ($core->auth->isSuperAdmin() ? |
---|
520 | '<hr />'. |
---|
521 | '<p>'.__('If you are a super administrator, you may define this set of favorites to be used by default on all blogs of this installation:').'</p>'. |
---|
522 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />' : |
---|
523 | ''). |
---|
524 | '</p>'. |
---|
525 | '</div>'; |
---|
526 | } else { |
---|
527 | echo |
---|
528 | '<p>'.__('Currently no personal favorites.').'</p>'; |
---|
529 | } |
---|
530 | |
---|
531 | echo '</fieldset>'; |
---|
532 | |
---|
533 | echo '<div id="default-favs"><h3>'.__('Default favorites').'</h3>'; |
---|
534 | echo '<p class="form-note info clear">'.__('Those favorites are displayed when My Favorites list is empty.').'</p>'; |
---|
535 | $count = 0; |
---|
536 | foreach ($ws->dumpPrefs() as $k => $v) { |
---|
537 | // Global favorites only |
---|
538 | if ($v['global']) { |
---|
539 | $fav = unserialize($v['value']); |
---|
540 | if (($fav['permissions'] == '*') || $core->auth->check($fav['permissions'],$core->blog->id)) { |
---|
541 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
542 | $count++; |
---|
543 | echo '<li id="fd-'.$k.'">'. |
---|
544 | '<img src="'.$fav['small-icon'].'" alt="" /> '.$fav['title'].'</li>'; |
---|
545 | } |
---|
546 | } |
---|
547 | } |
---|
548 | if ($count > 0) echo '</ul>'; |
---|
549 | echo '</div>'; |
---|
550 | echo '</div>'; |
---|
551 | echo '<div class="col30" id="available-favs">'; |
---|
552 | # Available favorites |
---|
553 | echo '<fieldset><legend>'.__('Available favorites').'</legend>'; |
---|
554 | $count = 0; |
---|
555 | $array = $_fav; |
---|
556 | function cmp($a,$b) { |
---|
557 | if ($a[1] == $b[1]) { |
---|
558 | return 0; |
---|
559 | } |
---|
560 | return ($a[1] < $b[1]) ? -1 : 1; |
---|
561 | } |
---|
562 | $array=$array->getArrayCopy(); |
---|
563 | uasort($array,'cmp'); |
---|
564 | foreach ($array as $k => $fav) { |
---|
565 | if (($fav[5] == '*') || $core->auth->check($fav[5],$core->blog->id)) { |
---|
566 | if ($count == 0) echo '<ul class="fav-list">'; |
---|
567 | $count++; |
---|
568 | echo '<li id="fa-'.$fav[0].'">'.'<label for="fak-'.$fav[0].'">'. |
---|
569 | form::checkbox(array('append[]','fak-'.$fav[0]),$k). |
---|
570 | '<img src="'.$fav[3].'" alt="" /> '.'<span class="zoom"><img src="'.$fav[4].'" alt="" /></span>'.$fav[1]. |
---|
571 | '</label>'.'</li>'; |
---|
572 | } |
---|
573 | } |
---|
574 | if ($count > 0) echo '</ul>'; |
---|
575 | echo |
---|
576 | '<p>'. |
---|
577 | $core->formNonce(). |
---|
578 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
---|
579 | echo '</fieldset>'; |
---|
580 | echo '</div>'; |
---|
581 | echo '</div>'; # Two-cols |
---|
582 | echo '</form>'; |
---|
583 | echo '</div>'; # user-favorites |
---|
584 | |
---|
585 | dcPage::helpBlock('core_user_pref'); |
---|
586 | dcPage::close(); |
---|
587 | ?> |
---|