Added comment validation system.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10272 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
dionisrom 2012-02-29 12:08:42 +00:00
parent 9307d94fc8
commit 13402bfc76
22 changed files with 417 additions and 19 deletions

View file

@ -13,6 +13,88 @@
function init() { function init() {
} }
function procCommentAdminChangePublishedStatusChecked()
{
$will_publish = Context::get('will_publish');
// Error display if none is selected
$cart = Context::get('cart');
if(!$cart)
{
return $this->stop('msg_cart_is_null');
}
if(!is_array($cart))
{
$comment_srl_list= explode('|@|', $cart);
}
else
{
$comment_srl_list = $cart;
}
$comment_count = count($comment_srl_list);
// begin transaction
// for message send - start
$message_content = Context::get('message_content');
if($message_content) $message_content = nl2br($message_content);
if($message_content) {
$oCommunicationController = &getController('communication');
$oCommentModel = &getModel('comment');
$logged_info = Context::get('logged_info');
$title = cut_str($message_content,10,'...');
$sender_member_srl = $logged_info->member_srl;
for($i=0;$i<$comment_count;$i++) {
$comment_srl = $comment_srl_list[$i];
$oComment = $oCommentModel->getComment($comment_srl, true);
if(!$oComment->get('member_srl') || $oComment->get('member_srl')==$sender_member_srl) continue;
$content = sprintf("<div>%s</div><hr /><div style=\"font-weight:bold\">%s</div>",$message_content, $oComment->getContentText(20));
$oCommunicationController->sendMessage($sender_member_srl, $oComment->get('member_srl'), $title, $content, false);
}
}
// for message send - end
$args->status = $will_publish;
$args->comment_srls_list = $comment_srl_list;
$output = executeQuery('comment.updatePublishedStatus', $args);
if(!$output->toBool()) return $output;
//update comment count for document
$updated_documents_arr = array();
// create the controller object of the document
$oDocumentController = &getController('document');
// create the comment model object
$oCommentModel = &getModel('comment');
for($i=0;$i<$comment_count;$i++)
{
$comment_srl = $comment_srl_list[$i];
// check if comment already exists
$comment = $oCommentModel->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
$document_srl = $comment->document_srl;
if (!in_array($document_srl,$updated_documents_arr))
{
$updated_documents_arr[] = $document_srl;
// update the number of comments
$comment_count = $oCommentModel->getCommentCount($document_srl);
// update comment count of the article posting
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
}
}
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_keyword', '');
header('location:'.$returnUrl);
return;
}
}
/** /**
* @brief Delete the selected comment from the administrator page * @brief Delete the selected comment from the administrator page
**/ **/

View file

@ -25,18 +25,35 @@
$args->sort_index = 'list_order'; // /< Sorting values $args->sort_index = 'list_order'; // /< Sorting values
$args->module_srl = Context::get('module_srl'); $args->module_srl = Context::get('module_srl');
/*
$search_target = Context::get('search_target');
$search_keyword = Context::get('search_keyword');
if ($search_target == 'is_published' && $search_keyword == 'Y')
{
$args->status = 1;
}
if ($search_target == 'is_published' && $search_keyword == 'N')
{
$args->status = 0;
}
*/
// get a list by using comment->getCommentList. // get a list by using comment->getCommentList.
$oCommentModel = &getModel('comment'); $oCommentModel = &getModel('comment');
$secretNameList = $oCommentModel->getSecretNameList(); $secretNameList = $oCommentModel->getSecretNameList();
$columnList = array('comment_srl', 'document_srl', 'is_secret', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress'); $columnList = array('comment_srl', 'document_srl', 'is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress');
$output = $oCommentModel->getTotalCommentList($args, $columnList); $output = $oCommentModel->getTotalCommentList($args, $columnList);
$oCommentModel = &getModel("comment");
$modules = $oCommentModel->getDistinctModules();
$modules_list = $modules;
// set values in the return object of comment_model:: getTotalCommentList() in order to use a template. // set values in the return object of comment_model:: getTotalCommentList() in order to use a template.
Context::set('total_count', $output->total_count); Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page); Context::set('total_page', $output->total_page);
Context::set('page', $output->page); Context::set('page', $output->page);
Context::set('comment_list', $output->data); Context::set('comment_list', $output->data);
Context::set('modules_list', $modules_list);
Context::set('page_navigation', $output->page_navigation); Context::set('page_navigation', $output->page_navigation);
Context::set('secret_name_list', $secretNameList); Context::set('secret_name_list', $secretNameList);
// set the template // set the template

View file

@ -57,7 +57,16 @@
if (!$oDB->isIndexExists("comments", "idx_module_list_order")) if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
return true; return true;
//2012. 02. 24 add comment published status column and index
if(!$oDB->isColumnExists("comments", "status"))
{
return true;
}
if (!$oDB->isIndexExists("comments", "idx_status"))
{
return true;
}
return false; return false;
} }
@ -93,7 +102,7 @@
} }
if(!$oDB->isColumnExists("comment_voted_log", "point")) if(!$oDB->isColumnExists("comment_voted_log", "point"))
$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true); $oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true);
if (!$oDB->isIndexExists("comments", "idx_module_list_order")) if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
$oDB->addIndex $oDB->addIndex
( (
@ -103,6 +112,19 @@
true true
); );
//2012. 02. 24 add comment published status column and index
if(!$oDB->isColumnExists("comments", "status")) {
$oDB->addColumn("comments", "status", "number", 1, 1, true);
}
if (!$oDB->isIndexExists("comments", "idx_status"))
$oDB->addIndex
(
"comments",
"idx_status",
array("status", "comment_srl", "module_srl", "document_srl"),
true
);
return new Object(0, 'success_updated'); return new Object(0, 'success_updated');
} }

View file

@ -98,11 +98,62 @@
$_SESSION['own_comment'][$comment_srl] = true; $_SESSION['own_comment'][$comment_srl] = true;
} }
/**
*@brief Check if module is using comment validation system
* @param number $document_srl
* @return boolean
*/
function isModuleUsingPublishValidation($document_srl=null, $module_srl=null)
{
$oModuleModel = &getModel('module');
if(!is_null($document_srl))
{
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
}
if(!is_null($module_srl))
{
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
}
$module_part_config = $oModuleModel->getModulePartConfig('comment',$module_info->module_srl);
$use_validation = false;
if (isset($module_part_config->use_comment_validation) && $module_part_config->use_comment_validation == "Y")
{
$use_validation = true;
}
return $use_validation;
}
/** /**
* @brief Enter comments * @brief Enter comments
**/ **/
function insertComment($obj, $manual_inserted = false) { function insertComment($obj, $manual_inserted = false) {
$obj->__isupdate = false;
// check if comment's module is using comment validation and set the publish status to 0 (false)
// for inserting query, otherwhise default is 1 (true - means comment is published)
$using_validation = $this->isModuleUsingPublishValidation($obj->document_srl);
if(Context::get('is_logged'))
{
$logged_info = Context::get('logged_info');
if ($logged_info->is_admin == 'Y')
{
$is_admin = true;
}
else
{
$is_admin = false;
}
}
if (!$using_validation || $is_admin)
{
$obj->status = 1;
}
else
{
$obj->status = 0;
}
$obj->__isupdate = false;
// call a trigger (before) // call a trigger (before)
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj); $output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
@ -195,7 +246,7 @@
} }
} }
$output = executeQuery('comment.insertCommentList', $list_args); $output = executeQuery('comment.insertCommentList', $list_args);
if(!$output->toBool()) return $output; if(!$output->toBool()) return $output;
// insert comment // insert comment
@ -211,7 +262,10 @@
// create the controller object of the document // create the controller object of the document
$oDocumentController = &getController('document'); $oDocumentController = &getController('document');
// Update the number of comments in the post // Update the number of comments in the post
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true); if (!$using_validation || $is_admin)
{
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true);
}
// grant autority of the comment // grant autority of the comment
$this->addGrant($obj->comment_srl); $this->addGrant($obj->comment_srl);
// call a trigger(after) // call a trigger(after)
@ -636,7 +690,10 @@
$comment_config->use_vote_down = Context::get('use_vote_down'); $comment_config->use_vote_down = Context::get('use_vote_down');
if(!$comment_config->use_vote_down) $comment_config->use_vote_down = 'Y'; if(!$comment_config->use_vote_down) $comment_config->use_vote_down = 'Y';
$comment_config->use_comment_validation = Context::get('use_comment_validation');
if(!$comment_config->use_comment_validation) $comment_config->use_comment_validation = 'N';
for($i=0;$i<count($module_srl);$i++) { for($i=0;$i<count($module_srl);$i++) {
$srl = trim($module_srl[$i]); $srl = trim($module_srl[$i]);
if(!$srl) continue; if(!$srl) continue;

View file

@ -119,7 +119,7 @@
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list); if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
// fetch from a database // fetch from a database
$args->comment_srls = $comment_srls; $args->comment_srls = $comment_srls;
$output = executeQuery('comment.getComments', $args, $columnList); $output = executeQuery('comment.getComments', $args, $columnList);
if(!$output->toBool()) return; if(!$output->toBool()) return;
$comment_list = $output->data; $comment_list = $output->data;
if(!$comment_list) return; if(!$comment_list) return;
@ -143,6 +143,15 @@
**/ **/
function getCommentCount($document_srl) { function getCommentCount($document_srl) {
$args->document_srl = $document_srl; $args->document_srl = $document_srl;
//check if module is using validation system
$oCommentController = &getController('comment');
$using_validation = $oCommentController->isModuleUsingPublishValidation($document_srl);
if($using_validation)
{
$args->status = 1;
}
$output = executeQuery('comment.getCommentCount', $args); $output = executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count; $total_count = $output->data->count;
return (int)$total_count; return (int)$total_count;
@ -164,14 +173,49 @@
/** /**
* @brief get the total number of comments in corresponding with module_srl. * @brief get the total number of comments in corresponding with module_srl.
**/ **/
function getCommentAllCount($module_srl) { function getCommentAllCount($module_srl,$published=null) {
$args->module_srl = $module_srl; $args->module_srl = $module_srl;
if(is_null($published))
{
// check if module is using comment validation system
$oCommentController = &getController("comment");
$is_using_validation = $oCommentController->isModuleUsingPublishValidation(null,$module_srl);
if($is_using_validation)
{
$args->status = 1;
}
}
else
{
if ($published)
{
$args->status = 1;
}
else
{
$args->status = 0;
}
}
$output = executeQuery('comment.getCommentCount', $args); $output = executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count; $total_count = $output->data->count;
return (int)$total_count; return (int)$total_count;
} }
function getDistinctModules()
{
$output = executeQuery('comment.getDistinctModules');
$module_srls = $output->data;
$oModuleModel = &getModel('module');
$result = array();
foreach($module_srls as $module)
{
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module->module_srl);
$result[$module->module_srl] = $module_info->mid;
}
return $result;
}
/** /**
* @brief get the comment in corresponding with mid. * @brief get the comment in corresponding with mid.
@ -195,6 +239,17 @@
$output = $oCacheHandler->get($cache_key); $output = $oCacheHandler->get($cache_key);
} }
if(!$output){ if(!$output){
if(strpos($args->module_srl,",")===false)
{
// check if module is using comment validation system
$oCommentController = &getController("comment");
$is_using_validation = $oCommentController->isModuleUsingPublishValidation(null,$obj->module_srl);
if($is_using_validation)
{
$args->status = 1;
}
}
$output = executeQuery('comment.getNewestCommentList', $args, $columnList); $output = executeQuery('comment.getNewestCommentList', $args, $columnList);
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output); if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
} }
@ -255,6 +310,16 @@
$args->list_count = $comment_count; $args->list_count = $comment_count;
$args->page = $page; $args->page = $page;
$args->page_count = 10; $args->page_count = 10;
//check if module is using validation system
$oCommentController = &getController('comment');
$using_validation = $oCommentController->isModuleUsingPublishValidation($document_srl);
if($using_validation)
{
$args->status = 1;
}
$output = executeQueryArray('comment.getCommentPageList', $args); $output = executeQueryArray('comment.getCommentPageList', $args);
// return if an error occurs in the query results // return if an error occurs in the query results
if(!$output->toBool()) return; if(!$output->toBool()) return;
@ -366,6 +431,15 @@
$args->page_count = $obj->page_count?$obj->page_count:10; $args->page_count = $obj->page_count?$obj->page_count:10;
$args->s_module_srl = $obj->module_srl; $args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl; $args->exclude_module_srl = $obj->exclude_module_srl;
// check if module is using comment validation system
$oCommentController = &getController("comment");
$is_using_validation = $oCommentController->isModuleUsingPublishValidation(null,$obj->module_srl);
if ($is_using_validation)
{
$args->s_is_published = 1;
}
// Search options // Search options
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target')); $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword')); $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
@ -408,7 +482,20 @@
break; break;
case 'is_secret' : case 'is_secret' :
$args->s_is_secret= $search_keyword; $args->s_is_secret= $search_keyword;
break;
case 'is_published' :
if($search_keyword == 'Y')
{
$args->s_is_published = 1;
}
if($search_keyword == 'N')
{
$args->s_is_published = 0;
}
break; break;
case 'module':
$args->s_module_srl = (int)$search_keyword;
break;
case 'member_srl' : case 'member_srl' :
$args->{"s_".$search_target} = (int)$search_keyword; $args->{"s_".$search_target} = (int)$search_keyword;
break; break;

View file

@ -15,7 +15,9 @@
<action name="getCommentVotedMemberList" type="model" standalone="true" /> <action name="getCommentVotedMemberList" type="model" standalone="true" />
<action name="procCommentInsertModuleConfig" type="controller" standalone="true" ruleset="insertCommentModuleConfig" /> <action name="procCommentInsertModuleConfig" type="controller" standalone="true" ruleset="insertCommentModuleConfig" />
<action name="procCommentAdminDeleteChecked" type="controller" standalone="true" ruleset="deleteChecked" /> <action name="procCommentAdminDeleteChecked" type="controller" standalone="true" ruleset="deleteChecked" />
<action name="procCommentAdminCancelDeclare" type="controller" standalone="true" /> <action name="procCommentAdminChangePublishedStatusChecked" type="controller" standalone="true" />
<action name="isModuleUsingPublishValidation" type="controller" standalone="true" />
<action name="procCommentAdminCancelDeclare" type="controller" standalone="true" />
<action name="procCommentAdminAddCart" type="controller" standalone="true" /> <action name="procCommentAdminAddCart" type="controller" standalone="true" />
<action name="procCommentGetList" type="controller" standalone="true" /> <action name="procCommentGetList" type="controller" standalone="true" />
</actions> </actions>

View file

@ -248,6 +248,14 @@
<value xml:lang="zh-TW"><![CDATA[公開]]></value> <value xml:lang="zh-TW"><![CDATA[公開]]></value>
</item> </item>
</item> </item>
<item name="published_name_list" type="array">
<item name="Y">
<value xml:lang="en"><![CDATA[Published]]></value>
</item>
<item name="N">
<value xml:lang="en"><![CDATA[Unpublished]]></value>
</item>
</item>
<item name="comment_manager"> <item name="comment_manager">
<value xml:lang="ko"><![CDATA[선택한 댓글 관리]]></value> <value xml:lang="ko"><![CDATA[선택한 댓글 관리]]></value>
<value xml:lang="en"><![CDATA[Manage Selected Comment]]></value> <value xml:lang="en"><![CDATA[Manage Selected Comment]]></value>
@ -260,4 +268,19 @@
<value xml:lang="jp"><![CDATA[選択したコメント]]></value> <value xml:lang="jp"><![CDATA[選択したコメント]]></value>
<value xml:lang="zh-TW"><![CDATA[已選回覆]]></value> <value xml:lang="zh-TW"><![CDATA[已選回覆]]></value>
</item> </item>
<item name="cmd_comment_validation">
<value xml:lang="en"><![CDATA[Use comment validation]]></value>
</item>
<item name="about_comment_validation">
<value xml:lang="en"><![CDATA[If you want to use comment validation before displaying on your module frontend select USE, otherwise select NOT USE.]]></value>
</item>
<item name="published">
<value xml:lang="en"><![CDATA[Publish status]]></value>
</item>
<item name="cmd_publish">
<value xml:lang="en"><![CDATA[Publish]]></value>
</item>
<item name="cmd_unpublish">
<value xml:lang="en"><![CDATA[Unpublish]]></value>
</item>
</lang> </lang>

View file

@ -6,7 +6,8 @@
<column name="count(*)" alias="count" /> <column name="count(*)" alias="count" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" /> <condition operation="equal" column="status" var="status" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" pipe="and" />
<condition operation="in" column="module_srl" var="module_srl" filter="number" pipe="and" /> <condition operation="in" column="module_srl" var="module_srl" filter="number" pipe="and" />
<condition operation="like_prefix" column="regdate" var="regDate" pipe="and" /> <condition operation="like_prefix" column="regdate" var="regDate" pipe="and" />
</conditions> </conditions>

View file

@ -8,12 +8,14 @@
<column name="comments_list.depth" alias="depth" /> <column name="comments_list.depth" alias="depth" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="comments_list.document_srl" var="document_srl" notnull="notnull" pipe="and" /> <condition operation="equal" column="comments.status" var="status" pipe="and" />
<condition operation="equal" column="comments_list.document_srl" var="document_srl" notnull="notnull" pipe="and" />
<condition operation="equal" column="comments_list.comment_srl" var="comments.comment_srl" filter="number" pipe="and" /> <condition operation="equal" column="comments_list.comment_srl" var="comments.comment_srl" filter="number" pipe="and" />
<condition operation="more" column="comments_list.head" default="0" pipe="and" /> <condition operation="more" column="comments_list.head" default="0" pipe="and" />
<condition operation="more" column="comments_list.arrange" default="0" pipe="and" /> <condition operation="more" column="comments_list.arrange" default="0" pipe="and" />
</conditions> </conditions>
<navigation> <navigation>
<index var="list_order" default="comments.status" order="desc" />
<index var="list_order" default="comments_list.head" order="asc" /> <index var="list_order" default="comments_list.head" order="asc" />
<index var="list_order" default="comments_list.arrange" order="asc" /> <index var="list_order" default="comments_list.arrange" order="asc" />
<list_count var="list_count" default="list_count" /> <list_count var="list_count" default="list_count" />

View file

@ -0,0 +1,8 @@
<query id="getDistinctModules" action="select">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="DISTINCT(module_srl)" />
</columns>
</query>

View file

@ -6,9 +6,11 @@
<column name="*" /> <column name="*" />
</columns> </columns>
<conditions> <conditions>
<condition operation="in" column="module_srl" var="module_srl" filter="number" /> <condition operation="equal" column="status" var="status" pipe="and" />
<condition operation="in" column="module_srl" var="module_srl" filter="number" pipe="and" />
</conditions> </conditions>
<navigation> <navigation>
<index var="sort_index" default="status" order="desc" />
<index var="sort_index" default="list_order" order="asc" /> <index var="sort_index" default="list_order" order="asc" />
<list_count var="list_count" default="20" /> <list_count var="list_count" default="20" />
</navigation> </navigation>

View file

@ -9,6 +9,7 @@
<condition operation="in" column="module_srl" var="s_module_srl" /> <condition operation="in" column="module_srl" var="s_module_srl" />
<condition operation="notin" column="module_srl" var="exclude_module_srl" pipe="and" /> <condition operation="notin" column="module_srl" var="exclude_module_srl" pipe="and" />
<condition operation="equal" column="is_secret" var="s_is_secret" pipe="and" /> <condition operation="equal" column="is_secret" var="s_is_secret" pipe="and" />
<condition operation="equal" column="status" var="s_is_published" pipe="and" />
<group pipe="and"> <group pipe="and">
<condition operation="like" column="content" var="s_content" pipe="or" /> <condition operation="like" column="content" var="s_content" pipe="or" />
<condition operation="like" column="user_name" var="s_user_name" pipe="or" /> <condition operation="like" column="user_name" var="s_user_name" pipe="or" />

View file

@ -24,5 +24,6 @@
<column name="last_update" var="last_update" default="curdate()" /> <column name="last_update" var="last_update" default="curdate()" />
<column name="ipaddress" var="ipaddress" default="ipaddress()" /> <column name="ipaddress" var="ipaddress" default="ipaddress()" />
<column name="list_order" var="list_order" default="0" /> <column name="list_order" var="list_order" default="0" />
<column name="status" var="status" notnull="notnull" default="0" />
</columns> </columns>
</query> </query>

View file

@ -0,0 +1,12 @@
<query id="updatePublishedStatus" action="update">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="status" var="status" notnull="notnull" />
</columns>
<conditions>
<condition operation="in" column="comment_srl" var="comment_srls_list" notnull="notnull" pipe="or" />
<condition operation="in" column="parent_srl" var="comment_srls_list" notnull="notnull" pipe="or" />
</conditions>
</query>

View file

@ -20,4 +20,5 @@
<column name="last_update" type="date" index="idx_last_update" /> <column name="last_update" type="date" index="idx_last_update" />
<column name="ipaddress" type="varchar" size="128" notnull="notnull" index="idx_ipaddress" /> <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="list_order" type="number" size="11" notnull="notnull" index="idx_list_order" />
<column name="status" type="number" size="1" default="1" notnull="notnull" index="idx_status" />
</table> </table>

View file

@ -11,9 +11,18 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<h1 class="h1">{$lang->comment}</h1> <h1 class="h1">{$lang->comment}</h1>
<div class="table even"> <div class="table even">
<div class="cnb"> <div class="cnb">
<a href="{getUrl('','act','dispCommentAdminList', 'Y')}" <!--@if($search_keyword == '')-->class="active"<!--@end-->>{$lang->all}</a> <a href="{getUrl('search_keyword','','act','dispCommentAdminList', 'Y')}" <!--@if($search_keyword == '')-->class="active"<!--@end-->>{$lang->all}</a>
| <a href="{getUrl('search_target','is_secret','search_keyword', 'N')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'N')-->class="active"<!--@end-->>{$secret_name_list['N']}</a> | <a href="{getUrl('search_target','is_secret','search_keyword', 'N')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'N')-->class="active"<!--@end-->>{$secret_name_list['N']}</a>
| <a href="{getUrl('search_target','is_secret','search_keyword', 'Y')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$secret_name_list['Y']}</a> | <a href="{getUrl('search_target','is_secret','search_keyword', 'Y')}" <!--@if($search_target == 'is_secret' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$secret_name_list['Y']}</a>
| <a href="{getUrl('search_target','is_published','search_keyword', 'N')}" <!--@if($search_target == 'is_published' && $search_keyword == 'N')-->class="active"<!--@end-->>{$lang->published_name_list['N']}</a>
| <a href="{getUrl('search_target','is_published','search_keyword', 'Y')}" <!--@if($search_target == 'is_published' && $search_keyword == 'Y')-->class="active"<!--@end-->>{$lang->published_name_list['Y']}</a>
| <label for="comment_modules" <!--@if($search_target == 'module')-->class="active"<!--@end-->>Select Module:
<select id="comment_modules" name="comment_modules" onchange="location.href='{getUrl('search_target','module','search_keyword','')}&search_keyword='+this.value">
<option></option>
<!--@foreach($modules_list as $key => $node)-->
<option value="{$key}"<!--@if($key==$search_keyword)-->selected<!--@end-->>{$node}</option>
<!--@end-->
</select></label>
</div> </div>
<table width="100%" border="1" cellspacing="0" id="commentListTable"> <table width="100%" border="1" cellspacing="0" id="commentListTable">
<caption> <caption>
@ -23,6 +32,10 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
{$secret_name_list['N']} {$secret_name_list['N']}
<!--@elseif($search_target == 'is_secret' && $search_keyword == 'Y')--> <!--@elseif($search_target == 'is_secret' && $search_keyword == 'Y')-->
{$secret_name_list['Y']} {$secret_name_list['Y']}
<!--@elseif($search_target == 'is_published' && $search_keyword == 'N')-->
{$published_name_list['N']}
<!--@elseif($search_target == 'is_published' && $search_keyword == 'Y')-->
{$published_name_list['Y']}
<!--@end--> <!--@end-->
({number_format($total_count)}) ({number_format($total_count)})
<div class="side"> <div class="side">
@ -37,6 +50,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<th scope="col" class="nowr">{$lang->date}</th> <th scope="col" class="nowr">{$lang->date}</th>
<th scope="col" class="nowr">{$lang->ipaddress}</th> <th scope="col" class="nowr">{$lang->ipaddress}</th>
<th scope="col" class="nowr">{$lang->status}</th> <th scope="col" class="nowr">{$lang->status}</th>
<th scope="col">{$lang->published}</th>
<th scope="col"><input type="checkbox" data-name="cart" title="Check All" /></th> <th scope="col"><input type="checkbox" data-name="cart" title="Check All" /></th>
</tr> </tr>
</thead> </thead>
@ -48,6 +62,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<th scope="col" class="nowr">{$lang->date}</th> <th scope="col" class="nowr">{$lang->date}</th>
<th scope="col" class="nowr">{$lang->ipaddress}</th> <th scope="col" class="nowr">{$lang->ipaddress}</th>
<th scope="col" class="nowr">{$lang->status}</th> <th scope="col" class="nowr">{$lang->status}</th>
<th scope="col">{$lang->published}</th>
<th scope="col"><input type="checkbox" data-name="cart" title="Check All" /></th> <th scope="col"><input type="checkbox" data-name="cart" title="Check All" /></th>
</tr> </tr>
</tfoot> </tfoot>
@ -61,6 +76,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<td class="nowr">{(zdate($val->regdate,"Y-m-d\nH:i:s"))}</td> <td class="nowr">{(zdate($val->regdate,"Y-m-d\nH:i:s"))}</td>
<td class="nowr"><a href="{getUrl('search_target','ipaddress','search_keyword',$val->ipaddress)}">{$val->ipaddress}</a></td> <td class="nowr"><a href="{getUrl('search_target','ipaddress','search_keyword',$val->ipaddress)}">{$val->ipaddress}</a></td>
<td class="nowr"><!--@if($val->isSecret())-->{$secret_name_list['Y']}<!--@else-->{$secret_name_list['N']}<!--@end--></td> <td class="nowr"><!--@if($val->isSecret())-->{$secret_name_list['Y']}<!--@else-->{$secret_name_list['N']}<!--@end--></td>
<td><!--@if($val->status)-->{$lang->published_name_list['Y']}<!--@else-->{$lang->published_name_list['N']}<!--@end--></td>
<td><input type="checkbox" name="cart" value="{$val->comment_srl}" /></td> <td><input type="checkbox" name="cart" value="{$val->comment_srl}" /></td>
</tr> </tr>
<!--@end--> <!--@end-->
@ -77,6 +93,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<input type="hidden" name="act" value="procCommentAdminDeleteChecked" /> <input type="hidden" name="act" value="procCommentAdminDeleteChecked" />
<input type="hidden" name="page" value="{$page}" /> <input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_trash" value="false" /> <input type="hidden" name="is_trash" value="false" />
<input type="hidden" name="will_publish" value="0" />
<input type="hidden" name="search_target" value="{$search_target}" /> <input type="hidden" name="search_target" value="{$search_target}" />
<input type="hidden" name="search_keyword" value="{$search_keyword}" /> <input type="hidden" name="search_keyword" value="{$search_keyword}" />
<h2 class="h2">{$lang->comment_manager}</h2> <h2 class="h2">{$lang->comment_manager}</h2>
@ -90,6 +107,7 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<th scope="col" class="title">{$lang->comment}</th> <th scope="col" class="title">{$lang->comment}</th>
<th scope="col" class="nowr">{$lang->writer}</th> <th scope="col" class="nowr">{$lang->writer}</th>
<th scope="col" class="nowr">{$lang->status}</th> <th scope="col" class="nowr">{$lang->status}</th>
<th scope="col">{$lang->published}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -101,6 +119,14 @@ xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
<textarea cols="42" rows="3" name="message_content" id="message" style="width:98%"></textarea> <textarea cols="42" rows="3" name="message_content" id="message" style="width:98%"></textarea>
</p> </p>
<div class="btnArea"> <div class="btnArea">
<!--@if ($search_target=='is_published' && $search_keyword=="N")-->
<span class="btn"><button type="submit" name="will_publish" value="1" onclick="doChangePublishedStatus(this.value);">{$lang->cmd_publish}</button></span>
<!--@elseif ($search_target=='is_published' && $search_keyword=="Y")-->
<span class="btn"><button type="submit" name="will_publish" value="0" onclick="doChangePublishedStatus(this.value);">{$lang->cmd_unpublish}</button></span>
<!--@else-->
<span class="btn"><button type="submit" name="will_publish" value="1" onclick="doChangePublishedStatus(this.value);">{$lang->cmd_publish}</button></span>
<span class="btn"><button type="submit" name="will_publish" value="0" onclick="doChangePublishedStatus(this.value);">{$lang->cmd_unpublish}</button></span>
<!--@end-->
<span class="btn"><button type="submit" name="is_trash" value="true">{$lang->cmd_trash}</button></span> <span class="btn"><button type="submit" name="is_trash" value="true">{$lang->cmd_trash}</button></span>
<span class="btn"><button type="submit" name="is_trash" value="false">{$lang->cmd_delete}</button></span> <span class="btn"><button type="submit" name="is_trash" value="false">{$lang->cmd_delete}</button></span>
</div> </div>

View file

@ -32,6 +32,16 @@
<option value="N" selected="selected"|cond="$comment_config->use_vote_down=='N'">{$lang->notuse}</option> <option value="N" selected="selected"|cond="$comment_config->use_vote_down=='N'">{$lang->notuse}</option>
</select> </select>
</td> </td>
</tr>
<tr>
<th scope="row"><label for="use_comment_validation">{$lang->cmd_comment_validation}</label></th>
<td>
<select name="use_comment_validation">
<option value="N" selected="selected"|cond="$comment_config->use_comment_validation=='N'">{$lang->notuse}</option>
<option value="Y" selected="selected"|cond="$comment_config->use_comment_validation=='Y'">{$lang->use}</option>
</select>
<p>{$lang->about_comment_validation}</p>
</td>
</tr> </tr>
</table> </table>
</div> </div>

View file

@ -40,7 +40,7 @@ function completeGetCommentList(ret_obj, response_tags)
{ {
var htmlListBuffer = ''; var htmlListBuffer = '';
var statusNameList = {"N":"Public", "Y":"Secret"}; var statusNameList = {"N":"Public", "Y":"Secret"};
var publishedStatusList = {0:'Unpublished', 1:'Published'};
if(ret_obj['comment_list'] == null) if(ret_obj['comment_list'] == null)
{ {
htmlListBuffer = '<tr>' + htmlListBuffer = '<tr>' +
@ -58,6 +58,7 @@ function completeGetCommentList(ret_obj, response_tags)
'<td class="title">'+ objComment.content +'</td>' + '<td class="title">'+ objComment.content +'</td>' +
'<td class="nowr">'+ objComment.nick_name +'</td>' + '<td class="nowr">'+ objComment.nick_name +'</td>' +
'<td class="nowr">'+ statusNameList[objComment.is_secret] +'</td>' + '<td class="nowr">'+ statusNameList[objComment.is_secret] +'</td>' +
'<td>'+ publishedStatusList[objComment.status] +'</td>' +
'</tr>' + '</tr>' +
'<input type="hidden" name="cart[]" value="'+objComment.comment_srl+'" />'; '<input type="hidden" name="cart[]" value="'+objComment.comment_srl+'" />';
} }
@ -66,6 +67,16 @@ function completeGetCommentList(ret_obj, response_tags)
jQuery('#commentManageListTable>tbody').html(htmlListBuffer); jQuery('#commentManageListTable>tbody').html(htmlListBuffer);
} }
function doChangePublishedStatus(new_status)
{
container_div = jQuery("#listManager");
var act = container_div.find("input[name=act]");
var will_publish = container_div.find("input[name=will_publish]");
var action = "procCommentAdminChangePublishedStatusChecked";
will_publish.val(new_status);
act.val(action);
}
function checkSearch(form) function checkSearch(form)
{ {
if(form.search_target.value == '') if(form.search_target.value == '')

View file

@ -534,6 +534,7 @@
// Create commentItem object from a comment list // Create commentItem object from a comment list
// If admin priviledge is granted on parent posts, you can read its child posts. // If admin priviledge is granted on parent posts, you can read its child posts.
$accessible = array(); $accessible = array();
$comment_list = array();
foreach($output->data as $key => $val) { foreach($output->data as $key => $val) {
$oCommentItem = new commentItem(); $oCommentItem = new commentItem();
$oCommentItem->setAttribute($val); $oCommentItem->setAttribute($val);
@ -845,5 +846,23 @@
} }
return false; return false;
} }
public function getTranslationLangCodes()
{
$obj->document_srl = $this->document_srl;
// -2 is an index for content. We are interested if content has other translations.
$obj->var_idx = -2;
$output = executeQueryArray('document.getDocumentTranslationLangCodes', $obj);
if (!$output->data)
{
$output->data = array();
}
// add original page's lang code as well
$origLangCode->lang_code = $this->getLangCode();
$output->data[] = $origLangCode;
return $output->data;
}
} }
?> ?>

View file

@ -0,0 +1,12 @@
<query id="getDocumentTranslationLangCodes" action="select">
<tables>
<table name="document_extra_vars" />
</tables>
<columns>
<column name="DISTINCT(lang_code)" />
</columns>
<conditions>
<condition operation="equal" column="document_srl" var="document_srl" notnull="notnull" />
<condition operation="equal" column="var_idx" var="var_idx" default="-2" notnull="notnull" pipe="and" />
</conditions>
</query>

View file

@ -3,7 +3,8 @@
<table name="comments" /> <table name="comments" />
<table name="documents" type="left outer join" > <table name="documents" type="left outer join" >
<conditions> <conditions>
<condition operation="equal" column="comments.document_srl" default="documents.document_srl" /> <condition operation="equal" column="comments.status" default="1" pipe="and" />
<condition operation="equal" column="comments.document_srl" default="documents.document_srl" pipe="and" />
</conditions> </conditions>
</table> </table>
</tables> </tables>

View file

@ -7,7 +7,8 @@
<column name="count(*)" alias="count" /> <column name="count(*)" alias="count" />
</columns> </columns>
<conditions> <conditions>
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" /> <condition operation="equal" column="status" default="1" notnull="notnull" pipe="and" />
<condition operation="equal" column="document_srl" var="document_srl" filter="number" notnull="notnull" pipe="and" />
<condition operation="excess" column="member_srl" default="0" pipe="and" /> <condition operation="excess" column="member_srl" default="0" pipe="and" />
</conditions> </conditions>
<groups> <groups>