Changeset 2711:fab26880034e for admin
- Timestamp:
- 05/15/14 08:44:22 (11 years ago)
- Branch:
- default
- Parents:
- 2710:f99841305743 (diff), 2708:e8b17b3a7413 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/post.php
r2708 r2711 19 19 $post_dt = ''; 20 20 $post_format = $core->auth->getOption('post_format'); 21 $ editor = $core->auth->getOption('editor');21 $post_editor = $core->auth->getOption('editor'); 22 22 $post_password = ''; 23 23 $post_url = ''; … … 61 61 62 62 # Formaters combo 63 $formaters_combo = dcAdminCombos::getFormatersCombo($editor); 63 $formaters_combo = dcAdminCombos::getFormatersCombo(); 64 foreach ($formaters_combo as $editor => $formats) { 65 foreach ($formats as $format) { 66 $formaters_combo[$editor][$format] = "$editor:$format"; 67 } 68 } 64 69 65 70 # Languages combo … … 75 80 76 81 if (count($formaters_combo)==0 || !$core->auth->getOption('editor') || $core->auth->getOption('editor')=='') { 77 dcPage::addNotice("message", 78 sprintf(__('Choose an active editor in %s.'), 82 dcPage::addNotice("message", 83 sprintf(__('Choose an active editor in %s.'), 79 84 '<a href="preferences.php#user-options">'.__('your preferences').'</a>' 80 85 ) … … 83 88 84 89 # Get entry informations 85 if (!empty($_REQUEST['id'])) 86 { 90 if (!empty($_REQUEST['id'])) { 87 91 $page_title = __('Edit entry'); 88 92 … … 91 95 $post = $core->blog->getPosts($params); 92 96 93 if ($post->isEmpty()) 94 { 97 if ($post->isEmpty()) { 95 98 $core->error->add(__('This entry does not exist.')); 96 99 $can_view_page = false; 97 } 98 else 99 { 100 } else { 100 101 $post_id = $post->post_id; 101 102 $cat_id = $post->cat_id; 102 103 $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 103 104 $post_format = $post->post_format; 105 # try to retrieve editor from post meta 106 $meta_editor = $core->meta->getMetaStr($post->post_meta,'editor'); 107 if (!empty($meta_editor)) { 108 $post_editor = $meta_editor; 109 } 104 110 $post_password = $post->post_password; 105 111 $post_url = $post->post_url; … … 193 199 194 200 # Format excerpt and content 195 elseif (!empty($_POST) && $can_edit_post) 196 { 197 $post_format = $_POST['post_format']; 201 elseif (!empty($_POST) && $can_edit_post) { 202 203 if (strpos($_POST['post_format'], ':')!==false) { 204 list($post_editor, $post_format) = explode(':', $_POST['post_format']); 205 } else { 206 $post_format = $_POST['post_format']; 207 $post_editor = ''; 208 } 209 198 210 $post_excerpt = $_POST['post_excerpt']; 199 211 $post_content = $_POST['post_content']; … … 283 295 $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 284 296 $cur->post_format = $post_format; 297 $cur->post_meta = serialize(array('editor' => $post_editor)); 285 298 $cur->post_password = $post_password; 286 299 $cur->post_lang = $post_lang; … … 301 314 302 315 # Update post 303 if ($post_id) 304 { 305 try 306 { 316 if ($post_id) { 317 try { 318 $meta = $core->meta; 319 $meta->delPostMeta($post_id,'editor'); 320 $meta->setPostMeta($post_id,'editor',$post_editor); 321 307 322 # --BEHAVIOR-- adminBeforePostUpdate 308 323 $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); … … 317 332 array('id' => $post_id) 318 333 )); 319 } 320 catch (Exception $e) 321 { 334 } catch (Exception $e) { 322 335 $core->error->add($e->getMessage()); 323 336 } 324 } 325 else 326 { 337 } else { 327 338 $cur->user_id = $core->auth->userID(); 328 339 329 try 330 { 340 try { 331 341 # --BEHAVIOR-- adminBeforePostCreate 332 342 $core->callBehavior('adminBeforePostCreate',$cur); 333 343 334 344 $return_id = $core->blog->addPost($cur); 345 346 $meta = $core->meta; 347 $meta->delPostMeta($return_id,'editor'); 348 $meta->setPostMeta($return_id,'editor',$post_editor); 335 349 336 350 # --BEHAVIOR-- adminAfterPostCreate … … 342 356 array('id' => $return_id) 343 357 )); 344 } 345 catch (Exception $e) 346 { 358 } catch (Exception $e) { 347 359 $core->error->add($e->getMessage()); 348 360 } … … 390 402 } 391 403 404 $admin_post_behavior = ''; 405 if (($core->auth->getOption('editor')==$post_editor) 406 && in_array($post_format, $core->getFormaters($core->auth->getOption('editor')))) { 407 $admin_post_behavior = $core->callBehavior('adminPostEditor'); 408 } 392 409 393 410 dcPage::open($page_title.' - '.__('Entries'), … … 395 412 dcPage::jsModal(). 396 413 dcPage::jsMetaEditor(). 414 $admin_post_behavior. 397 415 dcPage::jsLoad('js/_post.js'). 398 $core->callBehavior('adminPostEditor').399 416 dcPage::jsConfirmClose('entry-form','comment-form'). 400 417 # --BEHAVIOR-- adminPostHeaders … … 464 481 /* Post form if we can edit post 465 482 -------------------------------------------------------- */ 466 if ($can_edit_post) 467 { 483 if ($can_edit_post) { 468 484 if (count($formaters_combo)>0 && ($core->auth->getOption('editor') && $core->auth->getOption('editor')!='')) { 469 $post_format_field = form::combo('post_format',$formaters_combo,$post_format,'maximal'); 485 // temporay removed until we can switch easily editor 486 // $post_format_field = form::combo('post_format',$formaters_combo,"$post_editor:$post_format",'maximal'); 487 488 $post_format_field = sprintf('%s (%s)', $post_format, $post_editor); 489 $post_format_field .= form::hidden('post_format',"$post_editor:$post_format"); 470 490 } else { 471 $post_format_field = sprintf(__('Choose an active editor in %s.'), 491 $post_format_field = sprintf(__('Choose an active editor in %s.'), 472 492 '<a href="preferences.php#user-options">'.__('your preferences').'</a>' 473 493 ); 494 $post_format_field .= form::hidden('post_format','xhtml'); 474 495 } 475 496 -
admin/post.php
r2705 r2711 41 41 $can_delete = false; 42 42 43 $post_headlink = '<link rel="%s" title="%s" href=" post.php?id=%s" />';44 $post_link = '<a href=" post.php?id=%s" title="%s">%s</a>';43 $post_headlink = '<link rel="%s" title="%s" href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&').'" />'; 44 $post_link = '<a href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&').'" title="%s">%s</a>'; 45 45 46 46 $next_link = $prev_link = $next_headlink = $prev_headlink = null; … … 163 163 } 164 164 165 $comments_actions_page = new dcCommentsActionsPage($core, 'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor));165 $comments_actions_page = new dcCommentsActionsPage($core,$core->adminurl->get('admin.post'),array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor)); 166 166 167 167 if ($comments_actions_page->process()) { … … 190 190 if (!$core->error->flag()) { 191 191 dcPage::addSuccessNotice(__('All pings sent.')); 192 http::redirect('post.php?id='.$post_id.'&tb=1'); 192 http::redirect($core->adminurl->get( 193 'admin.post', 194 array('id' => $post_id, 'tb'=> '1') 195 )); 193 196 } 194 197 } … … 325 328 $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 326 329 dcPage::addSuccessNotice (sprintf(__('The post "%s" has been successfully updated'),html::escapeHTML($cur->post_title))); 327 http::redirect('post.php?id='.$post_id); 330 http::redirect($core->adminurl->get( 331 'admin.post', 332 array('id' => $post_id) 333 )); 328 334 } catch (Exception $e) { 329 335 $core->error->add($e->getMessage()); … … 346 352 347 353 dcPage::addSuccessNotice(__('Entry has been successfully created.')); 348 http::redirect('post.php?id='.$return_id); 354 http::redirect($core->adminurl->get( 355 'admin.post', 356 array('id' => $return_id) 357 )); 349 358 } catch (Exception $e) { 350 359 $core->error->add($e->getMessage()); … … 507 516 '<p>'.$post_format_field.'</p>'. 508 517 '<p class="format_control control_no_xhtml">'. 509 '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&xconv=1">'. 518 '<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="'. 519 $core->adminurl->get('admin.post',array('id'=> $post_id,'xconv'=> '1')). 520 '">'. 510 521 __('Convert to XHTML').'</a></p></div>')), 511 522 'metas-box' => array( … … 604 615 605 616 echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">'; 606 echo '<form action=" post.php" method="post" id="entry-form">';617 echo '<form action="'.$core->adminurl->get('admin.post').'" method="post" id="entry-form">'; 607 618 echo '<div id="entry-wrapper">'; 608 619 echo '<div id="entry-content"><div class="constrained">'; … … 682 693 683 694 if ($has_action) { 684 echo '<form action=" post.php" id="form-comments" method="post">';695 echo '<form action="'.$core->adminurl->get('admin.post').'" id="form-comments" method="post">'; 685 696 } 686 697
Note: See TracChangeset
for help on using the changeset viewer.