issue 2662 comment

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12238 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-16 01:30:37 +00:00
parent 71361410b6
commit 7eaa7bb8f9
6 changed files with 2109 additions and 1955 deletions

View file

@ -1,25 +1,26 @@
<?php
/**
* commentAdminController class
* admin controller class of the comment module
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentAdminController extends comment
{
/**
* commentAdminController class
* admin controller class of the comment module
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
* Initialization
* @return void
*/
class commentAdminController extends comment {
function init()
{
}
/**
* Initialization
* @return void
*/
function init() {
}
/**
* Modify comment(s) status to publish/unpublish if calling module is using Comment Approval System
* @return void
*/
* Modify comment(s) status to publish/unpublish if calling module is using Comment Approval System
* @return void
*/
function procCommentAdminChangePublishedStatusChecked()
{ // Error display if none is selected
$cart = Context::get('cart');
@ -31,17 +32,17 @@
{
$comment_srl_list = $cart;
}
$this->procCommentAdminChangeStatus();
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_keyword', '');
$this->setRedirectUrl($returnUrl);
}
/**
* Change comment status
* @return void|object
*/
* Change comment status
* @return void|object
*/
function procCommentAdminChangeStatus()
{
$will_publish = Context::get('will_publish');
@ -89,7 +90,7 @@
$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))
if(!in_array($document_srl,$updated_documents_arr))
{
$updated_documents_arr[] = $document_srl;
// update the number of comments
@ -115,17 +116,18 @@
<br />Comment content:
".$comment->content."
<br />
";
";
$oMail->setContent($mail_content);
$oMail->setSender($logged_info->user_name, $logged_info->email_address);
$document_author_email = $oDocument->variables['email_address'];
//mail to author of thread - START
if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email) {
$oMail->setReceiptor($document_author_email, $document_author_email);
$oMail->send();
$already_sent[] = $document_author_email;
if($document_author_email != $comment->email_address && $logged_info->email_address != $document_author_email)
{
$oMail->setReceiptor($document_author_email, $document_author_email);
$oMail->send();
$already_sent[] = $document_author_email;
}
//mail to author of thread - STOP
@ -133,10 +135,12 @@
if($module_info->admin_mail)
{
$target_mail = explode(',',$module_info->admin_mail);
for($i=0;$i<count($target_mail);$i++) {
for($i=0;$i<count($target_mail);$i++)
{
$email_address = trim($target_mail[$i]);
if(!$email_address) continue;
if($author_email != $email_address) {
if($author_email != $email_address)
{
$oMail->setReceiptor($email_address, $email_address);
$oMail->send();
}
@ -150,227 +154,235 @@
// call a trigger for calling "send mail to subscribers" (for moment just for forum)
ModuleHandler::triggerCall("comment.procCommentAdminChangeStatus","after",$comment_srl_list);
}
}
/**
* Delete the selected comment from the administrator page
* @return void
*/
function procCommentAdminDeleteChecked() {
$isTrash = Context::get('is_trash');
// 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);
if(!$comment_count) return $this->stop('msg_cart_is_null');
/**
* Delete the selected comment from the administrator page
* @return void
*/
function procCommentAdminDeleteChecked()
{
$isTrash = Context::get('is_trash');
$oCommentController = &getController('comment');
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 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);
if(!$comment_count) return $this->stop('msg_cart_is_null');
// for message send - start
$message_content = Context::get('message_content');
if($message_content) $message_content = nl2br($message_content);
$oCommentController = &getController('comment');
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
if($message_content) {
$oCommunicationController = &getController('communication');
$oCommentModel = &getModel('comment');
// for message send - start
$message_content = Context::get('message_content');
if($message_content) $message_content = nl2br($message_content);
$logged_info = Context::get('logged_info');
if($message_content)
{
$oCommunicationController = &getController('communication');
$oCommentModel = &getModel('comment');
$title = cut_str($message_content,10,'...');
$sender_member_srl = $logged_info->member_srl;
$logged_info = Context::get('logged_info');
for($i=0;$i<$comment_count;$i++) {
$comment_srl = $comment_srl_list[$i];
$oComment = $oCommentModel->getComment($comment_srl, true);
$title = cut_str($message_content,10,'...');
$sender_member_srl = $logged_info->member_srl;
if(!$oComment->get('member_srl') || $oComment->get('member_srl')==$sender_member_srl) continue;
for($i=0;$i<$comment_count;$i++)
{
$comment_srl = $comment_srl_list[$i];
$oComment = $oCommentModel->getComment($comment_srl, true);
$content = sprintf("<div>%s</div><hr /><div style=\"font-weight:bold\">%s</div>",$message_content, $oComment->getContentText(20));
if(!$oComment->get('member_srl') || $oComment->get('member_srl')==$sender_member_srl) continue;
$oCommunicationController->sendMessage($sender_member_srl, $oComment->get('member_srl'), $title, $content, false);
}
$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
}
// for message send - end
// comment into trash
if($isTrash == 'true') $this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB);
// comment into trash
if($isTrash == 'true') $this->_moveCommentToTrash($comment_srl_list, $oCommentController, $oDB);
$deleted_count = 0;
// Delete the comment posting
for($i=0;$i<$comment_count;$i++) {
$comment_srl = trim($comment_srl_list[$i]);
if(!$comment_srl) continue;
$deleted_count = 0;
// Delete the comment posting
for($i=0;$i<$comment_count;$i++)
{
$comment_srl = trim($comment_srl_list[$i]);
if(!$comment_srl) continue;
$output = $oCommentController->deleteComment($comment_srl, true, $isTrash);
$output = $oCommentController->deleteComment($comment_srl, true, $isTrash);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$deleted_count ++;
}
$oDB->commit();
$msgCode = '';
if($isTrash == 'true') $msgCode = 'success_trashed';
else $msgCode = 'success_deleted';
//$this->setMessage( sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count) );
$this->setMessage($msgCode, 'info');
//set url params
$search_keyword = Context::get('search_keyword');
$search_target = Context::get('search_target');
$page = Context::get('page');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_keyword', $search_keyword, 'search_target', $search_target,'page',$page);
$this->setRedirectUrl($returnUrl);
}
/**
* comment move to trash
* @return void|object
*/
function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB)
{
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
if(is_array($commentSrlList))
{
$logged_info = Context::get('logged_info');
$oCommentModel = &getModel('comment');
$commentItemList = $oCommentModel->getComments($commentSrlList);
$oTrashAdminController = &getAdminController('trash');
foreach($commentItemList AS $key=>$oComment)
{
$oTrashVO = new TrashVO();
$oTrashVO->setTrashSrl(getNextSequence());
$oTrashVO->setTitle(trim(strip_tags($oComment->variables['content'])));
$oTrashVO->setOriginModule('comment');
$oTrashVO->setSerializedObject(serialize($oComment->variables));
$output = $oTrashAdminController->insertTrash($oTrashVO);
if(!$output->toBool())
{
$oDB->rollback();
return $output;
}
$deleted_count ++;
}
}
}
$oDB->commit();
/**
* Cancel the blacklist of abused comments reported by other users
* @return void|object
*/
function procCommentAdminCancelDeclare()
{
$comment_srl = trim(Context::get('comment_srl'));
$msgCode = '';
if($isTrash == 'true') $msgCode = 'success_trashed';
else $msgCode = 'success_deleted';
//$this->setMessage( sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count) );
$this->setMessage($msgCode, 'info');
//set url params
$search_keyword = Context::get('search_keyword');
$search_target = Context::get('search_target');
$page = Context::get('page');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispCommentAdminList', 'search_keyword', $search_keyword, 'search_target', $search_target,'page',$page);
$this->setRedirectUrl($returnUrl);
}
/**
* comment move to trash
* @return void|object
*/
function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB)
if($comment_srl)
{
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.deleteDeclaredComments', $args);
if(!$output->toBool()) return $output;
}
}
if(is_array($commentSrlList))
/**
* Comment add to _SESSION
* @return void
*/
function procCommentAdminAddCart()
{
$comment_srl = (int)Context::get('comment_srl');
$oCommentModel = &getModel('comment');
$columnList = array('comment_srl');
$commentSrlList = array($comment_srl);
$output = $oCommentModel->getComments($commentSrlList);
if(is_array($output))
{
foreach($output AS $key=>$value)
{
$logged_info = Context::get('logged_info');
$oCommentModel = &getModel('comment');
$commentItemList = $oCommentModel->getComments($commentSrlList);
$oTrashAdminController = &getAdminController('trash');
foreach($commentItemList AS $key=>$oComment)
{
$oTrashVO = new TrashVO();
$oTrashVO->setTrashSrl(getNextSequence());
$oTrashVO->setTitle(trim(strip_tags($oComment->variables['content'])));
$oTrashVO->setOriginModule('comment');
$oTrashVO->setSerializedObject(serialize($oComment->variables));
$output = $oTrashAdminController->insertTrash($oTrashVO);
if (!$output->toBool()) {
$oDB->rollback();
return $output;
}
}
if($_SESSION['comment_management'][$key]) unset($_SESSION['comment_management'][$key]);
else $_SESSION['comment_management'][$key] = true;
}
}
}
/**
* Cancel the blacklist of abused comments reported by other users
* @return void|object
*/
function procCommentAdminCancelDeclare() {
$comment_srl = trim(Context::get('comment_srl'));
/**
* Delete all comments of the specific module
* @return object
*/
function deleteModuleComments($module_srl)
{
$args->module_srl = $module_srl;
$output = executeQuery('comment.deleteModuleComments', $args);
if(!$output->toBool()) return $output;
if($comment_srl) {
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.deleteDeclaredComments', $args);
if(!$output->toBool()) return $output;
}
}
$output = executeQuery('comment.deleteModuleCommentsList', $args);
/**
* Comment add to _SESSION
* @return void
*/
function procCommentAdminAddCart()
//remove from cache
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
$comment_srl = (int)Context::get('comment_srl');
$oCommentModel = &getModel('comment');
$columnList = array('comment_srl');
$commentSrlList = array($comment_srl);
$output = $oCommentModel->getComments($commentSrlList);
if(is_array($output))
{
foreach($output AS $key=>$value)
{
if($_SESSION['comment_management'][$key]) unset($_SESSION['comment_management'][$key]);
else $_SESSION['comment_management'][$key] = true;
}
}
// Invalidate newest comments. Per document cache is invalidated inside document admin controller.
$oCacheHandler->invalidateGroupKey('newestCommentsList');
}
return $output;
}
/**
* Delete all comments of the specific module
* @return object
*/
function deleteModuleComments($module_srl) {
$args->module_srl = $module_srl;
$output = executeQuery('comment.deleteModuleComments', $args);
if(!$output->toBool()) return $output;
/**
* Restore comment from trash module, called by trash module
* this method is passived
* @return object
*/
function restoreTrash($originObject)
{
if(is_array($originObject)) $originObject = (object)$originObject;
$output = executeQuery('comment.deleteModuleCommentsList', $args);
$obj->document_srl = $originObject->document_srl;
$obj->comment_srl = $originObject->comment_srl;
$obj->parent_srl = $originObject->parent_srl;
$obj->content = $originObject->content;
$obj->password = $originObject->password;
$obj->nick_name = $originObject->nick_name;
$obj->member_srl = $originObject->member_srl;
$obj->email_address = $originObject->email_address;
$obj->homepage = $originObject->homepage;
$obj->is_secret = $originObject->is_secret;
$obj->notify_message = $originObject->notify_message;
$obj->module_srl = $originObject->module_srl;
//remove from cache
$oCacheHandler = &CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{
// Invalidate newest comments. Per document cache is invalidated inside document admin controller.
$oCacheHandler->invalidateGroupKey('newestCommentsList');
}
return $output;
}
$oCommentController = &getController('comment');
$output = $oCommentController->insertComment($obj);
/**
* Restore comment from trash module, called by trash module
* this method is passived
* @return object
*/
function restoreTrash($originObject)
{
if(is_array($originObject)) $originObject = (object)$originObject;
return $output;
}
$obj->document_srl = $originObject->document_srl;
$obj->comment_srl = $originObject->comment_srl;
$obj->parent_srl = $originObject->parent_srl;
$obj->content = $originObject->content;
$obj->password = $originObject->password;
$obj->nick_name = $originObject->nick_name;
$obj->member_srl = $originObject->member_srl;
$obj->email_address = $originObject->email_address;
$obj->homepage = $originObject->homepage;
$obj->is_secret = $originObject->is_secret;
$obj->notify_message = $originObject->notify_message;
$obj->module_srl = $originObject->module_srl;
/**
* Empty comment in trash, called by trash module
* this method is passived
* @return object
*/
function emptyTrash($originObject)
{
$originObject = unserialize($originObject);
if(is_array($originObject)) $originObject = (object) $originObject;
$oCommentController = &getController('comment');
$output = $oCommentController->insertComment($obj);
$oComment = new commentItem();
$oComment->setAttribute($originObject);
return $output;
}
/**
* Empty comment in trash, called by trash module
* this method is passived
* @return object
*/
function emptyTrash($originObject)
{
$originObject = unserialize($originObject);
if(is_array($originObject)) $originObject = (object) $originObject;
$oComment = new commentItem();
$oComment->setAttribute($originObject);
//already comment deleted, therefore only comment log delete
$oCommentController = &getController('comment');
$output = $oCommentController->deleteCommentLog($oComment->get('comment_srl'));
return $output;
}
}
?>
//already comment deleted, therefore only comment log delete
$oCommentController = &getController('comment');
$output = $oCommentController->deleteCommentLog($oComment->get('comment_srl'));
return $output;
}
}
/* End of file comment.admin.controller.php */
/* Location: ./modules/comment/comment.admin.controller.php */

View file

@ -1,108 +1,115 @@
<?php
/**
* commentAdminView class
* admin view class of the comment module
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentAdminView extends comment
{
/**
* commentAdminView class
* admin view class of the comment module
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
* Initialization
* @return void
*/
class commentAdminView extends comment {
/**
* Initialization
* @return void
function init()
{
}
/**
* Display the list(for administrators)
* @return void
*/
function dispCommentAdminList()
{
// option to get a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // / the number of postings to appear on a single page
$args->page_count = 5; // / the number of pages to appear on the page navigation
$args->sort_index = 'list_order'; // /< Sorting values
$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;
}
*/
function init() {
}
/**
* Display the list(for administrators)
* @return void
*/
function dispCommentAdminList() {
// option to get a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // / the number of postings to appear on a single page
$args->page_count = 5; // / the number of pages to appear on the page navigation
// get a list by using comment->getCommentList.
$oCommentModel = &getModel('comment');
$secretNameList = $oCommentModel->getSecretNameList();
$columnList = array('comment_srl', 'document_srl', 'is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count');
$output = $oCommentModel->getTotalCommentList($args, $columnList);
$args->sort_index = 'list_order'; // /< Sorting values
$oCommentModel = &getModel("comment");
$modules = $oCommentModel->getDistinctModules();
$modules_list = $modules;
$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')
// 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_page', $output->total_page);
Context::set('page', $output->page);
Context::set('comment_list', $output->data);
Context::set('modules_list', $modules_list);
Context::set('page_navigation', $output->page_navigation);
Context::set('secret_name_list', $secretNameList);
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('comment_list');
}
/**
* Show the blacklist of comments in the admin page
* @return void
*/
function dispCommentAdminDeclared()
{
// option to get a blacklist
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of comment postings to appear on a single page
$args->page_count = 10; // /< the number of pages to appear on the page navigation
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
$args->order_type = 'desc'; // /< sorted value
// get a list
$declared_output = executeQuery('comment.getDeclaredList', $args);
$oCommentModel = &getModel('comment');
if($declared_output->data && count($declared_output->data))
{
$comment_list = array();
foreach($declared_output->data as $key => $comment)
{
$args->status = 1;
$comment_list[$key] = new commentItem();
$comment_list[$key]->setAttribute($comment);
}
if ($search_target == 'is_published' && $search_keyword == 'N')
{
$args->status = 0;
}
*/
// get a list by using comment->getCommentList.
$oCommentModel = &getModel('comment');
$secretNameList = $oCommentModel->getSecretNameList();
$columnList = array('comment_srl', 'document_srl', 'is_secret', 'status', 'content', 'comments.member_srl', 'comments.nick_name', 'comments.regdate', 'ipaddress', 'voted_count', 'blamed_count');
$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.
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('comment_list', $output->data);
Context::set('modules_list', $modules_list);
Context::set('page_navigation', $output->page_navigation);
Context::set('secret_name_list', $secretNameList);
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('comment_list');
}
$declared_output->data = $comment_list;
}
/**
* Show the blacklist of comments in the admin page
* @return void
*/
function dispCommentAdminDeclared() {
// option to get a blacklist
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of comment postings to appear on a single page
$args->page_count = 10; // /< the number of pages to appear on the page navigation
$secretNameList = $oCommentModel->getSecretNameList();
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
$args->order_type = 'desc'; // /< sorted value
// get a list
$declared_output = executeQuery('comment.getDeclaredList', $args);
$oCommentModel = &getModel('comment');
if($declared_output->data && count($declared_output->data)) {
$comment_list = array();
foreach($declared_output->data as $key => $comment) {
$comment_list[$key] = new commentItem();
$comment_list[$key]->setAttribute($comment);
}
$declared_output->data = $comment_list;
}
$secretNameList = $oCommentModel->getSecretNameList();
// set values in the return object of comment_model:: getCommentList() in order to use a template.
Context::set('total_count', $declared_output->total_count);
Context::set('total_page', $declared_output->total_page);
Context::set('page', $declared_output->page);
Context::set('comment_list', $declared_output->data);
Context::set('page_navigation', $declared_output->page_navigation);
Context::set('secret_name_list', $secretNameList);
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('declared_list');
}
}
?>
// set values in the return object of comment_model:: getCommentList() in order to use a template.
Context::set('total_count', $declared_output->total_count);
Context::set('total_page', $declared_output->total_page);
Context::set('page', $declared_output->page);
Context::set('comment_list', $declared_output->data);
Context::set('page_navigation', $declared_output->page_navigation);
Context::set('secret_name_list', $secretNameList);
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('declared_list');
}
}
/* End of file comment.admin.view.php */
/* Location: ./modules/comment/comment.admin.view.php */

View file

@ -1,151 +1,164 @@
<?php
require_once(_XE_PATH_.'modules/comment/comment.item.php');
require_once(_XE_PATH_.'modules/comment/comment.item.php');
/**
* comment
* comment module's high class
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class comment extends ModuleObject
{
/**
* Implemented if additional tasks are required when installing
* @return Object
*/
function moduleInstall()
{
$oDB = &DB::getInstance();
// register the action forward (for using on the admin mode)
$oModuleController = &getController('module');
$oDB->addIndex
(
"comments",
"idx_module_list_order",
array("module_srl", "list_order"),
true
);
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2008. 02. 22 add comment setting when a new module added
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
return new Object();
}
/**
* comment
* comment module's high class
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
* Method to check if installation is succeeded
* @return bool
*/
class comment extends ModuleObject {
/**
* Implemented if additional tasks are required when installing
* @return Object
*/
function moduleInstall() {
$oDB = &DB::getInstance();
function checkUpdate()
{
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true;
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true;
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count")) return true;
if(!$oDB->isColumnExists("comments","notify_message")) return true;
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
// register the action forward (for using on the admin mode)
$oModuleController = &getController('module');
if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
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;
}
$oDB->addIndex
(
"comments",
"idx_module_list_order",
array("module_srl", "list_order"),
true
);
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) return true;
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2008. 02. 22 add comment setting when a new module added
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
return false;
}
return new Object();
}
/**
* Execute update
* @return Object
*/
function moduleUpdate()
{
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count"))
{
$oDB->addColumn("comments","voted_count", "number","11");
$oDB->addIndex("comments","idx_voted_count", array("voted_count"));
}
/**
* Method to check if installation is succeeded
* @return bool
*/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true;
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true;
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count")) return true;
if(!$oDB->isColumnExists("comments","notify_message")) return true;
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
if(!$oDB->isColumnExists("comments","notify_message"))
{
$oDB->addColumn("comments","notify_message", "char","1");
}
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count"))
{
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
}
if(!$oDB->isColumnExists("comment_voted_log", "point"))
$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true);
if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
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;
}
if(!$oDB->isIndexExists("comments", "idx_module_list_order"))
{
$oDB->addIndex
(
"comments",
"idx_module_list_order",
array("module_srl", "list_order"),
true
);
}
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after')) return 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 false;
}
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
}
/**
* Execute update
* @return Object
*/
function moduleUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count")) {
$oDB->addColumn("comments","voted_count", "number","11");
$oDB->addIndex("comments","idx_voted_count", array("voted_count"));
}
return new Object(0, 'success_updated');
}
if(!$oDB->isColumnExists("comments","notify_message")) {
$oDB->addColumn("comments","notify_message", "char","1");
}
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count")) {
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
}
if(!$oDB->isColumnExists("comment_voted_log", "point"))
$oDB->addColumn('comment_voted_log', 'point', 'number', 11, 0, true);
if (!$oDB->isIndexExists("comments", "idx_module_list_order"))
$oDB->addIndex
(
"comments",
"idx_module_list_order",
array("module_srl", "list_order"),
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
);
// 2012. 08. 29 Add a trigger to copy additional setting when the module is copied
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after'))
{
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'comment', 'controller', 'triggerCopyModule', 'after');
}
return new Object(0, 'success_updated');
}
/**
* Regenerate cache file
* @return void
*/
function recompileCache() {
}
}
?>
/**
* Regenerate cache file
* @return void
*/
function recompileCache()
{
}
}
/* End of file comment.class.php */
/* Location: ./modules/comment/comment.class.php */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,49 +1,54 @@
<?php
/**
* commentView class
* comment module's view class
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
*/
class commentView extends comment
{
/**
* commentView class
* comment module's view class
*
* @author NHN (developers@xpressengine.com)
* @package /modules/comment
* @version 0.1
* Initialization
* @return void
*/
class commentView extends comment {
/**
* Initialization
* @return void
*/
function init() {
}
function init()
{
}
/**
* Add a form fot comment setting on the additional setting of module
* @param string $obj
* @return string
*/
function triggerDispCommentAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
/**
* Add a form fot comment setting on the additional setting of module
* @param string $obj
* @return string
*/
function triggerDispCommentAdditionSetup(&$obj)
{
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if(!$current_module_srl && !$current_module_srls) {
// get information of the selected module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// get the comment configuration
$oCommentModel = &getModel('comment');
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
Context::set('comment_config', $comment_config);
// get a group list
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
$obj .= $tpl;
if(!$current_module_srl && !$current_module_srls)
{
// get information of the selected module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// get the comment configuration
$oCommentModel = &getModel('comment');
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
Context::set('comment_config', $comment_config);
// get a group list
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
$obj .= $tpl;
return new Object();
}
}
?>
return new Object();
}
}
/* End of file comment.view.php */
/* Location: ./modules/comment/comment.view.php */