* rewrite the ui code.

This commit is contained in:
wangchunsheng
2011-02-26 08:59:29 +00:00
parent 50f3dedde9
commit 6f9d33a096
9 changed files with 189 additions and 235 deletions
+1
View File
@@ -95,6 +95,7 @@ class install extends control
if($return->result == 'ok')
{
$this->view = (object)$_POST;
$this->view->app = $this->app;
$this->view->lang = $this->lang;
$this->view->config = $this->config;
$this->view->domain = $this->server->HTTP_HOST;
+4
View File
@@ -0,0 +1,4 @@
body{background:white; margin-top:50px}
caption, th, td {padding:10px; font-size:16px}
.ok{background:green; color:white}
.fail{background:red; color:white}
-17
View File
@@ -1,17 +0,0 @@
<script language='Javascript'>var needPing = false;</script>
<div class='yui-d0'>
<iframe frameborder='0' name='hiddenwin' id='hiddenwin' class='hiddenwin'></iframe>
</div>
<div id='footer' class='yui-d0 yui-t7'>
<div class='yui-g'>
<div class='yui-g first' id='crumbs'></div>
<div class='yui-g'>
<div class='yui-u first'> </div>
<div class='yui-u a-right'>
<span id='poweredby'>powered by <a href='http://www.zentao.net' target='_blank'>ZenTaoPMS</a> (<?php echo $config->version;?>)</span>
</div>
</div>
</div>
</div>
</body>
</html>
-26
View File
@@ -1,26 +0,0 @@
<?php
$config->webRoot = $this->install->getWebRoot();
$clientTheme = $this->app->getClientTheme();
$webRoot = $this->config->webRoot;
$jsRoot = $webRoot . "js/";
$themeRoot = $webRoot . "theme/";
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dli'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title><?php echo $header->title;?></title>
<?php echo js::exportConfigVars();?>
<script src="<?php echo $jsRoot;?>jquery/lib.js" type="text/javascript"></script>
<script src="<?php echo $jsRoot;?>my.js" type="text/javascript"></script>
<link rel='stylesheet' href='<?php echo $clientTheme . 'yui.css';?>' type='text/css' media='screen' />
<link rel='stylesheet' href='<?php echo $clientTheme . 'style.css';?>' type='text/css' media='screen' />
<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>
</head>
<body style='margin-top:50px'>
+22 -22
View File
@@ -9,25 +9,25 @@
* @version $Id$
*/
?>
<?php include './header.html.php';?>
<div class='yui-d0'>
<table align='center' class='table-6'>
<caption><?php echo $lang->install->welcome;?></caption>
<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';?>
<?php include '../../common/view/header.lite.html.php';?>
<table align='center' class='table-6'>
<caption><?php echo $lang->install->welcome;?></caption>
<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>
<?php include '../../common/view/footer.lite.html.php';?>
+77 -79
View File
@@ -9,84 +9,82 @@
* @version $Id$
*/
?>
<?php include './header.html.php';?>
<div class='yui-d0'>
<table align='center' class='table-6 a-center'>
<caption><?php echo $lang->install->checking;?></caption>
<tr>
<th class='w-p20'><?php echo $lang->install->checkItem;?></th>
<th class='w-p25'><?php echo $lang->install->current?></th>
<th class='w-p15'><?php echo $lang->install->result?></th>
<th><?php echo $lang->install->action?></th>
</tr>
<tr>
<th><?php echo $lang->install->phpVersion;?></th>
<td><?php echo $phpVersion;?></td>
<td class='<?php echo $phpResult;?>'><?php echo $lang->install->$phpResult;?></td>
<td class='a-left f-12px'><?php if($phpResult == 'fail') echo $lang->install->phpFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->pdo;?></th>
<td><?php $pdoResult == 'ok' ? printf($lang->install->loaded) : printf($lang->install->unloaded);?></td>
<td class='<?php echo $pdoResult;?>'><?php echo $lang->install->$pdoResult;?></td>
<td class='a-left f-12px'><?php if($pdoResult == 'fail') echo $lang->install->pdoFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->pdoMySQL;?></th>
<td><?php $pdoMySQLResult == 'ok' ? printf($lang->install->loaded) : printf($lang->install->unloaded);?></td>
<td class='<?php echo $pdoMySQLResult;?>'><?php echo $lang->install->$pdoMySQLResult;?></td>
<td class='a-left f-12px'><?php if($pdoMySQLResult == 'fail') echo $lang->install->pdoMySQLFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->tmpRoot;?></th>
<td>
<?php
$tmpRootInfo['exists'] ? print($lang->install->exists) : print($lang->install->notExists);
$tmpRootInfo['writable'] ? print($lang->install->writable) : print($lang->install->notWritable);
?>
</td>
<td class='<?php echo $tmpRootResult;?>'><?php echo $lang->install->$tmpRootResult;?></td>
<td class='a-left f-12px'>
<?php
if(!$tmpRootInfo['exists']) printf($lang->install->mkdir, $tmpRootInfo['path'], $tmpRootInfo['path']);
if(!$tmpRootInfo['writable']) printf($lang->install->chmod, $tmpRootInfo['path'], $tmpRootInfo['path']);
?>
</td>
</tr>
<tr>
<th><?php echo $lang->install->dataRoot;?></th>
<td>
<?php
$dataRootInfo['exists'] ? print($lang->install->exists) : print($lang->install->notExists);
$dataRootInfo['writable'] ? print($lang->install->writable) : print($lang->install->notWritable);
?>
</td>
<td class='<?php echo $dataRootResult;?>'><?php echo $lang->install->$dataRootResult;?></td>
<td class='a-left f-12px'>
<?php
if(!$dataRootInfo['exists']) printf($lang->install->mkdir, $dataRootInfo['path'], $dataRootInfo['path']);
if(!$dataRootInfo['writable']) printf($lang->install->chmod, $dataRootInfo['path'], $dataRootInfo['path']);
?>
</td>
</tr>
<tr>
<td colspan='4'>
<?php include '../../common/view/header.lite.html.php';?>
<table align='center' class='table-6 a-center'>
<caption><?php echo $lang->install->checking;?></caption>
<tr>
<th class='w-p20'><?php echo $lang->install->checkItem;?></th>
<th class='w-p25'><?php echo $lang->install->current?></th>
<th class='w-p15'><?php echo $lang->install->result?></th>
<th><?php echo $lang->install->action?></th>
</tr>
<tr>
<th><?php echo $lang->install->phpVersion;?></th>
<td><?php echo $phpVersion;?></td>
<td class='<?php echo $phpResult;?>'><?php echo $lang->install->$phpResult;?></td>
<td class='a-left f-12px'><?php if($phpResult == 'fail') echo $lang->install->phpFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->pdo;?></th>
<td><?php $pdoResult == 'ok' ? printf($lang->install->loaded) : printf($lang->install->unloaded);?></td>
<td class='<?php echo $pdoResult;?>'><?php echo $lang->install->$pdoResult;?></td>
<td class='a-left f-12px'><?php if($pdoResult == 'fail') echo $lang->install->pdoFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->pdoMySQL;?></th>
<td><?php $pdoMySQLResult == 'ok' ? printf($lang->install->loaded) : printf($lang->install->unloaded);?></td>
<td class='<?php echo $pdoMySQLResult;?>'><?php echo $lang->install->$pdoMySQLResult;?></td>
<td class='a-left f-12px'><?php if($pdoMySQLResult == 'fail') echo $lang->install->pdoMySQLFail;?></td>
</tr>
<tr>
<th><?php echo $lang->install->tmpRoot;?></th>
<td>
<?php
if($phpResult == 'ok' and $pdoResult == 'ok' and $pdoMySQLResult == 'ok' and $tmpRootResult == 'ok' and $dataRootResult == 'ok')
{
echo html::a($this->createLink('install', 'step2'), $lang->install->next);
}
else
{
echo html::a($this->createLink('install', 'step1'), $lang->install->reload);
if($pdoResult == 'fail' or $pdoMySQLResult == 'fail')
{
echo '<p class="f-12px a-left">' . '<strong>' . $lang->install->phpINI . '</strong><br />' . nl2br($this->install->getIniInfo()) . '</p>';
}
}
$tmpRootInfo['exists'] ? print($lang->install->exists) : print($lang->install->notExists);
$tmpRootInfo['writable'] ? print($lang->install->writable) : print($lang->install->notWritable);
?>
</td>
</tr>
</table>
</div>
<?php include './footer.html.php';?>
</td>
<td class='<?php echo $tmpRootResult;?>'><?php echo $lang->install->$tmpRootResult;?></td>
<td class='a-left f-12px'>
<?php
if(!$tmpRootInfo['exists']) printf($lang->install->mkdir, $tmpRootInfo['path'], $tmpRootInfo['path']);
if(!$tmpRootInfo['writable']) printf($lang->install->chmod, $tmpRootInfo['path'], $tmpRootInfo['path']);
?>
</td>
</tr>
<tr>
<th><?php echo $lang->install->dataRoot;?></th>
<td>
<?php
$dataRootInfo['exists'] ? print($lang->install->exists) : print($lang->install->notExists);
$dataRootInfo['writable'] ? print($lang->install->writable) : print($lang->install->notWritable);
?>
</td>
<td class='<?php echo $dataRootResult;?>'><?php echo $lang->install->$dataRootResult;?></td>
<td class='a-left f-12px'>
<?php
if(!$dataRootInfo['exists']) printf($lang->install->mkdir, $dataRootInfo['path'], $dataRootInfo['path']);
if(!$dataRootInfo['writable']) printf($lang->install->chmod, $dataRootInfo['path'], $dataRootInfo['path']);
?>
</td>
</tr>
<tr>
<td colspan='4'>
<?php
if($phpResult == 'ok' and $pdoResult == 'ok' and $pdoMySQLResult == 'ok' and $tmpRootResult == 'ok' and $dataRootResult == 'ok')
{
echo html::a($this->createLink('install', 'step2'), $lang->install->next);
}
else
{
echo html::a($this->createLink('install', 'step1'), $lang->install->reload);
if($pdoResult == 'fail' or $pdoMySQLResult == 'fail')
{
echo '<p class="f-12px a-left">' . '<strong>' . $lang->install->phpINI . '</strong><br />' . nl2br($this->install->getIniInfo()) . '</p>';
}
}
?>
</td>
</tr>
</table>
<?php include '../../common/view/footer.lite.html.php';?>
+4 -6
View File
@@ -9,9 +9,8 @@
* @version $Id$
*/
?>
<?php include './header.html.php';?>
<div class='yui-d0'>
<form method='post' action='<?php echo $this->createLink('install', 'step3');?>'>
<?php include '../../common/view/header.lite.html.php';?>
<form method='post' action='<?php echo $this->createLink('install', 'step3');?>'>
<table align='center' class='table-6'>
<caption><?php echo $lang->install->setConfig;?></caption>
<tr>
@@ -54,6 +53,5 @@
<td colspan='2' class='a-center'><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
</div>
<?php include './footer.html.php';?>
</form>
<?php include '../../common/view/footer.lite.html.php';?>
+41 -43
View File
@@ -9,7 +9,7 @@
* @version $Id$
*/
?>
<?php include './header.html.php';?>
<?php include '../../common/view/header.lite.html.php';?>
<?php
if(!isset($error))
{
@@ -29,45 +29,43 @@ if(!isset($error))
EOT;
}
?>
<div class='yui-d0'>
<?php if(isset($error)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->error;?></caption>
<tr><td><?php echo $error;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php else:?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->saveConfig;?></caption>
<tr>
<td class='a-center'><?php echo html::textArea('config', $configContent, "rows='15' class='area-1 f-12px'");?></td>
</tr>
<tr>
<td>
<?php
$configRoot = $this->app->getConfigRoot();
$myConfigFile = $configRoot . 'my.php';
if(is_writable($configRoot))
{
if(@file_put_contents($myConfigFile, $configContent))
{
printf($lang->install->saved2File, $myConfigFile);
}
else
{
printf($lang->install->save2File, $this->app->getConfigRoot() . 'my.php');
}
}
else
{
printf($lang->install->save2File, $this->app->getConfigRoot() . 'my.php');
}
echo "<br />";
echo "<div class='a-center'>" . html::a($this->createLink('install', 'step4'), $lang->install->next) . '</div>';
?>
</td>
</tr>
</table>
<?php endif;?>
</div>
<?php include './footer.html.php';?>
<?php if(isset($error)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->error;?></caption>
<tr><td><?php echo $error;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php else:?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->saveConfig;?></caption>
<tr>
<td class='a-center'><?php echo html::textArea('config', $configContent, "rows='15' class='area-1 f-12px'");?></td>
</tr>
<tr>
<td>
<?php
$configRoot = $this->app->getConfigRoot();
$myConfigFile = $configRoot . 'my.php';
if(is_writable($configRoot))
{
if(@file_put_contents($myConfigFile, $configContent))
{
printf($lang->install->saved2File, $myConfigFile);
}
else
{
printf($lang->install->save2File, $this->app->getConfigRoot() . 'my.php');
}
}
else
{
printf($lang->install->save2File, $this->app->getConfigRoot() . 'my.php');
}
echo "<br />";
echo "<div class='a-center'>" . html::a($this->createLink('install', 'step4'), $lang->install->next) . '</div>';
?>
</td>
</tr>
</table>
<?php endif;?>
<?php include '../../common/view/footer.lite.html.php';?>
+40 -42
View File
@@ -9,45 +9,43 @@
* @version $Id$
*/
?>
<?php include './header.html.php';?>
<div class='yui-d0'>
<?php if(isset($error)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->error;?></caption>
<tr><td><?php echo $error;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php elseif(isset($success)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->success;?></caption>
<tr><td><?php echo $lang->install->afterSuccess;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php else:?>
<form method='post' target='hiddenwin'>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->getPriv;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->install->company;?></th>
<td><?php echo html::input('company');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->pms;?></th>
<td><?php echo html::input('pms', $pmsDomain) . "<span class='f-12px'>{$lang->install->pmsNote}</span>";?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->account;?></th>
<td><?php echo html::input('account');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->password;?></th>
<td><?php echo html::input('password');?></td>
</tr>
<tr class='a-center'>
<td colspan='2'><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
<?php endif;?>
</div>
<?php include './footer.html.php';?>
<?php include '../../common/view/header.lite.html.php';?>
<?php if(isset($error)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->error;?></caption>
<tr><td><?php echo $error;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php elseif(isset($success)):?>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->success;?></caption>
<tr><td><?php echo $lang->install->afterSuccess;?></td></tr>
<tr><td><?php echo html::commonButton($lang->install->pre, "onclick='javascript:history.back(-1)'");?></td></tr>
</table>
<?php else:?>
<form method='post' target='hiddenwin'>
<table class='table-6' align='center'>
<caption><?php echo $lang->install->getPriv;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->install->company;?></th>
<td><?php echo html::input('company');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->pms;?></th>
<td><?php echo html::input('pms', $pmsDomain) . "<span class='f-12px'>{$lang->install->pmsNote}</span>";?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->account;?></th>
<td><?php echo html::input('account');?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->install->password;?></th>
<td><?php echo html::input('password');?></td>
</tr>
<tr class='a-center'>
<td colspan='2'><?php echo html::submitButton();?></td>
</tr>
</table>
</form>
<?php endif;?>
<?php include '../../common/view/footer.lite.html.php';?>