Merge pull request #105 from SoneYours/develop

조회수 설정 기능을 추가함 #103
This commit is contained in:
BJRambo 2016-01-19 15:46:28 +09:00
commit 64c2253502
8 changed files with 88 additions and 44 deletions

View file

@ -485,7 +485,8 @@ class documentAdminController extends document
function procDocumentAdminInsertConfig() function procDocumentAdminInsertConfig()
{ {
// Get the basic information // Get the basic information
$config = Context::gets('thumbnail_type'); $config = new stdClass();
$config->view_count_option = Context::get('view_count_option');
// Insert by creating the module Controller object // Insert by creating the module Controller object
$oModuleController = getController('module'); $oModuleController = getController('module');
$output = $oModuleController->insertModuleConfig('document',$config); $output = $oModuleController->insertModuleConfig('document',$config);

View file

@ -896,6 +896,10 @@ class documentController extends document
{ {
// Pass if Crawler access // Pass if Crawler access
if(isCrawler()) return false; if(isCrawler()) return false;
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
if($config->view_count_option == 'none') return false;
$document_srl = $oDocument->document_srl; $document_srl = $oDocument->document_srl;
$member_srl = $oDocument->get('member_srl'); $member_srl = $oDocument->get('member_srl');
@ -906,8 +910,20 @@ class documentController extends document
if(!$trigger_output->toBool()) return $trigger_output; if(!$trigger_output->toBool()) return $trigger_output;
// Pass if read count is increaded on the session information // Pass if read count is increaded on the session information
if($_SESSION['readed_document'][$document_srl]) return false; if($_SESSION['readed_document'][$document_srl] && $config->view_count_option == 'once')
{
return false;
}
else if($config->view_count_option == 'some')
{
if($_SESSION['readed_document'][$document_srl])
{
return false;
}
}
if($config->view_count_option == 'once')
{
// Pass if the author's IP address is as same as visitor's. // Pass if the author's IP address is as same as visitor's.
if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus()) if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR'] && Context::getSessionStatus())
{ {
@ -920,14 +936,14 @@ class documentController extends document
$_SESSION['readed_document'][$document_srl] = true; $_SESSION['readed_document'][$document_srl] = true;
return false; return false;
} }
}
$oDB = DB::getInstance(); $oDB = DB::getInstance();
$oDB->begin(); $oDB->begin();
// Update read counts // Update read counts
$args = new stdClass; $args = new stdClass;
$args->document_srl = $document_srl; $args->document_srl = $document_srl;
$output = executeQuery('document.updateReadedCount', $args); executeQuery('document.updateReadedCount', $args);
// Call a trigger when the read count is updated (after) // Call a trigger when the read count is updated (after)
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument); $trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);

View file

@ -916,7 +916,7 @@ class documentModel extends document
$config = $oModuleModel->getModuleConfig('document'); $config = $oModuleModel->getModuleConfig('document');
if(!$config) $config = new stdClass(); if(!$config) $config = new stdClass();
if(!$config->thumbnail_type) $config->thumbnail_type = 'crop'; if(!$config->view_count_option) $config->view_count_option = 'once';
$GLOBALS['__document_config__'] = $config; $GLOBALS['__document_config__'] = $config;
} }
return $GLOBALS['__document_config__']; return $GLOBALS['__document_config__'];

View file

@ -23,6 +23,21 @@
<value xml:lang="tr"><![CDATA[Küçük Resim Türü]]></value> <value xml:lang="tr"><![CDATA[Küçük Resim Türü]]></value>
<value xml:lang="vi"><![CDATA[Định dạng hình nhỏ]]></value> <value xml:lang="vi"><![CDATA[Định dạng hình nhỏ]]></value>
</item> </item>
<item name="view_count_option">
<value xml:lang="ko"><![CDATA[조회수 설정]]></value>
</item>
<item name="view_count_option_all">
<value xml:lang="ko"><![CDATA[모두 계산]]></value>
</item>
<item name="view_count_option_some">
<value xml:lang="ko"><![CDATA[일부 계산]]></value>
</item>
<item name="view_count_option_once">
<value xml:lang="ko"><![CDATA[중복 금지]]></value>
</item>
<item name="view_count_option_none">
<value xml:lang="ko"><![CDATA[계산 안함]]></value>
</item>
<item name="thumbnail_crop"> <item name="thumbnail_crop">
<value xml:lang="ko"><![CDATA[잘라내기 (정해진 크기에 꽉 찬 모습의 썸네일을 만듭니다.)]]></value> <value xml:lang="ko"><![CDATA[잘라내기 (정해진 크기에 꽉 찬 모습의 썸네일을 만듭니다.)]]></value>
<value xml:lang="en"><![CDATA[Crop (to a specific size)]]></value> <value xml:lang="en"><![CDATA[Crop (to a specific size)]]></value>
@ -183,6 +198,9 @@
<value xml:lang="tr"><![CDATA[Lütfen kategori ismi giriniz]]></value> <value xml:lang="tr"><![CDATA[Lütfen kategori ismi giriniz]]></value>
<value xml:lang="vi"><![CDATA[Hãy nhập tên thể loại]]></value> <value xml:lang="vi"><![CDATA[Hãy nhập tên thể loại]]></value>
</item> </item>
<item name="about_view_count_option">
<value xml:lang="ko"><![CDATA[조회수설정에 따라 중복 조회수 카운트를 할 수 있도록 도와줍니다. 각 옵션에 따라 조회수 기록하는 방식이 달라집니다.]]></value>
</item>
<item name="about_expand"> <item name="about_expand">
<value xml:lang="ko"><![CDATA[선택하면 늘 펼쳐진 상태로 있게 합니다.]]></value> <value xml:lang="ko"><![CDATA[선택하면 늘 펼쳐진 상태로 있게 합니다.]]></value>
<value xml:lang="en"><![CDATA[Select this option, and they will stay expanded.]]></value> <value xml:lang="en"><![CDATA[Select this option, and they will stay expanded.]]></value>

View file

@ -3,9 +3,7 @@ xe.lang.msg_empty_search_target = '{$lang->msg_empty_search_target}';
xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</script> </script>
<load target="js/document_admin.js" /> <load target="js/document_admin.js" />
<div class="x_page-header"> <include target="header.html" />
<h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/declared_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}"> <div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/declared_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p> <p>{$XE_VALIDATOR_MESSAGE}</p>
</div> </div>

View file

@ -1,21 +1,27 @@
<!--#include("header.html")--> <include target="header.html" />
<form action="./" method="post"> <form action="./" method="post" class="x_form-horizontal" method="post">
<input type="hidden" name="module" value="document" /> <input type="hidden" name="module" value="document" />
<input type="hidden" name="act" value="procDocumentAdminInsertConfig" /> <input type="hidden" name="act" value="procDocumentAdminInsertConfig" />
<table class="x_table x_table-striped x_table-hover"> <input type="hidden" name="xe_validator_id" value="modules/document/tpl/document_config/1" />
<tr>
<th scope="col">{$lang->thumbnail_type}</th> <div class="x_control-group">
</tr> <div class="x_control-group">
<tr> <label class="x_control-label">{$lang->view_count_option}</label>
<td> <div class="x_controls">
<input type="radio" name="thumbnail_type" value="crop" <!--@if($config->thumbnail_type != 'ratio')-->checked="checked"<!--@end-->/> {$lang->thumbnail_crop} <br /> <select name="view_count_option">
<input type="radio" name="thumbnail_type" value="ratio" <!--@if($config->thumbnail_type == 'ratio')-->checked="checked"<!--@end-->/> {$lang->thumbnail_ratio} <option value="all" selected="selected"|cond="$config->view_count_option=='all'">{$lang->view_count_option_all}</option>
</td> <option value="some" selected="selected"|cond="$config->view_count_option=='some'">{$lang->view_count_option_some}</option>
</tr> <option value="once" selected="selected"|cond="$config->view_count_option=='once'">{$lang->view_count_option_once}</option>
</table> <option value="none" selected="selected"|cond="$config->view_count_option=='none'">{$lang->view_count_option_none}</option>
<div class="btnArea"> </select>
<input class="btn" type="submit" value="{$lang->cmd_registration}" /> <p>{$lang->about_view_count_option}</p>
<input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/> </div>
</div>
</div>
<div class="btnArea x_clearfix">
<span class="x_pull-right" style="margin-left:10px;"><input class="btn" type="button" value="{$lang->cmd_delete_all_thumbnail}" onclick="doDeleteAllThumbnail()"/></span>
<span class="x_pull-right"><input class="x_btn x_btn-primary" type="submit" value="{$lang->cmd_save}" /></span>
</div> </div>
</form> </form>

View file

@ -3,9 +3,7 @@ xe.lang.msg_empty_search_target = '{$lang->msg_empty_search_target}';
xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}'; xe.lang.msg_empty_search_keyword = '{$lang->msg_empty_search_keyword}';
</script> </script>
<load target="js/document_admin.js" /> <load target="js/document_admin.js" />
<div class="x_page-header"> <include target="header.html" />
<h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
</div>
<div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/document_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}"> <div cond="$XE_VALIDATOR_MESSAGE && $XE_VALIDATOR_ID == 'modules/document/tpl/document_list/1'" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p> <p>{$XE_VALIDATOR_MESSAGE}</p>
</div> </div>

View file

@ -1,9 +1,16 @@
<load target="js/document_admin.js" /> <load target="js/document_admin.js" />
<h1>{$lang->document} {$lang->cmd_management}</h1>
<p> <div class="x_page-header">
<a href="{getUrl('act','dispDocumentAdminList')}" class="active"|cond="$act=='dispDocumentAdminList'">{$lang->document_list}</a> <h1>{$lang->document} <a class="x_icon-question-sign" href="./common/manual/admin/#UMAN_content_document" target="_blank">{$lang->help}</a></h1>
<i>|</i> </div>
<a href="{getUrl('act','dispDocumentAdminConfig')}" class="active"|cond="$act=='dispDocumentAdminConfig'">{$lang->cmd_module_config}</a> <ul class="x_nav x_nav-tabs">
<i>|</i> <li class="x_active"|cond="$act == 'dispDocumentAdminList'">
<a href="{getUrl('act','dispDocumentAdminDeclared')}" class="active"|cond="$act=='dispDocumentAdminDeclared'">{$lang->cmd_declared_list}</a> <a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminList')}">{$lang->document_list}</a>
</p> </li>
<li class="x_active"|cond="$act == 'dispDocumentAdminConfig'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig')}">{$lang->cmd_module_config}</a>
</li>
<li class="x_active"|cond="$act == 'dispDocumentAdminDeclared'">
<a href="{getUrl('', 'module', 'admin', 'act', 'dispDocumentAdminDeclared')}">{$lang->cmd_declared_list}</a>
</li>
</ul>