mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
issue 26 Document status change with config.
old version coding with hard coding git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8448 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0ba04bb1f7
commit
e3376c3c3a
8 changed files with 45 additions and 20 deletions
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
// 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');
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
|
|
@ -262,5 +263,23 @@
|
|||
FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Document Status List
|
||||
**/
|
||||
function getStatusList()
|
||||
{
|
||||
return $this->statusList;
|
||||
}
|
||||
|
||||
function getDefaultStatus()
|
||||
{
|
||||
return $this->statusList['public'];
|
||||
}
|
||||
|
||||
function getConfigStatus($key)
|
||||
{
|
||||
if(array_key_exists($key, $this->statusList)) return $this->statusList[$key];
|
||||
else $this->getDefaultStatus();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ class documentController extends document {
|
|||
// Remove iframe and script if not a top adminisrator in the session.
|
||||
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
|
||||
// if temporary document, regdate is now setting
|
||||
if($source_obj->get('status') == 'TEMP') $obj->regdate = date('YmdHis');
|
||||
if($source_obj->get('status') == $this->getConfigStatus('temp')) $obj->regdate = date('YmdHis');
|
||||
|
||||
// Insert data into the DB
|
||||
$output = executeQuery('document.updateDocument', $obj);
|
||||
|
|
@ -1648,7 +1648,7 @@ class documentController extends document {
|
|||
$obj = Context::getRequestVars();
|
||||
// Change the target module to log-in information
|
||||
$obj->module_srl = $module_info->module_srl;
|
||||
$obj->status = 'TEMP';
|
||||
$obj->status = $this->getConfigStatus('temp');
|
||||
unset($obj->is_notice);
|
||||
|
||||
// Extract from beginning part of contents in the guestbook
|
||||
|
|
|
|||
|
|
@ -122,7 +122,8 @@
|
|||
}
|
||||
|
||||
function isSecret() {
|
||||
return $this->get('status') == 'SECRET' ? true : false;
|
||||
$oDocumentModel = &getModel('document');
|
||||
return $this->get('status') == $oDocumentModel->getConfigStatus('secret') ? true : false;
|
||||
}
|
||||
|
||||
function isNotice() {
|
||||
|
|
@ -633,7 +634,7 @@
|
|||
|
||||
function getStatus()
|
||||
{
|
||||
if(!$this->get('status')) return 'PUBLIC';
|
||||
if(!$this->get('status')) return $this->getDefaultStatus();
|
||||
return $this->get('status');
|
||||
}
|
||||
|
||||
|
|
@ -756,8 +757,12 @@
|
|||
$status = $this->get('status');
|
||||
if(empty($status)) return false;
|
||||
|
||||
if($status == 'PUBLIC' || $status == 'PUBLISH') return true;
|
||||
else if($status == 'PRIVATE' || $status == 'SECRET')
|
||||
$oDocumentModel = &getModel('document');
|
||||
$configStatusList = $oDocumentModel->getStatusList();
|
||||
|
||||
if($status == $configStatusList['public'] || $status == $configStatusList['publish'])
|
||||
return true;
|
||||
else if($status == $configStatusList['private'] || $status == $configStatusList['secret'])
|
||||
{
|
||||
if($this->get('member_srl') == $logged_info->member_srl)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@
|
|||
$args->start_date = $obj->start_date?$obj->start_date:null;
|
||||
$args->end_date = $obj->end_date?$obj->end_date:null;
|
||||
$args->member_srl = $obj->member_srl;
|
||||
$args->statusList = $obj->statusList?$obj->statusList:array('SECRET', 'PUBLIC', 'PUBLISH');
|
||||
if($logged_info->is_admin == 'Y') $args->statusList = array('SECRET', 'PUBLIC', 'PUBLISH');
|
||||
$args->statusList = $obj->statusList?$obj->statusList:array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
|
||||
if($logged_info->is_admin == 'Y') $args->statusList = array($this->getConfigStatus('secret'), $this->getConfigStatus('public'));
|
||||
// Category is selected, further sub-categories until all conditions
|
||||
if($args->category_srl) {
|
||||
$category_list = $this->getCategoryList($args->module_srl);
|
||||
|
|
@ -927,8 +927,8 @@
|
|||
break;
|
||||
case 'is_notice' :
|
||||
case 'is_secret' :
|
||||
if($search_keyword=='N') $args->statusList = array('PUBLIC', 'PUBLISH');
|
||||
elseif($search_keyword=='Y') $args->statusList = array('SECRET');
|
||||
if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
|
||||
elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
|
||||
break;
|
||||
case 'member_srl' :
|
||||
case 'readed_count' :
|
||||
|
|
@ -1003,11 +1003,11 @@
|
|||
$this->add('voted_member_list',$output->data);
|
||||
}
|
||||
|
||||
function getStatusConfigList()
|
||||
function getStatusNameList()
|
||||
{
|
||||
global $lang;
|
||||
if(!isset($lang->status_name_list))
|
||||
return array('PRIVATE'=>'private', 'PUBLIC'=>'public', 'SECRET'=>'secret', 'TEMP'=>'temporary');
|
||||
return array_flip($this->getStatusList());
|
||||
else return $lang->status_name_list;
|
||||
}
|
||||
|
||||
|
|
@ -1083,8 +1083,8 @@
|
|||
break;
|
||||
case 'is_notice' :
|
||||
case 'is_secret' :
|
||||
if($search_keyword=='N') $args->statusList = array('PUBLIC', 'PUBLISH');
|
||||
elseif($search_keyword=='Y') $args->statusList = array('SECRET');
|
||||
if($search_keyword=='N') $args->statusList = array($this->getConfigStatus('public'));
|
||||
elseif($search_keyword=='Y') $args->statusList = array($this->getConfigStatus('secret'));
|
||||
break;
|
||||
case 'member_srl' :
|
||||
case 'readed_count' :
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@
|
|||
// Get the saved document (module_srl is set to member_srl instead)
|
||||
$logged_info = Context::get('logged_info');
|
||||
$args->member_srl = $logged_info->member_srl;
|
||||
$args->statusList = array('TEMP');
|
||||
$args->statusList = array($this->getConfigStatus('temp'));
|
||||
$args->page = (int)Context::get('page');
|
||||
$args->list_count = 10;
|
||||
|
||||
|
|
|
|||
|
|
@ -539,7 +539,7 @@
|
|||
$obj->member_srl = 0;
|
||||
|
||||
$obj->is_notice = base64_decode($xmlDoc->post->is_notice->body)=='Y'?'Y':'N';
|
||||
$obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?'SECRET':'PUBLIC';
|
||||
$obj->status = base64_decode($xmlDoc->post->is_secret->body)=='Y'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public');
|
||||
$obj->title = base64_decode($xmlDoc->post->title->body);
|
||||
$obj->content = base64_decode($xmlDoc->post->content->body);
|
||||
$obj->readed_count = base64_decode($xmlDoc->post->readed_count->body);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
|
||||
$obj->is_notice = 'N';
|
||||
$obj->status = in_array($xmlDoc->post->visibility->body, array('public','syndicated'))?'PUBLIC':'SECRET';
|
||||
$obj->status = in_array($xmlDoc->post->visibility->body, array('public','syndicated'))?$oDocumentModel->getConfigStatus('public'):$oDocumentModel->('secret');
|
||||
$obj->title = $xmlDoc->post->title->body;
|
||||
$obj->content = $xmlDoc->post->content->body;
|
||||
$obj->password = md5($xmlDoc->post->password->body);
|
||||
|
|
@ -275,7 +275,7 @@
|
|||
$obj->document_srl = getNextSequence();
|
||||
$obj->uploaded_count = 0;
|
||||
$obj->is_notice = 'N';
|
||||
$obj->status = $val->secret->body=='1'?'SECRET':'PUBLIC';
|
||||
$obj->status = $val->secret->body=='1'?$oDocumentModel->getConfigStatus('secret'):$oDocumentModel->getConfigStatus('public');
|
||||
$obj->content = nl2br($val->content->body);
|
||||
|
||||
// Extract a title form the bocy
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@
|
|||
* @brief A trigger to add points to the member for creating a post
|
||||
**/
|
||||
function triggerInsertDocument(&$obj) {
|
||||
if($obj->status != 'TEMP')
|
||||
$oDocumentModel = &getModel('document');
|
||||
if($obj->status != $oDocumentModel->getConfigStatus('temp'))
|
||||
{
|
||||
$module_srl = $obj->module_srl;
|
||||
$member_srl = $obj->member_srl;
|
||||
|
|
@ -100,7 +101,7 @@
|
|||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
|
||||
// if status is TEMP or PUBLIC... give not point, only status is empty
|
||||
if($oDocument->get('status') == 'TEMP' && $obj->status != 'TEMP')
|
||||
if($oDocument->get('status') == $oDocumentModel->getConfigStatus('temp') && $obj->status != $oDocumentModel->getConfigStatus('temp'))
|
||||
{
|
||||
$oModuleModel = &getModel('module');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue