| 1 | <?php |
|---|
| 2 | # -- BEGIN LICENSE BLOCK --------------------------------------- |
|---|
| 3 | # |
|---|
| 4 | # This file is part of Dotclear 2. |
|---|
| 5 | # |
|---|
| 6 | # Copyright (c) 2003-2014 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 | if (empty($user_options['editor']) || !is_array($user_options['editor'])) { |
|---|
| 30 | $user_options['editor'] = array(); |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | $core->auth->user_prefs->addWorkspace('dashboard'); |
|---|
| 34 | $user_dm_doclinks = $core->auth->user_prefs->dashboard->doclinks; |
|---|
| 35 | $user_dm_dcnews = $core->auth->user_prefs->dashboard->dcnews; |
|---|
| 36 | $user_dm_quickentry = $core->auth->user_prefs->dashboard->quickentry; |
|---|
| 37 | |
|---|
| 38 | $core->auth->user_prefs->addWorkspace('accessibility'); |
|---|
| 39 | $user_acc_nodragdrop = $core->auth->user_prefs->accessibility->nodragdrop; |
|---|
| 40 | |
|---|
| 41 | $core->auth->user_prefs->addWorkspace('interface'); |
|---|
| 42 | $user_ui_enhanceduploader = $core->auth->user_prefs->interface->enhanceduploader; |
|---|
| 43 | if ($core->auth->isSuperAdmin()) { |
|---|
| 44 | $user_ui_hide_std_favicon = $core->auth->user_prefs->interface->hide_std_favicon; |
|---|
| 45 | } |
|---|
| 46 | $user_ui_iconset = @$core->auth->user_prefs->interface->iconset; |
|---|
| 47 | $user_ui_nofavmenu = $core->auth->user_prefs->interface->nofavmenu; |
|---|
| 48 | $user_ui_media_by_page = ($core->auth->user_prefs->interface->media_by_page ? $core->auth->user_prefs->interface->media_by_page : 30); |
|---|
| 49 | |
|---|
| 50 | $default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'user-profile'; |
|---|
| 51 | |
|---|
| 52 | if (!empty($_GET['append']) || !empty($_GET['removed']) || !empty($_GET['neworder']) || |
|---|
| 53 | !empty($_GET['replaced']) || !empty($_POST['appendaction']) || !empty($_POST['removeaction']) || |
|---|
| 54 | !empty($_GET['db-updated'])) { |
|---|
| 55 | $default_tab = 'user-favorites'; |
|---|
| 56 | } elseif (!empty($_GET['updated'])) { |
|---|
| 57 | $default_tab = 'user-options'; |
|---|
| 58 | } |
|---|
| 59 | if (($default_tab != 'user-profile') && ($default_tab != 'user-options') && ($default_tab != 'user-favorites')) { |
|---|
| 60 | $default_tab = 'user-profile'; |
|---|
| 61 | } |
|---|
| 62 | |
|---|
| 63 | # Editors combo |
|---|
| 64 | $editors_combo = dcAdminCombos::getEditorsCombo(); |
|---|
| 65 | $editors = array_keys($editors_combo); |
|---|
| 66 | |
|---|
| 67 | # Format by editors |
|---|
| 68 | $formaters = $core->getFormaters(); |
|---|
| 69 | $format_by_editors = array(); |
|---|
| 70 | foreach ($formaters as $editor => $formats) { |
|---|
| 71 | foreach ($formats as $format) { |
|---|
| 72 | $format_by_editors[$format][$editor] = $editor; |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | $available_formats = array('' => ''); |
|---|
| 76 | foreach (array_keys($format_by_editors) as $format) { |
|---|
| 77 | $available_formats[$format] = $format; |
|---|
| 78 | if (!isset($user_options['editor'][$format])) { |
|---|
| 79 | $user_options['editor'][$format] = ''; |
|---|
| 80 | } |
|---|
| 81 | } |
|---|
| 82 | $status_combo = dcAdminCombos::getPostStatusescombo(); |
|---|
| 83 | |
|---|
| 84 | $iconsets_combo = array(__('Default') => ''); |
|---|
| 85 | $iconsets_root = dirname(__FILE__).'/images/iconset/'; |
|---|
| 86 | if (is_dir($iconsets_root) && is_readable($iconsets_root)) { |
|---|
| 87 | if (($d = @dir($iconsets_root)) !== false) { |
|---|
| 88 | while (($entry = $d->read()) !== false) { |
|---|
| 89 | if ($entry != '.' && $entry != '..' && substr($entry, 0, 1) != '.' && is_dir($iconsets_root.'/'.$entry)) { |
|---|
| 90 | $iconsets_combo[$entry] = $entry; |
|---|
| 91 | } |
|---|
| 92 | } |
|---|
| 93 | } |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | # Language codes |
|---|
| 97 | $lang_combo = dcAdminCombos::getAdminLangsCombo(); |
|---|
| 98 | |
|---|
| 99 | # Add or update user |
|---|
| 100 | if (isset($_POST['user_name'])) |
|---|
| 101 | { |
|---|
| 102 | try |
|---|
| 103 | { |
|---|
| 104 | $pwd_check = !empty($_POST['cur_pwd']) && $core->auth->checkPassword(crypt::hmac(DC_MASTER_KEY,$_POST['cur_pwd'])); |
|---|
| 105 | |
|---|
| 106 | if ($core->auth->allowPassChange() && !$pwd_check && $user_email != $_POST['user_email']) { |
|---|
| 107 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | $cur = $core->con->openCursor($core->prefix.'user'); |
|---|
| 111 | |
|---|
| 112 | $cur->user_name = $user_name = $_POST['user_name']; |
|---|
| 113 | $cur->user_firstname = $user_firstname = $_POST['user_firstname']; |
|---|
| 114 | $cur->user_displayname = $user_displayname = $_POST['user_displayname']; |
|---|
| 115 | $cur->user_email = $user_email = $_POST['user_email']; |
|---|
| 116 | $cur->user_url = $user_url = $_POST['user_url']; |
|---|
| 117 | $cur->user_lang = $user_lang = $_POST['user_lang']; |
|---|
| 118 | $cur->user_tz = $user_tz = $_POST['user_tz']; |
|---|
| 119 | |
|---|
| 120 | $cur->user_options = new ArrayObject($user_options); |
|---|
| 121 | |
|---|
| 122 | if ($core->auth->allowPassChange() && !empty($_POST['new_pwd'])) |
|---|
| 123 | { |
|---|
| 124 | if (!$pwd_check) { |
|---|
| 125 | throw new Exception(__('If you want to change your email or password you must provide your current password.')); |
|---|
| 126 | } |
|---|
| 127 | |
|---|
| 128 | if ($_POST['new_pwd'] != $_POST['new_pwd_c']) { |
|---|
| 129 | throw new Exception(__("Passwords don't match")); |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | $cur->user_pwd = $_POST['new_pwd']; |
|---|
| 133 | } |
|---|
| 134 | |
|---|
| 135 | # --BEHAVIOR-- adminBeforeUserUpdate |
|---|
| 136 | $core->callBehavior('adminBeforeUserProfileUpdate',$cur,$core->auth->userID()); |
|---|
| 137 | |
|---|
| 138 | # Udate user |
|---|
| 139 | $core->updUser($core->auth->userID(),$cur); |
|---|
| 140 | |
|---|
| 141 | # --BEHAVIOR-- adminAfterUserUpdate |
|---|
| 142 | $core->callBehavior('adminAfterUserProfileUpdate',$cur,$core->auth->userID()); |
|---|
| 143 | |
|---|
| 144 | dcPage::addSuccessNotice(__('Personal information has been successfully updated.')); |
|---|
| 145 | |
|---|
| 146 | $core->adminurl->redirect("admin.user.preferences"); |
|---|
| 147 | } |
|---|
| 148 | catch (Exception $e) |
|---|
| 149 | { |
|---|
| 150 | $core->error->add($e->getMessage()); |
|---|
| 151 | } |
|---|
| 152 | } |
|---|
| 153 | |
|---|
| 154 | # Update user options |
|---|
| 155 | if (isset($_POST['user_editor'])) |
|---|
| 156 | { |
|---|
| 157 | try |
|---|
| 158 | { |
|---|
| 159 | $cur = $core->con->openCursor($core->prefix.'user'); |
|---|
| 160 | |
|---|
| 161 | $cur->user_name = $user_name; |
|---|
| 162 | $cur->user_firstname = $user_firstname; |
|---|
| 163 | $cur->user_displayname = $user_displayname; |
|---|
| 164 | $cur->user_email = $user_email; |
|---|
| 165 | $cur->user_url = $user_url; |
|---|
| 166 | $cur->user_lang = $user_lang; |
|---|
| 167 | $cur->user_tz = $user_tz; |
|---|
| 168 | |
|---|
| 169 | $cur->user_post_status = $user_post_status = $_POST['user_post_status']; |
|---|
| 170 | |
|---|
| 171 | $user_options['edit_size'] = (integer) $_POST['user_edit_size']; |
|---|
| 172 | if ($user_options['edit_size'] < 1) { |
|---|
| 173 | $user_options['edit_size'] = 10; |
|---|
| 174 | } |
|---|
| 175 | $user_options['post_format'] = $_POST['user_post_format']; |
|---|
| 176 | $user_options['editor'] = $_POST['user_editor']; |
|---|
| 177 | $user_options['enable_wysiwyg'] = !empty($_POST['user_wysiwyg']); |
|---|
| 178 | |
|---|
| 179 | $cur->user_options = new ArrayObject($user_options); |
|---|
| 180 | |
|---|
| 181 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
|---|
| 182 | $core->callBehavior('adminBeforeUserOptionsUpdate',$cur,$core->auth->userID()); |
|---|
| 183 | |
|---|
| 184 | # Update user prefs |
|---|
| 185 | $core->auth->user_prefs->accessibility->put('nodragdrop',!empty($_POST['user_acc_nodragdrop']),'boolean'); |
|---|
| 186 | $core->auth->user_prefs->interface->put('enhanceduploader',!empty($_POST['user_ui_enhanceduploader']),'boolean'); |
|---|
| 187 | if ($core->auth->isSuperAdmin()) { |
|---|
| 188 | # Applied to all users |
|---|
| 189 | $core->auth->user_prefs->interface->put('hide_std_favicon',!empty($_POST['user_ui_hide_std_favicon']),'boolean',null,true,true); |
|---|
| 190 | } |
|---|
| 191 | $core->auth->user_prefs->interface->put('media_by_page',(integer)$_POST['user_ui_media_by_page'],'integer'); |
|---|
| 192 | |
|---|
| 193 | # Udate user |
|---|
| 194 | $core->updUser($core->auth->userID(),$cur); |
|---|
| 195 | |
|---|
| 196 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
|---|
| 197 | $core->callBehavior('adminAfterUserOptionsUpdate',$cur,$core->auth->userID()); |
|---|
| 198 | |
|---|
| 199 | dcPage::addSuccessNotice(__('Personal options has been successfully updated.')); |
|---|
| 200 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-options'); |
|---|
| 201 | } |
|---|
| 202 | catch (Exception $e) |
|---|
| 203 | { |
|---|
| 204 | $core->error->add($e->getMessage()); |
|---|
| 205 | } |
|---|
| 206 | } |
|---|
| 207 | |
|---|
| 208 | # Dashboard options |
|---|
| 209 | if (isset($_POST['db-options'])) { |
|---|
| 210 | try |
|---|
| 211 | { |
|---|
| 212 | # --BEHAVIOR-- adminBeforeUserOptionsUpdate |
|---|
| 213 | $core->callBehavior('adminBeforeDashboardOptionsUpdate',$core->auth->userID()); |
|---|
| 214 | |
|---|
| 215 | # Update user prefs |
|---|
| 216 | $core->auth->user_prefs->dashboard->put('doclinks',!empty($_POST['user_dm_doclinks']),'boolean'); |
|---|
| 217 | $core->auth->user_prefs->dashboard->put('dcnews',!empty($_POST['user_dm_dcnews']),'boolean'); |
|---|
| 218 | $core->auth->user_prefs->dashboard->put('quickentry',!empty($_POST['user_dm_quickentry']),'boolean'); |
|---|
| 219 | $core->auth->user_prefs->interface->put('iconset',(!empty($_POST['user_ui_iconset']) ? $_POST['user_ui_iconset'] : '')); |
|---|
| 220 | $core->auth->user_prefs->interface->put('nofavmenu',empty($_POST['user_ui_nofavmenu']),'boolean'); |
|---|
| 221 | |
|---|
| 222 | # --BEHAVIOR-- adminAfterUserOptionsUpdate |
|---|
| 223 | $core->callBehavior('adminAfterDashboardOptionsUpdate',$core->auth->userID()); |
|---|
| 224 | |
|---|
| 225 | dcPage::addSuccessNotice(__('Dashboard options has been successfully updated.')); |
|---|
| 226 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
|---|
| 227 | } |
|---|
| 228 | catch (Exception $e) |
|---|
| 229 | { |
|---|
| 230 | $core->error->add($e->getMessage()); |
|---|
| 231 | } |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | # Add selected favorites |
|---|
| 235 | if (!empty($_POST['appendaction'])) |
|---|
| 236 | { |
|---|
| 237 | try { |
|---|
| 238 | if (empty($_POST['append'])) { |
|---|
| 239 | throw new Exception(__('No favorite selected')); |
|---|
| 240 | } |
|---|
| 241 | $user_favs = $core->favs->getFavoriteIDs(false); |
|---|
| 242 | foreach ($_POST['append'] as $k => $v) |
|---|
| 243 | { |
|---|
| 244 | if ($core->favs->exists($v)) { |
|---|
| 245 | $user_favs[] = $v; |
|---|
| 246 | } |
|---|
| 247 | } |
|---|
| 248 | $core->favs->setFavoriteIDs($user_favs,false); |
|---|
| 249 | |
|---|
| 250 | if (!$core->error->flag()) { |
|---|
| 251 | dcPage::addSuccessNotice(__('Favorites have been successfully added.')); |
|---|
| 252 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
|---|
| 253 | } |
|---|
| 254 | } catch (Exception $e) { |
|---|
| 255 | $core->error->add($e->getMessage()); |
|---|
| 256 | } |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | # Delete selected favorites |
|---|
| 260 | if (!empty($_POST['removeaction'])) |
|---|
| 261 | { |
|---|
| 262 | try { |
|---|
| 263 | if (empty($_POST['remove'])) { |
|---|
| 264 | throw new Exception(__('No favorite selected')); |
|---|
| 265 | } |
|---|
| 266 | $user_fav_ids = array(); |
|---|
| 267 | foreach ($core->favs->getFavoriteIDs(false) as $v) { |
|---|
| 268 | $user_fav_ids[$v]=true; |
|---|
| 269 | } |
|---|
| 270 | foreach ($_POST['remove'] as $v) |
|---|
| 271 | { |
|---|
| 272 | if (isset($user_fav_ids[$v])) { |
|---|
| 273 | unset($user_fav_ids[$v]); |
|---|
| 274 | } |
|---|
| 275 | } |
|---|
| 276 | $core->favs->setFavoriteIDs(array_keys($user_fav_ids),false); |
|---|
| 277 | if (!$core->error->flag()) { |
|---|
| 278 | dcPage::addSuccessNotice(__('Favorites have been successfully removed.')); |
|---|
| 279 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
|---|
| 280 | } |
|---|
| 281 | } catch (Exception $e) { |
|---|
| 282 | $core->error->add($e->getMessage()); |
|---|
| 283 | } |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | # Order favs |
|---|
| 287 | $order = array(); |
|---|
| 288 | if (empty($_POST['favs_order']) && !empty($_POST['order'])) { |
|---|
| 289 | $order = $_POST['order']; |
|---|
| 290 | asort($order); |
|---|
| 291 | $order = array_keys($order); |
|---|
| 292 | } elseif (!empty($_POST['favs_order'])) { |
|---|
| 293 | $order = explode(',',$_POST['favs_order']); |
|---|
| 294 | } |
|---|
| 295 | |
|---|
| 296 | if (!empty($_POST['saveorder']) && !empty($order)) |
|---|
| 297 | { |
|---|
| 298 | foreach ($order as $k => $v) { |
|---|
| 299 | if (!$core->favs->exists($v)) { |
|---|
| 300 | unset($order[$k]); |
|---|
| 301 | } |
|---|
| 302 | } |
|---|
| 303 | $core->favs->setFavoriteIDs($order,false); |
|---|
| 304 | if (!$core->error->flag()) { |
|---|
| 305 | dcPage::addSuccessNotice(__('Favorites have been successfully updated.')); |
|---|
| 306 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
|---|
| 307 | } |
|---|
| 308 | } |
|---|
| 309 | |
|---|
| 310 | # Replace default favorites by current set (super admin only) |
|---|
| 311 | if (!empty($_POST['replace']) && $core->auth->isSuperAdmin()) { |
|---|
| 312 | $user_favs = $core->favs->getFavoriteIDs(false); |
|---|
| 313 | $core->favs->setFavoriteIDs($user_favs,true); |
|---|
| 314 | |
|---|
| 315 | if (!$core->error->flag()) { |
|---|
| 316 | dcPage::addSuccessNotice(__('Default favorites have been successfully updated.')); |
|---|
| 317 | $core->adminurl->redirect("admin.user.preferences",array(),'#user-favorites'); |
|---|
| 318 | } |
|---|
| 319 | } |
|---|
| 320 | |
|---|
| 321 | /* DISPLAY |
|---|
| 322 | -------------------------------------------------------- */ |
|---|
| 323 | dcPage::open($page_title, |
|---|
| 324 | dcPage::jsLoad('js/_preferences.js'). |
|---|
| 325 | ($user_acc_nodragdrop ? '' : dcPage::jsLoad('js/_preferences-dragdrop.js')). |
|---|
| 326 | dcPage::jsLoad('js/jquery/jquery-ui.custom.js'). |
|---|
| 327 | dcPage::jsLoad('js/jquery/jquery.ui.touch-punch.js'). |
|---|
| 328 | dcPage::jsLoad('js/jquery/jquery.pwstrength.js'). |
|---|
| 329 | '<script type="text/javascript">'."\n". |
|---|
| 330 | "//<![CDATA[\n". |
|---|
| 331 | "\$(function() {\n". |
|---|
| 332 | " \$('#new_pwd').pwstrength({texts: ['". |
|---|
| 333 | sprintf(__('Password strength: %s'),__('very weak'))."', '". |
|---|
| 334 | sprintf(__('Password strength: %s'),__('weak'))."', '". |
|---|
| 335 | sprintf(__('Password strength: %s'),__('mediocre'))."', '". |
|---|
| 336 | sprintf(__('Password strength: %s'),__('strong'))."', '". |
|---|
| 337 | sprintf(__('Password strength: %s'),__('very strong'))."']});\n". |
|---|
| 338 | "});". |
|---|
| 339 | "\n//]]>\n". |
|---|
| 340 | "</script>\n". |
|---|
| 341 | dcPage::jsPageTabs($default_tab). |
|---|
| 342 | dcPage::jsConfirmClose('user-form'). |
|---|
| 343 | |
|---|
| 344 | # --BEHAVIOR-- adminPreferencesHeaders |
|---|
| 345 | $core->callBehavior('adminPreferencesHeaders'), |
|---|
| 346 | |
|---|
| 347 | dcPage::breadcrumb( |
|---|
| 348 | array( |
|---|
| 349 | html::escapeHTML($core->auth->userID()) => '', |
|---|
| 350 | $page_title => '' |
|---|
| 351 | )) |
|---|
| 352 | ); |
|---|
| 353 | |
|---|
| 354 | if (!empty($_GET['upd'])) { |
|---|
| 355 | dcPage::success(__('Personal information has been successfully updated.')); |
|---|
| 356 | } |
|---|
| 357 | if (!empty($_GET['updated'])) { |
|---|
| 358 | dcPage::success(__('Personal options has been successfully updated.')); |
|---|
| 359 | } |
|---|
| 360 | if (!empty($_GET['db-updated'])) { |
|---|
| 361 | dcPage::success(__('Dashboard options has been successfully updated.')); |
|---|
| 362 | } |
|---|
| 363 | if (!empty($_GET['append'])) { |
|---|
| 364 | dcPage::success(__('Favorites have been successfully added.')); |
|---|
| 365 | } |
|---|
| 366 | if (!empty($_GET['neworder'])) { |
|---|
| 367 | dcPage::success(__('Favorites have been successfully updated.')); |
|---|
| 368 | } |
|---|
| 369 | if (!empty($_GET['removed'])) { |
|---|
| 370 | dcPage::success(__('Favorites have been successfully removed.')); |
|---|
| 371 | } |
|---|
| 372 | if (!empty($_GET['replaced'])) { |
|---|
| 373 | dcPage::success(__('Default favorites have been successfully updated.')); |
|---|
| 374 | } |
|---|
| 375 | |
|---|
| 376 | # User profile |
|---|
| 377 | echo '<div class="multi-part" id="user-profile" title="'.__('My profile').'">'; |
|---|
| 378 | |
|---|
| 379 | echo |
|---|
| 380 | '<h3>'.__('My profile').'</h3>'. |
|---|
| 381 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="user-form">'. |
|---|
| 382 | |
|---|
| 383 | '<p><label for="user_name">'.__('Last Name:').'</label>'. |
|---|
| 384 | form::field('user_name',20,255,html::escapeHTML($user_name)).'</p>'. |
|---|
| 385 | |
|---|
| 386 | '<p><label for="user_firstname">'.__('First Name:').'</label>'. |
|---|
| 387 | form::field('user_firstname',20,255,html::escapeHTML($user_firstname)).'</p>'. |
|---|
| 388 | |
|---|
| 389 | '<p><label for="user_displayname">'.__('Display name:').'</label>'. |
|---|
| 390 | form::field('user_displayname',20,255,html::escapeHTML($user_displayname)).'</p>'. |
|---|
| 391 | |
|---|
| 392 | '<p><label for="user_email">'.__('Email:').'</label>'. |
|---|
| 393 | form::field('user_email',20,255,html::escapeHTML($user_email)).'</p>'. |
|---|
| 394 | |
|---|
| 395 | '<p><label for="user_url">'.__('URL:').'</label>'. |
|---|
| 396 | form::field('user_url',30,255,html::escapeHTML($user_url)).'</p>'. |
|---|
| 397 | |
|---|
| 398 | '<p><label for="user_lang">'.__('Language for my interface:').'</label>'. |
|---|
| 399 | form::combo('user_lang',$lang_combo,$user_lang,'l10n').'</p>'. |
|---|
| 400 | |
|---|
| 401 | '<p><label for="user_tz">'.__('My timezone:').'</label>'. |
|---|
| 402 | form::combo('user_tz',dt::getZones(true,true),$user_tz).'</p>'; |
|---|
| 403 | |
|---|
| 404 | |
|---|
| 405 | if ($core->auth->allowPassChange()) |
|---|
| 406 | { |
|---|
| 407 | echo |
|---|
| 408 | '<h4 class="vertical-separator pretty-title">'.__('Change my password').'</h4>'. |
|---|
| 409 | |
|---|
| 410 | '<div class="pw-table">'. |
|---|
| 411 | '<p class="pw-cell"><label for="new_pwd">'.__('New password:').'</label>'. |
|---|
| 412 | form::password('new_pwd',20,255,'','','',false,' data-indicator="pwindicator" ').'</p>'. |
|---|
| 413 | '<div id="pwindicator">'. |
|---|
| 414 | ' <div class="bar"></div>'. |
|---|
| 415 | ' <p class="label no-margin"></p>'. |
|---|
| 416 | '</div>'. |
|---|
| 417 | '</div>'. |
|---|
| 418 | |
|---|
| 419 | '<p><label for="new_pwd_c">'.__('Confirm new password:').'</label>'. |
|---|
| 420 | form::password('new_pwd_c',20,255).'</p>'. |
|---|
| 421 | |
|---|
| 422 | '<p><label for="cur_pwd">'.__('Your current password:').'</label>'. |
|---|
| 423 | form::password('cur_pwd',20,255).'</p>'. |
|---|
| 424 | '<p class="form-note warn">'. |
|---|
| 425 | __('If you have changed your email or password you must provide your current password to save these modifications.'). |
|---|
| 426 | '</p>'; |
|---|
| 427 | } |
|---|
| 428 | |
|---|
| 429 | echo |
|---|
| 430 | '<p class="clear vertical-separator">'. |
|---|
| 431 | $core->formNonce(). |
|---|
| 432 | '<input type="submit" accesskey="s" value="'.__('Update my profile').'" /></p>'. |
|---|
| 433 | '</form>'. |
|---|
| 434 | |
|---|
| 435 | '</div>'; |
|---|
| 436 | |
|---|
| 437 | # User options : some from actual user profile, dashboard modules, ... |
|---|
| 438 | echo '<div class="multi-part" id="user-options" title="'.__('My options').'">'; |
|---|
| 439 | |
|---|
| 440 | echo |
|---|
| 441 | '<form action="'.$core->adminurl->get("admin.user.preferences").'#user-options" method="post" id="opts-forms">'. |
|---|
| 442 | '<h3>'.__('My options').'</h3>'; |
|---|
| 443 | |
|---|
| 444 | echo |
|---|
| 445 | '<div class="fieldset">'. |
|---|
| 446 | '<h4>'.__('Interface').'</h4>'. |
|---|
| 447 | |
|---|
| 448 | '<p><label for="user_ui_enhanceduploader" class="classic">'. |
|---|
| 449 | form::checkbox('user_ui_enhanceduploader',1,$user_ui_enhanceduploader).' '. |
|---|
| 450 | __('Activate enhanced uploader in media manager').'</label></p>'. |
|---|
| 451 | |
|---|
| 452 | '<p><label for="user_acc_nodragdrop" class="classic">'. |
|---|
| 453 | form::checkbox('user_acc_nodragdrop',1,$user_acc_nodragdrop).' '. |
|---|
| 454 | __('Disable javascript powered drag and drop for ordering items').'</label></p>'. |
|---|
| 455 | '<p class="clear form-note">'.__('If checked, numeric fields will allow to type the elements\' ordering number.').'</p>'; |
|---|
| 456 | |
|---|
| 457 | echo |
|---|
| 458 | '<p><label for="user_ui_media_by_page" class="classic">'.__('Number of elements displayed per page in media manager:').'</label> '. |
|---|
| 459 | form::field('user_ui_media_by_page',5,3,(integer) $user_ui_media_by_page).'</p>'; |
|---|
| 460 | |
|---|
| 461 | if ($core->auth->isSuperAdmin()) { |
|---|
| 462 | echo |
|---|
| 463 | '<p><label for="user_ui_hide_std_favicon" class="classic">'. |
|---|
| 464 | form::checkbox('user_ui_hide_std_favicon',1,$user_ui_hide_std_favicon).' '. |
|---|
| 465 | __('Do not use standard favicon').'</label> '. |
|---|
| 466 | '<span class="clear form-note warn">'.__('This will be applied for all users').'.</span>'. |
|---|
| 467 | '</p>';//Opera sucks; |
|---|
| 468 | } |
|---|
| 469 | |
|---|
| 470 | echo |
|---|
| 471 | '</div>'; |
|---|
| 472 | |
|---|
| 473 | echo |
|---|
| 474 | '<div class="fieldset">'. |
|---|
| 475 | '<h4>'.__('Edition').'</h4>'; |
|---|
| 476 | |
|---|
| 477 | foreach ($format_by_editors as $format => $editors) { |
|---|
| 478 | echo |
|---|
| 479 | '<p class="field"><label for="user_editor_'.$format.'">'.sprintf(__('Preferred editor for %s:'),$format).'</label>'. |
|---|
| 480 | form::combo( |
|---|
| 481 | array('user_editor['.$format.']', 'user_editor_'.$format), |
|---|
| 482 | array_merge(array(__('Choose an editor') => ''),$editors), |
|---|
| 483 | $user_options['editor'][$format] |
|---|
| 484 | ).'</p>'; |
|---|
| 485 | } |
|---|
| 486 | echo |
|---|
| 487 | '<p class="field"><label for="user_post_format">'.__('Preferred format:').'</label>'. |
|---|
| 488 | form::combo('user_post_format',$available_formats,$user_options['post_format']).'</p>'; |
|---|
| 489 | |
|---|
| 490 | echo |
|---|
| 491 | '<p class="field"><label for="user_post_status">'.__('Default entry status:').'</label>'. |
|---|
| 492 | form::combo('user_post_status',$status_combo,$user_post_status).'</p>'. |
|---|
| 493 | |
|---|
| 494 | '<p class="field"><label for="user_edit_size">'.__('Entry edit field height:').'</label>'. |
|---|
| 495 | form::field('user_edit_size',5,4,(integer) $user_options['edit_size']).'</p>'. |
|---|
| 496 | |
|---|
| 497 | '<p><label for="user_wysiwyg" class="classic">'. |
|---|
| 498 | form::checkbox('user_wysiwyg',1,$user_options['enable_wysiwyg']).' '. |
|---|
| 499 | __('Enable WYSIWYG mode').'</label></p>'. |
|---|
| 500 | |
|---|
| 501 | '</div>'; |
|---|
| 502 | |
|---|
| 503 | echo |
|---|
| 504 | '<h4 class="pretty-title">'.__('Other options').'</h4>'; |
|---|
| 505 | |
|---|
| 506 | # --BEHAVIOR-- adminPreferencesForm |
|---|
| 507 | $core->callBehavior('adminPreferencesForm',$core); |
|---|
| 508 | |
|---|
| 509 | echo |
|---|
| 510 | '<p class="clear vertical-separator">'. |
|---|
| 511 | $core->formNonce(). |
|---|
| 512 | '<input type="submit" accesskey="s" value="'.__('Save my options').'" /></p>'. |
|---|
| 513 | '</form>'; |
|---|
| 514 | |
|---|
| 515 | echo '</div>'; |
|---|
| 516 | |
|---|
| 517 | # My dashboard |
|---|
| 518 | echo '<div class="multi-part" id="user-favorites" title="'.__('My dashboard').'">'; |
|---|
| 519 | $ws = $core->auth->user_prefs->addWorkspace('favorites'); |
|---|
| 520 | echo '<h3>'.__('My dashboard').'</h3>'; |
|---|
| 521 | |
|---|
| 522 | echo '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="favs-form" class="two-boxes odd">'; |
|---|
| 523 | |
|---|
| 524 | echo '<div id="my-favs" class="fieldset"><h4>'.__('My favorites').'</h4>'; |
|---|
| 525 | |
|---|
| 526 | $count = 0; |
|---|
| 527 | $user_fav = $core->favs->getFavoriteIDs(false); |
|---|
| 528 | foreach ($user_fav as $id) { |
|---|
| 529 | $fav = $core->favs->getFavorite($id); |
|---|
| 530 | if ($fav != false) { |
|---|
| 531 | // User favorites only |
|---|
| 532 | if ($count == 0) echo '<ul class="fav-list">'; |
|---|
| 533 | $count++; |
|---|
| 534 | echo '<li id="fu-'.$id.'">'.'<label for="fuk-'.$id.'">'. |
|---|
| 535 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '.'<span class="zoom"><img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /></span>'. |
|---|
| 536 | form::field(array('order['.$id.']'),2,3,$count,'position','',false,'title="'.sprintf(__('position of %s'),$fav['title']).'"'). |
|---|
| 537 | form::hidden(array('dynorder[]','dynorder-'.$id.''),$id). |
|---|
| 538 | form::checkbox(array('remove[]','fuk-'.$id),$id).__($fav['title']).'</label>'. |
|---|
| 539 | '</li>'; |
|---|
| 540 | } |
|---|
| 541 | } |
|---|
| 542 | if ($count > 0) echo '</ul>'; |
|---|
| 543 | if ($count > 0) { |
|---|
| 544 | echo |
|---|
| 545 | '<div class="clear">'. |
|---|
| 546 | '<p>'.form::hidden('favs_order',''). |
|---|
| 547 | $core->formNonce(). |
|---|
| 548 | '<input type="submit" name="saveorder" value="'.__('Save order').'" /> '. |
|---|
| 549 | |
|---|
| 550 | '<input type="submit" class="delete" name="removeaction" '. |
|---|
| 551 | 'value="'.__('Delete selected favorites').'" '. |
|---|
| 552 | 'onclick="return window.confirm(\''.html::escapeJS( |
|---|
| 553 | __('Are you sure you want to remove selected favorites?')).'\');" /></p>'. |
|---|
| 554 | |
|---|
| 555 | ($core->auth->isSuperAdmin() ? |
|---|
| 556 | '<div class="info">'. |
|---|
| 557 | '<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>'. |
|---|
| 558 | '<p><input class="reset" type="submit" name="replace" value="'.__('Define as default favorites').'" />'.'</p>'. |
|---|
| 559 | '</div>' |
|---|
| 560 | : |
|---|
| 561 | ''). |
|---|
| 562 | |
|---|
| 563 | '</div>'; |
|---|
| 564 | } else { |
|---|
| 565 | echo |
|---|
| 566 | '<p>'.__('Currently no personal favorites.').'</p>'; |
|---|
| 567 | } |
|---|
| 568 | |
|---|
| 569 | $avail_fav = $core->favs->getFavorites($core->favs->getAvailableFavoritesIDs()); |
|---|
| 570 | $default_fav_ids = array(); |
|---|
| 571 | foreach($core->favs->getFavoriteIDs(true) as $v) { |
|---|
| 572 | $default_fav_ids[$v]=true; |
|---|
| 573 | } |
|---|
| 574 | echo '</div>'; # /box my-fav |
|---|
| 575 | |
|---|
| 576 | echo '<div class="fieldset" id="available-favs">'; |
|---|
| 577 | # Available favorites |
|---|
| 578 | echo '<h5 class="pretty-title">'.__('Other available favorites').'</h5>'; |
|---|
| 579 | $count = 0; |
|---|
| 580 | function cmp($a,$b) { |
|---|
| 581 | if ($a['title'] == $b['title']) { |
|---|
| 582 | return 0; |
|---|
| 583 | } |
|---|
| 584 | return ($a['title'] < $b['title']) ? -1 : 1; |
|---|
| 585 | } |
|---|
| 586 | uasort($avail_fav,'cmp'); |
|---|
| 587 | |
|---|
| 588 | foreach ($avail_fav as $k => $v) { |
|---|
| 589 | if (in_array($k,$user_fav)) { |
|---|
| 590 | unset($avail_fav[$k]); |
|---|
| 591 | } |
|---|
| 592 | } |
|---|
| 593 | foreach ($avail_fav as $k=>$fav) { |
|---|
| 594 | if ($count == 0) echo '<ul class="fav-list">'; |
|---|
| 595 | $count++; |
|---|
| 596 | echo '<li id="fa-'.$k.'">'.'<label for="fak-'.$k.'">'. |
|---|
| 597 | '<img src="'.dc_admin_icon_url($fav['small-icon']).'" alt="" /> '. |
|---|
| 598 | '<span class="zoom"><img src="'.dc_admin_icon_url($fav['large-icon']).'" alt="" /></span>'. |
|---|
| 599 | form::checkbox(array('append[]','fak-'.$k),$k). |
|---|
| 600 | $fav['title'].'</label>'. |
|---|
| 601 | (isset($default_fav_ids[$k]) ? ' <span class="default-fav"><img src="images/selected.png" alt="'.__('(default favorite)').'" /></span>' : ''). |
|---|
| 602 | '</li>'; |
|---|
| 603 | } |
|---|
| 604 | if ($count > 0) echo '</ul>'; |
|---|
| 605 | echo |
|---|
| 606 | '<p>'. |
|---|
| 607 | $core->formNonce(). |
|---|
| 608 | '<input type="submit" name="appendaction" value="'.__('Add to my favorites').'" /></p>'; |
|---|
| 609 | echo '</div>'; # /available favorites |
|---|
| 610 | |
|---|
| 611 | echo '</form>'; |
|---|
| 612 | |
|---|
| 613 | echo |
|---|
| 614 | '<form action="'.$core->adminurl->get("admin.user.preferences").'" method="post" id="db-forms" class="two-boxes even">'. |
|---|
| 615 | |
|---|
| 616 | '<div class="fieldset">'. |
|---|
| 617 | '<h4>'.__('Menu').'</h4>'. |
|---|
| 618 | '<p><label for="user_ui_nofavmenu" class="classic">'. |
|---|
| 619 | form::checkbox('user_ui_nofavmenu',1,!$user_ui_nofavmenu).' '. |
|---|
| 620 | __('Display favorites at the top of the menu').'</label></p></div>'; |
|---|
| 621 | |
|---|
| 622 | if (count($iconsets_combo) > 1) { |
|---|
| 623 | echo |
|---|
| 624 | '<div class="fieldset">'. |
|---|
| 625 | '<h4>'.__('Dashboard icons').'</h4>'. |
|---|
| 626 | '<p><label for="user_ui_iconset" class="classic">'.__('Iconset:').'</label> '. |
|---|
| 627 | form::combo('user_ui_iconset',$iconsets_combo,$user_ui_iconset).'</p>'. |
|---|
| 628 | '</div>'; |
|---|
| 629 | } else { |
|---|
| 630 | echo '<p class="hidden">'.form::hidden('user_ui_iconset','').'</p>'; |
|---|
| 631 | } |
|---|
| 632 | |
|---|
| 633 | echo |
|---|
| 634 | '<div class="fieldset">'. |
|---|
| 635 | '<h4>'.__('Dashboard modules').'</h4>'. |
|---|
| 636 | |
|---|
| 637 | '<p><label for="user_dm_doclinks" class="classic">'. |
|---|
| 638 | form::checkbox('user_dm_doclinks',1,$user_dm_doclinks).' '. |
|---|
| 639 | __('Display documentation links').'</label></p>'. |
|---|
| 640 | |
|---|
| 641 | '<p><label for="user_dm_dcnews" class="classic">'. |
|---|
| 642 | form::checkbox('user_dm_dcnews',1,$user_dm_dcnews).' '. |
|---|
| 643 | __('Display Dotclear news').'</label></p>'. |
|---|
| 644 | |
|---|
| 645 | '<p><label for="user_dm_quickentry" class="classic">'. |
|---|
| 646 | form::checkbox('user_dm_quickentry',1,$user_dm_quickentry).' '. |
|---|
| 647 | __('Display quick entry form').'</label><br class="clear" />'. //Opera sucks |
|---|
| 648 | '</p>'; |
|---|
| 649 | echo '</div>'; |
|---|
| 650 | |
|---|
| 651 | # --BEHAVIOR-- adminDashboardOptionsForm |
|---|
| 652 | $core->callBehavior('adminDashboardOptionsForm',$core); |
|---|
| 653 | |
|---|
| 654 | echo |
|---|
| 655 | '<p>'. |
|---|
| 656 | form::hidden('db-options','-'). |
|---|
| 657 | $core->formNonce(). |
|---|
| 658 | '<input type="submit" accesskey="s" value="'.__('Save my dashboard options').'" /></p>'. |
|---|
| 659 | '</form>'; |
|---|
| 660 | |
|---|
| 661 | echo '</div>'; # /multipart-user-favorites |
|---|
| 662 | |
|---|
| 663 | dcPage::helpBlock('core_user_pref'); |
|---|
| 664 | dcPage::close(); |
|---|