mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-20 03:39:56 +09:00
merge from 1.5.3 (~r10943)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@10951 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
7aa4798373
commit
54e3a72065
334 changed files with 13011 additions and 5561 deletions
|
|
@ -1,21 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's admin controller class
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentAdminController class
|
||||
* Document the module's admin controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentAdminController extends document {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove the selected docs from admin page
|
||||
**/
|
||||
/**
|
||||
* Remove the selected docs from admin page
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentAdminDeleteChecked() {
|
||||
// error appears if no doc is selected
|
||||
$cart = Context::get('cart');
|
||||
|
|
@ -35,9 +38,13 @@
|
|||
$this->setMessage( sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief change the module to move a specific article
|
||||
**/
|
||||
/**
|
||||
* Change the module to move a specific article
|
||||
* @param array $document_srl_list
|
||||
* @param int $module_srl
|
||||
* @param int $category_srl
|
||||
* @return Object
|
||||
*/
|
||||
function moveDocumentModule($document_srl_list, $module_srl, $category_srl) {
|
||||
if(!count($document_srl_list)) return;
|
||||
|
||||
|
|
@ -169,9 +176,13 @@
|
|||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Copy the post
|
||||
**/
|
||||
/**
|
||||
* Copy the post
|
||||
* @param array $document_srl_list
|
||||
* @param int $module_srl
|
||||
* @param int $category_srl
|
||||
* @return object
|
||||
*/
|
||||
function copyDocumentModule($document_srl_list, $module_srl, $category_srl) {
|
||||
if(!count($document_srl_list)) return;
|
||||
|
||||
|
|
@ -363,9 +374,11 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete all documents of the module
|
||||
**/
|
||||
/**
|
||||
* Delete all documents of the module
|
||||
* @param int $module_srl
|
||||
* @return object
|
||||
*/
|
||||
function deleteModuleDocument($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
|
@ -395,9 +408,10 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Save the default settings of the document module
|
||||
**/
|
||||
/**
|
||||
* Save the default settings of the document module
|
||||
* @return object
|
||||
*/
|
||||
function procDocumentAdminInsertConfig() {
|
||||
// Get the basic information
|
||||
$config = Context::gets('thumbnail_type');
|
||||
|
|
@ -405,17 +419,14 @@
|
|||
$oModuleController = &getController('module');
|
||||
$output = $oModuleController->insertModuleConfig('document',$config);
|
||||
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
return $output;
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig');
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Revoke declaration of the blacklisted posts
|
||||
**/
|
||||
/**
|
||||
* Revoke declaration of the blacklisted posts
|
||||
* @return object
|
||||
*/
|
||||
function procDocumentAdminCancelDeclare() {
|
||||
$document_srl = trim(Context::get('document_srl'));
|
||||
|
||||
|
|
@ -426,9 +437,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Delete all thumbnails
|
||||
**/
|
||||
/**
|
||||
* Delete all thumbnails
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentAdminDeleteAllThumbnail() {
|
||||
// delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4)
|
||||
$this->deleteThumbnailFile('./files/attach/images');
|
||||
|
|
@ -438,6 +450,10 @@
|
|||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete thumbnails with subdirectory
|
||||
* @return void
|
||||
*/
|
||||
function deleteThumbnailFile($path) {
|
||||
$directory = dir($path);
|
||||
while($entry = $directory->read()) {
|
||||
|
|
@ -453,9 +469,10 @@
|
|||
$directory->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Add or modify extra variables of the module
|
||||
**/
|
||||
/**
|
||||
* Add or modify extra variables of the module
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminInsertExtraVar() {
|
||||
$module_srl = Context::get('module_srl');
|
||||
$var_idx = Context::get('var_idx');
|
||||
|
|
@ -490,16 +507,15 @@
|
|||
if(!$output->toBool()) return $output;
|
||||
|
||||
$this->setMessage('success_registed');
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl);
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief delete extra variables of the module
|
||||
**/
|
||||
/**
|
||||
* Delete extra variables of the module
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminDeleteExtraVar() {
|
||||
$module_srl = Context::get('module_srl');
|
||||
$var_idx = Context::get('var_idx');
|
||||
|
|
@ -512,9 +528,10 @@
|
|||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief control the order of extra variables
|
||||
**/
|
||||
/**
|
||||
* Control the order of extra variables
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminMoveExtraVar() {
|
||||
$type = Context::get('type');
|
||||
$module_srl = Context::get('module_srl');
|
||||
|
|
@ -576,6 +593,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert alias for document
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminInsertAlias() {
|
||||
$args = Context::gets('module_srl','document_srl', 'alias_title');
|
||||
$alias_srl = Context::get('alias_srl');
|
||||
|
|
@ -591,28 +612,28 @@
|
|||
}
|
||||
$output = executeQuery($query, $args);
|
||||
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl);
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
return $output;
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $args->document_srl);
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete alias for document
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminDeleteAlias() {
|
||||
$document_srl = Context::get('document_srl');
|
||||
$alias_srl = Context::get('target_srl');
|
||||
$args->alias_srl = $alias_srl;
|
||||
$output = executeQuery("document.deleteAlias", $args);
|
||||
|
||||
if($output->toBool() && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $document_srl);
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
return $output;
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminAlias', 'document_srl', $document_srl);
|
||||
return $this->setRedirectUrl($returnUrl, $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Restor document from trash
|
||||
* @return void|object
|
||||
*/
|
||||
function procDocumentAdminRestoreTrash() {
|
||||
$trash_srl = Context::get('trash_srl');
|
||||
$this->restoreTrash($trash_srl);
|
||||
|
|
@ -671,10 +692,12 @@
|
|||
return $output;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @brief restore document from trash module, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
/**
|
||||
* Restore document from trash module, called by trash module
|
||||
* This method is passived
|
||||
* @param object|array $originObject
|
||||
* @return object
|
||||
*/
|
||||
function restoreTrash($originObject)
|
||||
{
|
||||
if(is_array($originObject)) $originObject = (object)$originObject;
|
||||
|
|
@ -712,10 +735,12 @@
|
|||
return new Object(0, 'success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty document in trash, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
/**
|
||||
* Empty document in trash, called by trash module
|
||||
* This method is passived
|
||||
* @param string $originObject string is serialized object
|
||||
* @return object
|
||||
*/
|
||||
function emptyTrash($originObject)
|
||||
{
|
||||
$originObject = unserialize($originObject);
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentAdminModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @version 0.1
|
||||
* @brief document the module's admin model class
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentAdminModel class
|
||||
* Document the module's admin model class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentAdminModel extends document {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get a document list from the trash
|
||||
**/
|
||||
/**
|
||||
* Get a document list from the trash
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrashList($obj) {
|
||||
// check a list and its order
|
||||
if (!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
|
||||
|
|
@ -64,9 +67,11 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the doc which has trash_srl from the trash can
|
||||
**/
|
||||
/**
|
||||
* Get the doc which has trash_srl from the trash can
|
||||
* @param int $trash_srl
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentTrash($trash_srl) {
|
||||
$args->trash_srl = $trash_srl;
|
||||
$output = executeQuery('document.getTrash', $args);
|
||||
|
|
@ -77,9 +82,13 @@
|
|||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return document count with date
|
||||
**/
|
||||
/**
|
||||
* Return document count with date
|
||||
* @param string $date
|
||||
* @parpam array $moduleSrlList
|
||||
* @param array $statusList
|
||||
* @return int
|
||||
*/
|
||||
function getDocumentCountByDate($date = '', $moduleSrlList = array(), $statusList = array()) {
|
||||
if($date) $args->regDate = date('Ymd', strtotime($date));
|
||||
if(count($moduleSrlList)>0) $args->moduleSrlList = $moduleSrlList;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document admin view of the module class
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentAdminView class
|
||||
* Document admin view of the module class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentAdminView extends document {
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
// check current location in admin menu
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -23,9 +26,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a list(administrative)
|
||||
**/
|
||||
/**
|
||||
* Display a list(administrative)
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminList() {
|
||||
// option to get a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
|
|
@ -67,9 +71,10 @@
|
|||
$this->setTemplateFile('document_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set a document module
|
||||
**/
|
||||
/**
|
||||
* Set a document module
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminConfig() {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$config = $oDocumentModel->getDocumentConfig();
|
||||
|
|
@ -80,9 +85,10 @@
|
|||
$this->setTemplateFile('document_config');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief display a report list on the admin page
|
||||
**/
|
||||
/**
|
||||
* Display a report list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminDeclared() {
|
||||
// option for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
|
|
@ -120,6 +126,10 @@
|
|||
$this->setTemplateFile('declared_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a alias list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminAlias() {
|
||||
$args->document_srl = Context::get('document_srl');
|
||||
if(!$args->document_srl) return $this->dispDocumentAdminList();
|
||||
|
|
@ -145,6 +155,10 @@
|
|||
$this->setTemplateFile('document_alias');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a trash list on the admin page
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentAdminTrashList() {
|
||||
// options for a list
|
||||
$args->page = Context::get('page'); // /< Page
|
||||
|
|
|
|||
|
|
@ -1,333 +1,337 @@
|
|||
<?php
|
||||
/**
|
||||
* @class document
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's high class
|
||||
**/
|
||||
require_once(_XE_PATH_.'modules/document/document.item.php');
|
||||
|
||||
require_once(_XE_PATH_.'modules/document/document.item.php');
|
||||
/**
|
||||
* document class
|
||||
* @brief document the module's high class
|
||||
* {@internal Silently adds one extra Foo to compensate for lack of Foo }
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class document extends ModuleObject
|
||||
{
|
||||
/**
|
||||
* Search option to use in admin page
|
||||
* @var array
|
||||
*/
|
||||
var $search_option = array('title','content','title_content','user_name',); // /< Search options
|
||||
/**
|
||||
* Status list
|
||||
* @var array
|
||||
*/
|
||||
var $statusList = array('private'=>'PRIVATE', 'public'=>'PUBLIC', 'secret'=>'SECRET', 'temp'=>'TEMP');
|
||||
|
||||
class document extends ModuleObject {
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall()
|
||||
{
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// search option to use in admin page
|
||||
var $search_option = array('title','content','title_content','user_name',); // /< Search options
|
||||
var $statusList = array('private'=>'PRIVATE', 'public'=>'PUBLIC', 'secret'=>'SECRET', 'temp'=>'TEMP');
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
|
||||
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
|
||||
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
|
||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
|
||||
$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
|
||||
$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
|
||||
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
// Register action forward (to use in administrator mode)
|
||||
$oModuleController = &getController('module');
|
||||
// 2009. 01. 29 Added a trigger for additional setup
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
|
||||
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
|
||||
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
|
||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
|
||||
$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
|
||||
$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
|
||||
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||
return new Object();
|
||||
}
|
||||
|
||||
// 2009. 01. 29 Added a trigger for additional setup
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||
/**
|
||||
* A method to check if successfully installed
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
return new Object();
|
||||
}
|
||||
// 2007. 7. 25: Add a column(notify_message) for notification
|
||||
if(!$oDB->isColumnExists("documents","notify_message")) return true;
|
||||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
// 2007. 8. 23: create a clustered index in the document table
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
|
||||
// 2007. 10. 25 add parent_srl, expand to the document category
|
||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
|
||||
if(!$oDB->isColumnExists("document_categories","expand")) return true;
|
||||
if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
|
||||
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
|
||||
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
|
||||
|
||||
/**
|
||||
* 2007. 7. 25: Add a column(notify_message) for notification
|
||||
**/
|
||||
if(!$oDB->isColumnExists("documents","notify_message")) return true;
|
||||
|
||||
/**
|
||||
* 2007. 8. 23: create a clustered index in the document table
|
||||
**/
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
|
||||
// 2007. 10. 25 add parent_srl, expand to the document category
|
||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
|
||||
if(!$oDB->isColumnExists("document_categories","expand")) return true;
|
||||
if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
|
||||
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
|
||||
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
|
||||
|
||||
/**
|
||||
* 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
|
||||
**/
|
||||
if(!$oDB->isColumnExists("documents","extra_vars")) return true;
|
||||
// 2008. 04. 23 Add a column(blamed_count)
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
|
||||
// 2008-12-15 Add a column(color)
|
||||
if(!$oDB->isColumnExists("document_categories", "color")) return true;
|
||||
|
||||
/**
|
||||
* 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
|
||||
**/
|
||||
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
|
||||
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
|
||||
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||
if(!$oDB->isColumnExists("documents","lang_code")) return true;
|
||||
// 2009. 03. 11 check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
|
||||
|
||||
/**
|
||||
* 2009. 03. 19: Add a column(eid) if not exist in the table
|
||||
**/
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
|
||||
|
||||
// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
|
||||
|
||||
//2011. 04. 07 adding description column to document categories
|
||||
if(!$oDB->isColumnExists("document_categories","description")) return true;
|
||||
|
||||
//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;
|
||||
|
||||
// 2011. 10. 25 status index check
|
||||
if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
/**
|
||||
* 2007. 7. 25: Add a column(notify_message) for notification
|
||||
**/
|
||||
if(!$oDB->isColumnExists("documents","notify_message")) {
|
||||
$oDB->addColumn('documents',"notify_message","char",1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2007. 8. 23: create a clustered index in the document table
|
||||
**/
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
|
||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order")) {
|
||||
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) {
|
||||
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
|
||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
}
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||
// 2007. 10. 25 add columns(parent_srl, expand)
|
||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
|
||||
if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
|
||||
if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
|
||||
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
|
||||
|
||||
/**
|
||||
* 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
|
||||
**/
|
||||
if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
|
||||
|
||||
/**
|
||||
* 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||
**/
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
// 2008. 04. 23 Add a column(blamed count)
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) {
|
||||
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point"))
|
||||
$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
|
||||
|
||||
|
||||
if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
|
||||
|
||||
/**
|
||||
* 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
|
||||
**/
|
||||
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
|
||||
|
||||
// 2009. 01. 29 Added a trigger for additional setup
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||
if(!$oDB->isColumnExists("documents","lang_code")) {
|
||||
$db_info = Context::getDBInfo();
|
||||
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
|
||||
$obj->lang_code = $db_info->lang_type;
|
||||
executeQuery('document.updateDocumentsLangCode', $obj);
|
||||
}
|
||||
// 2009. 03. 11 Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
|
||||
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||
}
|
||||
|
||||
if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) {
|
||||
$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 2009. 03. 19: Add a column(eid)
|
||||
* 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
|
||||
**/
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
|
||||
$oDB->addColumn("document_extra_keys","eid","varchar",40);
|
||||
|
||||
$output = executeQuery('document.getGroupsExtraKeys', $obj);
|
||||
if($output->toBool() && $output->data && count($output->data)) {
|
||||
foreach($output->data as $extra_keys) {
|
||||
$args->module_srl = $extra_keys->module_srl;
|
||||
$args->var_idx = $extra_keys->idx;
|
||||
$args->new_eid = "extra_vars".$extra_keys->idx;
|
||||
$output = executeQuery('document.updateDocumentExtraKeyEid', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) {
|
||||
$oDB->addColumn("document_extra_vars","eid","varchar",40);
|
||||
$obj->var_idx = '-1,-2';
|
||||
$output = executeQuery('document.getGroupsExtraVars', $obj);
|
||||
if($output->toBool() && $output->data && count($output->data)) {
|
||||
foreach($output->data as $extra_vars) {
|
||||
$args->module_srl = $extra_vars->module_srl;
|
||||
$args->var_idx = $extra_vars->idx;
|
||||
$args->new_eid = "extra_vars".$extra_vars->idx;
|
||||
$output = executeQuery('document.updateDocumentExtraVarEid', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) {
|
||||
$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
|
||||
}
|
||||
|
||||
//2011. 04. 07 adding description column to document categories
|
||||
if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
|
||||
|
||||
//2011. 05. 23 adding status column to document
|
||||
if(!$oDB->isColumnExists('documents', 'status'))
|
||||
{
|
||||
$oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC');
|
||||
$args->is_secret = 'Y';
|
||||
$output = executeQuery('document.updateDocumentStatus', $args);
|
||||
}
|
||||
|
||||
// 2011. 09. 08 drop column document is_secret
|
||||
if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
|
||||
$oDB->dropColumn('documents', 'is_secret');
|
||||
|
||||
//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';
|
||||
|
||||
// allow_comment='Y', lock_comment='Y'
|
||||
$args->allowComment = 'Y';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
|
||||
// allow_comment='N', lock_comment='Y'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
|
||||
// allow_comment='N', lock_comment='N'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'N';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
}
|
||||
|
||||
if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
|
||||
$oDB->dropColumn('documents', 'allow_comment');
|
||||
|
||||
if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
|
||||
$oDB->dropColumn('documents', 'lock_comment');
|
||||
|
||||
if(!$oDB->isIndexExists("documents", "idx_module_status"))
|
||||
$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
function recompileCache() {
|
||||
}
|
||||
// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
|
||||
if(!$oDB->isColumnExists("documents","extra_vars")) return true;
|
||||
// 2008. 04. 23 Add a column(blamed_count)
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
|
||||
// 2008-12-15 Add a column(color)
|
||||
if(!$oDB->isColumnExists("document_categories", "color")) return true;
|
||||
|
||||
/**
|
||||
* @brief Document Status List
|
||||
**/
|
||||
function getStatusList()
|
||||
{
|
||||
return $this->statusList;
|
||||
* 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
|
||||
*/
|
||||
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
|
||||
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
|
||||
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||
if(!$oDB->isColumnExists("documents","lang_code")) return true;
|
||||
// 2009. 03. 11 check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
|
||||
|
||||
// 2009. 03. 19: Add a column(eid) if not exist in the table
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
|
||||
|
||||
// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) return true;
|
||||
|
||||
//2011. 04. 07 adding description column to document categories
|
||||
if(!$oDB->isColumnExists("document_categories","description")) return true;
|
||||
|
||||
//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;
|
||||
|
||||
// 2011. 10. 25 status index check
|
||||
if(!$oDB->isIndexExists("documents", "idx_module_status")) return true;
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after')) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
$oModuleModel = &getModel('module');
|
||||
$oModuleController = &getController('module');
|
||||
|
||||
// 2007. 7. 25: Add a column(notify_message) for notification
|
||||
if(!$oDB->isColumnExists("documents","notify_message")) {
|
||||
$oDB->addColumn('documents',"notify_message","char",1);
|
||||
}
|
||||
|
||||
function getDefaultStatus()
|
||||
{
|
||||
return $this->statusList['public'];
|
||||
// 2007. 8. 23: create a clustered index in the document table
|
||||
if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
|
||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
|
||||
}
|
||||
|
||||
function getConfigStatus($key)
|
||||
{
|
||||
if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
|
||||
else $this->getDefaultStatus();
|
||||
if(!$oDB->isIndexExists("documents","idx_module_update_order")) {
|
||||
$oDB->addIndex("documents","idx_module_update_order", array("module_srl","update_order"));
|
||||
}
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) {
|
||||
$oDB->addIndex("documents","idx_module_readed_count", array("module_srl","readed_count"));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
|
||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
}
|
||||
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||
// 2007. 10. 25 add columns(parent_srl, expand)
|
||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
|
||||
if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
|
||||
if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
|
||||
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
|
||||
|
||||
// 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
|
||||
if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
|
||||
|
||||
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
// 2008. 04. 23 Add a column(blamed count)
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) {
|
||||
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point"))
|
||||
$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
|
||||
|
||||
|
||||
if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
|
||||
|
||||
// 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
|
||||
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
|
||||
|
||||
// 2009. 01. 29 Added a trigger for additional setup
|
||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
|
||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||
if(!$oDB->isColumnExists("documents","lang_code")) {
|
||||
$db_info = Context::getDBInfo();
|
||||
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
|
||||
$obj->lang_code = $db_info->lang_type;
|
||||
executeQuery('document.updateDocumentsLangCode', $obj);
|
||||
}
|
||||
// 2009. 03. 11 Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
|
||||
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||
}
|
||||
|
||||
if($oDB->isIndexExists("document_extra_vars", "unique_module_vars")) {
|
||||
$oDB->dropIndex("document_extra_vars", "unique_module_vars", true);
|
||||
}
|
||||
|
||||
// 2009. 03. 19: Add a column(eid)
|
||||
// 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
|
||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
|
||||
$oDB->addColumn("document_extra_keys","eid","varchar",40);
|
||||
|
||||
$output = executeQuery('document.getGroupsExtraKeys', $obj);
|
||||
if($output->toBool() && $output->data && count($output->data)) {
|
||||
foreach($output->data as $extra_keys) {
|
||||
$args->module_srl = $extra_keys->module_srl;
|
||||
$args->var_idx = $extra_keys->idx;
|
||||
$args->new_eid = "extra_vars".$extra_keys->idx;
|
||||
$output = executeQuery('document.updateDocumentExtraKeyEid', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) {
|
||||
$oDB->addColumn("document_extra_vars","eid","varchar",40);
|
||||
$obj->var_idx = '-1,-2';
|
||||
$output = executeQuery('document.getGroupsExtraVars', $obj);
|
||||
if($output->toBool() && $output->data && count($output->data)) {
|
||||
foreach($output->data as $extra_vars) {
|
||||
$args->module_srl = $extra_vars->module_srl;
|
||||
$args->var_idx = $extra_vars->idx;
|
||||
$args->new_eid = "extra_vars".$extra_vars->idx;
|
||||
$output = executeQuery('document.updateDocumentExtraVarEid', $args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 2011. 03. 30 Cubrid index Check the index in the document_extra_vars table
|
||||
if(!$oDB->isIndexExists("document_extra_vars", "idx_document_list_order")) {
|
||||
$oDB->addIndex("document_extra_vars", "idx_document_list_order", array("document_srl","module_srl","var_idx"), false);
|
||||
}
|
||||
|
||||
//2011. 04. 07 adding description column to document categories
|
||||
if(!$oDB->isColumnExists("document_categories","description")) $oDB->addColumn('document_categories',"description","varchar",200,0);
|
||||
|
||||
//2011. 05. 23 adding status column to document
|
||||
if(!$oDB->isColumnExists('documents', 'status'))
|
||||
{
|
||||
$oDB->addColumn('documents', 'status', 'varchar', 20, 'PUBLIC');
|
||||
$args->is_secret = 'Y';
|
||||
$output = executeQuery('document.updateDocumentStatus', $args);
|
||||
}
|
||||
|
||||
// 2011. 09. 08 drop column document is_secret
|
||||
if($oDB->isColumnExists('documents', 'status') && $oDB->isColumnExists('documents', 'is_secret'))
|
||||
$oDB->dropColumn('documents', 'is_secret');
|
||||
|
||||
//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';
|
||||
|
||||
// allow_comment='Y', lock_comment='Y'
|
||||
$args->allowComment = 'Y';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
|
||||
// allow_comment='N', lock_comment='Y'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'Y';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
|
||||
// allow_comment='N', lock_comment='N'
|
||||
$args->allowComment = 'N';
|
||||
$args->lockComment = 'N';
|
||||
$output = executeQuery('document.updateDocumentCommentStatus', $args);
|
||||
}
|
||||
|
||||
if($oDB->isColumnExists('documents', 'allow_comment') && $oDB->isColumnExists('documents', 'comment_status'))
|
||||
$oDB->dropColumn('documents', 'allow_comment');
|
||||
|
||||
if($oDB->isColumnExists('documents', 'lock_comment') && $oDB->isColumnExists('documents', 'comment_status'))
|
||||
$oDB->dropColumn('documents', 'lock_comment');
|
||||
|
||||
if(!$oDB->isIndexExists("documents", "idx_module_status"))
|
||||
$oDB->addIndex("documents", "idx_module_status", array("module_srl","status"));
|
||||
|
||||
// 2012. 02. 27 Add a trigger to copy extra keys when the module is copied
|
||||
if(!$oModuleModel->getTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('module.procModuleAdminCopyModule', 'document', 'controller', 'triggerCopyModuleExtraKeys', 'after');
|
||||
}
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Document Status List
|
||||
* @return array
|
||||
*/
|
||||
function getStatusList()
|
||||
{
|
||||
return $this->statusList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return default status
|
||||
* @return string
|
||||
*/
|
||||
function getDefaultStatus()
|
||||
{
|
||||
return $this->statusList['public'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status by key
|
||||
* @return string
|
||||
*/
|
||||
function getConfigStatus($key)
|
||||
{
|
||||
if(array_key_exists(strtolower($key), $this->statusList)) return $this->statusList[$key];
|
||||
else $this->getDefaultStatus();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,24 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentController
|
||||
* documentController class
|
||||
* document the module's controller class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's controller class
|
||||
**/
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentController extends document {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @breif action to handle vote-up of the post (Up)
|
||||
**/
|
||||
* Action to handle vote-up of the post (Up)
|
||||
* @return Object
|
||||
*/
|
||||
function procDocumentVoteUp() {
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
|
|
@ -34,6 +38,13 @@ class documentController extends document {
|
|||
return $this->updateVotedCount($document_srl, $point);
|
||||
}
|
||||
|
||||
/**
|
||||
* insert alias
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @param string $alias_title
|
||||
* @return object
|
||||
*/
|
||||
function insertAlias($module_srl, $document_srl, $alias_title) {
|
||||
$args->alias_srl = getNextSequence();
|
||||
$args->module_srl = $module_srl;
|
||||
|
|
@ -45,8 +56,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @breif action to handle vote-up of the post (Down)
|
||||
**/
|
||||
* Action to handle vote-up of the post (Down)
|
||||
* @return Object
|
||||
*/
|
||||
function procDocumentVoteDown() {
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
|
|
@ -67,8 +79,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Action called when the post is reported by other member
|
||||
**/
|
||||
* Action called when the post is reported by other member
|
||||
* @return void|Object
|
||||
*/
|
||||
function procDocumentDeclare() {
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
|
|
@ -78,18 +91,35 @@ class documentController extends document {
|
|||
return $this->declaredDocument($document_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete alias when module deleted
|
||||
* @param int $module_srl
|
||||
* @return void
|
||||
*/
|
||||
function deleteDocumentAliasByModule($module_srl)
|
||||
{
|
||||
$args->module_srl = $module_srl;
|
||||
executeQuery("document.deleteAlias", $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete alias when document deleted
|
||||
* @param int $document_srl
|
||||
* @return void
|
||||
*/
|
||||
function deleteDocumentAliasByDocument($document_srl)
|
||||
{
|
||||
$args->document_srl = $document_srl;
|
||||
executeQuery("document.deleteAlias", $args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete document history
|
||||
* @param int $history_srl
|
||||
* @param int $document_srl
|
||||
* @param int $module_srl
|
||||
* @return void
|
||||
*/
|
||||
function deleteDocumentHistory($history_srl, $document_srl, $module_srl)
|
||||
{
|
||||
$args->history_srl = $history_srl;
|
||||
|
|
@ -100,8 +130,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief A trigger to delete all posts together when the module is deleted
|
||||
**/
|
||||
* A trigger to delete all posts together when the module is deleted
|
||||
* @param object $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDeleteModuleDocuments(&$obj) {
|
||||
$module_srl = $obj->module_srl;
|
||||
if(!$module_srl) return new Object();
|
||||
|
|
@ -126,16 +158,22 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Grant a permisstion of the document
|
||||
* Grant a permisstion of the document
|
||||
* Available in the current connection with session value
|
||||
**/
|
||||
* @param int $document_srl
|
||||
* @return void
|
||||
*/
|
||||
function addGrant($document_srl) {
|
||||
$_SESSION['own_document'][$document_srl] = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Insert the document
|
||||
**/
|
||||
* Insert the document
|
||||
* @param object $obj
|
||||
* @param bool $manual_inserted
|
||||
* @param bool $isRestore
|
||||
* @return object
|
||||
*/
|
||||
function insertDocument($obj, $manual_inserted = false, $isRestore = false) {
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
|
|
@ -261,8 +299,11 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Update the document
|
||||
**/
|
||||
* Update the document
|
||||
* @param object $source_obj
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function updateDocument($source_obj, $obj) {
|
||||
if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request');
|
||||
if(!$obj->status && $obj->is_secret == 'Y') $obj->status = 'SECRET';
|
||||
|
|
@ -435,8 +476,13 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Deleting Documents
|
||||
**/
|
||||
* Deleting Documents
|
||||
* @param int $document_srl
|
||||
* @param bool $is_admin
|
||||
* @param bool $isEmptyTrash
|
||||
* @param documentItem $oDocument
|
||||
* @return object
|
||||
*/
|
||||
function deleteDocument($document_srl, $is_admin = false, $isEmptyTrash = false, $oDocument = null) {
|
||||
// Call a trigger (before)
|
||||
$trigger_obj->document_srl = $document_srl;
|
||||
|
|
@ -518,10 +564,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief delete declared document, log
|
||||
* @param $documentSrls : srls string (ex: 1, 2,56, 88)
|
||||
* Delete declared document, log
|
||||
* @param string $documentSrls (ex: 1, 2,56, 88)
|
||||
* @return void
|
||||
**/
|
||||
*/
|
||||
function _deleteDeclaredDocuments($documentSrls)
|
||||
{
|
||||
executeQuery('document.deleteDeclaredDocuments', $documentSrls);
|
||||
|
|
@ -529,28 +575,30 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief delete readed log
|
||||
* @param $documentSrls : srls string (ex: 1, 2,56, 88)
|
||||
* Delete readed log
|
||||
* @param string $documentSrls (ex: 1, 2,56, 88)
|
||||
* @return void
|
||||
**/
|
||||
*/
|
||||
function _deleteDocumentReadedLog($documentSrls)
|
||||
{
|
||||
executeQuery('document.deleteDocumentReadedLog', $documentSrls);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief delete voted log
|
||||
* @param $documentSrls : srls string (ex: 1, 2,56, 88)
|
||||
* Delete voted log
|
||||
* @param string $documentSrls (ex: 1, 2,56, 88)
|
||||
* @return void
|
||||
**/
|
||||
*/
|
||||
function _deleteDocumentVotedLog($documentSrls)
|
||||
{
|
||||
executeQuery('document.deleteDocumentVotedLog', $documentSrls);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Move the doc into the trash
|
||||
**/
|
||||
* Move the doc into the trash
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function moveDocumentToTrash($obj) {
|
||||
// Get trash_srl if a given trash_srl doesn't exist
|
||||
if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
|
||||
|
|
@ -650,8 +698,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Update read counts of the document
|
||||
**/
|
||||
* Update read counts of the document
|
||||
* @param documentItem $oDocument
|
||||
* @return bool|void
|
||||
*/
|
||||
function updateReadedCount(&$oDocument) {
|
||||
$document_srl = $oDocument->document_srl;
|
||||
$member_srl = $oDocument->get('member_srl');
|
||||
|
|
@ -677,11 +727,32 @@ class documentController extends document {
|
|||
$output = executeQuery('document.updateReadedCount', $args);
|
||||
// Register session
|
||||
$_SESSION['readed_document'][$document_srl] = true;
|
||||
//remove from cache
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport())
|
||||
{
|
||||
$cache_key = 'object:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
$oCacheHandler->invalidateGroupKey('documentList');
|
||||
//remove document item from cache
|
||||
$cache_key = 'object_document_item:'.$document_srl;
|
||||
$oCacheHandler->delete($cache_key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @breif Insert extra variables into the document table
|
||||
**/
|
||||
* Insert extra variables into the document table
|
||||
* @param int $module_srl
|
||||
* @param int $var_idx
|
||||
* @param string $var_name
|
||||
* @param string $var_type
|
||||
* @param string $var_is_required
|
||||
* @param string $var_search
|
||||
* @param string $var_default
|
||||
* @param string $var_desc
|
||||
* @param int $eid
|
||||
* @return object
|
||||
*/
|
||||
function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) {
|
||||
if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request');
|
||||
|
||||
|
|
@ -705,8 +776,11 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Remove the extra variables of the documents
|
||||
**/
|
||||
* Remove the extra variables of the documents
|
||||
* @param int $module_srl
|
||||
* @param int $var_idx
|
||||
* @return Object
|
||||
*/
|
||||
function deleteDocumentExtraKeys($module_srl, $var_idx = null) {
|
||||
if(!$module_srl) return new Object(-1,'msg_invalid_request');
|
||||
$obj->module_srl = $module_srl;
|
||||
|
|
@ -755,8 +829,15 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @breif Insert extra vaiable to the documents table
|
||||
**/
|
||||
* Insert extra vaiable to the documents table
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @param int $var_idx
|
||||
* @param mixed $value
|
||||
* @param int $eid
|
||||
* @param string $lang_code
|
||||
* @return Object|void
|
||||
*/
|
||||
function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') {
|
||||
if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request');
|
||||
if(!$lang_code) $lang_code = Context::getLangType();
|
||||
|
|
@ -772,8 +853,14 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Remove values of extra variable from the document
|
||||
**/
|
||||
* Remove values of extra variable from the document
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @param int $var_idx
|
||||
* @param string $lang_code
|
||||
* @param int $eid
|
||||
* @return $output
|
||||
*/
|
||||
function deleteDocumentExtraVars($module_srl, $document_srl = null, $var_idx = null, $lang_code = null, $eid = null) {
|
||||
$obj->module_srl = $module_srl;
|
||||
if(!is_null($document_srl)) $obj->document_srl = $document_srl;
|
||||
|
|
@ -786,8 +873,11 @@ class documentController extends document {
|
|||
|
||||
|
||||
/**
|
||||
* @brief Increase the number of vote-up of the document
|
||||
**/
|
||||
* Increase the number of vote-up of the document
|
||||
* @param int $document_srl
|
||||
* @param int $point
|
||||
* @return Object
|
||||
*/
|
||||
function updateVotedCount($document_srl, $point = 1) {
|
||||
if($point > 0) $failed_voted = 'failed_voted';
|
||||
else $failed_voted = 'failed_blamed';
|
||||
|
|
@ -865,8 +955,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Report posts
|
||||
**/
|
||||
* Report posts
|
||||
* @param int $document_srl
|
||||
* @return void|Object
|
||||
*/
|
||||
function declaredDocument($document_srl) {
|
||||
// Fail if session information already has a reported document
|
||||
if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
|
||||
|
|
@ -920,9 +1012,14 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Increase the number of comments in the document
|
||||
* Increase the number of comments in the document
|
||||
* Update modified date, modifier, and order with increasing comment count
|
||||
**/
|
||||
* @param int $document_srl
|
||||
* @param int $comment_count
|
||||
* @param string $last_updater
|
||||
* @param bool $comment_inserted
|
||||
* @return object
|
||||
*/
|
||||
function updateCommentCount($document_srl, $comment_count, $last_updater, $comment_inserted = false) {
|
||||
$args->document_srl = $document_srl;
|
||||
$args->comment_count = $comment_count;
|
||||
|
|
@ -948,8 +1045,11 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Increase trackback count of the document
|
||||
**/
|
||||
* Increase trackback count of the document
|
||||
* @param int $document_srl
|
||||
* @param int $trackback_count
|
||||
* @return object
|
||||
*/
|
||||
function updateTrackbackCount($document_srl, $trackback_count) {
|
||||
$args->document_srl = $document_srl;
|
||||
$args->trackback_count = $trackback_count;
|
||||
|
|
@ -958,8 +1058,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Add a category
|
||||
**/
|
||||
* Add a category
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function insertCategory($obj) {
|
||||
// Sort the order to display if a child category is added
|
||||
if($obj->parent_srl) {
|
||||
|
|
@ -983,8 +1085,11 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Increase list_count from a specific category
|
||||
**/
|
||||
* Increase list_count from a specific category
|
||||
* @param int $module_srl
|
||||
* @param int $list_order
|
||||
* @return object
|
||||
*/
|
||||
function updateCategoryListOrder($module_srl, $list_order) {
|
||||
$args->module_srl = $module_srl;
|
||||
$args->list_order = $list_order;
|
||||
|
|
@ -992,8 +1097,12 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Update document_count in the category.
|
||||
**/
|
||||
* Update document_count in the category.
|
||||
* @param int $module_srl
|
||||
* @param int $category_srl
|
||||
* @param int $document_count
|
||||
* @return object
|
||||
*/
|
||||
function updateCategoryCount($module_srl, $category_srl, $document_count = 0) {
|
||||
// Create a document model object
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
|
@ -1008,8 +1117,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Update category information
|
||||
**/
|
||||
* Update category information
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function updateCategory($obj) {
|
||||
$output = executeQuery('document.updateCategory', $obj);
|
||||
if($output->toBool()) $this->makeCategoryFile($obj->module_srl);
|
||||
|
|
@ -1017,9 +1128,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @brief Delete a category
|
||||
**/
|
||||
* Delete a category
|
||||
* @param int $category_srl
|
||||
* @return object
|
||||
*/
|
||||
function deleteCategory($category_srl) {
|
||||
$args->category_srl = $category_srl;
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
|
@ -1044,8 +1156,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Delete all categories in a module
|
||||
**/
|
||||
* Delete all categories in a module
|
||||
* @param int $module_srl
|
||||
* @return object
|
||||
*/
|
||||
function deleteModuleCategory($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('document.deleteModuleCategory', $args);
|
||||
|
|
@ -1053,8 +1167,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Move the category level to higher
|
||||
**/
|
||||
* Move the category level to higher
|
||||
* @param int $category_srl
|
||||
* @return Object
|
||||
*/
|
||||
function moveCategoryUp($category_srl) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Get information of the selected category
|
||||
|
|
@ -1093,8 +1209,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Move the category down
|
||||
**/
|
||||
* Move the category down
|
||||
* @param int $category_srl
|
||||
* @return Object
|
||||
*/
|
||||
function moveCategoryDown($category_srl) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Get information of the selected category
|
||||
|
|
@ -1131,8 +1249,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Add javascript codes into the header by checking values of document_extra_keys type, required and others
|
||||
**/
|
||||
* Add javascript codes into the header by checking values of document_extra_keys type, required and others
|
||||
* @param int $module_srl
|
||||
* @return void
|
||||
*/
|
||||
function addXmlJsFilter($module_srl) {
|
||||
$oDocumentModel = &getModel('document');
|
||||
$extra_keys = $oDocumentModel->getExtraKeys($module_srl);
|
||||
|
|
@ -1159,8 +1279,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Add a category
|
||||
**/
|
||||
* Add a category
|
||||
* @param object $args
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentInsertCategory($args = null) {
|
||||
// List variables
|
||||
if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','category_title','category_description','expand','group_srls','category_color','mid');
|
||||
|
|
@ -1219,14 +1341,14 @@ class documentController extends document {
|
|||
$this->add('category_srl', $args->category_srl);
|
||||
$this->add('parent_srl', $args->parent_srl);
|
||||
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : Context::get('error_return_url');
|
||||
header('location:'.$returnUrl);
|
||||
return;
|
||||
}
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : Context::get('error_return_url');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Move a category
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentMoveCategory() {
|
||||
$source_category_srl = Context::get('source_srl');
|
||||
// If parent_srl exists, be the first child
|
||||
|
|
@ -1284,8 +1406,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Delete a category
|
||||
**/
|
||||
* Delete a category
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentDeleteCategory() {
|
||||
// List variables
|
||||
$args = Context::gets('module_srl','category_srl');
|
||||
|
|
@ -1322,11 +1445,12 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief xml files updated
|
||||
* Xml files updated
|
||||
* Occasionally the xml file is not generated after menu is configued on the admin page \n
|
||||
* The administrator can manually update the file in this case \n
|
||||
* Although the issue is not currently reproduced, it is unnecessay to remove.
|
||||
**/
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentMakeXmlFile() {
|
||||
// Check input values
|
||||
$module_srl = Context::get('module_srl');
|
||||
|
|
@ -1343,8 +1467,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Save the category in a cache file
|
||||
**/
|
||||
* Save the category in a cache file
|
||||
* @param int $module_srl
|
||||
* @return string
|
||||
*/
|
||||
function makeCategoryFile($module_srl) {
|
||||
// Return if there is no information you need for creating a cache file
|
||||
if(!$module_srl) return false;
|
||||
|
|
@ -1451,10 +1577,15 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Create the xml data recursively referring to parent_srl
|
||||
* Create the xml data recursively referring to parent_srl
|
||||
* In the menu xml file, node tag is nested and xml doc enables the admin page to have a menu\n
|
||||
* (tree menu is implemented by reading xml file from the tree_menu.js)
|
||||
**/
|
||||
* @param array $source_node
|
||||
* @param array $tree
|
||||
* @param int $site_srl
|
||||
* @param string $xml_header_buff
|
||||
* @return string
|
||||
*/
|
||||
function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff) {
|
||||
if(!$source_node) return;
|
||||
|
||||
|
|
@ -1506,11 +1637,16 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief change sorted nodes in an array to the php code and then return
|
||||
* when using menu on tpl, you can directly xml data. howver you may need javascrips additionally.
|
||||
* therefore, you can configure the menu info directly from php cache file, not through DB.
|
||||
* Change sorted nodes in an array to the php code and then return
|
||||
* When using menu on tpl, you can directly xml data. howver you may need javascrips additionally.
|
||||
* Therefore, you can configure the menu info directly from php cache file, not through DB.
|
||||
* You may include the cache in the ModuleHandler::displayContent()
|
||||
**/
|
||||
* @param array $source_node
|
||||
* @param array $tree
|
||||
* @param int $site_srl
|
||||
* @param string $php_header_buff
|
||||
* @return array
|
||||
*/
|
||||
function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff) {
|
||||
$output = array("buff"=>"", "category_srl_list"=>array());
|
||||
if(!$source_node) return $output;
|
||||
|
|
@ -1562,8 +1698,13 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief A method to add a pop-up menu which appears when clicking
|
||||
**/
|
||||
* A method to add a pop-up menu which appears when clicking
|
||||
* @param string $url
|
||||
* @param string $str
|
||||
* @param string $icon
|
||||
* @param string $target
|
||||
* @return void
|
||||
*/
|
||||
function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self') {
|
||||
$document_popup_menu_list = Context::get('document_popup_menu_list');
|
||||
if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array();
|
||||
|
|
@ -1578,8 +1719,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Saved in the session when an administrator selects a post
|
||||
**/
|
||||
* Saved in the session when an administrator selects a post
|
||||
* @return void|Object
|
||||
*/
|
||||
function procDocumentAddCart() {
|
||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
|
||||
// Get document_srl
|
||||
|
|
@ -1636,8 +1778,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Move/ Delete the document in the seession
|
||||
**/
|
||||
* Move/ Delete the document in the seession
|
||||
* @return void|Object
|
||||
*/
|
||||
function procDocumentManageCheckedDocument() {
|
||||
set_time_limit(0);
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
|
|
@ -1739,13 +1882,15 @@ class documentController extends document {
|
|||
$_SESSION['document_management'] = array();
|
||||
|
||||
$this->setMessage($msg_code);
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert document module config
|
||||
* @return void
|
||||
*/
|
||||
function procDocumentInsertModuleConfig()
|
||||
{
|
||||
$module_srl = Context::get('target_module_srl');
|
||||
|
|
@ -1772,16 +1917,15 @@ class documentController extends document {
|
|||
}
|
||||
$this->setError(-1);
|
||||
$this->setMessage('success_updated', 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
|
||||
$this->setRedirectUrl($returnUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
**/
|
||||
* Document temporary save
|
||||
* @return void|Object
|
||||
*/
|
||||
function procDocumentTempSave()
|
||||
{
|
||||
// Check login information
|
||||
|
|
@ -1839,8 +1983,9 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief return Document List for exec_xml
|
||||
**/
|
||||
* Return Document List for exec_xml
|
||||
* @return void|Object
|
||||
*/
|
||||
function procDocumentGetList()
|
||||
{
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
|
|
@ -1862,8 +2007,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief for old version, comment allow status check.
|
||||
**/
|
||||
* For old version, comment allow status check.
|
||||
* @param object $obj
|
||||
* @return void
|
||||
*/
|
||||
function _checkCommentStatusForOldVersion(&$obj)
|
||||
{
|
||||
if(!isset($obj->allow_comment)) $obj->allow_comment = 'N';
|
||||
|
|
@ -1874,8 +2021,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief for old version, document status check.
|
||||
**/
|
||||
* For old version, document status check.
|
||||
* @param object $obj
|
||||
* @return void
|
||||
*/
|
||||
function _checkDocumentStatusForOldVersion(&$obj)
|
||||
{
|
||||
if(!$obj->status && $obj->is_secret == 'Y') $obj->status = $this->getConfigStatus('secret');
|
||||
|
|
@ -1883,8 +2032,10 @@ class documentController extends document {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief copy extra keys when module copied
|
||||
**/
|
||||
* Copy extra keys when module copied
|
||||
* @param object $obj
|
||||
* @return void
|
||||
*/
|
||||
function triggerCopyModuleExtraKeys(&$obj)
|
||||
{
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
|
|
|||
|
|
@ -1,21 +1,56 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentItem
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document object
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentItem class
|
||||
* document object
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentItem extends Object {
|
||||
|
||||
/**
|
||||
* Document number
|
||||
* @var int
|
||||
*/
|
||||
var $document_srl = 0;
|
||||
/**
|
||||
* Language code
|
||||
* @var string
|
||||
*/
|
||||
var $lang_code = null;
|
||||
|
||||
/**
|
||||
* Status of allow trackback
|
||||
* @var bool
|
||||
*/
|
||||
var $allow_trackback_status = null;
|
||||
/**
|
||||
* column list
|
||||
* @var array
|
||||
*/
|
||||
var $columnList = array();
|
||||
/**
|
||||
* allow script access list
|
||||
* @var array
|
||||
*/
|
||||
var $allowscriptaccessList = array();
|
||||
/**
|
||||
* allow script access key
|
||||
* @var int
|
||||
*/
|
||||
var $allowscriptaccessKey = 0;
|
||||
/**
|
||||
* upload file list
|
||||
* @var array
|
||||
*/
|
||||
var $uploadedFiles = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param int $document_srl
|
||||
* @param bool $load_extra_vars
|
||||
* @param array columnList
|
||||
* @return void
|
||||
*/
|
||||
function documentItem($document_srl = 0, $load_extra_vars = true, $columnList = array()) {
|
||||
$this->document_srl = $document_srl;
|
||||
$this->columnList = $columnList;
|
||||
|
|
@ -28,12 +63,17 @@
|
|||
$this->_loadFromDB($load_extra_vars);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from database, and set the value to documentItem object
|
||||
* @param bool $load_extra_vars
|
||||
* @return void
|
||||
*/
|
||||
function _loadFromDB($load_extra_vars = true) {
|
||||
if(!$this->document_srl) return;
|
||||
|
||||
// cache controll
|
||||
$oCacheHandler = &CacheHandler::getInstance('object');
|
||||
if($oCacheHandler->isSupport()){
|
||||
if($oCacheHandler->isSupport() && !count($this->columnList)){
|
||||
$cache_key = 'object_document_item:'.$this->document_srl;
|
||||
$output = $oCacheHandler->get($cache_key);
|
||||
}
|
||||
|
|
@ -170,6 +210,12 @@
|
|||
return $_SESSION['document_management'][$this->document_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* Send notify message to document owner
|
||||
* @param string $type
|
||||
* @param string $content
|
||||
* @return void
|
||||
*/
|
||||
function notify($type, $content) {
|
||||
if(!$this->document_srl) return;
|
||||
// return if it is not useNotify
|
||||
|
|
@ -364,9 +410,14 @@
|
|||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return transformed content by Editor codes
|
||||
**/
|
||||
/**
|
||||
* Return transformed content by Editor codes
|
||||
* @param bool $add_popup_menu
|
||||
* @param bool $add_content_info
|
||||
* @param bool $resource_realpath
|
||||
* @param bool $add_xe_content_class
|
||||
* @return string
|
||||
*/
|
||||
function getTransContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true) {
|
||||
$oEditorController = &getController('editor');
|
||||
|
||||
|
|
@ -451,6 +502,10 @@
|
|||
return $oTrackbackModel->getTrackbackUrl($this->document_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update readed count
|
||||
* @return void
|
||||
*/
|
||||
function updateReadedCount() {
|
||||
$oDocumentController = &getController('document');
|
||||
if($oDocumentController->updateReadedCount($this)) {
|
||||
|
|
@ -662,10 +717,12 @@
|
|||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Functions to display icons for new post, latest update, secret(private) post, image/video/attachment
|
||||
* Determine new post and latest update by $time_interval
|
||||
**/
|
||||
/**
|
||||
* Functions to display icons for new post, latest update, secret(private) post, image/video/attachment
|
||||
* Determine new post and latest update by $time_interval
|
||||
* @param int $time_interval
|
||||
* @return array
|
||||
*/
|
||||
function getExtraImages($time_interval = 43200) {
|
||||
if(!$this->document_srl) return;
|
||||
// variables for icon list
|
||||
|
|
@ -715,9 +772,11 @@
|
|||
return $this->get('status');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the value obtained from getExtraImages with image tag
|
||||
**/
|
||||
/**
|
||||
* Return the value obtained from getExtraImages with image tag
|
||||
* @param int $time_check
|
||||
* @return string
|
||||
*/
|
||||
function printExtraImages($time_check = 43200) {
|
||||
if(!$this->document_srl) return;
|
||||
// Get the icon directory
|
||||
|
|
@ -756,9 +815,10 @@
|
|||
return $this->uploadedFiles[$sortIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return Editor html
|
||||
**/
|
||||
/**
|
||||
* Return Editor html
|
||||
* @return string
|
||||
*/
|
||||
function getEditor() {
|
||||
$module_srl = $this->get('module_srl');
|
||||
if(!$module_srl) $module_srl = Context::get('module_srl');
|
||||
|
|
@ -767,10 +827,11 @@
|
|||
return $oEditorModel->getModuleEditor('document', $module_srl, $this->document_srl, 'document_srl', 'content');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether to have a permission to write comment
|
||||
* Authority to write a comment and to write a document is separated
|
||||
**/
|
||||
/**
|
||||
* Check whether to have a permission to write comment
|
||||
* Authority to write a comment and to write a document is separated
|
||||
* @return bool
|
||||
*/
|
||||
function isEnableComment() {
|
||||
// Return false if not authorized, if a secret document, if the document is set not to allow any comment
|
||||
if (!$this->allowComment()) return false;
|
||||
|
|
@ -779,9 +840,10 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return comment editor's html
|
||||
**/
|
||||
/**
|
||||
* Return comment editor's html
|
||||
* @return string
|
||||
*/
|
||||
function getCommentEditor() {
|
||||
if(!$this->isEnableComment()) return;
|
||||
|
||||
|
|
@ -789,9 +851,10 @@
|
|||
return $oEditorModel->getModuleEditor('comment', $this->get('module_srl'), $comment_srl, 'comment_srl', 'content');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return author's profile image
|
||||
**/
|
||||
/**
|
||||
* Return author's profile image
|
||||
* @return string
|
||||
*/
|
||||
function getProfileImage() {
|
||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||
$oMemberModel = &getModel('member');
|
||||
|
|
@ -801,9 +864,10 @@
|
|||
return $profile_info->src;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return author's signiture
|
||||
**/
|
||||
/**
|
||||
* Return author's signiture
|
||||
* @return string
|
||||
*/
|
||||
function getSignature() {
|
||||
// Pass if a document doesn't exist
|
||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||
|
|
@ -824,13 +888,20 @@
|
|||
return $signature;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Change an image path in the content to absolute path
|
||||
**/
|
||||
/**
|
||||
* Change an image path in the content to absolute path
|
||||
* @param array $matches
|
||||
* @return mixed
|
||||
*/
|
||||
function replaceResourceRealPath($matches) {
|
||||
return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check accessible by document status
|
||||
* @param array $matches
|
||||
* @return mixed
|
||||
*/
|
||||
function _checkAccessibleFromStatus()
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
|
@ -869,5 +940,51 @@
|
|||
|
||||
return $output->data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the document's mid in order to construct SEO friendly URLs
|
||||
* @return string
|
||||
*/
|
||||
function getDocumentMid() {
|
||||
$model = &getModel('module');
|
||||
$module = $model->getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||
return $module->mid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document's type (document/page/wiki/board/etc)
|
||||
* @return string
|
||||
*/
|
||||
function getDocumentType() {
|
||||
$model = &getModel('module');
|
||||
$module = $model->getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||
return $module->module;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document's alias
|
||||
* @return string
|
||||
*/
|
||||
function getDocumentAlias() {
|
||||
$oDocumentModel = &getModel('document');
|
||||
return $oDocumentModel->getAlias($this->document_srl);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the document's actual title (browser_title)
|
||||
* @return string
|
||||
*/
|
||||
function getModuleName() {
|
||||
$model = &getModel('module');
|
||||
$module = $model->getModuleInfoByModuleSrl($this->get('module_srl'));
|
||||
return $module->browser_title;
|
||||
}
|
||||
|
||||
function getBrowserTitle()
|
||||
{
|
||||
$this->getModuleName();
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -1,24 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentModel
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief model class of the module document
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentModel class
|
||||
* model class of the module document
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentModel extends document {
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief document checked the permissions on the session values
|
||||
**/
|
||||
/**
|
||||
* document checked the permissions on the session values
|
||||
* @param int $document_srl
|
||||
* @return void
|
||||
*/
|
||||
function isGranted($document_srl) {
|
||||
return $_SESSION['own_document'][$document_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document extra information from database
|
||||
* @param array $documentSrls
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentExtraVarsFromDB($documentSrls)
|
||||
{
|
||||
if(!is_array($documentSrls) || count($documentSrls) == 0)
|
||||
|
|
@ -31,9 +41,10 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief extra variables for each article will not be processed bulk select and apply the macro city
|
||||
**/
|
||||
/**
|
||||
* Extra variables for each article will not be processed bulk select and apply the macro city
|
||||
* @return void
|
||||
*/
|
||||
function setToAllDocumentExtraVars() {
|
||||
static $checked_documents = array();
|
||||
// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
|
||||
|
|
@ -98,25 +109,36 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import Document
|
||||
**/
|
||||
/**
|
||||
* Import Document
|
||||
* @param int $document_srl
|
||||
* @param bool $is_admin
|
||||
* @param bool $load_extra_vars
|
||||
* @param array $columnList
|
||||
* @return documentItem
|
||||
*/
|
||||
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true, $columnList = array()) {
|
||||
if(!$document_srl) return new documentItem();
|
||||
|
||||
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl])) {
|
||||
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl]) || $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey != serialize($columnList)) {
|
||||
$oDocument = new documentItem($document_srl, $load_extra_vars, $columnList);
|
||||
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
|
||||
if($load_extra_vars) $this->setToAllDocumentExtraVars();
|
||||
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->columnListKey = serialize($columnList);
|
||||
}
|
||||
if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
|
||||
|
||||
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Bringing multiple documents (or paging)
|
||||
**/
|
||||
/**
|
||||
* Bringing multiple documents (or paging)
|
||||
* @param array|string $document_srls
|
||||
* @param bool $is_admin
|
||||
* @param bool $load_extra_vars
|
||||
* @param array $columnList
|
||||
* @return array value type is documentItem
|
||||
*/
|
||||
function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true, $columnList = array()) {
|
||||
if(is_array($document_srls)) {
|
||||
$list_count = count($document_srls);
|
||||
|
|
@ -161,9 +183,14 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module_srl value, bringing the list of documents
|
||||
**/
|
||||
/**
|
||||
* Module_srl value, bringing the list of documents
|
||||
* @param object $obj
|
||||
* @param bool $except_notice
|
||||
* @param bool $load_extra_vars
|
||||
* @param array $columnList
|
||||
* @return Object
|
||||
*/
|
||||
function getDocumentList($obj, $except_notice = false, $load_extra_vars=true, $columnList = array()) {
|
||||
$sort_check = $this->_setSortIndex($obj, $load_extra_vars);
|
||||
$obj->sort_index = $sort_check->sort_index;
|
||||
|
|
@ -241,12 +268,12 @@
|
|||
{
|
||||
/**
|
||||
* list_order asc sort of division that can be used only when
|
||||
**/
|
||||
*/
|
||||
if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
|
||||
|
||||
/**
|
||||
* If it is true, use_division changed to use the document division
|
||||
**/
|
||||
*/
|
||||
if($use_division) {
|
||||
// Division begins
|
||||
$division = (int)Context::get('division');
|
||||
|
|
@ -388,9 +415,12 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module_srl value, bringing the document's gongjisa Port
|
||||
**/
|
||||
/**
|
||||
* Module_srl value, bringing the document's gongjisa Port
|
||||
* @param object $obj
|
||||
* @param array $columnList
|
||||
* @return object|void
|
||||
*/
|
||||
function getNoticeList($obj, $columnList = array()) {
|
||||
$args->module_srl = $obj->module_srl;
|
||||
$args->category_srl= $obj->category_srl;
|
||||
|
|
@ -418,10 +448,12 @@
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief function to retrieve the key values of the extended variable document
|
||||
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
|
||||
**/
|
||||
/**
|
||||
* Function to retrieve the key values of the extended variable document
|
||||
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
|
||||
* @param int $module_srl
|
||||
* @return array
|
||||
*/
|
||||
function getExtraKeys($module_srl) {
|
||||
if(is_null($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) {
|
||||
$oExtraVar = &ExtraVar::getInstance($module_srl);
|
||||
|
|
@ -483,9 +515,12 @@
|
|||
return $GLOBALS['XE_EXTRA_KEYS'][$module_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A particular document to get the value of the extra variable function
|
||||
**/
|
||||
/**
|
||||
* A particular document to get the value of the extra variable function
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @return array
|
||||
*/
|
||||
function getExtraVars($module_srl, $document_srl) {
|
||||
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
|
||||
// Extended to extract the values of variables set
|
||||
|
|
@ -497,11 +532,11 @@
|
|||
return $GLOBALS['XE_EXTRA_VARS'][$document_srl];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Show pop-up menu of the selected posts
|
||||
*
|
||||
* Printing, scrap, recommendations and negative, reported the Add Features
|
||||
**/
|
||||
/**
|
||||
* Show pop-up menu of the selected posts
|
||||
* Printing, scrap, recommendations and negative, reported the Add Features
|
||||
* @return void
|
||||
*/
|
||||
function getDocumentMenu() {
|
||||
// Post number and the current login information requested Wanted
|
||||
$document_srl = Context::get('target_srl');
|
||||
|
|
@ -575,9 +610,12 @@
|
|||
$this->add('menus', $menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module_srl the total number of documents that are bringing
|
||||
**/
|
||||
/**
|
||||
* The total number of documents that are bringing
|
||||
* @param int $module_srl
|
||||
* @param object $search_obj
|
||||
* @return int
|
||||
*/
|
||||
function getDocumentCount($module_srl, $search_obj = NULL) {
|
||||
// Additional search options
|
||||
$args->module_srl = $module_srl;
|
||||
|
|
@ -595,9 +633,11 @@
|
|||
return (int)$total_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module_srl the total number of documents that are bringing
|
||||
**/
|
||||
/**
|
||||
* the total number of documents that are bringing
|
||||
* @param object $search_obj
|
||||
* @return array
|
||||
*/
|
||||
function getDocumentCountByGroupStatus($search_obj = NULL) {
|
||||
// Additional search options
|
||||
$args->module_srl = $search_obj->module_srl;
|
||||
|
|
@ -614,9 +654,12 @@
|
|||
|
||||
return $output->data;
|
||||
}
|
||||
/**
|
||||
* @brief Import page of the document, module_srl Without throughout ..
|
||||
**/
|
||||
/**
|
||||
* Import page of the document, module_srl Without throughout ..
|
||||
* @param documentItem $oDocument
|
||||
* @param object $opt
|
||||
* @return int
|
||||
*/
|
||||
function getDocumentPage($oDocument, $opt) {
|
||||
// Sort type changes depending on the query args
|
||||
switch($opt->sort_index) {
|
||||
|
|
@ -679,9 +722,12 @@
|
|||
return $page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Imported Category of information
|
||||
**/
|
||||
/**
|
||||
* Imported Category of information
|
||||
* @param int $category_srl
|
||||
* @param array $columnList
|
||||
* @return object
|
||||
*/
|
||||
function getCategory($category_srl, $columnList = array()) {
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQuery('document.getCategory', $args, $columnList);
|
||||
|
|
@ -700,9 +746,11 @@
|
|||
return $node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the child has a specific category
|
||||
**/
|
||||
/**
|
||||
* Check whether the child has a specific category
|
||||
* @param int $category_srl
|
||||
* @return bool
|
||||
*/
|
||||
function getCategoryChlidCount($category_srl) {
|
||||
$args->category_srl = $category_srl;
|
||||
$output = executeQuery('document.getChildCategoryCount',$args);
|
||||
|
|
@ -710,10 +758,13 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Bringing the Categories list the specific module
|
||||
* Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use
|
||||
**/
|
||||
/**
|
||||
* Bringing the Categories list the specific module
|
||||
* Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use
|
||||
* @param int $module_srl
|
||||
* @param array $columnList
|
||||
* @return array
|
||||
*/
|
||||
function getCategoryList($module_srl, $columnList = array()) {
|
||||
// Category of the target module file swollen
|
||||
$filename = sprintf("./files/cache/document_category/%s.php", $module_srl);
|
||||
|
|
@ -730,9 +781,13 @@
|
|||
return $document_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Category within a primary method to change the array type
|
||||
**/
|
||||
/**
|
||||
* Category within a primary method to change the array type
|
||||
* @param array $document_category
|
||||
* @param array $list
|
||||
* @param int $depth
|
||||
* @return void
|
||||
*/
|
||||
function _arrangeCategory(&$document_category, $list, $depth) {
|
||||
if(!count($list)) return;
|
||||
$idx = 0;
|
||||
|
|
@ -785,9 +840,12 @@
|
|||
$document_category[$list_order[count($list_order)-1]]->last = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wanted number of documents belonging to category
|
||||
**/
|
||||
/**
|
||||
* Wanted number of documents belonging to category
|
||||
* @param int $module_srl
|
||||
* @param int $category_srl
|
||||
* @return int
|
||||
*/
|
||||
function getCategoryDocumentCount($module_srl, $category_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
$args->category_srl = $category_srl;
|
||||
|
|
@ -795,9 +853,11 @@
|
|||
return (int)$output->data->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Xml cache file of the document category return information
|
||||
**/
|
||||
/**
|
||||
* Xml cache file of the document category return information
|
||||
* @param int $module_srl
|
||||
* @return string
|
||||
*/
|
||||
function getCategoryXmlFile($module_srl) {
|
||||
$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
|
||||
if(!file_exists($xml_file)) {
|
||||
|
|
@ -807,9 +867,11 @@
|
|||
return $xml_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Php cache files in the document category return information
|
||||
**/
|
||||
/**
|
||||
* Php cache files in the document category return information
|
||||
* @param int $module_srl
|
||||
* @return string
|
||||
*/
|
||||
function getCategoryPhpFile($module_srl) {
|
||||
$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
|
||||
if(!file_exists($php_file)) {
|
||||
|
|
@ -819,9 +881,11 @@
|
|||
return $php_file;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Imported post monthly archive status
|
||||
**/
|
||||
/**
|
||||
* Imported post monthly archive status
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getMonthlyArchivedList($obj) {
|
||||
if($obj->mid) {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -840,9 +904,11 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Bringing a month on the status of the daily posts
|
||||
**/
|
||||
/**
|
||||
* Bringing a month on the status of the daily posts
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getDailyArchivedList($obj) {
|
||||
if($obj->mid) {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -862,9 +928,10 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a list for a particular module
|
||||
**/
|
||||
/**
|
||||
* Get a list for a particular module
|
||||
* @return void|Object
|
||||
*/
|
||||
function getDocumentCategories() {
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
$module_srl = Context::get('module_srl');
|
||||
|
|
@ -880,9 +947,10 @@
|
|||
$this->add('categories', $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Wanted to set document information
|
||||
**/
|
||||
/**
|
||||
* Wanted to set document information
|
||||
* @return object
|
||||
*/
|
||||
function getDocumentConfig() {
|
||||
if(!$GLOBALS['__document_config__']) {
|
||||
$oModuleModel = &getModel('module');
|
||||
|
|
@ -893,10 +961,12 @@
|
|||
return $GLOBALS['__document_config__'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Common:: Module extensions of variable management
|
||||
* Expansion parameter management module in the document module instance, when using all the modules available
|
||||
**/
|
||||
/**
|
||||
* Common:: Module extensions of variable management
|
||||
* Expansion parameter management module in the document module instance, when using all the modules available
|
||||
* @param int $module_srl
|
||||
* @return string
|
||||
*/
|
||||
function getExtraVarsHTML($module_srl) {
|
||||
// Bringing existing extra_keys
|
||||
$extra_keys = $this->getExtraKeys($module_srl);
|
||||
|
|
@ -909,9 +979,11 @@
|
|||
return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Common:: Category parameter management module
|
||||
**/
|
||||
/**
|
||||
* Common:: Category parameter management module
|
||||
* @param int $module_srl
|
||||
* @return string
|
||||
*/
|
||||
function getCategoryHTML($module_srl) {
|
||||
$category_xml_file = $this->getCategoryXmlFile($module_srl);
|
||||
|
||||
|
|
@ -923,10 +995,11 @@
|
|||
return $oTemplate->compile($this->module_path.'tpl', 'category_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Certain categories of information, return the template guhanhu
|
||||
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
|
||||
**/
|
||||
/**
|
||||
* Certain categories of information, return the template guhanhu
|
||||
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
|
||||
* @return void|Object
|
||||
*/
|
||||
function getDocumentCategoryTplInfo() {
|
||||
$oModuleModel = &getModel('module');
|
||||
$oMemberModel = &getModel('member');
|
||||
|
|
@ -973,7 +1046,12 @@
|
|||
$this->add('tpl', $tpl);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return docuent data by alias
|
||||
* @param string $mid
|
||||
* @param string $alias
|
||||
* @return int|void
|
||||
*/
|
||||
function getDocumentSrlByAlias($mid, $alias)
|
||||
{
|
||||
if(!$mid || !$alias) return null;
|
||||
|
|
@ -986,6 +1064,12 @@
|
|||
else return $output->data->document_srl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return docuent number by document title
|
||||
* @param int $module_srl
|
||||
* @param string $title
|
||||
* @return int|void
|
||||
*/
|
||||
function getDocumentSrlByTitle($module_srl, $title)
|
||||
{
|
||||
if(!$module_srl || !$title) return null;
|
||||
|
|
@ -993,9 +1077,17 @@
|
|||
$args->title = $title;
|
||||
$output = executeQuery('document.getDocumentSrlByTitle', $args);
|
||||
if(!$output->data) return null;
|
||||
else return $output->data->document_srl;
|
||||
else {
|
||||
if(is_array($output->data)) return $output->data[0]->document_srl;
|
||||
return $output->data->document_srl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return docuent's alias
|
||||
* @param int $document_srl
|
||||
* @return string|void
|
||||
*/
|
||||
function getAlias($document_srl){
|
||||
if(!$document_srl) return null;
|
||||
$args->document_srl = $document_srl;
|
||||
|
|
@ -1005,6 +1097,13 @@
|
|||
else return $output->data[0]->alias_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document's history list
|
||||
* @param int $document_srl
|
||||
* @param int $list_count
|
||||
* @param int $page
|
||||
* @return object
|
||||
*/
|
||||
function getHistories($document_srl, $list_count, $page)
|
||||
{
|
||||
$args->list_count = $list_count;
|
||||
|
|
@ -1014,6 +1113,11 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return document's history
|
||||
* @param int $history_srl
|
||||
* @return object
|
||||
*/
|
||||
function getHistory($history_srl)
|
||||
{
|
||||
$args->history_srl = $history_srl;
|
||||
|
|
@ -1021,9 +1125,11 @@
|
|||
return $output->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief module_srl value, bringing the list of documents
|
||||
**/
|
||||
/**
|
||||
* Module_srl value, bringing the list of documents
|
||||
* @param object $obj
|
||||
* @return object
|
||||
*/
|
||||
function getTrashList($obj) {
|
||||
// Variable check
|
||||
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
|
||||
|
|
@ -1096,9 +1202,10 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief vote up, vote down member list in Document View page
|
||||
**/
|
||||
/**
|
||||
* vote up, vote down member list in Document View page
|
||||
* @return void|Object
|
||||
*/
|
||||
function getDocumentVotedMemberList()
|
||||
{
|
||||
$document_srl = Context::get('document_srl');
|
||||
|
|
@ -1139,6 +1246,10 @@
|
|||
$this->add('voted_member_list',$output->data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status name list
|
||||
* @return array
|
||||
*/
|
||||
function getStatusNameList()
|
||||
{
|
||||
global $lang;
|
||||
|
|
@ -1147,6 +1258,12 @@
|
|||
else return $lang->status_name_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Setting sort index
|
||||
* @param object $obj
|
||||
* @param bool $load_extra_vars
|
||||
* @return object
|
||||
*/
|
||||
function _setSortIndex($obj, $load_extra_vars)
|
||||
{
|
||||
$sortIndex = $obj->sort_index;
|
||||
|
|
@ -1182,10 +1299,15 @@
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief 게시물 목록의 검색 옵션을 Setting함(2011.03.08 - cherryfilter)
|
||||
* 게시물 목록의 검색 옵션을 Setting함(2011.03.08 - cherryfilter)
|
||||
* page변수가 없는 상태에서 page 값을 알아오는 method(getDocumentPage)는 검색하지 않은 값을 return해서 검색한 값을 가져오도록 검색옵션이 추가 됨.
|
||||
* 검색옵션의 중복으로 인해 private method로 별도 분리
|
||||
**/
|
||||
* @param object $searchOpt
|
||||
* @param object $args
|
||||
* @param string $query_id
|
||||
* @param bool $use_division
|
||||
* @return void
|
||||
*/
|
||||
function _setSearchOption($searchOpt, &$args, &$query_id, &$use_division)
|
||||
{
|
||||
$search_target = $searchOpt->search_target;
|
||||
|
|
|
|||
|
|
@ -1,22 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of the module document
|
||||
**/
|
||||
|
||||
/**
|
||||
* documentView class
|
||||
* View class of the module document
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/document
|
||||
* @version 0.1
|
||||
*/
|
||||
class documentView extends document {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Document printing
|
||||
* I make it out to find the geulman;;
|
||||
**/
|
||||
/**
|
||||
* Document printing
|
||||
* I make it out to find the geulman;;
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentPrint() {
|
||||
// Bring a list of variables needed to implement
|
||||
$document_srl = Context::get('document_srl');
|
||||
|
|
@ -43,9 +46,10 @@
|
|||
$this->setTemplateFile('print_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Preview
|
||||
**/
|
||||
/**
|
||||
* Preview
|
||||
* @return void
|
||||
*/
|
||||
function dispDocumentPreview() {
|
||||
Context::set('layout','none');
|
||||
|
||||
|
|
@ -54,9 +58,10 @@
|
|||
$this->setTemplateFile('preview_page');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Selected by the administrator for the document management
|
||||
**/
|
||||
/**
|
||||
* Selected by the administrator for the document management
|
||||
* @return void|Object
|
||||
*/
|
||||
function dispDocumentManageDocument() {
|
||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||
// Taken from a list of selected sessions
|
||||
|
|
@ -93,6 +98,12 @@
|
|||
$this->setTemplateFile('checked_list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Trigger method.
|
||||
* Additional information realte to document setting
|
||||
* @param string $obj
|
||||
* @return Object
|
||||
*/
|
||||
function triggerDispDocumentAdditionSetup(&$obj) {
|
||||
$current_module_srl = Context::get('module_srl');
|
||||
$current_module_srls = Context::get('module_srls');
|
||||
|
|
@ -119,6 +130,10 @@
|
|||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* Document temp saved list
|
||||
* @return void
|
||||
*/
|
||||
function dispTempSavedList()
|
||||
{
|
||||
$this->setLayoutFile('popup_layout');
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
<condition operation="in" column="documents.status" var="statusList" pipe="and" />
|
||||
<condition operation="like" column="extra_vars.value" var="var_value" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
<groups>
|
||||
<group column="extra_vars.document_srl" />
|
||||
</groups>
|
||||
<navigation>
|
||||
<index var="sort_index" default="documents.list_order" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
<column name="extra_vars" var="extra_vars" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
<column name="last_update" var="last_update" default="curdate()" />
|
||||
<column name="last_updater" var="last_updater" />
|
||||
<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" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue