issue 2662 module

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12254 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-11-19 09:26:12 +00:00
parent 59b001578f
commit d456ea02e0
8 changed files with 5394 additions and 4967 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,516 +1,541 @@
<?php
/**
* @class moduleAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief AdminModel class of the "module" module
**/
/**
* @class moduleAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief AdminModel class of the "module" module
*/
class moduleAdminModel extends module
{
/**
* @brief Initialization
*/
function init()
{
}
class moduleAdminModel extends module {
/**
* @brief Return a list of target modules by using module_srls separated by comma(,)
* Used in the ModuleSelector
*/
function getModuleAdminModuleList()
{
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
$args->module_srls = Context::get('module_srls');
$output = executeQueryArray('module.getModulesInfo', $args);
if(!$output->toBool() || !$output->data) return new Object();
/**
* @brief Initialization
**/
function init() {
}
/**
* @brief Return a list of target modules by using module_srls separated by comma(,)
* Used in the ModuleSelector
**/
function getModuleAdminModuleList() {
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
$args->module_srls = Context::get('module_srls');
$output = executeQueryArray('module.getModulesInfo', $args);
if(!$output->toBool() || !$output->data) return new Object();
foreach($output->data as $key => $val) {
$info_xml = $oModuleModel->getModuleInfoXml($val->module);
$oModuleController->replaceDefinedLangCode($val->browser_title);
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
}
$modules = explode(',',$args->module_srls);
for($i=0;$i<count($modules);$i++) {
$module_list[$modules[$i]] = $list[$modules[$i]];
}
$this->add('id', Context::get('id'));
$this->add('module_list', $module_list);
}
function getModuleMidList($args){
$args->list_count = 20;
$args->page_count = 10;
$output = executeQueryArray('module.getModuleMidList', $args);
if(!$output->toBool()) return $output;
ModuleModel::syncModuleToSite($output->data);
return $output;
}
function getSelectedManageHTML($grantList)
foreach($output->data as $key => $val)
{
// Grant virtual permission for access and manager
$grantList->access->title = Context::getLang('grant_access');
$grantList->access->default = 'guest';
if(count($grantList))
{
foreach($grantList as $key => $val) {
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups(0);
Context::set('group_list', $group_list);
Context::set('module_srls', 'dummy');
$content = '';
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'include.manage_selected.html');
$info_xml = $oModuleModel->getModuleInfoXml($val->module);
$oModuleController->replaceDefinedLangCode($val->browser_title);
$list[$val->module_srl] = array('module_srl'=>$val->module_srl,'mid'=>$val->mid,'browser_title'=>$val->browser_title, 'module_name' => $info_xml->title);
}
$modules = explode(',',$args->module_srls);
for($i=0;$i<count($modules);$i++)
{
$module_list[$modules[$i]] = $list[$modules[$i]];
}
/**
* @brief Common:: module's permission displaying page in the module
* Available when using module instance in all the modules
**/
function getModuleGrantHTML($module_srl, $source_grant_list) {
if(!$module_srl)
{
return;
}
$this->add('id', Context::get('id'));
$this->add('module_list', $module_list);
}
// get member module's config
$oMemberModel = &getModel('member');
$member_config = $oMemberModel->getMemberConfig();
Context::set('member_config', $member_config);
function getModuleMidList($args)
{
$args->list_count = 20;
$args->page_count = 10;
$output = executeQueryArray('module.getModuleMidList', $args);
if(!$output->toBool()) return $output;
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'site_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
// Grant virtual permission for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
foreach($source_grant_list as $key => $val) {
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a permission group granted to the current module
$default_grant = array();
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $args);
if($output->data) {
foreach($output->data as $val) {
if($val->group_srl == 0) $default_grant[$val->name] = 'all';
else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
else {
$selected_group[$val->name][] = $val->group_srl;
$default_grant[$val->name] = 'group';
}
}
}
Context::set('selected_group', $selected_group);
Context::set('default_grant', $default_grant);
Context::set('module_srl', $module_srl);
// Extract admin ID set in the current module
$admin_member = $oModuleModel->getAdminId($module_srl);
Context::set('admin_member', $admin_member);
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
ModuleModel::syncModuleToSite($output->data);
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('group_list..description');
$security->encodeHTML('admin_member..nick_name');
return $output;
}
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
}
public function getModuleAdminGrant()
function getSelectedManageHTML($grantList)
{
// Grant virtual permission for access and manager
$grantList->access->title = Context::getLang('grant_access');
$grantList->access->default = 'guest';
if(count($grantList))
{
$targetModule = Context::get('target_module');
$moduleSrl = Context::get('module_srl');
if(!$targetModule || !$moduleSrl)
foreach($grantList as $key => $val)
{
return new Object(-1, 'msg_invalid_request');
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
if($targetModule == '_SHORTCUT')
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups(0);
Context::set('group_list', $group_list);
Context::set('module_srls', 'dummy');
$content = '';
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'include.manage_selected.html');
}
/**
* @brief Common:: module's permission displaying page in the module
* Available when using module instance in all the modules
*/
function getModuleGrantHTML($module_srl, $source_grant_list)
{
if(!$module_srl)
{
return;
}
// get member module's config
$oMemberModel = &getModel('member');
$member_config = $oMemberModel->getMemberConfig();
Context::set('member_config', $member_config);
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'site_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
// Grant virtual permission for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list))
{
foreach($source_grant_list as $key => $val)
{
return new Object(0);
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
$oModuleModel = &getModel('module');
$xmlInfo = $oModuleModel->getModuleActionXml($targetModule);
// Grant virtual permission for access and manager
$grantList->access->title = Context::getLang('grant_access');
$grantList->access->default = 'guest';
if(count($xmlInfo->grant))
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a permission group granted to the current module
$default_grant = array();
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $args);
if($output->data)
{
foreach($output->data as $val)
{
foreach($xmlInfo->grant as $key => $val)
if($val->group_srl == 0) $default_grant[$val->name] = 'all';
else if($val->group_srl == -1) $default_grant[$val->name] = 'member';
else if($val->group_srl == -2) $default_grant[$val->name] = 'site';
else if($val->group_srl == -3) $default_grant[$val->name] = 'manager';
else
{
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grantList->{$key} = $val;
$selected_group[$val->name][] = $val->group_srl;
$default_grant[$val->name] = 'group';
}
}
$grantList->manager->title = Context::getLang('grant_manager');
$grantList->manager->default = 'manager';
}
Context::set('selected_group', $selected_group);
Context::set('default_grant', $default_grant);
Context::set('module_srl', $module_srl);
// Extract admin ID set in the current module
$admin_member = $oModuleModel->getAdminId($module_srl);
Context::set('admin_member', $admin_member);
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// Get a permission group granted to the current module
$defaultGrant = new stdClass();
$args->module_srl = $moduleSrl;
$output = executeQueryArray('module.getModuleGrants', $args);
//Security
$security = new Security();
$security->encodeHTML('group_list..title');
$security->encodeHTML('group_list..description');
$security->encodeHTML('admin_member..nick_name');
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
}
public function getModuleAdminGrant()
{
$targetModule = Context::get('target_module');
$moduleSrl = Context::get('module_srl');
if(!$targetModule || !$moduleSrl)
{
return new Object(-1, 'msg_invalid_request');
}
if($targetModule == '_SHORTCUT')
{
return new Object(0);
}
$oModuleModel = &getModel('module');
$xmlInfo = $oModuleModel->getModuleActionXml($targetModule);
// Grant virtual permission for access and manager
$grantList->access->title = Context::getLang('grant_access');
$grantList->access->default = 'guest';
if(count($xmlInfo->grant))
{
foreach($xmlInfo->grant as $key => $val)
{
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grantList->{$key} = $val;
}
}
$grantList->manager->title = Context::getLang('grant_manager');
$grantList->manager->default = 'manager';
// Get a permission group granted to the current module
$defaultGrant = new stdClass();
$args->module_srl = $moduleSrl;
$output = executeQueryArray('module.getModuleGrants', $args);
if($output->data)
{
foreach($output->data as $val)
{
if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
else
{
$selectedGroup->{$val->name}[] = $val->group_srl;
$defaultGrant->{$val->name} = 'group';
}
}
}
if(is_object($grantList))
{
foreach($grantList AS $key=>$value)
{
if(isset($defaultGrant->{$key}))
{
$grantList->{$key}->grant = $defaultGrant->{$key};
}
if(isset($selectedGroup->{$key}))
{
$grantList->{$key}->group_srls = $selectedGroup->{$key};
}
}
}
$this->add('grantList', $grantList);
}
/**
* @brief Common:: skin setting page for the module
*/
function getModuleSkinHTML($module_srl)
{
return $this->_getModuleSkinHTML($module_srl, 'P');
}
/**
* Common:: skin setting page for the module (mobile)
*
* @param $module_srl sequence of module
* @return string The html code
*/
function getModuleMobileSkinHTML($module_srl)
{
return $this->_getModuleSkinHtml($module_srl, 'M');
}
/**
* Skin setting page for the module
*
* @param $module_srl sequence of module
* @param $mode P or M
* @return string The HTML code
*/
function _getModuleSkinHTML($module_srl, $mode)
{
$mode = $mode === 'P' ? 'P' : 'M';
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) return;
if($mode === 'P')
{
if($module_info->is_skin_fix == 'N')
{
$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
}
else
{
$skin = $module_info->skin;
}
}
else
{
if($module_info->is_mskin_fix == 'N')
{
$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
}
else
{
$skin = $module_info->mskin;
}
}
$module_path = './modules/'.$module_info->module;
// Get XML information of the skin and skin sinformation set in DB
if($mode === 'P')
{
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
}
else
{
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
}
if(count($skin_info->extra_vars))
{
foreach($skin_info->extra_vars as $key => $val)
{
$group = $val->group;
$name = $val->name;
$type = $val->type;
if($skin_vars[$name])
{
$value = $skin_vars[$name]->value;
}
else $value = '';
if($type=="checkbox")
{
$value = $value?unserialize($value):array();
}
$value = empty($value) ? $val->default : $value;
$skin_info->extra_vars[$key]->value= $value;
}
}
Context::set('module_info', $module_info);
Context::set('mid', $module_info->mid);
Context::set('skin_info', $skin_info);
Context::set('skin_vars', $skin_vars);
Context::set('mode', $mode);
//Security
$security = new Security();
$security->encodeHTML('mid');
$security->encodeHTML('module_info.browser_title');
$security->encodeHTML('skin_info...');
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'skin_config');
}
/**
* @brief Get values for a particular language code
* Return its corresponding value if lang_code is specified. Otherwise return $name.
*/
function getLangCode($site_srl, $name)
{
$lang_supported = Context::get('lang_supported');
if(substr($name,0,12)=='$user_lang->')
{
$args->site_srl = (int)$site_srl;
$args->name = substr($name,12);
$output = executeQueryArray('module.getLang', $args);
if($output->data)
{
foreach($output->data as $val)
foreach($output->data as $key => $val)
{
if($val->group_srl == 0) $defaultGrant->{$val->name} = 'all';
else if($val->group_srl == -1) $defaultGrant->{$val->name} = 'member';
else if($val->group_srl == -2) $defaultGrant->{$val->name} = 'site';
else if($val->group_srl == -3) $defaultGrant->{$val->name} = 'manager';
else {
$selectedGroup->{$val->name}[] = $val->group_srl;
$defaultGrant->{$val->name} = 'group';
}
$selected_lang[$val->lang_code] = $val->value;
}
}
if(is_object($grantList))
}
else
{
$tmp = unserialize($name);
if($tmp)
{
foreach($grantList AS $key=>$value)
$selected_lang = array();
$rand_name = $tmp[Context::getLangType()];
if(!$rand_name) $rand_name = array_shift($tmp);
if(is_array($lang_supported))
{
if(isset($defaultGrant->{$key}))
{
$grantList->{$key}->grant = $defaultGrant->{$key};
}
if(isset($selectedGroup->{$key}))
{
$grantList->{$key}->group_srls = $selectedGroup->{$key};
}
foreach($lang_supported as $key => $val)
$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
}
}
$this->add('grantList', $grantList);
}
/**
* @brief Common:: skin setting page for the module
**/
function getModuleSkinHTML($module_srl) {
return $this->_getModuleSkinHTML($module_srl, 'P');
}
/**
* Common:: skin setting page for the module (mobile)
*
* @param $module_srl sequence of module
* @return string The html code
*/
function getModuleMobileSkinHTML($module_srl)
$output = array();
if(is_array($lang_supported))
{
return $this->_getModuleSkinHtml($module_srl, 'M');
foreach($lang_supported as $key => $val)
$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
}
return $output;
}
/**
* Skin setting page for the module
*
* @param $module_srl sequence of module
* @param $mode P or M
* @return string The HTML code
*/
function _getModuleSkinHTML($module_srl, $mode)
/**
* @brief Return if the module language in ajax is requested
*/
function getModuleAdminLangCode()
{
$name = Context::get('name');
if(!$name) return new Object(-1,'msg_invalid_request');
$site_module_info = Context::get('site_module_info');
$this->add('name', $name);
$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
$this->add('langs', $output);
}
/**
* @brief Returns lang list by lang name
*/
function getModuleAdminLangListByName()
{
$args = Context::getRequestVars();
if(!$args->site_srl) $args->site_srl = 0;
$columnList = array('lang_code', 'name', 'value');
$langList = array();
$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
$output = executeQueryArray('module.getLangListByName', $args, $columnList);
if($output->toBool()) $langList = $output->data;
$this->add('lang_list', $langList);
$this->add('lang_name', $args->langName);
}
/**
* @brief Return lang list
*/
function getModuleAdminLangListByValue()
{
$args = Context::getRequestVars();
if(!$args->site_srl) $args->site_srl = 0;
$langList = array();
// search value
$output = executeQueryArray('module.getLangNameByValue', $args);
if($output->toBool() && is_array($output->data))
{
$mode = $mode === 'P' ? 'P' : 'M';
unset($args->value);
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) return;
if($mode === 'P')
foreach($output->data as $data)
{
if($module_info->is_skin_fix == 'N')
$args->langName = $data->name;
$columnList = array('lang_code', 'name', 'value');
$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
if($outputByName->toBool())
{
$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'P', $module_info->site_srl);
}
else
{
$skin = $module_info->skin;
$langList = array_merge($langList, $outputByName->data);
}
}
else
{
if($module_info->is_mskin_fix == 'N')
{
$skin = $oModuleModel->getModuleDefaultSkin($module_info->module, 'M', $module_info->site_srl);
}
else
{
$skin = $module_info->mskin;
}
}
$module_path = './modules/'.$module_info->module;
// Get XML information of the skin and skin sinformation set in DB
if($mode === 'P')
{
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
}
else
{
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin, 'm.skins');
$skin_vars = $oModuleModel->getModuleMobileSkinVars($module_srl);
}
if(count($skin_info->extra_vars))
{
foreach($skin_info->extra_vars as $key => $val)
{
$group = $val->group;
$name = $val->name;
$type = $val->type;
if($skin_vars[$name])
{
$value = $skin_vars[$name]->value;
}
else $value = '';
if($type=="checkbox")
{
$value = $value?unserialize($value):array();
}
$value = empty($value) ? $val->default : $value;
$skin_info->extra_vars[$key]->value= $value;
}
}
Context::set('module_info', $module_info);
Context::set('mid', $module_info->mid);
Context::set('skin_info', $skin_info);
Context::set('skin_vars', $skin_vars);
Context::set('mode', $mode);
//Security
$security = new Security();
$security->encodeHTML('mid');
$security->encodeHTML('module_info.browser_title');
$security->encodeHTML('skin_info...');
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'skin_config');
}
/**
* @brief Get values for a particular language code
* Return its corresponding value if lang_code is specified. Otherwise return $name.
**/
function getLangCode($site_srl, $name) {
$lang_supported = Context::get('lang_supported');
$this->add('lang_list', $langList);
}
if(substr($name,0,12)=='$user_lang->') {
$args->site_srl = (int)$site_srl;
$args->name = substr($name,12);
$output = executeQueryArray('module.getLang', $args);
if($output->data) {
foreach($output->data as $key => $val) {
$selected_lang[$val->lang_code] = $val->value;
}
}
} else {
$tmp = unserialize($name);
if($tmp) {
$selected_lang = array();
$rand_name = $tmp[Context::getLangType()];
if(!$rand_name) $rand_name = array_shift($tmp);
if(is_array($lang_supported))
{
foreach($lang_supported as $key => $val)
$selected_lang[$key] = $tmp[$key]?$tmp[$key]:$rand_name;
}
}
}
/**
* @brief Return current lang list
*/
function getLangListByLangcode($args)
{
$output = executeQueryArray('module.getLangListByLangcode', $args);
if(!$output->toBool()) return array();
$output = array();
if(is_array($lang_supported))
{
foreach($lang_supported as $key => $val)
$output[$key] = $selected_lang[$key]?$selected_lang[$key]:$name;
}
return $output;
}
return $output;
}
/**
* @brief Return if the module language in ajax is requested
**/
function getModuleAdminLangCode() {
$name = Context::get('name');
if(!$name) return new Object(-1,'msg_invalid_request');
$site_module_info = Context::get('site_module_info');
$this->add('name', $name);
$output = $this->getLangCode($site_module_info->site_srl, '$user_lang->'.$name);
$this->add('langs', $output);
}
/**
* return multilingual html
*/
function getModuleAdminMultilingualHtml()
{
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'multilingual_v17.html');
/**
* @brief Returns lang list by lang name
**/
function getModuleAdminLangListByName()
$this->add('html', $tpl);
}
/**
* return multilingual list html
*/
function getModuleAdminLangListHtml()
{
$siteModuleInfo = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->langCode = Context::get('lang_code');
$args->page = Context::get('page');
$args->sort_index = 'name';
$args->order_type = 'asc';
$args->search_keyword = Context::get('search_keyword');
$args->name = Context::get('name');
$args->list_count = Context::get('list_count');
$args->page_count = 5;
if(!$args->langCode)
{
$args = Context::getRequestVars();
if(!$args->site_srl) $args->site_srl = 0;
$columnList = array('lang_code', 'name', 'value');
$langList = array();
$args->langName = preg_replace('/^\$user_lang->/', '', $args->lang_name);
$output = executeQueryArray('module.getLangListByName', $args, $columnList);
if($output->toBool()) $langList = $output->data;
$this->add('lang_list', $langList);
$this->add('lang_name', $args->langName);
$args->langCode = Context::get('lang_type');
}
/**
* @brief Return lang list
**/
function getModuleAdminLangListByValue()
{
$args = Context::getRequestVars();
if(!$args->site_srl) $args->site_srl = 0;
$output = $this->getLangListByLangcode($args);
$langList = array();
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('lang_code_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// search value
$output = executeQueryArray('module.getLangNameByValue', $args);
if ($output->toBool() && is_array($output->data)){
unset($args->value);
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'multilingual_v17_list.html');
foreach($output->data as $data) {
$args->langName = $data->name;
$columnList = array('lang_code', 'name', 'value');
$outputByName = executeQueryArray('module.getLangListByName', $args, $columnList);
$this->add('html', $tpl);
}
if($outputByName->toBool()) {
$langList = array_merge($langList, $outputByName->data);
}
}
}
/**
* return module searcher html
*/
function getModuleAdminModuleSearcherHtml()
{
Context::loadLang('./modules/admin/lang');
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'module_searcher_v17.html');
$this->add('lang_list', $langList);
}
$this->add('html', $tpl);
}
/**
* @brief Return current lang list
**/
function getLangListByLangcode($args)
{
$output = executeQueryArray('module.getLangListByLangcode', $args);
if(!$output->toBool()) return array();
/**
* return module info.
*/
function getModuleAdminModuleInfo()
{
$module_srl = Context::get('module_srl');
return $output;
}
$model = getModel('module');
$module_info = $model->getModuleInfoByModuleSrl($module_srl);
/**
* return multilingual html
*/
function getModuleAdminMultilingualHtml()
{
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'multilingual_v17.html');
$this->add('html', $tpl);
}
/**
* return multilingual list html
*/
function getModuleAdminLangListHtml()
{
$siteModuleInfo = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->langCode = Context::get('lang_code');
$args->page = Context::get('page');
$args->sort_index = 'name';
$args->order_type = 'asc';
$args->search_keyword = Context::get('search_keyword');
$args->name = Context::get('name');
$args->list_count = Context::get('list_count');
$args->page_count = 5;
if(!$args->langCode)
{
$args->langCode = Context::get('lang_type');
}
$output = $this->getLangListByLangcode($args);
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('lang_code_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'multilingual_v17_list.html');
$this->add('html', $tpl);
}
/**
* return module searcher html
*/
function getModuleAdminModuleSearcherHtml()
{
Context::loadLang('./modules/admin/lang');
$oTemplate = TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/module/tpl', 'module_searcher_v17.html');
$this->add('html', $tpl);
}
/**
* return module info.
*/
function getModuleAdminModuleInfo()
{
$module_srl = Context::get('module_srl');
$model = getModel('module');
$module_info = $model->getModuleInfoByModuleSrl($module_srl);
$this->add('module_info', $module_info);
}
}
?>
$this->add('module_info', $module_info);
}
}
/* End of file module.admin.model.php */
/* Location: ./modules/module/module.admin.model.php */

View file

@ -1,289 +1,307 @@
<?php
/**
* @class moduleAdminView
* @author NHN (developers@xpressengine.com)
* @brief admin view class of the module module
**/
/**
* @class moduleAdminView
* @author NHN (developers@xpressengine.com)
* @brief admin view class of the module module
*/
class moduleAdminView extends module
{
/**
* @brief Initialization
*/
function init()
{
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
class moduleAdminView extends module {
/**
* @brief Module admin page
*/
function dispModuleAdminContent()
{
$this->dispModuleAdminList();
}
/**
* @brief Initialization
**/
function init() {
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief Display a lost of modules
*/
function dispModuleAdminList()
{
// Obtain a list of modules
$oAdminModel = &getAdminModel('admin');
$oModuleModel = &getModel('module');
$oAutoinstallModel = &getModel('autoinstall');
/**
* @brief Module admin page
**/
function dispModuleAdminContent() {
$this->dispModuleAdminList();
}
/**
* @brief Display a lost of modules
**/
function dispModuleAdminList() {
// Obtain a list of modules
$oAdminModel = &getAdminModel('admin');
$oModuleModel = &getModel('module');
$oAutoinstallModel = &getModel('autoinstall');
$module_list = $oModuleModel->getModuleList();
if(is_array($module_list))
$module_list = $oModuleModel->getModuleList();
if(is_array($module_list))
{
foreach($module_list as $key => $val)
{
foreach($module_list as $key => $val) {
$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
$module_list[$key]->delete_url = $oAutoinstallModel->getRemoveUrlByPath($val->path);
// get easyinstall need update
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($val->path);
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
// get easyinstall need update
$packageSrl = $oAutoinstallModel->getPackageSrlByPath($val->path);
$package = $oAutoinstallModel->getInstalledPackages($packageSrl);
$module_list[$key]->need_autoinstall_update = $package[$packageSrl]->need_update;
// get easyinstall update url
if ($module_list[$key]->need_autoinstall_update == 'Y')
{
$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
}
// get easyinstall update url
if($module_list[$key]->need_autoinstall_update == 'Y')
{
$module_list[$key]->update_url = $oAutoinstallModel->getUpdateUrlByPackageSrl($packageSrl);
}
}
$output = $oAdminModel->getFavoriteList('0');
$favoriteList = $output->get('favoriteList');
$favoriteModuleList = array();
if ($favoriteList){
foreach($favoriteList as $favorite => $favorite_info){
$favoriteModuleList[] = $favorite_info->module;
}
}
Context::set('favoriteModuleList', $favoriteModuleList);
Context::set('module_list', $module_list);
$security = new Security();
$security->encodeHTML('module_list....');
// Set a template file
$this->setTemplateFile('module_list');
}
/**
* @brief Pop-up details of the module (conf/info.xml)
**/
function dispModuleAdminInfo() {
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
Context::set('module_info', $module_info);
$security = new Security();
$security->encodeHTML('module_info...');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_info');
}
/**
* @brief Module Categories
**/
function dispModuleAdminCategory() {
$module_category_srl = Context::get('module_category_srl');
// Obtain a list of modules
$oModuleModel = &getModel('module');
// Display the category page if a category is selected
//Security
$security = new Security();
if($module_category_srl) {
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
Context::set('selected_category', $selected_category);
//Security
$security->encodeHTML('selected_category.title');
// Set a template file
$this->setTemplateFile('category_update_form');
// If not selected, display a list of categories
} else {
$category_list = $oModuleModel->getModuleCategories();
Context::set('category_list', $category_list);
//Security
$security->encodeHTML('category_list..title');
// Set a template file
$this->setTemplateFile('category_list');
}
}
/**
* @brief Feature to copy module
**/
function dispModuleAdminCopyModule() {
// Get a target module to copy
$module_srl = Context::get('module_srl');
// Get information of the module
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module', 'mid', 'browser_title');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
Context::set('module_info', $module_info);
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('copy_module');
}
/**
* @brief Applying the default settings to all modules
**/
function dispModuleAdminModuleSetup() {
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
// Get a skin list of the module
$skin_list = $oModuleModel->getSkins('./modules/'.$module_info->module);
Context::set('skin_list',$skin_list);
// Get a layout list
$oLayoutMode = &getModel('layout');
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
$security = new Security();
$security->encodeHTML('layout_list..title','layout_list..layout');
$security->encodeHTML('skin_list....');
$security->encodeHTML('module_category...');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_setup');
}
/**
* @brief Apply module addition settings to all modules
**/
function dispModuleAdminModuleAdditionSetup() {
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
// pre-define variables because you can get contents from other module (call by reference)
$content = '';
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_addition_setup');
}
/**
* @brief Applying module permission settings to all modules
**/
function dispModuleAdminModuleGrantSetup() {
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module', 'site_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
$xml_info = $oModuleModel->getModuleActionXml($module_info->module);
$source_grant_list = $xml_info->grant;
// Grant virtual permissions for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
foreach($source_grant_list as $key => $val) {
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
$security = new Security();
$security->encodeHTML('group_list..title');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_grant_setup');
}
/**
* @brief Language codes
**/
function dispModuleAdminLangcode() {
// Get the language file of the current site
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->langCode = Context::get('lang_type');
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 5; // /< the number of pages that appear in the page navigation
$args->sort_index = 'name';
$args->order_type = 'asc';
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
$oModuleAdminModel = &getAdminModel('module');
$output = $oModuleAdminModel->getLangListByLangcode($args);
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('lang_code_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
if(Context::get('module') != 'admin')
{
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
}
// Set a template file
$this->setTemplateFile('module_langcode');
}
function dispModuleAdminFileBox(){
$oModuleModel = &getModel('module');
$output = $oModuleModel->getModuleFileBoxList();
$page = Context::get('page');
$page = $page?$page:1;
Context::set('filebox_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('page', $page);
$this->setTemplateFile('adminFileBox');
}
}
?>
$output = $oAdminModel->getFavoriteList('0');
$favoriteList = $output->get('favoriteList');
$favoriteModuleList = array();
if($favoriteList)
{
foreach($favoriteList as $favorite => $favorite_info)
{
$favoriteModuleList[] = $favorite_info->module;
}
}
Context::set('favoriteModuleList', $favoriteModuleList);
Context::set('module_list', $module_list);
$security = new Security();
$security->encodeHTML('module_list....');
// Set a template file
$this->setTemplateFile('module_list');
}
/**
* @brief Pop-up details of the module (conf/info.xml)
*/
function dispModuleAdminInfo()
{
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
Context::set('module_info', $module_info);
$security = new Security();
$security->encodeHTML('module_info...');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_info');
}
/**
* @brief Module Categories
*/
function dispModuleAdminCategory()
{
$module_category_srl = Context::get('module_category_srl');
// Obtain a list of modules
$oModuleModel = &getModel('module');
// Display the category page if a category is selected
//Security
$security = new Security();
if($module_category_srl)
{
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
Context::set('selected_category', $selected_category);
//Security
$security->encodeHTML('selected_category.title');
// Set a template file
$this->setTemplateFile('category_update_form');
// If not selected, display a list of categories
}
else
{
$category_list = $oModuleModel->getModuleCategories();
Context::set('category_list', $category_list);
//Security
$security->encodeHTML('category_list..title');
// Set a template file
$this->setTemplateFile('category_list');
}
}
/**
* @brief Feature to copy module
*/
function dispModuleAdminCopyModule()
{
// Get a target module to copy
$module_srl = Context::get('module_srl');
// Get information of the module
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module', 'mid', 'browser_title');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl, $columnList);
Context::set('module_info', $module_info);
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('copy_module');
}
/**
* @brief Applying the default settings to all modules
*/
function dispModuleAdminModuleSetup()
{
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
// Get a skin list of the module
$skin_list = $oModuleModel->getSkins('./modules/'.$module_info->module);
Context::set('skin_list',$skin_list);
// Get a layout list
$oLayoutMode = &getModel('layout');
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
$security = new Security();
$security->encodeHTML('layout_list..title','layout_list..layout');
$security->encodeHTML('skin_list....');
$security->encodeHTML('module_category...');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_setup');
}
/**
* @brief Apply module addition settings to all modules
*/
function dispModuleAdminModuleAdditionSetup()
{
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
// pre-define variables because you can get contents from other module (call by reference)
$content = '';
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_addition_setup');
}
/**
* @brief Applying module permission settings to all modules
*/
function dispModuleAdminModuleGrantSetup()
{
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
$oModuleModel = &getModel('module');
$columnList = array('module_srl', 'module', 'site_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0], $columnList);
$xml_info = $oModuleModel->getModuleActionXml($module_info->module);
$source_grant_list = $xml_info->grant;
// Grant virtual permissions for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list))
{
foreach($source_grant_list as $key => $val)
{
if(!$val->default) $val->default = 'guest';
if($val->default == 'root') $val->default = 'manager';
$grant_list->{$key} = $val;
}
}
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
$security = new Security();
$security->encodeHTML('group_list..title');
// Set the layout to be pop-up
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_grant_setup');
}
/**
* @brief Language codes
*/
function dispModuleAdminLangcode()
{
// Get the language file of the current site
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->langCode = Context::get('lang_type');
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 5; // /< the number of pages that appear in the page navigation
$args->sort_index = 'name';
$args->order_type = 'asc';
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
$oModuleAdminModel = &getAdminModel('module');
$output = $oModuleAdminModel->getLangListByLangcode($args);
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('lang_code_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
if(Context::get('module') != 'admin')
{
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
}
// Set a template file
$this->setTemplateFile('module_langcode');
}
function dispModuleAdminFileBox()
{
$oModuleModel = &getModel('module');
$output = $oModuleModel->getModuleFileBoxList();
$page = Context::get('page');
$page = $page?$page:1;
Context::set('filebox_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
Context::set('page', $page);
$this->setTemplateFile('adminFileBox');
}
}
/* End of file module.admin.view.php */
/* Location: ./modules/module/module.admin.view.php */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,10 +1,11 @@
<?php
class moduleMobile extends moduleObject {
function dispModuleChangeLang() {
class moduleMobile extends moduleObject
{
function dispModuleChangeLang()
{
$this->setTemplatePath(sprintf("%stpl/",$this->module_path));
$this->setTemplateFile('lang.html');
}
}
?>
/* End of file module.mobile.php */
/* Location: ./modules/module/module.mobile.php */

File diff suppressed because it is too large Load diff

View file

@ -1,155 +1,174 @@
<?php
/**
* @class moduleView
* @author NHN (developers@xpressengine.com)
* @brief view class of the module module
**/
/**
* @class moduleView
* @author NHN (developers@xpressengine.com)
* @brief view class of the module module
*/
class moduleView extends module
{
/**
* @brief Initialization
*/
function init()
{
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
class moduleView extends module {
/**
* @brief Display skin information
*/
function dispModuleSkinInfo()
{
$selected_module = Context::get('selected_module');
$skin = Context::get('skin');
// Get modules/skin information
$module_path = sprintf("./modules/%s/", $selected_module);
if(!is_dir($module_path)) $this->stop("msg_invalid_request");
/**
* @brief Initialization
**/
function init() {
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
/**
* @brief Display skin information
**/
function dispModuleSkinInfo() {
$selected_module = Context::get('selected_module');
$skin = Context::get('skin');
// Get modules/skin information
$module_path = sprintf("./modules/%s/", $selected_module);
if(!is_dir($module_path)) $this->stop("msg_invalid_request");
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
Context::set('skin_info',$skin_info);
$skin_info_xml = sprintf("%sskins/%s/skin.xml", $module_path, $skin);
if(!file_exists($skin_info_xml)) $this->stop("msg_invalid_request");
$this->setLayoutFile("popup_layout");
$this->setTemplateFile("skin_info");
}
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
Context::set('skin_info',$skin_info);
/**
* @brief Select a module
*/
function dispModuleSelectList()
{
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
$this->setLayoutFile("popup_layout");
$this->setTemplateFile("skin_info");
}
$oModuleModel = &getModel('module');
// Extract the number of virtual sites
$output = executeQuery('module.getSiteCount');
$site_count = $output->data->count;
Context::set('site_count', $site_count);
// Variable setting for site keyword
$site_keyword = Context::get('site_keyword');
// If there is no site keyword, use as information of the current virtual site
$args = null;
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y')
{
$query_id = 'module.getSiteModules';
$module_category_exists = false;
if(!$site_keyword)
{
$site_module_info = Context::get('site_module_info');
if($site_module_info && $logged_info->is_admin != 'Y')
{
$site_keyword = $site_module_info->domain;
$args->site_srl = (int)$site_module_info->site_srl;
Context::set('site_keyword', $site_keyword);
}
else
{
$query_id = 'module.getDefaultModules';
$args->site_srl = 0;
$module_category_exists = true;
}
// If site keyword exists, extract information from the sites
}
else
{
$args->site_keyword = $site_keyword;
}
}
else
{
$query_id = 'module.getSiteModules';
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
}
//if(is_null($args->site_srl)) $query_id = 'module.getDefaultModules';
// Get a list of modules at the site
$output = executeQueryArray($query_id, $args);
$category_list = $mid_list = array();
if(count($output->data))
{
foreach($output->data as $key => $val)
{
$module = trim($val->module);
if(!$module) continue;
/**
* @brief Select a module
**/
function dispModuleSelectList() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted');
$category = $val->category;
$obj = null;
$obj->module_srl = $val->module_srl;
$obj->browser_title = $val->browser_title;
$mid_list[$module]->list[$category][$val->mid] = $obj;
}
}
$oModuleModel = &getModel('module');
// Extract the number of virtual sites
$output = executeQuery('module.getSiteCount');
$site_count = $output->data->count;
Context::set('site_count', $site_count);
// Variable setting for site keyword
$site_keyword = Context::get('site_keyword');
// If there is no site keyword, use as information of the current virtual site
$args = null;
$logged_info = Context::get('logged_info');
if($logged_info->is_admin == 'Y') {
$query_id = 'module.getSiteModules';
$module_category_exists = false;
if(!$site_keyword) {
$site_module_info = Context::get('site_module_info');
if($site_module_info && $logged_info->is_admin != 'Y') {
$site_keyword = $site_module_info->domain;
$args->site_srl = (int)$site_module_info->site_srl;
Context::set('site_keyword', $site_keyword);
} else {
$query_id = 'module.getDefaultModules';
$args->site_srl = 0;
$module_category_exists = true;
}
// If site keyword exists, extract information from the sites
} else {
$args->site_keyword = $site_keyword;
}
} else {
$query_id = 'module.getSiteModules';
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
}
//if(is_null($args->site_srl)) $query_id = 'module.getDefaultModules';
// Get a list of modules at the site
$output = executeQueryArray($query_id, $args);
$category_list = $mid_list = array();
if(count($output->data)) {
foreach($output->data as $key => $val) {
$module = trim($val->module);
if(!$module) continue;
$selected_module = Context::get('selected_module');
if(count($mid_list))
{
foreach($mid_list as $module => $val)
{
if(!$selected_module) $selected_module = $module;
$xml_info = $oModuleModel->getModuleInfoXml($module);
$mid_list[$module]->title = $xml_info->title;
}
}
$category = $val->category;
$obj = null;
$obj->module_srl = $val->module_srl;
$obj->browser_title = $val->browser_title;
$mid_list[$module]->list[$category][$val->mid] = $obj;
}
}
Context::set('mid_list', $mid_list);
Context::set('selected_module', $selected_module);
Context::set('selected_mids', $mid_list[$selected_module]->list);
Context::set('module_category_exists', $module_category_exists);
$selected_module = Context::get('selected_module');
if(count($mid_list)) {
foreach($mid_list as $module => $val) {
if(!$selected_module) $selected_module = $module;
$xml_info = $oModuleModel->getModuleInfoXml($module);
$mid_list[$module]->title = $xml_info->title;
}
}
$security = new Security();
$security->encodeHTML('id', 'type');
Context::set('mid_list', $mid_list);
Context::set('selected_module', $selected_module);
Context::set('selected_mids', $mid_list[$selected_module]->list);
Context::set('module_category_exists', $module_category_exists);
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_selector');
}
$security = new Security();
$security->encodeHTML('id', 'type');
// See the file box
function dispModuleFileBox()
{
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// Set a template file
$this->setTemplateFile('module_selector');
}
// See the file box
function dispModuleFileBox(){
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
$input_name = Context::get('input');
$input_name = Context::get('input');
if(!$input_name) return new Object(-1, 'msg_not_permitted');
if(!$input_name) return new Object(-1, 'msg_not_permitted');
$addscript = sprintf('<script>//<![CDATA[
var selected_filebox_input_name = "%s";
//]]></script>',$input_name);
Context::addHtmlHeader($addscript);
$oModuleModel = &getModel('module');
$output = $oModuleModel->getModuleFileBoxList();
Context::set('filebox_list', $output->data);
$addscript = sprintf('<script>//<![CDATA[
var selected_filebox_input_name = "%s";
//]]></script>',$input_name);
Context::addHtmlHeader($addscript);
$filter = Context::get('filter');
if($filter) Context::set('arrfilter',explode(',',$filter));
$oModuleModel = &getModel('module');
$output = $oModuleModel->getModuleFileBoxList();
Context::set('filebox_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
$this->setLayoutFile('popup_layout');
$this->setTemplateFile('filebox_list');
}
$filter = Context::get('filter');
if($filter) Context::set('arrfilter',explode(',',$filter));
// Screen to add a file box
function dispModuleFileBoxAdd()
{
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
Context::set('page_navigation', $output->page_navigation);
$this->setLayoutFile('popup_layout');
$this->setTemplateFile('filebox_list');
}
// Screen to add a file box
function dispModuleFileBoxAdd(){
$logged_info = Context::get('logged_info');
if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted');
$filter = Context::get('filter');
if($filter) Context::set('arrfilter',explode(',',$filter));
$filter = Context::get('filter');
if($filter) Context::set('arrfilter',explode(',',$filter));
$this->setLayoutFile('popup_layout');
$this->setTemplateFile('filebox_add');
}
}
?>
$this->setLayoutFile('popup_layout');
$this->setTemplateFile('filebox_add');
}
}
/* End of file module.view.php */
/* Location: ./modules/module/module.view.php */