From d5c98490ad92504c74542b093dfadc446a7746a7 Mon Sep 17 00:00:00 2001 From: haneul Date: Tue, 10 Nov 2009 13:21:36 +0000 Subject: [PATCH] #18427049 : add autoinstall module git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6915 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- .../autoinstall.admin.controller.php | 292 ++++++++++++++++++ .../autoinstall/autoinstall.admin.view.php | 222 +++++++++++++ modules/autoinstall/autoinstall.class.php | 64 ++++ .../autoinstall/autoinstall.controller.php | 18 ++ modules/autoinstall/autoinstall.model.php | 117 +++++++ modules/autoinstall/autoinstall.view.php | 26 ++ modules/autoinstall/conf/info.xml | 24 ++ modules/autoinstall/conf/module.xml | 12 + modules/autoinstall/lang/ko.lang.php | 21 ++ .../autoinstall/queries/deleteCategory.xml | 7 + .../queries/deleteInstalledPackage.xml | 8 + modules/autoinstall/queries/getCategories.xml | 8 + modules/autoinstall/queries/getCategory.xml | 11 + .../queries/getInstalledPackage.xml | 11 + .../queries/getInstalledPackages.xml | 11 + .../autoinstall/queries/getLatestPackage.xml | 16 + modules/autoinstall/queries/getPackage.xml | 11 + .../autoinstall/queries/getPackageCount.xml | 11 + modules/autoinstall/queries/getPackages.xml | 8 + .../autoinstall/queries/insertCategory.xml | 10 + .../queries/insertInstalledPackage.xml | 11 + modules/autoinstall/queries/insertPackage.xml | 13 + .../autoinstall/queries/updateCategory.xml | 12 + .../queries/updateInstalledPackage.xml | 13 + modules/autoinstall/queries/updatePackage.xml | 15 + .../autoinstall_installed_packages.xml | 6 + .../schemas/autoinstall_packages.xml | 9 + .../schemas/autoinstall_remote_categories.xml | 5 + modules/autoinstall/tpl/config.html | 37 +++ modules/autoinstall/tpl/css/autoinstall.css | 47 +++ .../autoinstall/tpl/filter/insert_config.xml | 9 + modules/autoinstall/tpl/header.html | 8 + modules/autoinstall/tpl/img/arrDown.gif | Bin 0 -> 60 bytes modules/autoinstall/tpl/img/arrUp.gif | Bin 0 -> 60 bytes .../autoinstall/tpl/img/arrowPagination.gif | Bin 0 -> 98 bytes modules/autoinstall/tpl/img/btn_search.gif | Bin 0 -> 605 bytes modules/autoinstall/tpl/img/hrE1.gif | Bin 0 -> 43 bytes modules/autoinstall/tpl/img/starOff.gif | Bin 0 -> 97 bytes modules/autoinstall/tpl/img/starOn.gif | Bin 0 -> 127 bytes modules/autoinstall/tpl/index.html | 22 ++ modules/autoinstall/tpl/install.html | 35 +++ modules/autoinstall/tpl/js/autoinstall.js | 26 ++ modules/autoinstall/tpl/leftBox.html | 47 +++ modules/autoinstall/tpl/list.html | 94 ++++++ 44 files changed, 1317 insertions(+) create mode 100644 modules/autoinstall/autoinstall.admin.controller.php create mode 100644 modules/autoinstall/autoinstall.admin.view.php create mode 100644 modules/autoinstall/autoinstall.class.php create mode 100644 modules/autoinstall/autoinstall.controller.php create mode 100644 modules/autoinstall/autoinstall.model.php create mode 100644 modules/autoinstall/autoinstall.view.php create mode 100644 modules/autoinstall/conf/info.xml create mode 100644 modules/autoinstall/conf/module.xml create mode 100644 modules/autoinstall/lang/ko.lang.php create mode 100644 modules/autoinstall/queries/deleteCategory.xml create mode 100644 modules/autoinstall/queries/deleteInstalledPackage.xml create mode 100644 modules/autoinstall/queries/getCategories.xml create mode 100644 modules/autoinstall/queries/getCategory.xml create mode 100644 modules/autoinstall/queries/getInstalledPackage.xml create mode 100644 modules/autoinstall/queries/getInstalledPackages.xml create mode 100644 modules/autoinstall/queries/getLatestPackage.xml create mode 100644 modules/autoinstall/queries/getPackage.xml create mode 100644 modules/autoinstall/queries/getPackageCount.xml create mode 100644 modules/autoinstall/queries/getPackages.xml create mode 100644 modules/autoinstall/queries/insertCategory.xml create mode 100644 modules/autoinstall/queries/insertInstalledPackage.xml create mode 100644 modules/autoinstall/queries/insertPackage.xml create mode 100644 modules/autoinstall/queries/updateCategory.xml create mode 100644 modules/autoinstall/queries/updateInstalledPackage.xml create mode 100644 modules/autoinstall/queries/updatePackage.xml create mode 100644 modules/autoinstall/schemas/autoinstall_installed_packages.xml create mode 100644 modules/autoinstall/schemas/autoinstall_packages.xml create mode 100644 modules/autoinstall/schemas/autoinstall_remote_categories.xml create mode 100644 modules/autoinstall/tpl/config.html create mode 100644 modules/autoinstall/tpl/css/autoinstall.css create mode 100644 modules/autoinstall/tpl/filter/insert_config.xml create mode 100644 modules/autoinstall/tpl/header.html create mode 100644 modules/autoinstall/tpl/img/arrDown.gif create mode 100644 modules/autoinstall/tpl/img/arrUp.gif create mode 100644 modules/autoinstall/tpl/img/arrowPagination.gif create mode 100644 modules/autoinstall/tpl/img/btn_search.gif create mode 100644 modules/autoinstall/tpl/img/hrE1.gif create mode 100644 modules/autoinstall/tpl/img/starOff.gif create mode 100644 modules/autoinstall/tpl/img/starOn.gif create mode 100644 modules/autoinstall/tpl/index.html create mode 100644 modules/autoinstall/tpl/install.html create mode 100644 modules/autoinstall/tpl/js/autoinstall.js create mode 100644 modules/autoinstall/tpl/leftBox.html create mode 100644 modules/autoinstall/tpl/list.html diff --git a/modules/autoinstall/autoinstall.admin.controller.php b/modules/autoinstall/autoinstall.admin.controller.php new file mode 100644 index 000000000..452f35c54 --- /dev/null +++ b/modules/autoinstall/autoinstall.admin.controller.php @@ -0,0 +1,292 @@ +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;$iftp_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); + } + } + } +?> diff --git a/modules/autoinstall/autoinstall.admin.view.php b/modules/autoinstall/autoinstall.admin.view.php new file mode 100644 index 000000000..c4116a1bb --- /dev/null +++ b/modules/autoinstall/autoinstall.admin.view.php @@ -0,0 +1,222 @@ +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'); + } + } +?> diff --git a/modules/autoinstall/autoinstall.class.php b/modules/autoinstall/autoinstall.class.php new file mode 100644 index 000000000..7b4ec4760 --- /dev/null +++ b/modules/autoinstall/autoinstall.class.php @@ -0,0 +1,64 @@ +'; + if(!is_array($params)) return null; + $params["module"] = "resourceapi"; + foreach($params as $key => $val) + { + $xmlDoc .= sprintf("<%s>", $key, $val, $key); + } + $xmlDoc .= ""; + 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() { + } + } +?> diff --git a/modules/autoinstall/autoinstall.controller.php b/modules/autoinstall/autoinstall.controller.php new file mode 100644 index 000000000..bc2ecc08c --- /dev/null +++ b/modules/autoinstall/autoinstall.controller.php @@ -0,0 +1,18 @@ + diff --git a/modules/autoinstall/autoinstall.model.php b/modules/autoinstall/autoinstall.model.php new file mode 100644 index 000000000..cb874a53d --- /dev/null +++ b/modules/autoinstall/autoinstall.model.php @@ -0,0 +1,117 @@ +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; + } + + } +?> diff --git a/modules/autoinstall/autoinstall.view.php b/modules/autoinstall/autoinstall.view.php new file mode 100644 index 000000000..6de79151b --- /dev/null +++ b/modules/autoinstall/autoinstall.view.php @@ -0,0 +1,26 @@ +install($file, $checksum); + return $output; + } + } +?> diff --git a/modules/autoinstall/conf/info.xml b/modules/autoinstall/conf/info.xml new file mode 100644 index 000000000..6b7a412e0 --- /dev/null +++ b/modules/autoinstall/conf/info.xml @@ -0,0 +1,24 @@ + + + 자동설치 모듈 + Auto Installation Module + 관리자 모드에서 클릭으로 모듈/스킨/레이아웃/위젯/위젯스타일 등을 설치하는 모듈입니다. + Package management, automatic installation. + 0.1 + 2009-10-30 + system + + haneul + haneul + haneul + haneul + haneul + haneul + haneul + + + sol + sol + sol + + diff --git a/modules/autoinstall/conf/module.xml b/modules/autoinstall/conf/module.xml new file mode 100644 index 000000000..2cc9462c9 --- /dev/null +++ b/modules/autoinstall/conf/module.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/modules/autoinstall/lang/ko.lang.php b/modules/autoinstall/lang/ko.lang.php new file mode 100644 index 000000000..35633c0c5 --- /dev/null +++ b/modules/autoinstall/lang/ko.lang.php @@ -0,0 +1,21 @@ +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 = "새로 설치한 모듈의 버전 정보등은 업데이트를 눌러주시면 반영됩니다."; +?> diff --git a/modules/autoinstall/queries/deleteCategory.xml b/modules/autoinstall/queries/deleteCategory.xml new file mode 100644 index 000000000..f0cbea6d6 --- /dev/null +++ b/modules/autoinstall/queries/deleteCategory.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/modules/autoinstall/queries/deleteInstalledPackage.xml b/modules/autoinstall/queries/deleteInstalledPackage.xml new file mode 100644 index 000000000..feb3cc3df --- /dev/null +++ b/modules/autoinstall/queries/deleteInstalledPackage.xml @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/modules/autoinstall/queries/getCategories.xml b/modules/autoinstall/queries/getCategories.xml new file mode 100644 index 000000000..be66b8c1e --- /dev/null +++ b/modules/autoinstall/queries/getCategories.xml @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/modules/autoinstall/queries/getCategory.xml b/modules/autoinstall/queries/getCategory.xml new file mode 100644 index 000000000..99d8e7275 --- /dev/null +++ b/modules/autoinstall/queries/getCategory.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/getInstalledPackage.xml b/modules/autoinstall/queries/getInstalledPackage.xml new file mode 100644 index 000000000..4c2680c49 --- /dev/null +++ b/modules/autoinstall/queries/getInstalledPackage.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/getInstalledPackages.xml b/modules/autoinstall/queries/getInstalledPackages.xml new file mode 100644 index 000000000..f0d8afe07 --- /dev/null +++ b/modules/autoinstall/queries/getInstalledPackages.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/getLatestPackage.xml b/modules/autoinstall/queries/getLatestPackage.xml new file mode 100644 index 000000000..9ce02710d --- /dev/null +++ b/modules/autoinstall/queries/getLatestPackage.xml @@ -0,0 +1,16 @@ + + +
+ + + + + + + + + + + + + diff --git a/modules/autoinstall/queries/getPackage.xml b/modules/autoinstall/queries/getPackage.xml new file mode 100644 index 000000000..ff00dd252 --- /dev/null +++ b/modules/autoinstall/queries/getPackage.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/getPackageCount.xml b/modules/autoinstall/queries/getPackageCount.xml new file mode 100644 index 000000000..f1f3e05d0 --- /dev/null +++ b/modules/autoinstall/queries/getPackageCount.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/getPackages.xml b/modules/autoinstall/queries/getPackages.xml new file mode 100644 index 000000000..e85b91ce6 --- /dev/null +++ b/modules/autoinstall/queries/getPackages.xml @@ -0,0 +1,8 @@ + + +
+ + + + + diff --git a/modules/autoinstall/queries/insertCategory.xml b/modules/autoinstall/queries/insertCategory.xml new file mode 100644 index 000000000..87e240d6f --- /dev/null +++ b/modules/autoinstall/queries/insertCategory.xml @@ -0,0 +1,10 @@ + + +
+ + + + + + + diff --git a/modules/autoinstall/queries/insertInstalledPackage.xml b/modules/autoinstall/queries/insertInstalledPackage.xml new file mode 100644 index 000000000..b05ddacc9 --- /dev/null +++ b/modules/autoinstall/queries/insertInstalledPackage.xml @@ -0,0 +1,11 @@ + + +
+ + + + + + + + diff --git a/modules/autoinstall/queries/insertPackage.xml b/modules/autoinstall/queries/insertPackage.xml new file mode 100644 index 000000000..4b0148c0f --- /dev/null +++ b/modules/autoinstall/queries/insertPackage.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/autoinstall/queries/updateCategory.xml b/modules/autoinstall/queries/updateCategory.xml new file mode 100644 index 000000000..ec2bbcf28 --- /dev/null +++ b/modules/autoinstall/queries/updateCategory.xml @@ -0,0 +1,12 @@ + + +
+ + + + + + + + + diff --git a/modules/autoinstall/queries/updateInstalledPackage.xml b/modules/autoinstall/queries/updateInstalledPackage.xml new file mode 100644 index 000000000..26f9c5926 --- /dev/null +++ b/modules/autoinstall/queries/updateInstalledPackage.xml @@ -0,0 +1,13 @@ + + +
+ + + + + + + + + + diff --git a/modules/autoinstall/queries/updatePackage.xml b/modules/autoinstall/queries/updatePackage.xml new file mode 100644 index 000000000..7ae6aefd0 --- /dev/null +++ b/modules/autoinstall/queries/updatePackage.xml @@ -0,0 +1,15 @@ + + +
+ + + + + + + + + + + + diff --git a/modules/autoinstall/schemas/autoinstall_installed_packages.xml b/modules/autoinstall/schemas/autoinstall_installed_packages.xml new file mode 100644 index 000000000..84b2ef4d0 --- /dev/null +++ b/modules/autoinstall/schemas/autoinstall_installed_packages.xml @@ -0,0 +1,6 @@ +
+ + + + +
diff --git a/modules/autoinstall/schemas/autoinstall_packages.xml b/modules/autoinstall/schemas/autoinstall_packages.xml new file mode 100644 index 000000000..cf1e102a9 --- /dev/null +++ b/modules/autoinstall/schemas/autoinstall_packages.xml @@ -0,0 +1,9 @@ + + + + + + + +
+ diff --git a/modules/autoinstall/schemas/autoinstall_remote_categories.xml b/modules/autoinstall/schemas/autoinstall_remote_categories.xml new file mode 100644 index 000000000..6e25f12b9 --- /dev/null +++ b/modules/autoinstall/schemas/autoinstall_remote_categories.xml @@ -0,0 +1,5 @@ + + + + +
diff --git a/modules/autoinstall/tpl/config.html b/modules/autoinstall/tpl/config.html new file mode 100644 index 000000000..1edb85f3e --- /dev/null +++ b/modules/autoinstall/tpl/config.html @@ -0,0 +1,37 @@ + + + +
+ + + + + + + + + + + + + + + + +
설치된 XE의 절대경로
{_XE_PATH_} +
설치된 XE의 FTP 절대경로 설정
+ +
+ + + +
+ +
+
diff --git a/modules/autoinstall/tpl/css/autoinstall.css b/modules/autoinstall/tpl/css/autoinstall.css new file mode 100644 index 000000000..619b42657 --- /dev/null +++ b/modules/autoinstall/tpl/css/autoinstall.css @@ -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; } diff --git a/modules/autoinstall/tpl/filter/insert_config.xml b/modules/autoinstall/tpl/filter/insert_config.xml new file mode 100644 index 000000000..08b866eca --- /dev/null +++ b/modules/autoinstall/tpl/filter/insert_config.xml @@ -0,0 +1,9 @@ + +
+ + + + + + +
diff --git a/modules/autoinstall/tpl/header.html b/modules/autoinstall/tpl/header.html new file mode 100644 index 000000000..9c5655dfb --- /dev/null +++ b/modules/autoinstall/tpl/header.html @@ -0,0 +1,8 @@ +

autoinstall module {$lang->cmd_management}

+ +
+ +
diff --git a/modules/autoinstall/tpl/img/arrDown.gif b/modules/autoinstall/tpl/img/arrDown.gif new file mode 100644 index 0000000000000000000000000000000000000000..f99fafc0529f9e9800dc50ed81a53db8346bab3c GIT binary patch literal 60 zcmZ?wbhEHbe#7av{EO#oxz)XX zQNnZnwnrY*?v_k@b!ywXDRv*duYc>UI@k04U;d?&Ee95Tyz#)XI|MaiB8VErB}U^0ao-iwt07PdCl6k{df;G$ zQf4~sbUI_{lqoGD6e}%-QbD>`Y-tBdVVL;@{{Y|N_YUv)Dyu3=N^2#M1PVY94*<_E z(}`-9+UF1OfJd}Cc5zXM6ME9n4y##q0l{=?OpogDQ1~}(vCJ?th#F%UhN5U=x7lPi zvn&e$=W@9LznGkzwSBi!v^klY>mMBKP-}d?fKmk~=TbOnm`%<(oG#DL@sY8y&ng(j z@GevL59cs~>S(hCBT3q7)#BtlyD;hXD-kp{ofvg{dMv%nOft?eN?45zef_=P22u<2 z2`1t92LTVlk*R1b8jnx6!H9|O!3dJ$ff7cdv3R=*`C_E3U;8vTiD1}(%@z!Yd5-sb z{h`Pdsv`i;c_t?G2FmRj?^J7}(+SV`Bt{tiL}TsBP5=P(-{jAW{_RD}E`I{0>FZ?; zjq)Z%bBki@wJR$do^BE}OUn1HTeGe5odCKeU$G-EZCC!Gtf~j;GDsv(-??h{rL(7w zzr1m$?R{fGMfLs7GErg1_JcCP2KnKeN5zeopC5biP*Iw3`^brgS9N8ttxX3??qzO# z^JwqgCy$#?=A5tDzok}~z2`!UNP6+KaCK4kxlh$%NSgQTZEK;iRg@<^Q(Pb&5-D=C lu4jsK*4B7G<_hWRR6%-udHK~y@%lQmm;O+kCKfCMz{Q{g5(b&Uz@ii2X}N5w#zJdh-B Tp(?CL)+aFL7%+IUFjxZsw%0A7 literal 0 HcmV?d00001 diff --git a/modules/autoinstall/tpl/index.html b/modules/autoinstall/tpl/index.html new file mode 100644 index 000000000..4fc2f2f99 --- /dev/null +++ b/modules/autoinstall/tpl/index.html @@ -0,0 +1,22 @@ + + + +
+ +{$lang->description_ftp_note} + + +

+{$lang->need_update}

+ +

{$lang->description_update}

+ +Update +
+
+ + + + + + diff --git a/modules/autoinstall/tpl/install.html b/modules/autoinstall/tpl/install.html new file mode 100644 index 000000000..ae1bc4e75 --- /dev/null +++ b/modules/autoinstall/tpl/install.html @@ -0,0 +1,35 @@ + + + +
+ + + + + + + + + + + + + + + + +
+

+ {$package->title} ver. {$package->version} ( 현재버전: {$package->cur_version} (업데이트가 필요합니다.) 인스톨이 필요합니다. ) +

+
의존하고 있는 프로그램 + + {$dep->title} ver. {$dep->version} - + 현재버전: {$dep->cur_version} (업데이트가 필요합니다.) 인스톨이 필요합니다. +
+ +
+ 설치를 진행하면 의존성이 있는 모든 프로그램을 함께 설치합니다. 설치하기 +
+ +
diff --git a/modules/autoinstall/tpl/js/autoinstall.js b/modules/autoinstall/tpl/js/autoinstall.js new file mode 100644 index 000000000..4e65fd53f --- /dev/null +++ b/modules/autoinstall/tpl/js/autoinstall.js @@ -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); +} + diff --git a/modules/autoinstall/tpl/leftBox.html b/modules/autoinstall/tpl/leftBox.html new file mode 100644 index 000000000..a89bdac5b --- /dev/null +++ b/modules/autoinstall/tpl/leftBox.html @@ -0,0 +1,47 @@ +
+
+

{$lang->view_all_package} ({$tCount})

+ {@ $_pDepth = 0;} + +
    + + + +
+ + + {@ $_pDepth = $val->depth} + +
  • + + category_srl == $category_srl)--> class="selected">{$val->title} + + category_srl == $category_srl)--> class="selected">{$val->title} + + + ({$val->nPackages}) + + + {@$_pDepth++} +
      + + + + + +
    + +
  • + + +
    + +
    diff --git a/modules/autoinstall/tpl/list.html b/modules/autoinstall/tpl/list.html new file mode 100644 index 000000000..f8752c1ba --- /dev/null +++ b/modules/autoinstall/tpl/list.html @@ -0,0 +1,94 @@ +
    +
      + + {@$_order_type = 'asc'}{@$_order_type = 'desc'} + + {@$_order_type = 'desc'} + +
    • class="arrow">{$lang->order_newest}
    • + + {@$_order_type = 'asc'}{@$_order_type = 'desc'} + + {@$_order_type = 'desc'} + +
    • class="arrow">{$lang->order_download}
    • + + {@$_order_type = 'asc'}{@$_order_type = 'desc'} + + {@$_order_type = 'desc'} + +
    • class="arrow">{$lang->order_popular}
    • +
    + + + + + + + + {@ $target_url = $original_site."?mid=download&package_srl=".$val->package_srl; } + + + + + + + + + + + + + + + + +
    +

    + {htmlspecialchars($val->title)} ver. {htmlspecialchars($val->item_version)} +

    +
    +
    {cut_str(htmlspecialchars($val->package_description),200)}
    +
      +
    • + {$lang->package_update} {zdate($val->item_regdate, "Y-m-d H:i")} + / {$lang->package_downloaded_count} : {number_format($val->package_downloaded)} + + +
    • +
    +
    + +
    + + + +