merge from 1.5.2

git-svn-id: http://xe-core.googlecode.com/svn/trunk@10446 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-03-20 08:03:02 +00:00
parent 6c23751ef8
commit c727926d9e
382 changed files with 6855 additions and 3603 deletions

View file

@ -119,7 +119,7 @@
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
// fetch from a database
$args->comment_srls = $comment_srls;
$output = executeQuery('comment.getComments', $args, $columnList);
$output = executeQuery('comment.getComments', $args, $columnList);
if(!$output->toBool()) return;
$comment_list = $output->data;
if(!$comment_list) return;
@ -143,6 +143,23 @@
**/
function getCommentCount($document_srl) {
$args->document_srl = $document_srl;
// get the number of comments on the document module
$oDocumentModel = &getModel('document');
$columnList = array('document_srl', 'module_srl');
$oDocument = $oDocumentModel->getDocument($document_srl, false, true, $columnList);
// return if no doc exists.
if(!$oDocument->isExists()) return;
// get a list of comments
$module_srl = $oDocument->get('module_srl');
//check if module is using validation system
$oCommentController = &getController('comment');
$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
if($using_validation)
{
$args->status = 1;
}
$output = executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count;
return (int)$total_count;
@ -164,14 +181,52 @@
/**
* @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;
if(is_null($published))
{
// check if module is using comment validation system
$oCommentController = &getController("comment");
$is_using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
if($is_using_validation)
{
$args->status = 1;
}
}
else
{
if ($published)
{
$args->status = 1;
}
else
{
$args->status = 0;
}
}
$output = executeQuery('comment.getCommentCount', $args);
$total_count = $output->data->count;
return (int)$total_count;
}
function getDistinctModules()
{
$output = executeQuery('comment.getDistinctModules');
$module_srls = $output->data;
$oModuleModel = &getModel('module');
$result = array();
if($module_srls)
{
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.
@ -195,6 +250,17 @@
$output = $oCacheHandler->get($cache_key);
}
if(!$output){
if(strpos($args->module_srl,",")===false)
{
// check if module is using comment validation system
$oCommentController = &getController("comment");
$is_using_validation = $oCommentController->isModuleUsingPublishValidation($obj->module_srl);
if($is_using_validation)
{
$args->status = 1;
}
}
$output = executeQuery('comment.getNewestCommentList', $args, $columnList);
if($oCacheHandler->isSupport()) $oCacheHandler->put($cache_key,$output);
}
@ -255,6 +321,16 @@
$args->list_count = $comment_count;
$args->page = $page;
$args->page_count = 10;
//check if module is using validation system
$oCommentController = &getController('comment');
$using_validation = $oCommentController->isModuleUsingPublishValidation($module_srl);
if($using_validation)
{
$args->status = 1;
}
$output = executeQueryArray('comment.getCommentPageList', $args);
// return if an error occurs in the query results
if(!$output->toBool()) return;
@ -366,6 +442,15 @@
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->s_module_srl = $obj->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($obj->module_srl);
if ($is_using_validation)
{
$args->s_is_published = 1;
}
// Search options
$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'));
@ -408,7 +493,20 @@
break;
case 'is_secret' :
$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;
case 'module':
$args->s_module_srl = (int)$search_keyword;
break;
case 'member_srl' :
$args->{"s_".$search_target} = (int)$search_keyword;
break;