Dotclear

Changeset 2711:fab26880034e for admin


Ignore:
Timestamp:
05/15/14 08:44:22 (11 years ago)
Author:
Dsls
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.
Message:

Merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • admin/post.php

    r2708 r2711  
    1919$post_dt = ''; 
    2020$post_format = $core->auth->getOption('post_format'); 
    21 $editor = $core->auth->getOption('editor'); 
     21$post_editor = $core->auth->getOption('editor'); 
    2222$post_password = ''; 
    2323$post_url = ''; 
     
    6161 
    6262# Formaters combo 
    63 $formaters_combo = dcAdminCombos::getFormatersCombo($editor); 
     63$formaters_combo = dcAdminCombos::getFormatersCombo(); 
     64foreach ($formaters_combo as $editor => $formats) { 
     65     foreach ($formats as $format) { 
     66          $formaters_combo[$editor][$format] = "$editor:$format"; 
     67     } 
     68} 
    6469 
    6570# Languages combo 
     
    7580 
    7681if (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.'),  
    7984                                          '<a href="preferences.php#user-options">'.__('your preferences').'</a>' 
    8085                                          ) 
     
    8388 
    8489# Get entry informations 
    85 if (!empty($_REQUEST['id'])) 
    86 { 
     90if (!empty($_REQUEST['id'])) { 
    8791     $page_title = __('Edit entry'); 
    8892 
     
    9195     $post = $core->blog->getPosts($params); 
    9296 
    93      if ($post->isEmpty()) 
    94      { 
     97     if ($post->isEmpty()) { 
    9598          $core->error->add(__('This entry does not exist.')); 
    9699          $can_view_page = false; 
    97      } 
    98      else 
    99      { 
     100     } else { 
    100101          $post_id = $post->post_id; 
    101102          $cat_id = $post->cat_id; 
    102103          $post_dt = date('Y-m-d H:i',strtotime($post->post_dt)); 
    103104          $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        } 
    104110          $post_password = $post->post_password; 
    105111          $post_url = $post->post_url; 
     
    193199 
    194200# Format excerpt and content 
    195 elseif (!empty($_POST) && $can_edit_post) 
    196 { 
    197      $post_format = $_POST['post_format']; 
     201elseif (!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 
    198210     $post_excerpt = $_POST['post_excerpt']; 
    199211     $post_content = $_POST['post_content']; 
     
    283295     $cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : ''; 
    284296     $cur->post_format = $post_format; 
     297     $cur->post_meta = serialize(array('editor' => $post_editor)); 
    285298     $cur->post_password = $post_password; 
    286299     $cur->post_lang = $post_lang; 
     
    301314 
    302315     # 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 
    307322               # --BEHAVIOR-- adminBeforePostUpdate 
    308323               $core->callBehavior('adminBeforePostUpdate',$cur,$post_id); 
     
    317332                    array('id' => $post_id) 
    318333               )); 
    319           } 
    320           catch (Exception $e) 
    321           { 
     334          } catch (Exception $e) { 
    322335               $core->error->add($e->getMessage()); 
    323336          } 
    324      } 
    325      else 
    326      { 
     337     } else { 
    327338          $cur->user_id = $core->auth->userID(); 
    328339 
    329           try 
    330           { 
     340          try { 
    331341               # --BEHAVIOR-- adminBeforePostCreate 
    332342               $core->callBehavior('adminBeforePostCreate',$cur); 
    333343 
    334344               $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); 
    335349 
    336350               # --BEHAVIOR-- adminAfterPostCreate 
     
    342356                    array('id' => $return_id) 
    343357               )); 
    344           } 
    345           catch (Exception $e) 
    346           { 
     358          } catch (Exception $e) { 
    347359               $core->error->add($e->getMessage()); 
    348360          } 
     
    390402} 
    391403 
     404$admin_post_behavior = ''; 
     405if (($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} 
    392409 
    393410dcPage::open($page_title.' - '.__('Entries'), 
     
    395412     dcPage::jsModal(). 
    396413     dcPage::jsMetaEditor(). 
     414    $admin_post_behavior. 
    397415     dcPage::jsLoad('js/_post.js'). 
    398      $core->callBehavior('adminPostEditor'). 
    399416     dcPage::jsConfirmClose('entry-form','comment-form'). 
    400417     # --BEHAVIOR-- adminPostHeaders 
     
    464481/* Post form if we can edit post 
    465482-------------------------------------------------------- */ 
    466 if ($can_edit_post) 
    467 { 
     483if ($can_edit_post) { 
    468484     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"); 
    470490     } else { 
    471           $post_format_field = sprintf(__('Choose an active editor in %s.'), 
     491          $post_format_field = sprintf(__('Choose an active editor in %s.'),  
    472492          '<a href="preferences.php#user-options">'.__('your preferences').'</a>' 
    473493          ); 
     494          $post_format_field .= form::hidden('post_format','xhtml'); 
    474495     } 
    475496 
  • admin/post.php

    r2705 r2711  
    4141$can_delete = false; 
    4242 
    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>'; 
    4545 
    4646$next_link = $prev_link = $next_headlink = $prev_headlink = null; 
     
    163163} 
    164164 
    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)); 
    166166 
    167167if ($comments_actions_page->process()) { 
     
    190190          if (!$core->error->flag()) { 
    191191               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               )); 
    193196          } 
    194197     } 
     
    325328               $core->callBehavior('adminAfterPostUpdate',$cur,$post_id); 
    326329               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               )); 
    328334          } catch (Exception $e) { 
    329335               $core->error->add($e->getMessage()); 
     
    346352 
    347353               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               )); 
    349358          } catch (Exception $e) { 
    350359               $core->error->add($e->getMessage()); 
     
    507516                         '<p>'.$post_format_field.'</p>'. 
    508517                         '<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.'&amp;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                         '">'. 
    510521                         __('Convert to XHTML').'</a></p></div>')), 
    511522          'metas-box' => array( 
     
    604615 
    605616     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">'; 
    607618     echo '<div id="entry-wrapper">'; 
    608619     echo '<div id="entry-content"><div class="constrained">'; 
     
    682693 
    683694     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">'; 
    685696     } 
    686697 
Note: See TracChangeset for help on using the changeset viewer.

Sites map