diff --git a/addons/smartphone/classes/smartphone.class.php b/addons/smartphone/classes/smartphone.class.php index 4d0a4c285..652a33898 100644 --- a/addons/smartphone/classes/smartphone.class.php +++ b/addons/smartphone/classes/smartphone.class.php @@ -74,45 +74,44 @@ return $output; } - function procSmartPhone() { + function procSmartPhone($msg = null) { if(preg_match('/(iPopd|iPhone)/',$_SERVER['HTTP_USER_AGENT'])) { Context::addHtmlHeader(''); } else if(preg_match('/PPC/',$_SERVER['HTTP_USER_AGENT'])) { Context::addHtmlHeader(''); } - if(is_a($this->output, 'Object') || is_subclass_of($this->output, 'Object')) { - $this->setContent($this->output->getMessage()); + if(is_a($this->output, 'Object') || is_subclass_of($this->output, 'Object') || $msg) { + if($msg) $this->setContent(Context::getLang($msg)); + else $this->setContent($this->output->getMessage()); return; } - if($_GET['mid'] || $_GET['document_srl']) { - if($this->haveSmartphoneModule($this->module_info->module)) { - $oSmartPhoneModule =& getModule($this->module_info->module, 'smartphone'); - $vars = get_object_vars($this->oModule); - if(count($vars)) foreach($vars as $key => $val) $oSmartPhoneModule->{$key} = $val; - $oSmartPhoneModule->procSmartPhone($this); - } else { - switch(Context::getLangType()) { - case 'ko' : - $msg = '스마트폰을 지원하지 않는 모듈입니다'; - break; - case 'jp' : - $msg = 'このモジュールをサポートしていません。'; - break; - case 'zh-TW' : - $msg = '該模塊不支持。'; - break; - case 'zh-CN' : - $msg = '该模块不支持。'; - break; - default : - $msg = 'This module is not supported.'; - break; - } - $this->setContent($msg); + if($this->haveSmartphoneModule($this->module_info->module)) { + $oSmartPhoneModule =& getModule($this->module_info->module, 'smartphone'); + $vars = get_object_vars($this->oModule); + if(count($vars)) foreach($vars as $key => $val) $oSmartPhoneModule->{$key} = $val; + $oSmartPhoneModule->procSmartPhone($this); + } else { + switch(Context::getLangType()) { + case 'ko' : + $msg = '스마트폰을 지원하지 않는 모듈입니다'; + break; + case 'jp' : + $msg = 'このモジュールをサポートしていません。'; + break; + case 'zh-TW' : + $msg = '該模塊不支持。'; + break; + case 'zh-CN' : + $msg = '该模块不支持。'; + break; + default : + $msg = 'This module is not supported.'; + break; } - } + $this->setContent($msg); + } } function setContent($content) { diff --git a/addons/smartphone/smartphone.addon.php b/addons/smartphone/smartphone.addon.php index c1512037b..f4d9a3190 100644 --- a/addons/smartphone/smartphone.addon.php +++ b/addons/smartphone/smartphone.addon.php @@ -1,19 +1,31 @@ module_info, $output); - $oSmartphoneXE->procSmartPhone(); + if($called_position == 'after_module_proc' ) { + $oSmartphoneXE = new smartphoneXE($this, $this->module_info, $output); + $oSmartphoneXE->procSmartPhone(); + Context::set('layout', 'none'); + Context::set('smart_content', $oSmartphoneXE->content); + Context::set('parent_url', $oSmartphoneXE->parent_url); + Context::set('prev_url', $oSmartphoneXE->prev_url); + Context::set('next_url', $oSmartphoneXE->next_url); + $this->setTemplatePath('addons/smartphone/tpl'); + $this->setTemplateFile('layout'); - Context::set('layout', 'none'); - Context::set('smart_content', $oSmartphoneXE->content); - Context::set('parent_url', $oSmartphoneXE->parent_url); - Context::set('prev_url', $oSmartphoneXE->prev_url); - Context::set('next_url', $oSmartphoneXE->next_url); - $this->setTemplatePath('addons/smartphone/tpl'); - $this->setTemplateFile('layout'); + } elseif($called_position == 'before_module_proc' && !$this->grant->access) { + $oSmartphoneXE = new smartphoneXE($this, $this->module_info, $output); + $oSmartphoneXE->procSmartPhone('msg_not_permitted_act'); + Context::set('layout', 'none'); + Context::set('smart_content', $oSmartphoneXE->content); + Context::set('parent_url', $oSmartphoneXE->parent_url); + Context::set('prev_url', $oSmartphoneXE->prev_url); + Context::set('next_url', $oSmartphoneXE->next_url); + $this->setTemplatePath('addons/smartphone/tpl'); + $this->setTemplateFile('layout'); + } ?> diff --git a/addons/smartphone/tpl/smartphone.js b/addons/smartphone/tpl/smartphone.js index 801c9e616..d0b4a13ca 100644 --- a/addons/smartphone/tpl/smartphone.js +++ b/addons/smartphone/tpl/smartphone.js @@ -1,4 +1,5 @@ var xeSmartMenu = null; +var xeSmartUpperMenu = null; function showXEMenu() { if(!xeSmartMenu) { @@ -40,9 +41,12 @@ function showXEMenu() { } if(xeSmartMenu.css('display')=='none' && typeof(xeMenus)!='undefined') { + xeSmartUpperMenu = null; var menu = findSmartNode(xeMenus); if(!menu) menu = xeMenus; var html = '