+ add the feature of checking version when install.

This commit is contained in:
wangchunsheng
2010-04-26 06:52:32 +00:00
parent caefaec774
commit 9e4b37d6f1
4 changed files with 38 additions and 5 deletions

View File

@@ -34,7 +34,20 @@ class install extends control
public function index()
{
if(!isset($this->config->installed) or !$this->config->installed) $this->session->set('installing', true);
$this->view->header->title = $this->lang->install->welcome;
/* 获得官方网站最新的版本。*/
$snoopy = $this->app->loadClass('snoopy');
if($snoopy->fetchText('http://www.zentaoms.cn/misc-getlatestrelease.json'))
{
$result = json_decode($snoopy->results);
if(isset($result->release) and $this->config->version != $result->release->version)
{
$this->view->latestRelease = $result->release;
}
}
$this->display();
}

View File

@@ -27,14 +27,20 @@ $lang->install->pre = '返回';
$lang->install->reload = '刷新';
$lang->install->error = '错误 ';
$lang->install->start = '开始安装';
$lang->install->welcome = '欢迎使用禅道项目管理软件!';
$lang->install->desc = <<<EOT
$lang->install->start = '开始安装';
$lang->install->keepInstalling = '继续安装当前版本';
$lang->install->seeLatestRelease = '看看最新的版本';
$lang->install->welcome = '欢迎使用禅道项目管理软件!';
$lang->install->desc = <<<EOT
禅道项目管理软件(ZenTaoPMS)是一款国产的基于LGPL协议开源免费的项目管理软件它集产品管理、项目管理、测试管理于一体同时还包含了事务管理、组织管理等诸多功能是中小型企业项目管理的首选。
禅道项目管理软件使用PHP + MySQL开发基于自主的PHP开发框架──ZenTaoPHP而成。第三方开发者或者企业可以非常方便的开发插件或者进行定制。
您现在正在安装的版本是 <strong class='red'>%s</strong>。
EOT;
$lang->install->newReleased= "<strong class='red'>提示</strong>:官网网站已有最新版本,为<strong class='red'>%s</strong>, 发布日期于 %s。";
$lang->install->choice = '您可以选择:';
$lang->install->checking = '系统检查';
$lang->install->ok = '检查通过(√)';
$lang->install->fail = '检查失败(×)';

View File

@@ -18,6 +18,7 @@ $themeRoot = $webRoot . "theme/";
<style>
.ok{background:green; color:white}
.fail{background:red; color:white}
body{background:white}
caption, th, td {padding:10px; font-size:16px}
</style>
<script type="text/javascript">loadFixedCSS();</script>

View File

@@ -25,8 +25,21 @@
<div class='yui-d0'>
<table align='center' class='table-6'>
<caption><?php echo $lang->install->welcome;?></caption>
<tr><td><?php echo nl2br($lang->install->desc);?></td></tr>
<tr><td><h3 class='a-center'><?php echo html::a($this->createLink('install', 'step1'), $lang->install->start);?></h3></td></tr>
<tr><td><?php echo nl2br(sprintf($lang->install->desc, $config->version));?></td></tr>
<tr><td>
<?php if(!isset($latestRelease)):?>
<h3 class='a-center'><?php echo html::a($this->createLink('install', 'step1'), $lang->install->start);?></h3>
<?php else:?>
<?php vprintf($lang->install->newReleased, $latestRelease);?>
<h3 class='a-center'>
<?php
echo $lang->install->choice;
echo html::a($latestRelease->url, $lang->install->seeLatestRelease, '_blank');
echo html::a($this->createLink('install', 'step1'), $lang->install->keepInstalling);
?>
</h3>
<?php endif;?>
</td></tr>
</table>
</div>
<?php include './footer.html.php';?>