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