#18540114 : added a feature showing installed packages

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7032 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2009-12-11 14:31:50 +00:00
parent 33aef51d0f
commit 01ec0c89d2
14 changed files with 113 additions and 17 deletions

View file

@ -14,6 +14,14 @@
Context::set('original_site', $this->original_site);
Context::set('uri', $this->uri);
$this->setTemplatePath($template_path);
$ftp_info = Context::getFTPInfo();
if(!$ftp_info->ftp_root_path) Context::set('show_ftp_note', true);
$this->dispCategory();
$oModel = &getModel('autoinstall');
Context::set('tCount', $oModel->getPackageCount(null));
Context::set('iCount', $oModel->getInstalledPackageCount());
}
function rearrange(&$item, &$targets)
@ -26,7 +34,7 @@
return $ret;
}
function rearranges($items)
function rearranges($items, $packages = null)
{
if(!is_array($items)) $items = array($items);
$item_list = array();
@ -37,7 +45,8 @@
$targetpackages[$item->package_srl->body] = 0;
}
$oModel = &getModel('autoinstall');
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
if($package == null)
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
foreach($items as $item)
{
@ -53,11 +62,39 @@
return $item_list;
}
function dispAutoinstallAdminInstalledPackages()
{
$page = Context::get('page');
if(!$page) $page = 1;
Context::set('page', $page);
$oModel = &getModel('autoinstall');
$output = $oModel->getInstalledPackageList($page);
$package_list = $output->data;
$params["act"] = "getResourceapiPackages";
$params["package_srls"] = implode(",", array_keys($package_list));
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($this->uri, $body, 3, "POST", "application/xml");
$xml_lUpdate = new XmlParser();
$xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item)
{
$item_list = $this->rearranges($xmlDoc->response->packagelist->item, $package_list);
$res = array();
foreach($package_list as $package_srl => $package)
{
$res[] = $item_list[$package_srl];
}
Context::set('item_list', $res);
}
Context::set('page_navigation', $output->page_navigation);
$this->setTemplateFile('index');
}
function dispAutoinstallAdminInstall() {
$package_srl = Context::get('package_srl');
if(!$package_srl) return $this->dispAutoinstallAdminIndex();
$ftp_info = Context::getFTPInfo();
if(!$ftp_info->ftp_root_path) Context::set('show_ftp_note', true);
$params["act"] = "getResourceapiInstallInfo";
$params["package_srl"] = $package_srl;
@ -185,10 +222,13 @@
Context::set('page_navigation', $page_navigation);
}
}
function dispCategory()
{
$oModel = &getModel('autoinstall');
$categories = &$oModel->getCategoryList();
Context::set('categories', $categories);
Context::set('tCount', $oModel->getPackageCount(null));
}
}
?>

View file

@ -78,6 +78,13 @@
return $output->data->count;
}
function getInstalledPackageCount()
{
$output = executeQuery("autoinstall.getInstalledPackageCount", $args);
if(!$output->data) return 0;
return $output->data->count;
}
function setDepth(&$item, $depth, &$list, &$resultList)
{
$resultList[$item->category_srl] =& $item;
@ -113,5 +120,18 @@
return $result;
}
function getInstalledPackageList($page)
{
$args->page = $page;
$output = executeQueryArray("autoinstall.getInstalledPackageList", $args);
$res = array();
foreach($output->data as $val)
{
$res[$val->package_srl] = $val;
}
$output->data = $res;
return $output;
}
}
?>

View file

@ -2,6 +2,7 @@
<module>
<actions>
<action name="dispAutoinstallAdminInstall" type="view" standalone="true" />
<action name="dispAutoinstallAdminInstalledPackages" type="view" standalone="true" />
<action name="dispAutoinstallAdminIndex" type="view" standalone="true" admin_index="true" />
<action name="procAutoinstallAdminUpdateinfo" type="controller" standalone="true" />
<action name="procAutoinstallAdminPackageinstall" type="controller" standalone="true" />

View file

@ -1,12 +1,12 @@
<?php
/**
* @file en.lang.php
* @author sol (sol@ngleader.com)
* @brief Autoinstall(autoinstall) 모듈의 기본 언어팩
* @author haneul (haneul0318@gmail.com)
* @brief Autoinstall(autoinstall) language pack (English)
**/
$lang->autoinstall = 'One Click Installer';
$lang->about_autoinstall = 'One Click Installer will help you install/upgrade programs(skins) for XE.';
$lang->autoinstall = 'EasyInstall';
$lang->about_autoinstall = 'EasyInstall module will help you install/upgrade programs(skins) for XE.';
$lang->package_update = 'Recent Update';
$lang->package_downloaded_count = 'Download Count';
$lang->need_update = "Please update package list first.";
@ -17,15 +17,16 @@
$lang->success_installed = "Successfully Installed";
$lang->view_all_package = "View All";
$lang->description_ftp_note = "If FTP configuration is not set, installation would not work. Please configure FTP information";
$lang->description_update = "If you have upgraded or installed programs without One Click Installer, please press update button to renew new information.";
$lang->description_update = "If you have upgraded or installed programs without EasyInstall module, please press update button to renew new information.";
$lang->install = "Install";
$lang->update = "Update";
$lang->current_version = "Version";
$lang->depending_programs = "This program is depending on ";
$lang->require_update = "Update is required.";
$lang->require_installation = "Installation is required.";
$lang->description_install = "One Click Installer will also install/update all other programs which this program is depending on";
$lang->description_install = "EasyInstall will also install/update all other programs which this program is depending on";
$lang->description_download = "If FTP is unavailable, you should manually download it and extract it into target path. (if target path is ./modules/board, extract it at ./modules)";
$lang->path = "Path";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
?>

View file

@ -28,4 +28,5 @@
$lang->description_download = "FTPの利用が出来ない場合は、直接ダウンロードし、サーバー上の該当パスにてインストールして下さい。 (一つ上階層にて解凍します。 ./modules/board の場合 ./modulesにて tarを解凍して下さい。)";
$lang->path = "インストールパス";
$lang->cmd_download = "ダウンロード";
$lang->view_installed_packages = "Installed Packages";
?>

View file

@ -28,4 +28,5 @@
$lang->description_download = "FTP를 이용할 수 없는 경우, 직접 다운로드 하여 해당 path에 설치하셔야 합니다. (한칸 상위에서 압축을 푸시면 됩니다. ./modules/board의 경우 ./modules에서 tar를 푸세요)";
$lang->path = "설치경로";
$lang->cmd_download = "다운로드";
$lang->view_installed_packages = "설치된 패키지";
?>

View file

@ -28,4 +28,5 @@
$lang->description_download = "Khi FTP không được mở, bạn nên tải về và giả nén, sau đó Upload theo đường dẫn. (Nếu đường dẫn là ./modules/board, thì giải nén vào ./modules)";
$lang->path = "Đường dẫn";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
?>

View file

@ -28,4 +28,5 @@
$lang->description_download = "When FTP is disabled, you should download it and extract it into target path. (if target path is ./modules/board, extract it at ./modules)";
$lang->path = "Path";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
?>

View file

@ -28,4 +28,5 @@
$lang->description_download = "When FTP is disabled, you should download it and extract it into target path. (if target path is ./modules/board, extract it at ./modules)";
$lang->path = "路徑";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
?>

View file

@ -0,0 +1,8 @@
<query id="getInstalledPackageCount" action="select">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
</query>

View file

@ -0,0 +1,14 @@
<query id="getInstalledPackageList" action="select">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="*" />
</columns>
<navigation>
<index var="sort_index" default="need_update" order="desc" />
<list_count var="list_count" default="10" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -6,7 +6,9 @@
.aside { width:180px; float:left; margin-right:30px; padding-bottom:30px; }
.aside .categoryBox { background-color:#F8F8F8; padding:10px; width:160px; overflow:hidden; }
.aside .categoryBox h3 { padding:0 0 10px 0; margin:0 0 10px 0; white-space:nowrap; overflow:hidden; color:#48494E; font-size:11px; font-weight:normal; background:transparent url(../img/hrE1.gif) repeat-x scroll left bottom;}
.aside .categoryBox h3 { padding:0 0 10px 0; margin:0 0 10px 0; white-space:nowrap; overflow:hidden; color:#48494E; font-size:11px; font-weight:normal;}
.aside .categoryBox .bottomLine {background:transparent url(../img/hrE1.gif) repeat-x scroll left bottom;}
.aside .categoryBox .topLine {background:transparent url(../img/hrE1.gif) repeat-x scroll left top;}
.aside .categoryBox h3 a { color:#48494E; font-size:12px; font-weight:bold; text-decoration:none; }
.aside .categoryBox ul.category { margin:10px 0 0 0; padding:0; list-style:none; }
.aside .categoryBox ul.category li { margin:0 0 10px 10px; }
@ -19,7 +21,7 @@
.aside .categoryBox ul.resourceManage li a { text-decoration:none; color:#747474; }
.aside .categoryBox ul.resourceManage li a.selected { font-weight:bold; }
.aside .searchBox { padding:10px 0; text-align:center; background:transparent url(../img/hrE1.gif) repeat-x scroll left top;}
.aside .searchBox { padding:10px 0; text-align:center; }
.aside .searchBox input.input { border:1px solid #ddd; width:120px; height:16px;}
.aside .searchBox input.submit { vertical-align:middle; }

View file

@ -1,6 +1,6 @@
<div class="aside">
<div class="categoryBox">
<h3><a href="{getUrl('category_srl','')}">{$lang->view_all_package}</a> <span>({$tCount})</span></h3>
<h3 class="bottomLine"><a href="{getUrl('act','dispAutoinstallAdminIndex','category_srl','')}">{$lang->view_all_package}</a> <span>({$tCount})</span></h3>
{@ $_pDepth = 0;}
<ul class="category">
@ -14,9 +14,9 @@
<!--@end-->
<li>
<!--@if(count($val->children))-->
<a href="{getUrl('category_srl',$val->category_srl,'childrenList',$val->childrenList)}"<!--@if($val->category_srl == $category_srl)--> class="selected"<!--@end-->>{$val->title}</a>
<a href="{getUrl('act','dispAutoinstallAdminIndex','category_srl',$val->category_srl,'childrenList',$val->childrenList)}"<!--@if($val->category_srl == $category_srl)--> class="selected"<!--@end-->>{$val->title}</a>
<!--@else-->
<a href="{getUrl('category_srl',$val->category_srl,'childrenList','')}"<!--@if($val->category_srl == $category_srl)--> class="selected"<!--@end-->>{$val->title}</a>
<a href="{getUrl('act','dispAutoinstallAdminIndex','category_srl',$val->category_srl,'childrenList','')}"<!--@if($val->category_srl == $category_srl)--> class="selected"<!--@end-->>{$val->title}</a>
<!--@end-->
<!--@if($val->nPackages)-->
<span>({$val->nPackages})</span>
@ -33,7 +33,7 @@
<!--@end-->
</li>
</ul>
<div class="searchBox">
<div class="searchBox bottomLine">
<form action="{getUrl()}" method="get">
<input type="hidden" name="category_srl" value="{$category_srl}" />
<input type="hidden" name="module" value="admin" />
@ -42,6 +42,9 @@
<input type="image" src="./img/btn_search.gif" class="submit" />
</form>
</div>
<br />
<h3><a href="{getUrl('','module','admin','act','dispAutoinstallAdminInstalledPackages')}">{$lang->view_installed_packages}</a> <span>({$iCount})</span></h3>
</div>
</div>

View file

@ -1,4 +1,5 @@
<div class="content">
<!--@if($act == "dispAutoinstallAdminIndex")-->
<ul class="listOrder {$order_type}">
<!--@if($order_target=='newest')-->
<!--@if($order_type == 'desc')-->{@$_order_type = 'asc'}<!--@else-->{@$_order_type = 'desc'}<!--@end-->
@ -19,6 +20,7 @@
<!--@end-->
<li <!--@if($order_target=='popular')-->class="arrow"<!--@end-->><a href="{getUrl('order_target','popular','order_type',$_order_type)}">{$lang->order_popular}</a></li>
</ul>
<!--@end-->
<table class="updateList" border="1" cellspacing="0">
<col width="120" /><col />