Index: admin/post.php
===================================================================
--- admin/post.php	(revision 2705)
+++ admin/post.php	(revision 2708)
@@ -19,5 +19,5 @@
 $post_dt = '';
 $post_format = $core->auth->getOption('post_format');
-$post_editor = $core->auth->getOption('editor');
+$editor = $core->auth->getOption('editor');
 $post_password = '';
 $post_url = '';
@@ -41,6 +41,6 @@
 $can_delete = false;
 
-$post_headlink = '<link rel="%s" title="%s" href="post.php?id=%s" />';
-$post_link = '<a href="post.php?id=%s" title="%s">%s</a>';
+$post_headlink = '<link rel="%s" title="%s" href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&').'" />';
+$post_link = '<a href="'.$core->adminurl->get('admin.post',array('id' => "%s"),'&').'" title="%s">%s</a>';
 
 $next_link = $prev_link = $next_headlink = $prev_headlink = null;
@@ -61,10 +61,5 @@
 
 # Formaters combo
-$formaters_combo = dcAdminCombos::getFormatersCombo();
-foreach ($formaters_combo as $editor => $formats) {
-	foreach ($formats as $format) {
-		$formaters_combo[$editor][$format] = "$editor:$format";
-	}
-}
+$formaters_combo = dcAdminCombos::getFormatersCombo($editor);
 
 # Languages combo
@@ -80,6 +75,6 @@
 
 if (count($formaters_combo)==0 || !$core->auth->getOption('editor') || $core->auth->getOption('editor')=='') {
-	dcPage::addNotice("message", 
-					  sprintf(__('Choose an active editor in %s.'), 
+	dcPage::addNotice("message",
+					  sprintf(__('Choose an active editor in %s.'),
 								  '<a href="preferences.php#user-options">'.__('your preferences').'</a>'
 								  )
@@ -88,5 +83,6 @@
 
 # Get entry informations
-if (!empty($_REQUEST['id'])) {
+if (!empty($_REQUEST['id']))
+{
 	$page_title = __('Edit entry');
 
@@ -95,17 +91,15 @@
 	$post = $core->blog->getPosts($params);
 
-	if ($post->isEmpty()) {
+	if ($post->isEmpty())
+	{
 		$core->error->add(__('This entry does not exist.'));
 		$can_view_page = false;
-	} else {
+	}
+	else
+	{
 		$post_id = $post->post_id;
 		$cat_id = $post->cat_id;
 		$post_dt = date('Y-m-d H:i',strtotime($post->post_dt));
 		$post_format = $post->post_format;
-        # try to retrieve editor from post meta
-        $meta_editor = $core->meta->getMetaStr($post->post_meta,'editor');
-        if (!empty($meta_editor)) {
-            $post_editor = $meta_editor;
-        }
 		$post_password = $post->post_password;
 		$post_url = $post->post_url;
@@ -163,5 +157,5 @@
 }
 
-$comments_actions_page = new dcCommentsActionsPage($core,'post.php',array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor));
+$comments_actions_page = new dcCommentsActionsPage($core,$core->adminurl->get('admin.post'),array('id' => $post_id, '_ANCHOR'=>$anchor,'section' => $anchor));
 
 if ($comments_actions_page->process()) {
@@ -190,5 +184,8 @@
 		if (!$core->error->flag()) {
 			dcPage::addSuccessNotice(__('All pings sent.'));
-			http::redirect('post.php?id='.$post_id.'&tb=1');
+			http::redirect($core->adminurl->get(
+				'admin.post',
+				array('id' => $post_id, 'tb'=> '1')
+			));
 		}
 	}
@@ -196,13 +193,7 @@
 
 # Format excerpt and content
-elseif (!empty($_POST) && $can_edit_post) {
-
-	if (strpos($_POST['post_format'], ':')!==false) {
-		list($post_editor, $post_format) = explode(':', $_POST['post_format']);
-	} else {
-		$post_format = $_POST['post_format'];
-		$post_editor = '';
-	}
-
+elseif (!empty($_POST) && $can_edit_post)
+{
+	$post_format = $_POST['post_format'];
 	$post_excerpt = $_POST['post_excerpt'];
 	$post_content = $_POST['post_content'];
@@ -292,5 +283,4 @@
 	$cur->post_dt = $post_dt ? date('Y-m-d H:i:00',strtotime($post_dt)) : '';
 	$cur->post_format = $post_format;
-	$cur->post_meta = serialize(array('editor' => $post_editor));
 	$cur->post_password = $post_password;
 	$cur->post_lang = $post_lang;
@@ -311,10 +301,8 @@
 
 	# Update post
-	if ($post_id) {
-		try {
-            $meta = $core->meta;
-            $meta->delPostMeta($post_id,'editor');
-            $meta->setPostMeta($post_id,'editor',$post_editor);
-
+	if ($post_id)
+	{
+		try
+		{
 			# --BEHAVIOR-- adminBeforePostUpdate
 			$core->callBehavior('adminBeforePostUpdate',$cur,$post_id);
@@ -325,12 +313,20 @@
 			$core->callBehavior('adminAfterPostUpdate',$cur,$post_id);
 			dcPage::addSuccessNotice (sprintf(__('The post "%s" has been successfully updated'),html::escapeHTML($cur->post_title)));
-			http::redirect('post.php?id='.$post_id);
-		} catch (Exception $e) {
+			http::redirect($core->adminurl->get(
+				'admin.post',
+				array('id' => $post_id)
+			));
+		}
+		catch (Exception $e)
+		{
 			$core->error->add($e->getMessage());
 		}
-	} else {
+	}
+	else
+	{
 		$cur->user_id = $core->auth->userID();
 
-		try {
+		try
+		{
 			# --BEHAVIOR-- adminBeforePostCreate
 			$core->callBehavior('adminBeforePostCreate',$cur);
@@ -338,14 +334,15 @@
 			$return_id = $core->blog->addPost($cur);
 
-            $meta = $core->meta;
-            $meta->delPostMeta($return_id,'editor');
-            $meta->setPostMeta($return_id,'editor',$post_editor);
-
 			# --BEHAVIOR-- adminAfterPostCreate
 			$core->callBehavior('adminAfterPostCreate',$cur,$return_id);
 
 			dcPage::addSuccessNotice(__('Entry has been successfully created.'));
-			http::redirect('post.php?id='.$return_id);
-		} catch (Exception $e) {
+			http::redirect($core->adminurl->get(
+				'admin.post',
+				array('id' => $return_id)
+			));
+		}
+		catch (Exception $e)
+		{
 			$core->error->add($e->getMessage());
 		}
@@ -393,9 +390,4 @@
 }
 
-$admin_post_behavior = '';
-if (($core->auth->getOption('editor')==$post_editor) 
-    && in_array($post_format, $core->getFormaters($core->auth->getOption('editor')))) {
-    $admin_post_behavior = $core->callBehavior('adminPostEditor');
-}
 
 dcPage::open($page_title.' - '.__('Entries'),
@@ -403,6 +395,6 @@
 	dcPage::jsModal().
 	dcPage::jsMetaEditor().
-    $admin_post_behavior.
 	dcPage::jsLoad('js/_post.js').
+	$core->callBehavior('adminPostEditor').
 	dcPage::jsConfirmClose('entry-form','comment-form').
 	# --BEHAVIOR-- adminPostHeaders
@@ -472,16 +464,12 @@
 /* Post form if we can edit post
 -------------------------------------------------------- */
-if ($can_edit_post) {
+if ($can_edit_post)
+{
 	if (count($formaters_combo)>0 && ($core->auth->getOption('editor') && $core->auth->getOption('editor')!='')) {
-		// temporay removed until we can switch easily editor
-        // $post_format_field = form::combo('post_format',$formaters_combo,"$post_editor:$post_format",'maximal');
-
-        $post_format_field = sprintf('%s (%s)', $post_format, $post_editor);
- 		$post_format_field .= form::hidden('post_format',"$post_editor:$post_format");
+		$post_format_field = form::combo('post_format',$formaters_combo,$post_format,'maximal');
 	} else {
-		$post_format_field = sprintf(__('Choose an active editor in %s.'), 
+		$post_format_field = sprintf(__('Choose an active editor in %s.'),
 		'<a href="preferences.php#user-options">'.__('your preferences').'</a>'
 		);
-		$post_format_field .= form::hidden('post_format','xhtml');
 	}
 
@@ -507,5 +495,7 @@
 					'<p>'.$post_format_field.'</p>'.
 					'<p class="format_control control_no_xhtml">'.
-					'<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="post.php?id='.$post_id.'&amp;xconv=1">'.
+					'<a id="convert-xhtml" class="button'.($post_id && $post_format != 'wiki' ? ' hide' : '').'" href="'.
+					$core->adminurl->get('admin.post',array('id'=> $post_id,'xconv'=> '1')).
+					'">'.
 					__('Convert to XHTML').'</a></p></div>')),
 		'metas-box' => array(
@@ -604,5 +594,5 @@
 
 	echo '<div class="multi-part" title="'.($post_id ? __('Edit entry') : __('New entry')).'" id="edit-entry">';
-	echo '<form action="post.php" method="post" id="entry-form">';
+	echo '<form action="'.$core->adminurl->get('admin.post').'" method="post" id="entry-form">';
 	echo '<div id="entry-wrapper">';
 	echo '<div id="entry-content"><div class="constrained">';
@@ -682,5 +672,5 @@
 
 	if ($has_action) {
-		echo '<form action="post.php" id="form-comments" method="post">';
+		echo '<form action="'.$core->adminurl->get('admin.post').'" id="form-comments" method="post">';
 	}
 
