mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
issue 27 comment status refactoring
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8460 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
23453c0aac
commit
e56c8ee2a1
12 changed files with 106 additions and 25 deletions
|
|
@ -243,7 +243,7 @@
|
|||
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$obj->allow_comment = 'Y';
|
||||
$obj->commentStatus = 'ALLOW';
|
||||
$obj->allow_trackback = 'Y';
|
||||
$output = $oDocumentController->insertDocument($obj);
|
||||
|
||||
|
|
@ -403,7 +403,7 @@
|
|||
$post->publish = 1;
|
||||
$post->userid = $oDocument->get('user_id');
|
||||
$post->mt_allow_pings = 0;
|
||||
$post->mt_allow_comments = $oDocument->allowComment()=='Y'?1:0;
|
||||
$post->mt_allow_comments = $oDocument->allowComment()?1:0;
|
||||
$posts[] = $post;
|
||||
}
|
||||
$content = getXmlRpcResponse($posts);
|
||||
|
|
|
|||
|
|
@ -106,6 +106,9 @@
|
|||
//2011. 05. 23 adding status column to document
|
||||
if(!$oDB->isColumnExists('documents', 'status')) return true;
|
||||
|
||||
//2011. 06. 07 check comment status update
|
||||
if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -251,8 +254,42 @@
|
|||
$oDB->dropColumn('documents', 'is_secret');
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
//2011. 06. 07 merge column, allow_comment and lock_comment
|
||||
if($oDB->isColumnExists('documents', 'allow_comment') || $oDB->isColumnExists('documents', 'lock_comment'))
|
||||
{
|
||||
$oDB->addColumn('documents', 'comment_status', 'varchar', 20, 'ALLOW');
|
||||
$columnList = array('module_srl');
|
||||
$moduleSrlList = $oModuleModel->getModuleSrlList(null, $columnList);
|
||||
|
||||
$args->commentStatus = 'DENY';
|
||||
$isSuccessUpdated = true;
|
||||
|
||||
// allow_comment='Y', lock_comment='Y'
|
||||
$args->allowComment = 'Y';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
if(!$output->toBool()) $isSuccessUpdated = false;
|
||||
|
||||
// allow_comment='N', lock_comment='Y'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
if(!$output->toBool()) $isSuccessUpdated = false;
|
||||
|
||||
// allow_comment='N', lock_comment='N'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'N';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
if(!$output->toBool()) $isSuccessUpdated = false;
|
||||
|
||||
if($isSuccessUpdated)
|
||||
{
|
||||
$oDB->dropColumn('documents', 'allow_comment');
|
||||
$oDB->dropColumn('documents', 'lock_comment');
|
||||
}
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -278,7 +315,7 @@
|
|||
|
||||
function getConfigStatus($key)
|
||||
{
|
||||
if(array_key_exists($key, $this->statusList)) return $this->statusList[$key];
|
||||
if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
|
||||
else $this->getDefaultStatus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ class documentController extends document {
|
|||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
// List variables
|
||||
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
|
||||
if($obj->lock_comment!='Y') $obj->lock_comment = 'N';
|
||||
if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
|
||||
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion(&$obj);
|
||||
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
||||
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
|
||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
|
|
@ -201,6 +201,9 @@ class documentController extends document {
|
|||
|
||||
$obj->lang_code = Context::getLangType();
|
||||
// Insert data into the DB
|
||||
debugPrint($obj->status);
|
||||
if(!$obj->status) $this->_checkDocumentStatusForOldVersion(&$obj);
|
||||
debugPrint($obj->status);
|
||||
$output = executeQuery('document.insertDocument', $obj);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
|
|
@ -275,8 +278,8 @@ class documentController extends document {
|
|||
$obj->ipaddress = $source_obj->get('ipaddress');
|
||||
}
|
||||
// List variables
|
||||
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
|
||||
if($obj->lock_comment!='Y') $obj->lock_comment = 'N';
|
||||
if(!$obj->commentStatus) $obj->commentStatus = 'DENY';
|
||||
if($obj->commentStatus == 'DENY') $this->_checkCommentStatusForOldVersion(&$obj);
|
||||
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
||||
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
|
||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
|
|
@ -544,8 +547,8 @@ class documentController extends document {
|
|||
$oTrashVO->setRemoverSrl($logged_info->member_srl);
|
||||
$oTrashVO->setRegdate(date('YmdHis'));
|
||||
|
||||
$oTrashController = &getController('trash');
|
||||
$output = $oTrashController->insertTrash($oTrashVO);
|
||||
$oTrashAdminController = &getAdminController('trash');
|
||||
$output = $oTrashAdminController->insertTrash($oTrashVO);
|
||||
if (!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
|
|
@ -1683,5 +1686,26 @@ class documentController extends document {
|
|||
$this->setMessage('success_saved');
|
||||
$this->add('document_srl', $obj->document_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief for old version, comment allow status check.
|
||||
**/
|
||||
function _checkCommentStatusForOldVersion(&$obj)
|
||||
{
|
||||
if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
|
||||
if(!isset($obj->lock_comment)) $obj->lock_comment = 'N';
|
||||
|
||||
if($obj->allow_comment == 'Y' && $obj->lock_comment == 'N') $obj->commentStatus = 'ALLOW';
|
||||
else $obj->commentStatus = 'DENY';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief for old version, document status check.
|
||||
**/
|
||||
function _checkDocumentStatusForOldVersion(&$obj)
|
||||
{
|
||||
if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
|
||||
if(!$obj->status && $obj->is_secret != 'Y') $obj->status = $this->getConfigStatus('public');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@
|
|||
function allowComment() {
|
||||
if(!$this->isExists()) return true;
|
||||
|
||||
return $this->get('allow_comment') == 'Y' ? true : false;
|
||||
return $this->get('comment_status') == 'ALLOW' ? true : false;
|
||||
}
|
||||
|
||||
function allowTrackback() {
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
|
||||
function isLocked() {
|
||||
return $this->get('lock_comment') == 'Y' ? true : false;
|
||||
return $this->get('comment_status') == 'ALLOW' ? false : true;
|
||||
}
|
||||
|
||||
function isEditable() {
|
||||
|
|
|
|||
|
|
@ -33,10 +33,9 @@
|
|||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="list_order" var="list_order" default="0" />
|
||||
<column name="update_order" var="update_order" default="0" />
|
||||
<column name="allow_comment" var="allow_comment" default="Y" />
|
||||
<column name="lock_comment" var="lock_comment" default="N" />
|
||||
<column name="allow_trackback" var="allow_trackback" default="Y" />
|
||||
<column name="notify_message" var="notify_message" default="N" />
|
||||
<column name="status" var="status" default="PUBLIC" />
|
||||
<column name="comment_status" var="commentStatus" default="ALLOW" />
|
||||
</columns>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -26,11 +26,10 @@
|
|||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="list_order" var="list_order" />
|
||||
<column name="update_order" var="update_order" default="0" />
|
||||
<column name="allow_comment" var="allow_comment" default="Y" />
|
||||
<column name="lock_comment" var="lock_comment" default="N" />
|
||||
<column name="allow_trackback" var="allow_trackback" default="Y" />
|
||||
<column name="notify_message" var="notify_message" default="N" />
|
||||
<column name="status" var="status" default="PUBLIC" />
|
||||
<column name="comment_status" var="commentStatus" default="ALLOW" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" />
|
||||
|
|
|
|||
12
modules/document/queries/updateDocumentCommentStatus.xml
Normal file
12
modules/document/queries/updateDocumentCommentStatus.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="updateDocumentCommentStatus" action="update">
|
||||
<tables>
|
||||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_status" var="commentStatus" default="ALLOW" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="allow_comment" var="allowComment" default="Y" pipe="and" />
|
||||
<condition operation="equal" column="lock_comment" var="lockComment" default="N" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="allow_comment" var="allow_comment" default="Y" />
|
||||
<column name="comment_status" var="commentStatus" default="ALLOW" />
|
||||
<column name="allow_trackback" var="allow_trackback" default="Y" />
|
||||
</columns>
|
||||
<conditions>
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@
|
|||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress" />
|
||||
<column name="list_order" type="number" size="11" notnull="notnull" index="idx_list_order" />
|
||||
<column name="update_order" type="number" size="11" notnull="notnull" index="idx_update_order" />
|
||||
<column name="allow_comment" type="char" size="1" default="Y" notnull="notnull" />
|
||||
<column name="lock_comment" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="allow_trackback" type="char" size="1" default="Y" notnull="notnull" />
|
||||
<column name="notify_message" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="status" type="varchar" size="20" default="PUBLIC" />
|
||||
<column name="comment_status" type="varchar" size="20" default="ALLOW" />
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -559,8 +559,7 @@
|
|||
if(!$obj->last_update) $obj->last_update = $obj->regdate;
|
||||
$obj->ipaddress = base64_decode($xmlDoc->post->ipaddress->body);
|
||||
$obj->list_order = $obj->update_order = $obj->document_srl*-1;
|
||||
$obj->allow_comment = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'Y':'N';
|
||||
$obj->lock_comment = base64_decode($xmlDoc->post->lock_comment->body)=='Y'?'Y':'N';
|
||||
$obj->commentStatus = base64_decode($xmlDoc->post->allow_comment->body)!='N'?'ALLOW':'DENY';
|
||||
$obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N';
|
||||
$obj->notify_message = base64_decode($xmlDoc->post->is_notice->body);
|
||||
// Change content information (attachment)
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
$obj->title = $xmlDoc->post->title->body;
|
||||
$obj->content = $xmlDoc->post->content->body;
|
||||
$obj->password = md5($xmlDoc->post->password->body);
|
||||
$obj->allow_comment = $xmlDoc->post->acceptcomment->body=='1'?'Y':'N';
|
||||
$obj->commentStatus = $xmlDoc->post->acceptcomment->body=='1'?'ALLOW':'DENY';
|
||||
$obj->allow_trackback = $xmlDoc->post->accepttrackback->body=='1'?'Y':'N';
|
||||
//$obj->allow_comment = $xmlDoc->post->acceptComment->body=='1'?'Y':'N';
|
||||
//$obj->allow_trackback = $xmlDoc->post->acceptTrackback->body=='1'?'Y':'N';
|
||||
|
|
@ -144,7 +144,6 @@
|
|||
$obj->homepage = $member_info->homepage;
|
||||
$obj->ipaddress = $_REMOTE['SERVER_ADDR'];
|
||||
$obj->list_order = $obj->update_order = $obj->document_srl*-1;
|
||||
$obj->lock_comment = 'N';
|
||||
$obj->notify_message = 'N';
|
||||
// Change content information (attachment)
|
||||
$obj->content = str_replace('[##_ATTACH_PATH_##]/','',$obj->content);
|
||||
|
|
@ -282,7 +281,7 @@
|
|||
$obj->title = cut_str(strip_tags($obj->content),20,'...');
|
||||
if ($obj->title == '') $obj->title = 'Untitled';
|
||||
|
||||
$obj->allow_comment = 'Y';
|
||||
$obj->commentStatus = 'ALLOW';
|
||||
$obj->allow_trackback = 'N';
|
||||
$obj->regdate = date("YmdHis",$val->written->body);
|
||||
$obj->last_update = date("YmdHis", $val->written->body);
|
||||
|
|
@ -307,7 +306,6 @@
|
|||
}
|
||||
$obj->ipaddress = $val->commenter->ip->body;
|
||||
$obj->list_order = $obj->update_order = $obj->document_srl*-1;
|
||||
$obj->lock_comment = 'N';
|
||||
$obj->notify_message = 'N';
|
||||
$obj->trackback_count = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -227,6 +227,20 @@
|
|||
return $mid_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a complete list of module_srl, which is created in the DB
|
||||
**/
|
||||
function getModuleSrlList($args = null, $columnList = array())
|
||||
{
|
||||
$output = executeQueryArray('module.getMidList', $args, $columnList);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
$list = $output->data;
|
||||
if(!$list) return;
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return an array of module_srl corresponding to a mid list
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue