Changeset 2736:09dd799a19bd for admin/preferences.php
- Timestamp:
- 08/25/14 09:20:20 (11 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/preferences.php
r2720 r2736 27 27 28 28 $user_options = $core->auth->getOptions(); 29 if (empty($user_options['editor']) ) {30 $user_options['editor'] = '';29 if (empty($user_options['editor']) || !is_array($user_options['editor'])) { 30 $user_options['editor'] = array(); 31 31 } 32 32 … … 65 65 $editors = array_keys($editors_combo); 66 66 67 # Formaters combo 68 $formaters_combo = dcAdminCombos::getFormatersCombo(); 69 $formaters_combo_editor = array(); 70 71 if (!empty($user_options['editor']) && !empty($formaters_combo[$user_options['editor']])) { 72 $formaters_combo_editor = $formaters_combo[$user_options['editor']]; 73 } elseif (count($editors)!=0) { 74 $formaters_combo_editor = $formaters_combo[$editors[0]]; 75 } else { 76 $formaters_combo = array(); 77 } 78 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 } 79 82 $status_combo = dcAdminCombos::getPostStatusescombo(); 80 83 … … 150 153 151 154 # Update user options 152 if (isset($_POST['user_ post_format']))155 if (isset($_POST['user_editor'])) 153 156 { 154 157 try … … 333 336 sprintf(__('Password strength: %s'),__('strong'))."', '". 334 337 sprintf(__('Password strength: %s'),__('very strong'))."']});\n". 335 "});\n". 336 'var formats_by_editor = \''.json_encode($formaters_combo).'\';'. 338 "});". 337 339 "\n//]]>\n". 338 340 "</script>\n". … … 471 473 echo 472 474 '<div class="fieldset">'. 473 '<h4>'.__('Edition').'</h4>'. 474 475 '<p class="field"><label for="user_editor">'.__('Preferred editor:').'</label>'. 476 form::combo('user_editor',array_merge(array(__('Choose an editor') => ''),$editors_combo),$user_options['editor']).'</p>'. 477 475 '<h4>'.__('Edition').'</h4>'; 476 477 foreach ($format_by_editors as $format => $editors) { 478 echo 479 '<p class="field"><label for="user_editor">'.sprintf(__('Preferred editor for %s:'),$format).'</label>'. 480 form::combo( 481 'user_editor['.$format.']', 482 array_merge(array(__('Choose an editor') => ''),$editors),$user_options['editor'][$format] 483 ).'</p>'; 484 } 485 echo 478 486 '<p class="field"><label for="user_post_format">'.__('Preferred format:').'</label>'. 479 form::combo('user_post_format',array_merge(array('' => ''), $formaters_combo_editor),$user_options['post_format']).'</p>'. 480 487 form::combo('user_post_format',$available_formats,$user_options['post_format']).'</p>'; 488 489 echo 481 490 '<p class="field"><label for="user_post_status">'.__('Default entry status:').'</label>'. 482 491 form::combo('user_post_status',$status_combo,$user_post_status).'</p>'.
Note: See TracChangeset
for help on using the changeset viewer.