Display module that is setted 'have_instance' on easyinstall server at add menu

git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12292 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2012-11-23 07:59:17 +00:00
parent 76c448d62e
commit 30ba6b7835
9 changed files with 55 additions and 2 deletions

View file

@ -228,7 +228,7 @@ class autoinstallAdminController extends autoinstall
{
$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
}
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl');
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl', 'have_instance');
foreach($xmlDoc->response->packages->item as $item)
{
$args = null;

View file

@ -228,6 +228,7 @@ class autoinstallAdminModel extends autoinstall
return $result;
}
}
/* End of file autoinstall.admin.model.php */
/* Location: ./modules/autoinstall/autoinstall.admin.model.php */

View file

@ -108,6 +108,12 @@ class autoinstall extends ModuleObject
$config = $oModuleModel->getModuleConfig('autoinstall');
if(!isset($config->downloadServer)) return true;
// 2012.11.12 add column 'have_instance' in autoinstall_packages
if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
{
return TRUE;
}
return false;
}
@ -148,6 +154,12 @@ class autoinstall extends ModuleObject
$oModuleController->insertModuleConfig('autoinstall', $config);
}
// 2012.11.12 add column 'have_instance' in autoinstall_packages
if(!$oDB->isColumnExists('autoinstall_packages', 'have_instance'))
{
$oDB->addColumn('autoinstall_packages', 'have_instance', 'char', '1', 'N', TRUE);
}
return new Object(0, 'success_updated');
}

View file

@ -360,6 +360,12 @@ class autoinstallModel extends autoinstall
return getNotEncodedUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminInstall', 'package_srl', $packageSrl);
}
function getHaveInstance($columnList = array())
{
$output = executeQueryArray('autoinstall.getHaveInstance', NULL, $columnList);
return $output->data;
}
}
/* End of file autoinstall.model.php */
/* Location: ./modules/autoinstall/autoinstall.model.php */

View file

@ -0,0 +1,11 @@
<query id="getHaveInstance" action="select">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="have_instance" default="Y" />
</conditions>
</query>

View file

@ -6,6 +6,7 @@
<column name="package_srl" var="package_srl" filter="number" notnull="notnull" />
<column name="category_srl" var="category_srl" filter="number" />
<column name="path" var="path" notnull="notnull" />
<column name="have_instance" var="have_instance" notnull="notnull" />
<column name="updatedate" var="updatedate" notnull="notnull" />
<column name="latest_item_srl" var="latest_item_srl" notnull="notnull" />
<column name="version" var="version" notnull="notnull" />

View file

@ -4,6 +4,7 @@
</tables>
<columns>
<column name="path" var="path" notnull="notnull" />
<column name="have_instance" var="have_instance" notnull="notnull" />
<column name="updatedate" var="updatedate" notnull="notnull" />
<column name="category_srl" var="category_srl" filter="number" />
<column name="latest_item_srl" var="latest_item_srl" notnull="notnull" />

View file

@ -2,6 +2,7 @@
<column name="package_srl" type="number" size="11" notnull="notnull" default="0" index="idx_package_srl" />
<column name="category_srl" type="number" size="11" default="0" index="idx_category_srl" />
<column name="path" type="varchar" size="250" notnull="notnull" unique="unique_path" />
<column name="have_instance" type="char" size="1" notnull="notnull" default="N" />
<column name="updatedate" type="date" index="idx_regdate" />
<column name="latest_item_srl" type="number" size="11" default="0" notnull="notnull" />
<column name="version" type="varchar" size="255" />

View file

@ -329,9 +329,29 @@ class menuAdminModel extends menu
$output = ModuleHandler::triggerCall('menu.getModuleListInSitemap', 'after', $moduleList);
if(!$output->toBool()) return $output;
$moduleList = array_unique($moduleList);
$localModuleList = array_unique($moduleList);
$oAutoinstallModel = getModel('autoinstall');
// get have instance
$remotePackageList = $oAutoinstallModel->getHaveInstance(array('path'));
$remoteModuleList = array();
foreach($remotePackageList as $package)
{
if(strpos($package->path, './modules/') !== 0) continue;
$pathInfo = explode('/', $package->path);
$remoteModuleList[] = $pathInfo[2];
}
// all module list
$allModuleList = FileHandler::readDir('./modules', '/^([a-zA-Z0-9_-]+)$/');
// union have instance and all module list
$haveInstance = array_intersect($remoteModuleList, $allModuleList);
// union
$moduleList = array_unique(array_merge($localModuleList, $haveInstance));
$moduleInfoList = array();
Context::loadLang('modules/page/lang');