- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 ?>
Note: See TracChangeset
for help on using the changeset viewer.