Merge pull request #946 from bjrambo/pr/document-icons

문서 모듈의 아이콘을 스킨으로 설정할 수 있도록 개선
This commit is contained in:
BJRambo 2017-11-28 19:06:21 +09:00 committed by GitHub
commit 49f1a691d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 95 additions and 12 deletions

View file

@ -471,13 +471,21 @@ class documentAdminController extends document
$oDocumentModel = getModel('document');
$config = $oDocumentModel->getDocumentConfig();
$config->view_count_option = Context::get('view_count_option');
$config->icons = Context::get('icons');
$config->micons = Context::get('micons');
// Insert by creating the module Controller object
$oModuleController = getController('module');
$output = $oModuleController->insertModuleConfig('document',$config);
if(!$output->toBool())
{
return $output;
}
$this->setMessage('success_updated');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispDocumentAdminConfig');
return $this->setRedirectUrl($returnUrl, $output);
$this->setRedirectUrl($returnUrl, $output);
}
/**
@ -503,10 +511,11 @@ class documentAdminController extends document
*/
function procDocumentAdminDeleteAllThumbnail()
{
// delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4)
$this->deleteThumbnailFile('./files/attach/images');
// delete a directory itself, files/thumbnails (thumbnail policies have changed since version 1.0.5)
FileHandler::removeFilesInDir('./files/thumbnails');
$temp_cache_dir = './files/thumbnails_' . $_SERVER['REQUEST_TIME'];
FileHandler::rename('./files/thumbnails', $temp_cache_dir);
FileHandler::makeDir('./files/thumbnails');
FileHandler::removeDir($temp_cache_dir);
$this->setMessage('success_deleted');
}

View file

@ -148,6 +148,13 @@ class documentAdminView extends document
$config = $oDocumentModel->getDocumentConfig();
Context::set('config',$config);
$oModuleModel = getModel('module');
$pcIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'icons');
$mobileIconSkinList = $oModuleModel->getSkins($this->module_path . 'tpl', 'micons');
Context::set('pcIconSkinList', $pcIconSkinList);
Context::set('mobileIconSkinList', $mobileIconSkinList);
// Set the template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_config');

View file

@ -1188,9 +1188,27 @@ class documentItem extends Object
*/
function printExtraImages($time_check = 43200)
{
if(!$this->document_srl) return;
// Get the icon directory
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
if (!$this->document_srl)
{
return;
}
$oDocumentModel = getModel('document');
$documentConfig = $oDocumentModel->getDocumentConfig();
if(Mobile::isFromMobilePhone())
{
$iconSkin = $documentConfig->micons;
}
else
{
$iconSkin = $documentConfig->icons;
}
if($iconSkin == null)
{
$iconSkin = 'default';
}
$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
$buffs = $this->getExtraImages($time_check);
if(!count($buffs)) return;

View file

@ -10,6 +10,8 @@
*/
class documentModel extends document
{
private $documentConfig = NULL;
/**
* Initialization
* @return void
@ -935,15 +937,18 @@ class documentModel extends document
*/
function getDocumentConfig()
{
if(!$GLOBALS['__document_config__'])
if ($this->documentConfig === NULL)
{
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('document');
if(!$config) $config = new stdClass();
$GLOBALS['__document_config__'] = $config;
if (!$config)
{
$config = new stdClass();
}
$this->documentConfig = $config;
}
return $GLOBALS['__document_config__'];
return $this->documentConfig;
}
/**
@ -1610,6 +1615,22 @@ class documentModel extends document
return false;
}
function getDocumentExtraImagePath()
{
$documentConfig = getModel('document')->getDocumentConfig();
if(Mobile::isFromMobilePhone())
{
$iconSkin = $documentConfig->micons;
}
else
{
$iconSkin = $documentConfig->icons;
}
$path = sprintf('%s%s',getUrl(), "modules/document/tpl/icons/$iconSkin/");
return $path;
}
}
/* End of file document.model.php */
/* Location: ./modules/document/document.model.php */

View file

@ -10,6 +10,8 @@ $lang->category_color = 'Category Font Color';
$lang->expand = 'Expand';
$lang->category_group_srls = 'Accessable Group';
$lang->cmd_make_child = 'Add Child Category';
$lang->cmd_pc_icon_setting = 'PC icon setting';
$lang->cmd_mobile_icon_setting = 'Mobile icon setting';
$lang->cmd_enable_move_category = 'Change category position (Select a category and drag it to the position you want.)';
$lang->about_category_title = 'Please enter a category name.';
$lang->about_expand = 'Select this option, and they will stay expanded.';

View file

@ -6,6 +6,8 @@ $lang->view_count_option_some = '일부 계산';
$lang->view_count_option_once = '중복 금지';
$lang->view_count_option_none = '계산 안함';
$lang->cmd_delete_all_thumbnail = '섬네일 모두 삭제';
$lang->cmd_pc_icon_setting = 'PC아이콘 설정';
$lang->cmd_mobile_icon_setting = '모바일 아이콘 설정';
$lang->title_bold = '제목 굵게';
$lang->title_color = '제목 색깔';
$lang->new_document_count = '새 글';
@ -21,6 +23,8 @@ $lang->about_view_count_option = '조회수설정에 따라 중복 조회수 카
$lang->about_expand = '선택하면 늘 펼쳐진 상태로 있게 합니다.';
$lang->about_category_group_srls = '선택한 그룹만 현재 카테고리를 지정할 수 있도록 합니다.';
$lang->about_category_color = '분류 폰트색깔을 지정합니다. 예) red 또는 #ff0000';
$lang->about_cmd_pc_icon_setting = '게시판 새로운 글 혹은 수정되었을 때 출력하는 아이콘입니다. 기본값은 default 입니다. 사용않함을 선택할 경우 default 스킨이 기본값으로 출력됩니다.';
$lang->about_cmd_mobile_icon_setting = '게시판 새로운 글 혹은 수정되었을 때 출력하는 아이콘입니다. 기본값은 default 입니다. 사용않함을 선택할 경우 default 스킨이 기본값으로 출력됩니다.';
$lang->cmd_search_next = '계속 검색';
$lang->cmd_temp_save = '임시 저장';
$lang->cmd_toggle_checked_document = '선택항목 반전';

View file

@ -19,6 +19,28 @@
</div>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="icons">{$lang->cmd_pc_icon_setting}</label>
<div class="x_controls">
<select name="icons" id="icons">
<option value="">{$lang->notuse}</option>
<option loop="$pcIconSkinList => $key, $val" value="{$val->title}" selected="selected"|cond="$config->icons == $val->title">{$val->title}</option>
</select>
<a href="#icons_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="icons_help" class="x_help-block" hidden>{$lang->about_cmd_pc_icon_setting}</p>
</div>
</div>
<div class="x_control-group">
<label class="x_control-label" for="micons">{$lang->cmd_mobile_icon_setting}</label>
<div class="x_controls">
<select name="micons" id="micons">
<option value="">{$lang->notuse}</option>
<option loop="$pcIconSkinList => $key, $val" value="{$val->title}" selected="selected"|cond="$config->micons == $val->title">{$val->title}</option>
</select>
<a href="#micons_help" class="x_icon-question-sign" data-toggle>{$lang->help}</a>
<p id="micons_help" class="x_help-block" hidden>{$lang->about_cmd_mobile_icon_setting}</p>
</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B