Changeset 2736:09dd799a19bd for admin
- Timestamp:
- 08/25/14 09:20:20 (11 years ago)
- Branch:
- default
- Location:
- admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_preferences.js
r2679 r2736 20 20 return true; 21 21 }); 22 23 // choose format depending of editor based on formats_by_editor defined in preferences.php24 if (formats_by_editor !== undefined) {25 var _editors = $.parseJSON(formats_by_editor);26 27 $('#user_editor').change(function() {28 if (!_editors[$(this).val()]) {return;}29 30 $('#user_post_format option').remove();31 for (var format in _editors[$(this).val()]) {32 $('#user_post_format').append('<option value="'+format+'">'+format+'</option>');33 }34 });35 }36 22 }); -
admin/post.php
r2722 r2736 60 60 $img_status_pattern = '<img class="img_select_option" alt="%1$s" title="%1$s" src="images/%2$s" />'; 61 61 62 # Formaters combo 63 $formaters_combo = dcAdminCombos::getFormatersCombo(); 64 foreach ($formaters_combo as $editor => $formats) { 62 # Formats combo 63 $core_formaters = $core->getFormaters(); 64 $available_formats = array('' => ''); 65 foreach ($core_formaters as $editor => $formats) { 65 66 foreach ($formats as $format) { 66 $formaters_combo[$editor][$format] = "$editor:$format";67 67 $available_formats[$format] = $format; 68 } 68 69 } 69 70 … … 78 79 $TB = new dcTrackback($core); 79 80 $tb_urls = $tb_excerpt = ''; 80 81 if (count($formaters_combo)==0 || !$core->auth->getOption('editor') || $core->auth->getOption('editor')=='') {82 dcPage::addNotice("message",83 sprintf(__('Choose an active editor in %s.'),84 '<a href="'.$core->adminurl->get("admin.user.preferences").'#user-options">'.__('your preferences').'</a>'85 )86 );87 }88 81 89 82 # Get entry informations … … 195 188 # Format excerpt and content 196 189 elseif (!empty($_POST) && $can_edit_post) { 197 list(, $post_format) = explode(':', $_POST['post_format']);190 $post_format = $_POST['post_format']; 198 191 $post_excerpt = $_POST['post_excerpt']; 199 192 $post_content = $_POST['post_content']; … … 382 375 383 376 $admin_post_behavior = ''; 384 if (($core->auth->getOption('editor')==$post_editor) 385 && in_array($post_format, $core->getFormaters($core->auth->getOption('editor')))) { 386 $admin_post_behavior = $core->callBehavior('adminPostEditor'); 377 if (!empty($core->auth->getOption('editor')) && !empty($core->auth->getOption('editor')[$post_format])) { 378 $admin_post_behavior = $core->callBehavior('adminPostEditor', $core->auth->getOption('editor')[$post_format]); 387 379 } 388 380 … … 461 453 -------------------------------------------------------- */ 462 454 if ($can_edit_post) { 463 if (count($formaters_combo)>0 && ($core->auth->getOption('editor') && $core->auth->getOption('editor')!='')) {464 $post_format_field = form::combo('post_format',$formaters_combo,"$post_editor:$post_format",'maximal');465 } else {466 $post_format_field = sprintf(__('Choose an active editor in %s.'),467 '<a href="'.$core->adminurl->get("admin.user.preferences").'#user-options">'.__('your preferences').'</a>'468 );469 $post_format_field .= form::hidden('post_format','xhtml');470 }471 472 455 $sidebar_items = new ArrayObject(array( 473 456 'status-box' => array( … … 489 472 '<div>'. 490 473 '<h5 id="label_format"><label for="post_format" class="classic">'.__('Text formatting').'</label></h5>'. 491 '<p>'. $post_format_field.'</p>'.474 '<p>'.form::combo('post_format',$available_formats,$post_format,'maximal').'</p>'. 492 475 '<p class="format_control control_no_xhtml">'. 493 476 '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="'. -
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.