mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 19:51:42 +09:00
#18985672 : separate mobile/pc for addons
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7576 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
074074623f
commit
7f325e46e9
16 changed files with 89 additions and 28 deletions
|
|
@ -24,15 +24,17 @@
|
|||
|
||||
// addon값을 받아옴
|
||||
$addon = Context::get('addon');
|
||||
$type = Context::get('type');
|
||||
if(!$type) $type = "pc";
|
||||
if($addon) {
|
||||
// 활성화 되어 있으면 비활성화 시킴
|
||||
if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl)) $this->doDeactivate($addon, $site_module_info->site_srl);
|
||||
if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) $this->doDeactivate($addon, $site_module_info->site_srl, $type);
|
||||
|
||||
// 비활성화 되어 있으면 활성화 시킴
|
||||
else $this->doActivate($addon, $site_module_info->site_srl);
|
||||
else $this->doActivate($addon, $site_module_info->site_srl, $type);
|
||||
}
|
||||
|
||||
$this->makeCacheFile($site_module_info->site_srl);
|
||||
$this->makeCacheFile($site_module_info->site_srl, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -50,7 +52,8 @@
|
|||
|
||||
$this->doSetup($addon_name, $args, $site_module_info->site_srl);
|
||||
|
||||
$this->makeCacheFile($site_module_info->site_srl);
|
||||
$this->makeCacheFile($site_module_info->site_srl, "pc");
|
||||
$this->makeCacheFile($site_module_info->site_srl, "mobile");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -71,9 +74,10 @@
|
|||
* @brief 애드온 활성화
|
||||
* addons라는 테이블에 애드온의 활성화 상태를 on 시켜줌
|
||||
**/
|
||||
function doActivate($addon, $site_srl = 0) {
|
||||
function doActivate($addon, $site_srl = 0, $type = "pc") {
|
||||
$args->addon = $addon;
|
||||
$args->is_used = 'Y';
|
||||
if($type == "pc") $args->is_used = 'Y';
|
||||
else $args->is_used_m = "Y";
|
||||
if(!$site_srl) return executeQuery('addon.updateAddon', $args);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
|
|
@ -84,9 +88,10 @@
|
|||
*
|
||||
* addons라는 테이블에 애드온의 이름을 제거하는 것으로 비활성화를 시키게 된다
|
||||
**/
|
||||
function doDeactivate($addon, $site_srl = 0) {
|
||||
function doDeactivate($addon, $site_srl = 0, $type = "pc") {
|
||||
$args->addon = $addon;
|
||||
$args->is_used = 'N';
|
||||
if($type == "pc") $args->is_used = 'N';
|
||||
else $args->is_used_m = 'N';
|
||||
if(!$site_srl) return executeQuery('addon.updateAddon', $args);
|
||||
$args->site_srl = $site_srl;
|
||||
return executeQuery('addon.updateSiteAddon', $args);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
$info->addon = $addon_name;
|
||||
$info->path = $path;
|
||||
$info->activated = false;
|
||||
$info->mactivated = false;
|
||||
|
||||
// DB에 입력되어 있는지 확인
|
||||
if(!in_array($addon_name, array_keys($inserted_addons))) {
|
||||
|
|
@ -60,6 +61,7 @@
|
|||
// 활성화 되어 있는지 확인
|
||||
} else {
|
||||
if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true;
|
||||
if($inserted_addons[$addon_name]->is_used_m=='Y') $info->mactivated = true;
|
||||
}
|
||||
|
||||
$list[] = $info;
|
||||
|
|
@ -292,12 +294,16 @@
|
|||
/**
|
||||
* @brief 애드온이 활성화 되어 있는지 체크
|
||||
**/
|
||||
function isActivatedAddon($addon, $site_srl = 0) {
|
||||
function isActivatedAddon($addon, $site_srl = 0, $type = "pc") {
|
||||
$args->addon = $addon;
|
||||
if(!$site_srl) $output = executeQuery('addon.getAddonIsActivated', $args);
|
||||
if(!$site_srl) {
|
||||
if($type == "pc") $output = executeQuery('addon.getAddonIsActivated', $args);
|
||||
else $output = executeQuery('addon.getMAddonIsActivated', $args);
|
||||
}
|
||||
else {
|
||||
$args->site_srl = $site_srl;
|
||||
$output = executeQuery('addon.getSiteAddonIsActivated', $args);
|
||||
if($type == "pc") $output = executeQuery('addon.getSiteAddonIsActivated', $args);
|
||||
else $output = executeQuery('addon.getSiteMAddonIsActivated', $args);
|
||||
}
|
||||
if($output->data->count>0) return true;
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
class addon extends ModuleObject {
|
||||
|
||||
var $cache_file = "./files/cache/activated_addons.cache.php";
|
||||
var $cache_file = "./files/cache/activated_addons.ache.php";
|
||||
|
||||
/**
|
||||
* @brief 설치시 추가 작업이 필요할시 구현
|
||||
|
|
@ -43,6 +43,9 @@
|
|||
**/
|
||||
function checkUpdate() {
|
||||
if(file_exists($this->cache_file)) FileHandler::removeFile($this->cache_file);
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("addons", "is_used_m")) return true;
|
||||
if(!$oDB->isColumnExists("addons_site", "is_used_m")) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -50,6 +53,13 @@
|
|||
* @brief 업데이트 실행
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
$oDB = &DB::getInstance();
|
||||
if(!$oDB->isColumnExists("addons", "is_used_m")) {
|
||||
$oDB->addColumn("addons", "is_used_m", "char", 1, "N", true);
|
||||
}
|
||||
if(!$oDB->isColumnExists("addons_site", "is_used_m")) {
|
||||
$oDB->addColumn("addons_site", "is_used_m", "char", 1, "N", true);
|
||||
}
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@
|
|||
/**
|
||||
* @brief 메인/ 가상 사이트별 애드온 캐시 파일의 위치를 구함
|
||||
**/
|
||||
function getCacheFilePath() {
|
||||
function getCacheFilePath($type = "pc") {
|
||||
$site_module_info = Context::get('site_module_info');
|
||||
$site_srl = $site_module_info->site_srl;
|
||||
|
||||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
||||
|
||||
if($site_srl) $addon_file = $addon_path.$site_srl.'.acivated_addons.cache.php';
|
||||
else $addon_file = $addon_path.'acivated_addons.cache.php';
|
||||
if($site_srl) $addon_file = $addon_path.$site_srl.$type.'.acivated_addons.cache.php';
|
||||
else $addon_file = $addon_path.$type.'acivated_addons.cache.php';
|
||||
|
||||
if($this->addon_file_called) return $addon_file;
|
||||
$this->addon_file_called = true;
|
||||
|
||||
if(!is_dir($addon_path)) FileHandler::makeDir($addon_path);
|
||||
if(!file_exists($addon_file)) $this->makeCacheFile($site_srl);
|
||||
if(!file_exists($addon_file)) $this->makeCacheFile($site_srl, $type);
|
||||
return $addon_file;
|
||||
}
|
||||
|
||||
|
|
@ -120,14 +120,15 @@
|
|||
/**
|
||||
* @brief 캐시 파일 생성
|
||||
**/
|
||||
function makeCacheFile($site_srl = 0) {
|
||||
function makeCacheFile($site_srl = 0, $type = "pc") {
|
||||
// 모듈에서 애드온을 사용하기 위한 캐시 파일 생성
|
||||
$buff = "";
|
||||
$oAddonModel = &getAdminModel('addon');
|
||||
$addon_list = $oAddonModel->getInsertedAddons($site_srl);
|
||||
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $type);
|
||||
foreach($addon_list as $addon => $val) {
|
||||
if($val->addon == "smartphone") continue;
|
||||
if($val->is_used != 'Y' || !is_dir(_XE_PATH_.'addons/'.$addon) ) continue;
|
||||
if(!is_dir(_XE_PATH_.'addons/'.$addon)) continue;
|
||||
if(($type == "pc" && $val->is_used != 'Y') || ($type == "mobile" && $val->is_used_m != 'Y')) continue;
|
||||
|
||||
$extra_vars = unserialize($val->extra_vars);
|
||||
$mid_list = $extra_vars->mid_list;
|
||||
|
|
@ -147,8 +148,8 @@
|
|||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
||||
if(!is_dir($addon_path)) FileHandler::makeDir($addon_path);
|
||||
|
||||
if($site_srl) $addon_file = $addon_path.$site_srl.'.acivated_addons.cache.php';
|
||||
else $addon_file = $addon_path.'acivated_addons.cache.php';
|
||||
if($site_srl) $addon_file = $addon_path.$site_srl.$type.'.acivated_addons.cache.php';
|
||||
else $addon_file = $addon_path.$type.'acivated_addons.cache.php';
|
||||
|
||||
FileHandler::writeFile($addon_file, $buff);
|
||||
}
|
||||
|
|
|
|||
12
modules/addon/queries/getMAddonIsActivated.xml
Normal file
12
modules/addon/queries/getMAddonIsActivated.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="getMAddonIsActivated" action="select">
|
||||
<tables>
|
||||
<table name="addons" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="addon" var="addon" notnull="notnull" />
|
||||
<condition operation="equal" column="is_used_m" default="Y" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<query id="getAddonIsActivated" action="select">
|
||||
<query id="getSiteAddonIsActivated" action="select">
|
||||
<tables>
|
||||
<table name="addons_site" />
|
||||
</tables>
|
||||
|
|
|
|||
13
modules/addon/queries/getSiteMAddonIsActivated.xml
Normal file
13
modules/addon/queries/getSiteMAddonIsActivated.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<query id="getSiteMAddonIsActivated" action="select">
|
||||
<tables>
|
||||
<table name="addons_site" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="count(*)" alias="count" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="site_srl" var="site_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="addon" var="addon" notnull="notnull" pipe="and" />
|
||||
<condition operation="equal" column="is_used_m" default="Y" notnull="notnull" pipe="and" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
</tables>
|
||||
<columns>
|
||||
<column name="is_used" var="is_used" />
|
||||
<column name="is_used_m" var="is_used_m" />
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
</columns>
|
||||
<conditions>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
</tables>
|
||||
<columns>
|
||||
<column name="is_used" var="is_used" />
|
||||
<column name="is_used_m" var="is_used_m" />
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
</columns>
|
||||
<conditions>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<table name="addons">
|
||||
<column name="addon" type="varchar" size="250" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="is_used" type="char" size="1" default="Y" notnull="notnull" />
|
||||
<column name="is_used_m" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="extra_vars" type="text" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<column name="site_srl" type="number" size="11" notnull="notnull" default="0" unique="unique_addon_site" />
|
||||
<column name="addon" type="varchar" size="250" notnull="notnull" unique="unique_addon_site" />
|
||||
<column name="is_used" type="char" size="1" default="Y" notnull="notnull" />
|
||||
<column name="is_used_m" type="char" size="1" default="N" notnull="notnull" />
|
||||
<column name="extra_vars" type="text" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ function doToggleAddon(addon) {
|
|||
}
|
||||
|
||||
// 관리자 제어판 페이지용
|
||||
function doToggleAddonInAdmin(obj, addon) {
|
||||
function doToggleAddonInAdmin(obj, addon, type) {
|
||||
var params = new Array();
|
||||
params['addon'] = addon;
|
||||
if(typeof(type) == "undefined") type = "pc";
|
||||
params['type'] = type;
|
||||
exec_xml('addon','procAddonAdminToggleActivate',params,function() { if(/Active/.test(obj.className)) obj.className = "buttonSet buttonDisable"; else obj.className = "buttonSet buttonActive"; } );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue