Changeset 1699:5b68157bf85e
- Timestamp:
- 09/03/13 14:15:53 (10 years ago)
- Branch:
- default
- Children:
- 1703:512d631f31bd, 1714:28737e5f6607, 1896:a514b85f3261
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/index.php
r1698 r1699 63 63 $core->auth->user_prefs->dashboard->put('quickentry',false,'boolean'); 64 64 } 65 66 // Handle folded/unfolded sections in admin from user preferences 67 $ws = $core->auth->user_prefs->addWorkspace('toggles'); 68 if (!$core->auth->user_prefs->toggles->prefExists('unfolded_sections')) { 69 $core->auth->user_prefs->toggles->put('unfolded_sections','','string','Folded sections in admin',null,true); 70 } 71 65 72 66 73 # Dashboard icons -
admin/js/_index.js
r1638 r1699 75 75 $('#quick h3').toggleWithLegend($('#quick').children().not('h3'),{ 76 76 legend_click: true, 77 cookie: 'dcx_quick_entry'77 user_pref: 'dcx_quick_entry' 78 78 }); 79 79 }); -
admin/js/_post.js
r1638 r1699 120 120 // Hide some fields 121 121 $('#notes-area label').toggleWithLegend($('#notes-area').children().not('label'),{ 122 cookie: 'dcx_post_notes',122 user_pref: 'dcx_post_notes', 123 123 legend_click:true, 124 124 hide: $('#post_notes').val() == '' … … 129 129 }); 130 130 $('#post_lang').parent().children('label').toggleWithLegend($('#post_lang'),{ 131 cookie: 'dcx_post_lang',131 user_pref: 'dcx_post_lang', 132 132 legend_click: true 133 133 }); 134 134 $('#post_password').parent().children('label').toggleWithLegend($('#post_password'),{ 135 cookie: 'dcx_post_password',135 user_pref: 'dcx_post_password', 136 136 legend_click: true, 137 137 hide: $('#post_password').val() == '' 138 138 }); 139 139 $('#post_status').parent().children('label').toggleWithLegend($('#post_status'),{ 140 cookie: 'dcx_post_status',140 user_pref: 'dcx_post_status', 141 141 legend_click: true 142 142 }); 143 143 $('#post_dt').parent().children('label').toggleWithLegend($('#post_dt').parent().children().not('label'),{ 144 cookie: 'dcx_post_dt',144 user_pref: 'dcx_post_dt', 145 145 legend_click: true 146 146 }); 147 147 $('#label_format').toggleWithLegend($('#label_format').parent().children().not('#label_format'),{ 148 cookie: 'dcx_post_format',148 user_pref: 'dcx_post_format', 149 149 legend_click: true 150 150 }); 151 151 $('#cat_id').parent().children('label').toggleWithLegend($('#cat_id'),{ 152 cookie: 'cat_id',152 user_pref: 'cat_id', 153 153 legend_click: true 154 154 }); 155 155 $('#post_url').parent().children('label').toggleWithLegend($('#post_url').parent().children().not('label'),{ 156 cookie: 'post_url',156 user_pref: 'post_url', 157 157 legend_click: true 158 158 }); 159 159 // We load toolbar on excerpt only when it's ready 160 160 $('#excerpt-area label').toggleWithLegend($('#excerpt-area').children().not('label'),{ 161 cookie: 'dcx_post_excerpt',161 user_pref: 'dcx_post_excerpt', 162 162 legend_click: true, 163 163 hide: $('#post_excerpt').val() == '' -
admin/js/common.js
r1635 r1699 63 63 img_off_src: dotclear.img_minus_src, 64 64 img_off_alt: dotclear.img_minus_alt, 65 unfolded_sections: dotclear.unfolded_sections, 65 66 hide: true, 66 67 speed: 0, 67 68 legend_click: false, 68 69 fn: false, // A function called on first display, 69 cookie: false, 70 reverse_cookie: false // Reverse cookie behavior 70 user_pref: false, 71 reverse_user_pref: false, // Reverse cookie behavior 72 user_pref:false, 73 reverse_user_pref: false 71 74 }; 72 75 var p = jQuery.extend(defaults,s); … … 78 81 p.hide = p.reverse_cookie; 79 82 } 80 83 84 var set_user_pref = p.hide ^ p.reverse_user_pref; 85 if (p.user_pref && (p.user_pref in p.unfolded_sections)) { 86 p.hide = p.reverse_user_pref; 87 } 81 88 var toggle = function(i,speed) { 82 89 speed = speed || 0; … … 102 109 } 103 110 } 104 105 111 p.hide = !p.hide; 106 112 }; … … 125 131 } 126 132 $(ctarget).click(function() { 133 if (p.user_pref && set_user_pref) { 134 if (p.hide ^ p.reverse_user_pref) { 135 jQuery.post('services.php', 136 {'f':'setSectionFold','section':p.user_pref,'value':1,xd_check: dotclear.nonce}, 137 function(data) {}); 138 } else { 139 jQuery.post('services.php', 140 {'f':'setSectionFold','section':p.user_pref,'value':0,xd_check: dotclear.nonce}, 141 function(data) {}); 142 } 143 jQuery.cookie(p.user_pref,'',{expires: -1}); 144 } 127 145 toggle(i,p.speed); 128 146 return false; … … 348 366 } 349 367 $('#blog-menu h3:first').toggleWithLegend($('#blog-menu ul:first'), 350 $.extend({ cookie:'dc_blog_menu'},menu_settings)368 $.extend({user_pref:'dc_blog_menu'},menu_settings) 351 369 ); 352 370 $('#system-menu h3:first').toggleWithLegend($('#system-menu ul:first'), 353 $.extend({ cookie:'dc_system_menu'},menu_settings)371 $.extend({user_pref:'dc_system_menu'},menu_settings) 354 372 ); 355 373 $('#plugins-menu h3:first').toggleWithLegend($('#plugins-menu ul:first'), 356 $.extend({ cookie:'dc_plugins_menu'},menu_settings)374 $.extend({user_pref:'dc_plugins_menu'},menu_settings) 357 375 ); 358 376 $('#favorites-menu h3:first').toggleWithLegend($('#favorites-menu ul:first'), 359 $.extend({ cookie:'dc_favorites_menu',hide:false,reverse_cookie:true},menu_settings)377 $.extend({user_pref:'dc_favorites_menu',hide:false,reverse_user_pref:true},menu_settings) 360 378 ); 361 379 -
admin/services.php
r1538 r1699 26 26 $core->rest->addFunction('setPostMeta',array('dcRestMethods','setPostMeta')); 27 27 $core->rest->addFunction('searchMeta',array('dcRestMethods','searchMeta')); 28 $core->rest->addFunction('setSectionFold',array('dcRestMethods','setSectionFold')); 28 29 29 30 $core->rest->serve(); … … 412 413 return $rsp; 413 414 } 415 416 public static function setSectionFold($core,$get,$post) 417 { 418 if (empty($post['section'])) { 419 throw new Exception('No section name'); 420 } 421 if ($core->auth->user_prefs->toggles === null) { 422 $core->auth->user_prefs->addWorkspace('toggles'); 423 } 424 $section = $post['section']; 425 $status = isset($post['value']) && ($post['value'] != 0); 426 if ($core->auth->user_prefs->toggles->prefExists('unfolded_sections')) { 427 $toggles = explode(',',trim($core->auth->user_prefs->toggles->unfolded_sections)); 428 } else { 429 $toggles = array(); 430 } 431 $k = array_search($section,$toggles); 432 if ($status) { // true == Fold section ==> remove it from unfolded list 433 if ($k !== false) { 434 unset($toggles[$k]); 435 } 436 } else { // false == unfold section ==> add it to unfolded list 437 if ($k === false) { 438 $toggles[]=$section; 439 }; 440 } 441 $core->auth->user_prefs->toggles->put('unfolded_sections',join(',',$toggles)); 442 return true; 443 } 444 445 414 446 } 415 447 ?> -
inc/admin/lib.dc.page.php
r1686 r1699 114 114 echo 115 115 self::jsCommon(). 116 self::jsToggles(). 116 117 $head; 117 118 … … 253 254 echo 254 255 self::jsCommon(). 256 self::jsToggles(). 255 257 $head; 256 258 … … 444 446 } 445 447 448 public static function jsToggles() 449 { 450 if($GLOBALS['core']->auth->user_prefs->toggles) { 451 $unfolded_sections = explode(',',$GLOBALS['core']->auth->user_prefs->toggles->unfolded_sections); 452 foreach ($unfolded_sections as $k=>&$v) { 453 if ($v == '') { 454 unset($unfolded_sections[$k]); 455 } else { 456 $v = "'".html::escapeJS($v)."':true"; 457 } 458 } 459 } else { 460 $unfolded_sections=array(); 461 } 462 return '<script type="text/javascript">'."\n". 463 "//<![CDATA[\n". 464 'dotclear.unfolded_sections = {'.join(",",$unfolded_sections)."};\n". 465 "\n//]]>\n". 466 "</script>\n"; 467 } 468 446 469 public static function jsCommon() 447 470 { … … 544 567 self::jsVar('dotclear.msg.load_enhanced_uploader', 545 568 __('Loading enhanced uploader, please wait.')). 546 "\n//]]>\n".569 "\n//]]>\n". 547 570 "</script>\n"; 548 571 } -
plugins/attachments/js/post.js
r1606 r1699 1 1 $(function() { 2 2 $('h5.s-attachments').toggleWithLegend($('.s-attachments').not('h5'),{ 3 cookie: 'dcx_attachments',3 user_pref: 'dcx_attachments', 4 4 legend_click: true 5 5 }); -
plugins/pings/post.js
r1606 r1699 13 13 } 14 14 $('h5.ping-services').toggleWithLegend($('p.ping-services'),{ 15 cookie: 'dcx_ping_services',15 user_pref: 'dcx_ping_services', 16 16 legend_click: true 17 17 }); -
plugins/tags/js/post.js
r1606 r1699 60 60 61 61 $('h5 .s-tags').toggleWithLegend($('.s-tags').not('label'),{ 62 cookie: 'post_tags',62 user_pref: 'post_tags', 63 63 legend_clik: true 64 64 });
Note: See TracChangeset
for help on using the changeset viewer.