#18427049 : add autoinstall module

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6915 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2009-11-10 13:21:36 +00:00
parent 82d01adc2d
commit d5c98490ad
44 changed files with 1317 additions and 0 deletions

View file

@ -0,0 +1,292 @@
<?php
/**
* @class autoinstallAdminController
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 admin controller class
**/
class ModuleInstaller {
var $package = null;
var $base_url = 'http://resource.xpressengine.com/';
var $temp_dir = './files/cache/autoinstall/';
var $target_path;
var $download_file;
var $url;
var $download_path;
function ModuleInstaller(&$package)
{
$this->package =& $package;
}
function _download()
{
if($this->package->path == ".")
{
$this->download_file = $this->temp_dir."xe.tar";
$this->target_path = "";
$this->download_path = $this->temp_dir;
}
else
{
$subpath = substr($this->package->path,2);
$this->download_file = $this->temp_dir.$subpath.".tar";
$subpatharr = explode("/", $subpath);
array_pop($subpatharr);
$this->download_path = $this->temp_dir.implode("/", $subpatharr);
$this->target_path = implode("/", $subpatharr);
}
$postdata = array();
$postdata["path"] = $this->package->path;
$postdata["module"] = "resourceapi";
$postdata["act"] = "procResourceapiDownload";
$buff = FileHandler::getRemoteResource($this->base_url, null, 3, "POST", "application/x-www-form-urlencoded; charset=utf-8", array(), array(), $postdata);
FileHandler::writeFile($this->download_file, $buff);
}
function install()
{
$this->_download();
$file_list = $this->_unPack();
$this->_copyDir($file_list);
return;
}
function _unPack(){
require_once(_XE_PATH_.'libs/tar.class.php');
$oTar = new tar();
$oTar->openTAR($this->download_file);
$_files = $oTar->files;
$file_list = array();
foreach($_files as $key => $info) {
FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
$file_list[] = $info['name'];
}
return $file_list;
}
function _copyDir(&$file_list){
$ftp_info = Context::getFTPInfo();
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_ftp_invalid_auth_info');
require_once(_XE_PATH_.'libs/ftp.class.php');
$oFtp = new ftp();
if(!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_invalid_auth_info');
}
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('autoinstall');
$target_dir = $config->ftp_root_path.$this->target_path;
foreach($file_list as $k => $file){
$org_file = $file;
if($this->package->path == ".")
{
$file = substr($file,3);
}
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
$path_list = explode('/', dirname($this->target_path."/".$file));
$real_path = "./";
$ftp_path = $config->ftp_root_path;
for($i=0;$i<count($path_list);$i++)
{
if($path_list=="") continue;
$real_path .= $path_list[$i]."/";
$ftp_path .= $path_list[$i]."/";
if(!file_exists(FileHandler::getRealPath($real_path)))
{
$oFtp->ftp_mkdir($ftp_path);
$oFtp->ftp_site("CHMOD 755 ".$path);
}
}
$oFtp->ftp_put($target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file));
}
$oFtp->ftp_quit();
return new Object();
}
}
class autoinstallAdminController extends autoinstall {
/**
* @brief 초기화
**/
function init() {
}
function procAutoinstallAdminInsertConfig(){
$oModuleController = &getController('module');
$config->ftp_root_path = Context::get('ftp_root_path');
$output = $oModuleController->insertModuleConfig('autoinstall',$config);
return $output;
}
function checkFileCheckSum($file, $checksum){
$local_checksum = md5_file(FileHandler::getRealPath($file));
return ($local_checksum === $checksum);
}
function _cleanDownloaded($obj){
FileHandler::removeDir($obj->download_path);
}
function procAutoinstallAdminUpdateinfo()
{
$oModel = &getModel('autoinstall');
$item = $oModel->getLatestPackage();
if($item)
{
$params["updatedate"] = $item->updatedate;
}
$params["act"] = "getResourceapiUpdate";
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($this->uri, $body, 3, "POST", "application/xml");
$xml = new XmlParser();
$xmlDoc = $xml->parse($buff);
$this->updateCategory($xmlDoc);
$this->updatePackages($xmlDoc);
$this->checkInstalled();
$this->setMessage("success_updated");
}
function checkInstalled()
{
executeQuery("autoinstall.deleteInstalledPackage");
$oModel =& getModel('autoinstall');
$packages = $oModel->getPackages();
foreach($packages as $package)
{
$real_path = FileHandler::getRealPath($package->path);
if(!file_exists($real_path)) {
continue;
}
if($package->path == ".")
{
$type = "core";
$version = __ZBXE_VERSION__;
}
else
{
$path_array = explode("/", $package->path);
$target_name = array_pop($path_array);
$type = substr(array_pop($path_array), 0, -1);
switch($type)
{
case "module":
case "addon":
case "layout":
case "widget":
$config_file = "/conf/info.xml";
break;
case "component":
$config_file = "/info.xml";
break;
case "skin":
case "widgetstyle":
$config_file = "/skin.xml";
break;
default:
continue;
}
$xml = new XmlParser();
$xmlDoc = $xml->loadXmlFile($real_path.$config_file);
if(!$xmlDoc) continue;
$version = $xmlDoc->{$type}->version->body;
}
$args = null;
$args->package_srl = $package->package_srl;
$args->version = $package->version;
$args->current_version = $version;
if(version_compare($args->version, $args->current_version, ">"))
{
$args->need_update="Y";
}
else
{
$args->need_update="N";
}
$output = executeQuery("autoinstall.insertInstalledPackage", $args);
}
}
function procAutoinstallAdminPackageinstall()
{
$package_srls = Context::get('package_srl');
$oModel =& getModel('autoinstall');
$packages = explode(',', $package_srls);
foreach($packages as $package_srl)
{
$package = $oModel->getPackage($package_srl);
$oModuleInstaller = new ModuleInstaller($package);
$oModuleInstaller->install();
}
$this->setMessage('success_installed');
}
function updatePackages(&$xmlDoc)
{
$oModel =& getModel('autoinstall');
if(!$xmlDoc->response->packages->item) return;
if(!is_array($xmlDoc->response->packages->item))
{
$xmlDoc->response->packages->item = array($xmlDoc->response->packages->item);
}
$targets = array('package_srl', 'updatedate', 'latest_item_srl', 'path', 'version', 'category_srl');
foreach($xmlDoc->response->packages->item as $item)
{
$args = null;
foreach($targets as $target)
{
$args->{$target} = $item->{$target}->body;
}
if($oModel->getPackage($args->package_srl))
{
executeQuery("autoinstall.updatePackage", $args);
}
else
{
executeQuery("autoinstall.insertPackage", $args);
}
}
}
function updateCategory(&$xmlDoc)
{
executeQuery("autoinstall.deleteCategory", $args);
$oModel =& getModel('autoinstall');
if(!is_array($xmlDoc->response->categorylist->item))
{
$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
}
foreach($xmlDoc->response->categorylist->item as $item)
{
$args = null;
$args->category_srl = $item->category_srl->body;
$args->parent_srl = $item->parent_srl->body;
$args->title = $item->title->body;
executeQuery("autoinstall.insertCategory", $args);
}
}
}
?>

View file

@ -0,0 +1,222 @@
<?php
/**
* @class autoinstallAdminView
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 admin view class
**/
class autoinstallAdminView extends autoinstall {
function init() {
$template_path = sprintf("%stpl/",$this->module_path);
Context::set('original_site', $this->original_site);
Context::set('uri', $this->uri);
$this->setTemplatePath($template_path);
}
function rearrange(&$item, &$targets)
{
$ret = null;
foreach($targets as $target)
{
$ret->{$target} = $item->{$target}->body;
}
return $ret;
}
function rearranges($items)
{
if(!is_array($items)) $items = array($items);
$item_list = array();
$targets = array('category_srl', 'package_srl', 'item_screenshot_url', 'package_voted', 'package_voter', 'package_description', 'package_downloaded', 'item_regdate', 'title', 'item_version', 'package_star');
$targetpackages = array();
foreach($items as $item)
{
$targetpackages[$item->package_srl->body] = 0;
}
$oModel = &getModel('autoinstall');
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
foreach($items as $item)
{
$v = $this->rearrange($item, $targets);
if($packages[$v->package_srl])
{
$v->current_version = $packages[$v->package_srl]->current_version;
$v->need_update = $packages[$v->package_srl]->need_update;
}
$item_list[$v->package_srl] = $v;
}
return $item_list;
}
function dispAutoinstallAdminInstall() {
$package_srl = Context::get('package_srl');
if(!$package_srl) return $this->dispAutoinstallAdminIndex();
$params["act"] = "getResourceapiInstallInfo";
$params["package_srl"] = $package_srl;
$xmlDoc = XmlGenerater::getXmlDoc($params);
$oModel = &getModel('autoinstall');
$targetpackages = array();
if($xmlDoc)
{
$xmlPackage =& $xmlDoc->response->package;
$package->package_srl = $xmlPackage->package_srl->body;
$package->title = $xmlPackage->title->body;
$package->package_description = $xmlPackage->package_description->body;
$package->version = $xmlPackage->version->body;
if($xmlPackage->depends)
{
if(!is_array($xmlPackage->depends->item)) $xmlPackage->depends->item = array($xmlPackage->depends->item);
$package->depends = array();
foreach($xmlPackage->depends->item as $item)
{
$dep_item = null;
$dep_item->package_srl = $item->package_srl->body;
$dep_item->title = $item->title->body;
$dep_item->version = $item->version->body;
$package->depends[] = $dep_item;
$targetpackages[$dep_item->package_srl] = 1;
}
$packages = $oModel->getInstalledPackages(array_keys($targetpackages));
$package->deplist = "";
foreach($package->depends as $key => $dep)
{
if(!$packages[$dep->package_srl]) {
$package->depends[$key]->installed = false;
$package->package_srl .= ",". $dep->package_srl;
}
else {
$package->depends[$key]->installed = true;
$package->depends[$key]->cur_version = $packages[$dep->package_srl]->version;
if(version_compare($dep->version, $packages[$dep->package_srl]->version, ">"))
{
$package->need_update = true;
$package->package_srl .= ",". $dep->package_srl;
}
else
{
$package->need_update = false;
}
}
}
}
$installedPackage = $oModel->getInstalledPackage($package_srl);
if($installedPackage) {
$package->installed = true;
$package->cur_version = $installedPackage->current_version;
$package->need_update = version_compare($package->version, $installedPackage->current_version, ">");
}
Context::set("package", $package);
}
$this->setTemplateFile('install');
}
function dispAutoinstallAdminIndex() {
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('autoinstall');
if(!$config || !$config->ftp_root_path) Context::set('show_ftp_note', true);
$this->setTemplateFile('index');
$params = array();
$params["act"] = "getResourceapiLastupdate";
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($this->uri, $body, 3, "POST", "application/xml");
$xml_lUpdate = new XmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body;
$oModel = &getModel('autoinstall');
$item = $oModel->getLatestPackage();
if(!$item || $item->updatedate < $updateDate )
{
Context::set('need_update', true);
return;
}
$page = Context::get('page');
if(!$page) $page = 1;
Context::set('page', $page);
$order_type = Context::get('order_type');
if(!in_array($order_type, array('asc', 'desc'))) $order_type = 'desc';
Context::set('order_type', $order_type);
$order_target = Context::get('order_target');
if(!in_array($order_target, array('newest', 'download', 'popular'))) $order_target = 'newest';
Context::set('order_target', $order_target);
$search_keyword = Context::get('search_keyword');
$childrenList = Context::get('childrenList');
$category_srl = Context::get('category_srl');
if($childrenList) $params["category_srl"] = $childrenList;
else if($category_srl) $params["category_srl"] = $category_srl;
$params["act"] = "getResourceapiPackagelist";
$params["order_target"] = $order_target;
$params["order_type"] = $order_type;
$params["page"] = $page;
if($search_keyword)
{
$params["search_keyword"] = $search_keyword;
}
$xmlDoc = XmlGenerater::getXmlDoc($params);
if($xmlDoc && $xmlDoc->response->packagelist->item)
{
$item_list = $this->rearranges($xmlDoc->response->packagelist->item);
Context::set('item_list', $item_list);
$array = array('total_count', 'total_page', 'cur_page', 'page_count', 'first_page', 'last_page');
$page_nav = $this->rearrange($xmlDoc->response->page_navigation, $array);
$page_navigation = new PageHandler($page_nav->total_count, $page_nav->total_page, $page_nav->cur_page, $page_nav->page_count);
Context::set('page_navigation', $page_navigation);
}
$oModel = &getModel('autoinstall');
$categories = &$oModel->getCategoryList();
Context::set('categories', $categories);
Context::set('tCount', $oModel->getPackageCount(null));
}
function dispAutoinstallAdminConfig(){
$pwd = Context::get('pwd');
if(!$pwd) $pwd = '/';
Context::set('pwd',$pwd);
require_once(_XE_PATH_.'libs/ftp.class.php');
$ftp_info = Context::getFTPInfo();
$oFtp = new ftp();
if(!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
$oFtp->ftp_quit();
return new Object(-1,'msg_ftp_invalid_auth_info');
}
$_list = $oFtp->ftp_rawlist($pwd);
$oFtp->ftp_quit();
$list = array();
if($_list){
foreach($_list as $k => $v){
if(strpos($v,'d') === 0) $list[] = substr(strrchr($v,' '),1) . '/';
}
}
Context::set('list',$list);
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('autoinstall');
Context::set('config',$config);
$this->setTemplateFile('config');
}
}
?>

View file

@ -0,0 +1,64 @@
<?php
/**
* @class autoinstall
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 high class
**/
class XmlGenerater {
function generate(&$params)
{
$xmlDoc = '<?xml version="1.0" encoding="utf-8" ?><methodCall><params>';
if(!is_array($params)) return null;
$params["module"] = "resourceapi";
foreach($params as $key => $val)
{
$xmlDoc .= sprintf("<%s><![CDATA[%s]]></%s>", $key, $val, $key);
}
$xmlDoc .= "</params></methodCall>";
return $xmlDoc;
}
function getXmlDoc(&$params)
{
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($this->uri, $body, 3, "POST", "application/xml");
if(!$buff) return;
$xml = new XmlParser();
$xmlDoc = $xml->parse($buff);
return $xmlDoc;
}
}
class autoinstall extends ModuleObject {
var $uri = "http://resource.xpressengine.com/";
var $original_site = "http://www.xpressengine.com/";
var $tmp_dir = './files/cache/autoinstall/';
/**
* @brief 설치시 추가 작업이 필요할시 구현
**/
function moduleInstall() {
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
**/
function moduleUpdate() {
return new Object(0, 'success_updated');
}
/**
* @brief 캐시 파일 재생성
**/
function recompileCache() {
}
}
?>

View file

@ -0,0 +1,18 @@
<?php
/**
* @class autoinstallController
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 Controller class
**/
class autoinstallController extends autoinstall {
/**
* @brief 초기화
**/
function init() {
}
}
?>

View file

@ -0,0 +1,117 @@
<?php
/**
* @class autoinstallModel
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 Model class
**/
class autoinstallModel extends autoinstall {
function getCategory($category_srl)
{
$args->category_srl = $category_srl;
$output = executeQueryArray("autoinstall.getCategory", $args);
if(!$output->data) return null;
return array_shift($output->data);
}
function getPackages()
{
$output = executeQueryArray("autoinstall.getPackages");
if(!$output->data) return array();
return $output->data;
}
function getInstalledPackage($package_srl)
{
$args->package_srl = $package_srl;
$output = executeQueryArray("autoinstall.getInstalledPackage", $args);
if(!$output->data) return null;
return array_shift($output->data);
}
function getPackage($package_srl)
{
$args->package_srl = $package_srl;
$output = executeQueryArray("autoinstall.getPackage", $args);
if(!$output->data) return null;
return array_shift($output->data);
}
function getCategoryList()
{
$output = executeQueryArray("autoinstall.getCategories");
if(!$output->toBool() || !$output->data) return array();
$categoryList = array();
foreach($output->data as $category)
{
$category->children = array();
$categoryList[$category->category_srl] = $category;
}
$depth0 = array();
foreach($categoryList as $key => $category)
{
if($category->parent_srl)
{
$categoryList[$category->parent_srl]->children[] =& $categoryList[$key];
}
else
{
$depth0[] = $key;
}
}
$resultList = array();
foreach($depth0 as $category_srl)
{
$this->setDepth($categoryList[$category_srl], 0, $categoryList, $resultList);
}
return $resultList;
}
function getPackageCount($category_srl)
{
$args->category_srl = $category_srl;
$output = executeQuery("autoinstall.getPackageCount", $args);
if(!$output->data) return 0;
return $output->data->count;
}
function setDepth(&$item, $depth, &$list, &$resultList)
{
$resultList[] =& $item;
$item->depth = $depth;
$siblingList = $item->category_srl;
foreach($item->children as $child)
{
$siblingList .= ",".$this->setDepth($list[$child->category_srl], $depth+1, $list, $resultList);
}
if(count($item->children) < 1)
{
$item->nPackages = $this->getPackageCount($item->category_srl);
}
$item->childrenList = $siblingList;
return $siblingList;
}
function getLatestPackage() {
$output = executeQueryArray("autoinstall.getLatestPackage");
if(!$output->data) return null;
return array_shift($output->data);
}
function getInstalledPackages(&$package_list) {
$args->package_list = &$package_list;
$output = executeQueryArray("autoinstall.getInstalledPackages", $args);
$result = array();
if(!$output->data) return $result;
foreach($output->data as $value)
{
$result[$value->package_srl] = $value;
}
return $result;
}
}
?>

View file

@ -0,0 +1,26 @@
<?php
/**
* @class autoinstallView
* @author sol (sol@ngleader.com)
* @brief autoinstall 모듈의 View class
**/
class autoinstallView extends autoinstall {
/**
* @brief 초기화
**/
function init() {
}
function dispAutoinstallTest(){
$file = "modules.test.tar";
$checksum = '549989037bd8401d39b83ca2393d8131';
$file = "modules.test.skins.test.tar";
$oAutoinstallAdminController = &getAdminController('autoinstall');
$output = $oAutoinstallAdminController->install($file, $checksum);
return $output;
}
}
?>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="0.2">
<title xml:lang="ko">자동설치 모듈</title>
<title xml:lang="en">Auto Installation Module</title>
<description xml:lang="ko">관리자 모드에서 클릭으로 모듈/스킨/레이아웃/위젯/위젯스타일 등을 설치하는 모듈입니다. </description>
<description xml:lang="en">Package management, automatic installation. </description>
<version>0.1</version>
<date>2009-10-30</date>
<category>system</category>
<author email_address="haneul0318@gmail.com" link="http://www.seungyeop.kr">
<name xml:lang="ko">haneul</name>
<name xml:lang="vi">haneul</name>
<name xml:lang="jp">haneul</name>
<name xml:lang="zh-CN">haneul</name>
<name xml:lang="en">haneul</name>
<name xml:lang="es">haneul</name>
<name xml:lang="zh-TW">haneul</name>
</author>
<author email_address="sol@ngleader.com" link="http://ngleader.com">
<name xml:lang="ko">sol</name>
<name xml:lang="en">sol</name>
<name xml:lang="jp">sol</name>
</author>
</module>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<actions>
<action name="dispAutoinstallTest" type="view" index="true" />
<action name="dispAutoinstallAdminInstall" type="view" standalone="true" />
<action name="dispAutoinstallAdminConfig" type="view" standalone="true" />
<action name="dispAutoinstallAdminIndex" type="view" standalone="true" admin_index="true" />
<action name="procAutoinstallAdminInsertConfig" type="controller" standalone="true" />
<action name="procAutoinstallAdminUpdateinfo" type="controller" standalone="true" />
<action name="procAutoinstallAdminPackageinstall" type="controller" standalone="true" />
</actions>
</module>

View file

@ -0,0 +1,21 @@
<?php
/**
* @file ko.lang.php
* @author sol (sol@ngleader.com)
* @brief Autoinstall(autoinstall) 모듈의 기본 언어팩
**/
$lang->autoinstall = 'Autoinstall';
$lang->about_autoinstall = 'Autoinstall은 XpressEngine의 자동설치 모듈입니다.';
$lang->package_update = '최근 업데이트';
$lang->package_downloaded_count = '전체 다운로드';
$lang->need_update = "업데이트가 필요합니다.";
$lang->order_newest = "신규 등록";
$lang->order_popular = "인기";
$lang->order_download = "다운로드";
$lang->success_installed = "설치가 성공하였습니다.";
$lang->view_all_package = "전체 보기";
$lang->description_ftp_note = "FTP 설정이 안되어있으면 설치가 진행되지 않습니다. FTP설정을 해주세요";
$lang->description_update = "새로 설치한 모듈의 버전 정보등은 업데이트를 눌러주시면 반영됩니다.";
?>

View file

@ -0,0 +1,7 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="autoinstall_remote_categories" />
</tables>
<conditions>
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="deleteInstalledPackage" action="delete">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<conditions>
<condition operation="equal" column="package_srl" var="package_srl" filter="number" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="getCategories" action="select">
<tables>
<table name="autoinstall_remote_categories" />
</tables>
<columns>
<column name="*" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="getCategory" action="select">
<tables>
<table name="autoinstall_remote_categories" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getInstalledPackage" action="select">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="package_srl" var="package_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getInstalledPackages" action="select">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="package_srl" var="package_list" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,16 @@
<query id="getLatestPackage" action="select">
<tables>
<table name="autoinstall_packages" alias="packages" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
</conditions>
<navigation>
<index var="sort_index" default="updatedate" order="desc" />
<list_count var="list_count" default="1" />
<page_count var="page_count" default="10" />
<page var="page" default="1" />
</navigation>
</query>

View file

@ -0,0 +1,11 @@
<query id="getPackage" action="select">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="package_srl" var="package_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="getPackageCount" action="select">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,8 @@
<query id="getPackages" action="select">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<column name="*" />
</columns>
</query>

View file

@ -0,0 +1,10 @@
<query id="insertCategory" action="insert">
<tables>
<table name="autoinstall_remote_categories" />
</tables>
<columns>
<column name="category_srl" var="category_srl" filter="number" notnull="notnull" />
<column name="parent_srl" var="parent_srl" filter="number" notnull="notnull" />
<column name="title" var="title" minlength="1" maxlength="250" />
</columns>
</query>

View file

@ -0,0 +1,11 @@
<query id="insertInstalledPackage" action="insert">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="package_srl" var="package_srl" filter="number" notnull="notnull" />
<column name="version" var="version" notnull="notnull" />
<column name="current_version" var="current_version" notnull="notnull" />
<column name="need_update" var="need_update" />
</columns>
</query>

View file

@ -0,0 +1,13 @@
<query id="insertPackage" action="insert">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<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="updatedate" var="updatedate" notnull="notnull" />
<column name="latest_item_srl" var="latest_item_srl" notnull="notnull" />
<column name="version" var="version" notnull="notnull" />
</columns>
</query>

View file

@ -0,0 +1,12 @@
<query id="updateCategory" action="update">
<tables>
<table name="autoinstall_remote_categories" />
</tables>
<columns>
<column name="parent_srl" var="parent_srl" filter="number" notnull="notnull" />
<column name="title" var="title" minlength="1" maxlength="250" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,13 @@
<query id="updateInstalledPackage" action="update">
<tables>
<table name="autoinstall_installed_packages" />
</tables>
<columns>
<column name="version" var="version" notnull="notnull" />
<column name="current_version" var="current_version" notnull="notnull" />
<column name="need_update" var="need_update" />
</columns>
<conditions>
<condition operation="equal" column="package_srl" var="package_srl" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,15 @@
<query id="updatePackage" action="update">
<tables>
<table name="autoinstall_packages" />
</tables>
<columns>
<column name="path" var="path" 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" />
<column name="version" var="version" notnull="notnull" />
</columns>
<conditions>
<condition operation="equal" column="package_srl" var="package_srl" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,6 @@
<table name="autoinstall_installed_packages">
<column name="package_srl" type="number" size="11" notnull="notnull" default="0" index="idx_package_srl" />
<column name="version" type="varchar" size="255" />
<column name="current_version" type="varchar" size="255" />
<column name="need_update" type="char" size="1" default="N" />
</table>

View file

@ -0,0 +1,9 @@
<table name="autoinstall_packages">
<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="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" />
</table>

View file

@ -0,0 +1,5 @@
<table name="autoinstall_remote_categories">
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" primary_key="primary_key" />
<column name="parent_srl" type="number" size="11" default="0" notnull="notnull" index="idx_parent_srl" />
<column name="title" type="varchar" size="250" notnull="notnull" />
</table>

View file

@ -0,0 +1,37 @@
<!--%import("filter/insert_config.xml")-->
<!--#include("header.html")-->
<form action="./" method="get" onsubmit="return procFilter(this, insert_config)">
<table cellspacing="0" class="rowTable">
<tr>
<th scope="col"><div>설치된 XE의 절대경로</div></th>
<td>{_XE_PATH_}
</td>
</tr>
<tr>
<th scope="col" rowspan="2"><div>설치된 XE의 FTP 절대경로 설정</div></th>
<td>
<input type="text" name="ftp_root_path" value="<!--@if($pwd && $pwd!='/')-->{$pwd}<!--@else-->{$config->ftp_root_path}<!--@end-->" class="inputTypeText w400" />
</td>
</tr>
<tr>
<td>
<!--@if($list)-->
<ul>
<!--@foreach($list as $k => $v)-->
<!--@if($v)-->
<li> <a href="{getUrl('pwd',$pwd.$v)}">{$v}</a></li>
<!--@end-->
<!--@end-->
</ul>
<!--@end-->
</td>
</tr>
<tr class="row2">
<th colspan="2" class="button" style="text-align:center">
<span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" accesskey="s" /></span>
</th>
</tr>
</table>
</form>

View file

@ -0,0 +1,47 @@
.leftBox { width:180px; float:left; margin-right:30px; padding-bottom:30px; }
.leftBox .categoryBox { background-color:#F8F8F8; padding:10px; width:160px; overflow:hidden; }
.leftBox .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;}
.leftBox .categoryBox h3 a { color:#48494E; font-size:12px; font-weight:bold; text-decoration:none; }
.leftBox .categoryBox ul.category { margin:10px 0 0 0; padding:0; list-style:none; }
.leftBox .categoryBox ul.category li { margin:0 0 10px 10px; }
.leftBox .categoryBox ul.category li a.selected { font-weight:bold; color:#2893BB; }
.leftBox .categoryBox ul.category li a { text-decoration:none; color:#7B7575; }
.leftBox .categoryBox ul.category li span { font-family:verdana; font-size:10px; color:#999; }
.leftBox .categoryBox ul.resourceManage { margin:0; padding:10px 0 0 0; list-style:none; background:transparent url(../img/hrE1.gif) repeat-x scroll left top; }
.leftBox .categoryBox ul.resourceManage li { background:url(../img/btnManage.gif) no-repeat 2px 2px; padding-left:14px; white-space:nowrap; overflow:hidden; margin-bottom:10px; }
.leftBox .categoryBox ul.resourceManage li a { text-decoration:none; color:#747474; }
.leftBox .categoryBox ul.resourceManage li a.selected { font-weight:bold; }
.leftBox .searchBox { padding:10px 0; text-align:center; background:transparent url(../img/hrE1.gif) repeat-x scroll left top;}
.leftBox .searchBox input.input { border:1px solid #ddd; width:120px; height:16px;}
.leftBox .searchBox input.submit { vertical-align:middle; }
.resourceContent { position:relative; *zoom:1; overflow:hidden; }
table.packageList {width:100%; height:100px; table-layout:fixed; border-bottom:1px solid #ddd; }
table td { vertical-align:top; }
table td.thumbnail { text-align:center; padding:10px 0; }
table td.thumbnail img { border:1px solid #ccc; padding:2px; overflow:hidden; *zoom:1; }
table td.title { height:18px; padding:10px 0 0 0;}
table td.title h3 { padding:0; margin:0; }
table td.title a {text-decoration:none; color:#000; }
table td.description { padding:5px 0 0 0; color:#777; height:44px; white-space:normal; overflow:hidden; }
table td.info { height:18px; }
table td.info ul { list-style:none; padding:0; margin:0; }
table td.info ul li { float:left; margin-right:20px; white-space:nowrap; }
table td.info ul li.category a { text-decoration:none; color:#888; font-weight:bold; }
table td.info ul li.voted { color:#666; font-family:tahoma; font-size:10px;}
table td.info ul li.downloaded { background:url(../img/iconFile.gif) no-repeat left 2px; padding-left:16px; color:#666; font-family:tahoma; font-size:10px;}
table td.info ul li.info { color:#aaa; font-family:tahoma; font-size:11px;}
table td.info ul li.info a { text-decoration:none; color:#aaa; }
table td.info ul li.author a { text-decoration:none; color:#444; }
ul.listOrder { margin:10px 0 0 0; padding:0 0 10px 0; text-align:left; background:transparent url(../img/hrE1.gif) repeat-x scroll left bottom;}
ul.listOrder.asc li.arrow { background:url(../img/arrUp.gif) no-repeat right 2px; padding-right:10px; }
ul.listOrder.desc li.arrow { background:url(../img/arrDown.gif) no-repeat right 2px; padding-right:10px; }
ul.listOrder li { display:inline; margin-left:10px; }
ul.listOrder li.arrow a { text-decoration:none; font-weight:bold; color:#2893BB; }
ul.listOrder li a { text-decoration:none; color:#7B7575; }

View file

@ -0,0 +1,9 @@
<filter name="insert_config" module="autoinstall" act="procAutoinstallAdminInsertConfig" confirm_msg_code="confirm_submit">
<form>
<node target="ftp_root_path" required="true" />
</form>
<response>
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -0,0 +1,8 @@
<h3 class="xeAdmin">autoinstall module <span class="gray">{$lang->cmd_management}</span></h3>
<div class="header4">
<ul class="localNavigation">
<li <!--@if($act=="dispAutoinstallAdminIndex")-->class="on"<!--@end-->><a href="{getUrl('act','dispAutoinstallAdminIndex')}">Index</a></li>
<li <!--@if($act=="dispAutoinstallAdminConfig")-->class="on"<!--@end-->><a href="{getUrl('act','dispAutoinstallAdminConfig')}">Config</a></li>
</ul>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View file

@ -0,0 +1,22 @@
<!--#include("header.html")-->
<!--%import("css/autoinstall.css")-->
<!--%import("js/autoinstall.js")-->
<div>
<!--@if($show_ftp_note)-->
{$lang->description_ftp_note}
<!--@end-->
<!--@if($need_update)-->
<p>
{$lang->need_update}</p>
<!--@else-->
<p>{$lang->description_update}</p>
<!--@end-->
<a href="#" onclick="doUpdate(); return false;" title="update">Update</a>
</div>
<div class="clear" ></div>
<!--#include("leftBox.html")-->
<!--@if($item_list)-->
<!--#include("list.html")-->
<!--@end-->

View file

@ -0,0 +1,35 @@
<!--#include("header.html")-->
<!--%import("css/autoinstall.css")-->
<!--%import("js/autoinstall.js")-->
<div class="resourceContent">
<table class="packageList">
<colgroup>
<col width="150" /><col width="*" />
</colgroup>
<tr>
<td class="title" colspan="2">
<h3>
{$package->title} ver. {$package->version} ( <!--@if($package->installed)-->현재버전: {$package->cur_version} <!--@if($package->need_update)--> (업데이트가 필요합니다.)<!--@end--> <!--@else-->인스톨이 필요합니다. <!--@end--> )
</h3>
</td>
</tr>
<!--@if($package->depends)-->
<tr>
<td>의존하고 있는 프로그램</td>
<td>
<!--@foreach($package->depends as $dep)-->
{$dep->title} ver. {$dep->version} -
<!--@if($dep->installed)-->현재버전: {$dep->cur_version} <!--@if($dep->need_update)--> (업데이트가 필요합니다.)<!--@end--> <!--@else-->인스톨이 필요합니다. <!--@end-->
<br />
<!--@end-->
</td>
</tr>
<!--@end-->
<tr>
<td colspan="2">
설치를 진행하면 의존성이 있는 모든 프로그램을 함께 설치합니다. <!--@if(!$package->installed || $package->need_update)--><a href="#" onclick="doInstallPackage('{$package->package_srl}')">설치하기</a><!--@end-->
</td>
</tr>
</table>
</div>

View file

@ -0,0 +1,26 @@
function completeUpdate(ret_obj) {
alert(ret_obj['message']);
location.reload();
}
function doUpdate() {
var params = new Array();
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdate);
}
function doInstallPackage(package_srl) {
var params = new Array();
params['package_srl'] = package_srl;
exec_xml('autoinstall', 'procAutoinstallAdminPackageinstall', params, completeInstall);
}
function completeUpdateNoMsg(ret_obj) {
location.reload();
}
function completeInstall(ret_obj) {
alert(ret_obj['message']);
var params = new Array();
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
}

View file

@ -0,0 +1,47 @@
<div class="leftBox">
<div class="categoryBox">
<h3><a href="{getUrl('category_srl','')}">{$lang->view_all_package}</a> <span>({$tCount})</span></h3>
{@ $_pDepth = 0;}
<ul class="category">
<!--@foreach($categories as $key => $val)-->
<!--@if($_pDepth > $val->depth)-->
<!--@for($i=$val->depth; $i<$_pDepth; $i++)-->
</ul>
</li>
<!--@end-->
{@ $_pDepth = $val->depth}
<!--@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>
<!--@else-->
<a href="{getUrl('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>
<!--@end-->
<!--@if(count($val->children))-->
{@$_pDepth++}
<ul class="category">
<!--@else-->
</li>
<!--@end-->
<!--@end-->
<!--@for($i=0;$i<$_pDepth;$i++)-->
</ul>
<!--@end-->
</li>
</ul>
<div class="searchBox">
<form action="{getUrl()}" method="get">
<input type="hidden" name="category_srl" value="{$category_srl}" />
<input type="hidden" name="module" value="admin" />
<input type="hidden" name="act" value="dispAutoinstallAdminIndex" />
<input type="text" name="search_keyword" value="{htmlspecialchars($search_keyword)}" class="input" />
<input type="image" src="./img/btn_search.gif" class="submit" />
</form>
</div>
</div>
</div>

View file

@ -0,0 +1,94 @@
<div class="resourceContent">
<ul class="listOrder {$order_type}">
<!--@if($order_target=='newest')-->
<!--@if($order_type == 'desc')-->{@$_order_type = 'asc'}<!--@else-->{@$_order_type = 'desc'}<!--@end-->
<!--@else-->
{@$_order_type = 'desc'}
<!--@end-->
<li <!--@if($order_target=='newest')-->class="arrow"<!--@end-->><a href="{getUrl('order_target','newest','order_type',$_order_type)}">{$lang->order_newest}</a></li>
<!--@if($order_target=='download')-->
<!--@if($order_type == 'desc')-->{@$_order_type = 'asc'}<!--@else-->{@$_order_type = 'desc'}<!--@end-->
<!--@else-->
{@$_order_type = 'desc'}
<!--@end-->
<li <!--@if($order_target=='download')-->class="arrow"<!--@end-->><a href="{getUrl('order_target','download','order_type',$_order_type)}">{$lang->order_download}</a></li>
<!--@if($order_target=='popular')-->
<!--@if($order_type == 'desc')-->{@$_order_type = 'asc'}<!--@else-->{@$_order_type = 'desc'}<!--@end-->
<!--@else-->
{@$_order_type = 'desc'}
<!--@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>
<!--@foreach($item_list as $key => $val)-->
<table class="packageList">
<colgroup>
<col width="120" /><col width="*"/>
</colgroup>
<tr>
{@ $target_url = $original_site."?mid=download&package_srl=".$val->package_srl; }
<td rowspan="4" class="thumbnail"><a href="{$target_url}"><img src="{str_replace('./', $uri, $val->item_screenshot_url)}" width="100" height="100" alt="" /></a></td>
<td class="title">
<h3>
<a href="{$target_url}">{htmlspecialchars($val->title)} ver. {htmlspecialchars($val->item_version)}</a>
</h3>
</td>
</tr>
<tr>
<tr>
<td class="info">
<ul>
<!--@if($val->category_srl)--><li class="category"><a href="{getUrl('category_srl', $val->category_srl)}">{$categories[$val->category_srl]->title}</a></li><!--@end-->
<li class="voted">
<!--@for($i=0;$i<5;$i++)--><!--@if($i<$val->package_star)--><img src="./img/starOn.gif" alt="" /><!--@else--><img src="./img/starOff.gif" alt="" /><!--@end--><!--@end-->
{sprintf("%0.1f",$val->package_voted/$val->package_voter*2)} /{number_format($val->package_voter)}
</li>
</li>
</td>
</tr>
<tr>
<td class="description">{cut_str(htmlspecialchars($val->package_description),200)}</td>
</tr>
<tr>
<td class="info">
<ul>
<li class="info">
{$lang->package_update} {zdate($val->item_regdate, "Y-m-d H:i")}
/ {$lang->package_downloaded_count} : {number_format($val->package_downloaded)}
</li>
</ul>
</td>
</tr>
<tr>
<td class="info">
<ul>
<li class="info">
<!--@if($val->current_version)-->
현재 설치 버전 : {$val->current_version}
<!--@if($val->need_update == 'Y')-->
<a href="{getUrl('act','dispAutoinstallAdminInstall','package_srl',$val->package_srl)}">업데이트</a>
<!--@end-->
<!--@else-->
<a href="{getUrl('act','dispAutoinstallAdminInstall','package_srl',$val->package_srl)}">인스톨</a>
<!--@end-->
</li>
</ul>
</td>
</tr>
</table>
<!--@end-->
<div class="pagination">
<a href="{getUrl('page','')}" class="prevEnd">{$lang->first_page}</a>
<!--@while($page_no = $page_navigation->getNextPage())-->
<!--@if($page == $page_no)-->
<strong>{$page_no}</strong>
<!--@else-->
<a href="{getUrl('page',$page_no)}">{$page_no}</a>
<!--@end-->
<!--@end-->
<a href="{getUrl('page',$page_navigation->last_page)}" class="nextEnd">{$lang->last_page}</a>
</div>
</div>