[pLog-svn] r3454 - plog/trunk/class/action/admin
mark at devel.lifetype.net
mark at devel.lifetype.net
Wed May 24 06:07:03 GMT 2006
Author: mark
Date: 2006-05-24 06:07:01 +0000 (Wed, 24 May 2006)
New Revision: 3454
Modified:
plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
Log:
Fixed the bug http://bugs.lifetype.net/view.php?id=907
Modified: plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php 2006-05-24 04:38:40 UTC (rev 3453)
+++ plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php 2006-05-24 06:07:01 UTC (rev 3454)
@@ -4,25 +4,25 @@
include_once( PLOG_CLASS_PATH."class/view/admin/adminxmlview.class.php" );
include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php");
include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
-
+
/**
* \ingroup Action
* @private
*/
class AdminSaveDraftArticleAjaxAction extends AdminAction
{
-
+
function AdminSaveDraftArticleAjaxAction( $actionInfo, $request )
{
$this->AdminAction( $actionInfo, $request );
}
-
+
function validate()
{
$this->_postText = $this->_request->getValue( "postText" );
$this->_postExtendedText = $this->_request->getValue( "postExtendedText" );
$this->_postTopic = $this->_request->getValue( "postTopic" );
-
+
// if there is no text, extended text or topic there is no point in saving anything
if( $this->_postText == "" && $this->_postExtendedTExt == "" &&
$this->_postTopic == "" ) {
@@ -30,11 +30,11 @@
$this->_view = new AdminXmlView( $this->_blogInfo, "response" );
$this->_view->setValue( "method", "saveDraftArticleAjax" );
$this->_view->setValue( "success", "0" );
- $this->_view->setValue( "message", $this->_locale->tr( "error_saving_draft" ) );
-
+ $this->_view->setValue( "message", $this->_locale->tr( "error_saving_draft" ) );
+
return false;
}
-
+
$this->_postCategories = $this->_request->getValue( "postCategories" );
$this->_postStatus = $this->_request->getValue( "postStatus" );
$this->_postSlug = $this->_request->getValue( "postSlug" );
@@ -47,7 +47,7 @@
$this->_commentsEnabled = false;
else
$this->_commentsEnabled = true;
-
+
// fetch the custom fields
$this->_customFields = $this->_request->getValue( "customField" );
@@ -77,16 +77,16 @@
$this->_postTimestamp->setDay( $this->_postDay );
$this->_postTimestamp->setMonth( $this->_postMonth );
$this->_postTimestamp->setYear( $this->_postYear );
- return true;
+ return true;
}
-
+
function perform()
- {
+ {
$status = POST_STATUS_DRAFT;
$articles = new Articles();
$postText = Textfilter::xhtmlize($this->_postText).POST_EXTENDED_TEXT_MODIFIER.Textfilter::xhtmlize($this->_postExtendedText);
- $article = new Article( $this->_postTopic, $postText, $this->_postCategories, $this->_userInfo->getId(),
+ $article = new Article( $this->_postTopic, $postText, $this->_postCategories, $this->_userInfo->getId(),
$this->_blogInfo->getId(), $status, 0, Array(), $this->_postSlug );
// set also the date before it's too late
$article->setDateObject( $this->_postTimestamp );
@@ -94,6 +94,7 @@
// prepare the custom fields
$fields = Array();
if( is_array($this->_customFields)) {
+ include_once( PLOG_CLASS_PATH."class/dao/customfields/customfieldvalue.class.php" );
foreach( $this->_customFields as $fieldId => $fieldValue ) {
// 3 of those parameters are not really need when creating a new object... it's enough that
// we know the field definition id.
@@ -102,12 +103,12 @@
}
$article->setFields( $fields );
}
-
+
// in case the post is already in the db
if( $this->_postId != "" ) {
$article->setId( $this->_postId );
$postSavedOk = $articles->updateArticle( $article );
-
+
if( $postSavedOk )
$artId = $this->_postId;
else
@@ -116,25 +117,25 @@
else {
$artId = $articles->addArticle( $article );
}
-
+
// once we have built the object, we can add it to the database
- $this->_view = new AdminXmlView( $this->_blogInfo, "response" );
- $this->_view->setValue( "method", "saveDraftArticleAjax" );
+ $this->_view = new AdminXmlView( $this->_blogInfo, "response" );
+ $this->_view->setValue( "method", "saveDraftArticleAjax" );
if( $artId )
{
$this->_view->setValue( "success", "1" );
$this->_view->setValue( "message", $this->_locale->pr( "draft_saved_ok", $this->_postTopic ) );
-
+
$result = '<id>'.$artId.'</id>';
- $this->_view->setValue( "result", $result );
+ $this->_view->setValue( "result", $result );
}
else
{
$this->_view->setValue( "success", "0" );
- $this->_view->setValue( "message", $this->_locale->tr( "error_saving_draft" ) );
+ $this->_view->setValue( "message", $this->_locale->tr( "error_saving_draft" ) );
}
-
- return true;
+
+ return true;
}
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list