add getRemoveUrlByPath(), checking dependency when dispAutoinstallAdminUninstall

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8642 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-07-26 07:04:49 +00:00
parent 9acd474c52
commit 5f7be4a7f1
15 changed files with 153 additions and 70 deletions

View file

@ -98,6 +98,7 @@
$installed[$key]->title = $title;
}
Context::set('installed', $installed);
foreach($installed as $key=>$val)
{
foreach($depto[$key] as $package_srl)
@ -302,18 +303,38 @@
$config_file = $oModel->getConfigFilePath($type);
if(!$config_file) return $this->stop("msg_invalid_request");
$xml = new XmlParser();
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file);
if(!$xmlDoc) return $this->stop("msg_invalid_request");
if($type == "drcomponent") $type = "component";
if($type == "style") $type = "skin";
$title = $xmlDoc->{$type}->title->body;
$installedPackage->title = $title;
$installedPackage->type = $type;
// $xml = new XmlParser();
// $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path).$config_file);
// if(!$xmlDoc) return $this->stop("msg_invalid_request");
// if($type == "drcomponent") $type = "component";
// if($type == "style") $type = "skin";
// $title = $xmlDoc->{$type}->title->body;
// $installedPackage->title = $title;
// $installedPackage->type = $type;
// Context::set('package', $installedPackage);
$params["act"] = "getResourceapiPackages";
$params["package_srls"] = $package_srl;
$body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource(_XE_DOWNLOAD_SERVER_, $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);
$installedPackage->title = $item_list[$package_srl]->title;
$installedPackage->type = $item_list[$package_srl]->category;
$installedPackage->avail_remove = $item_list[$package_srl]->avail_remove;
$installedPackage->deps = $item_list[$package_srl]->deps;
Context::set('package', $installedPackage);
$this->setTemplateFile('uninstall');
Context::addJsFilter($this->module_path.'tpl/filter', 'uninstall_package.xml');
}
else
{
return $this->stop('Connection failed');
}
}
}
?>

View file

@ -123,6 +123,8 @@
function getInstalledPackageList($page)
{
$args->page = $page;
$args->list_count = 10;
$args->page_count = 5;
$output = executeQueryArray("autoinstall.getInstalledPackageList", $args);
$res = array();
foreach($output->data as $val)
@ -181,5 +183,27 @@
else return false;
}
function getPackageSrlByPath($path)
{
if (!$path) return;
if(substr($path,-1) == '/') $path = substr($path, 0, strlen($path)-1);
$args->path = $path;
$output = executeQuery('autoinstall.getPackageSrlByPath', $args);
return $output->data->package_srl;
}
function getRemoveUrlByPath($path)
{
if (!$path) return;
$packageSrl = $this->getPackageSrlByPath($path);
if (!$packageSrl) return;
return getUrl('', 'module', 'admin', 'act', 'dispAutoinstallAdminUninstall', 'package_srl', $packageSrl);
}
}
?>

View file

@ -33,4 +33,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "Dependant package list of the current package";
?>

View file

@ -32,4 +32,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "このパッケージに依存するパッケージのリスト";
?>

View file

@ -32,4 +32,6 @@
$lang->name = '이름';
$lang->about_depending_programs = '이 패키지 사용을 위해서는 아래 프로그램이 설치되어 있어야 합니다.';
$lang->ftp_password = 'FTP 비밀번호';
$lang->msg_dependency_package = '이 패키지를 의존하고 있는 다른 패키지가 있기 때문에 삭제할 수 없습니다.';
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
?>

View file

@ -32,4 +32,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "Dependant package list of the current package";
?>

View file

@ -32,4 +32,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "Mevcut pakete bağlı paket listesi";
?>

View file

@ -32,4 +32,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "Gói cài đặt này phụ thuộc vào các gói khác trong danh sách";
?>

View file

@ -32,4 +32,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "联动数据包列表";
?>

View file

@ -33,4 +33,6 @@
$lang->name = 'Name';
$lang->about_depending_programs = 'To use this package must be installed the fllowing program.';
$lang->ftp_password = 'FTP password';
$lang->msg_dependency_package = 'Can not remove this package because there exists another package dependent on this.';
$lang->dependant_list = "與此程式相關程式列表";
?>

View file

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

View file

@ -1,5 +1,5 @@
<include target="header.html" />
{@debugPrint($package)}
<h2 class="h2">{$package->title} ver. {$package->version}</h2>
<p cond="$package->installed">{$lang->current_version}: {$package->cur_version} <block cond="$package->need_update">({$lang->require_update})</block></p>
<p cond="!$package->installed">{$lang->require_installation}</p>

View file

@ -39,6 +39,7 @@
</thead>
<tbody>
<tr loop="$item_list => $key, $item">
{@ $target_url = $original_site."?mid=download&package_srl=".$item->package_srl; }
<td>{$item->category}</td>
<td class="title"><img src="{str_replace('./', $uri, $item->item_screenshot_url)}" alt="" width="100" height="100" /></td>
<td class="title">
@ -50,6 +51,10 @@
{$lang->package_update} {zdate($item->item_regdate, "Y-m-d H:i")} |
{$lang->package_downloaded_count} : {number_format($item->package_downloaded)}
</p>
<p cond="$item->deps">{$lang->dependant_list}:</p>
<ul cond="$item->deps">
<li loop="$item->deps => $package_srl">{$installed[$package_srl]->title}</li>
</ul>
</td>
<td>{htmlspecialchars($item->item_version)}</td>
<td>{htmlspecialchars($item->current_version)}</td>
@ -76,12 +81,7 @@
<a href="{getUrl('page', '')}" class="direction">&laquo; FIRST</a>
<block cond="$page_navigation->first_page + $page_navigation->page_count > $page_navigation->last_page && $page_navigation->page_count != $page_navigation->total_page">
<a href="{getUrl('page', '')}">1</a>
<a href="#goTo" class="tgSimple">...</a>
<span id="goTo" class="tgContent">
<input name="page" title="Go to Page" />
<button type="submit">Go</button>
</span>
<a href="{getUrl('page', $page_navigation->last_page)}">{$page_navigation->last_page}</a>
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
</block>
<!--@while($page_no = $page_navigation->getNextPage())-->
{@$last_page = $page_no}
@ -89,14 +89,14 @@
<a cond="$page_no != $page" href="{getUrl('page', $page_no)}">{$page_no}</a>
<!--@end-->
<block cond="$last_page != $page_navigation->last_page">
<a href="#goTo" class="tgSimple">...</a>
<span id="goTo" class="tgContent">
<input name="page" title="Go to Page" />
<button type="submit">Go</button>
</span>
<a href="#goTo" class="tgSimple" title="{$lang->cmd_go_to_page}">...</a>
<a href="{getUrl('page', $page_navigation->last_page)}">{$page_navigation->last_page}</a>
</block>
<a href="{getUrl('page', $page_navigation->last_page)}" class="direction">LAST &raquo;</a>
<span id="goTo" class="tgContent">
<input name="page" title="{$lang->cmd_go_to_page}" />
<button type="submit">Go</button>
</span>
</form>
<form cond="$act == 'dispAutoinstallAdminIndex'" action="./">
<input type="hidden" name="error_return_url" value="" />

View file

@ -3,14 +3,15 @@
<h2 class="h2">{$package->title}</h2>
<p>{$package->type} ({$package->path})</p>
<div class="message info">
<block cond="$package->avail_remove">
<div class="message info">
<p>{$lang->description_uninstall}</p>
</div>
</div>
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<div cond="$XE_VALIDATOR_MESSAGE" class="message {$XE_VALIDATOR_MESSAGE_TYPE}">
<p>{$XE_VALIDATOR_MESSAGE}</p>
</div>
<form action="" class="form" method="post">
</div>
<form action="" class="form" method="post">
<input type="hidden" name="module" value="autoinstall" />
<input type="hidden" name="act" value="procAutoinstallAdminUninstallPackage" />
<input type="hidden" name="package_srl" value="{$package_srl}" />
@ -24,4 +25,14 @@
<div class="btnArea">
<span class="btn medium"><input type="submit" value="{$lang->cmd_delete}" /></span>
</div>
</form>
</form>
</block>
<block cond="!$package->avail_remove">
<div class="message error">
<p>{$lang->msg_dependency_package}</p>
</div>
<p cond="$package->deps">{$lang->dependant_list}:</p>
<ul cond="$package->deps">
<li loop="$package->deps => $dep_package_srl">{$installed[$dep_package_srl]->title}</li>
</ul>
</block>