* finish task #670.

This commit is contained in:
zhujinyong
2012-02-18 03:44:58 +00:00
parent 6f5a27626d
commit 3149328efe
13 changed files with 488 additions and 4 deletions
+9
View File
@@ -0,0 +1,9 @@
<?php
$config->url->community = 'http://www.zentao.net';
$config->url->ask = 'http://www.zentao.net/ask-browse.html';
$config->url->document = 'http://www.zentao.net/help-book-zentaopmshelp.html';
$config->url->feedback = 'http://www.zentao.net/forum-board-1074.html';
$config->url->faq = 'http://www.zentao.net/ask-faq.html';
$config->url->extension = 'http://www.zentao.net/extension-browse.html';
$config->url->donation = 'http://www.zentao.net/help-donation.html';
$config->url->service = 'http://www.cnezsoft.com/article-browse-1078.html';
+68 -3
View File
@@ -12,13 +12,78 @@
class admin extends control
{
/**
* Index page of admin module. Locate to action's trash page.
*
* Index page.
* @access public
* @return void
*/
public function index()
{
$this->locate($this->createLink('extension', 'browse'));
$user = $this->dao->select('value')->from(TABLE_CONFIG)
->where('owner')->eq($this->app->user->account)
->andWhere('`key`')->eq('account')
->fetch('', false);
if($user)
{
$this->view->login = true;
$this->view->account = $user->value;
}
else
{
$this->view->login = false;
$this->view->account = '';
}
if($this->cookie->notice == 'ignore')
{
$this->view->ignore = true;
}
else
{
$this->view->ignore = false;
}
$this->display();
}
/**
* Ignore notice of register and login.
*
* @access public
* @return void
*/
public function ignoreNotice()
{
setcookie('notice', 'ignore');
die(js::locate(inlink('index')));
}
/**
* Register zentao.
*
* @access public
* @return void
*/
public function register()
{
if($_POST)
{
$this->admin->registerByAPI();
}
$this->view->sn = $this->admin->getSN();
$this->display();
}
/**
* Login zentao.
*
* @access public
* @return void
*/
public function login()
{
if($_POST)
{
$this->admin->loginByAPI();
}
$this->view->sn = $this->admin->getSN();
$this->display();
}
}
+39 -1
View File
@@ -2,7 +2,7 @@
/**
* The admin module English file of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @copyright Copyright 2009-2012 QingDao Nature Easy Soft Network Technology Co,LTD (www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package admin
@@ -17,3 +17,41 @@ $lang->admin->group = 'Group';
$lang->admin->welcome = 'Welcome to ZenTaoPMS.';
$lang->admin->browseCompany = 'Browse Company';
$lang->admin->info->caption = 'ZentaoPMS information';
$lang->admin->info->urls = 'Related links';
$lang->admin->info->currentVersion = 'Current version';
$lang->admin->info->community = 'Zentao home page';
$lang->admin->info->ask = 'Zentao ask';
$lang->admin->info->document = 'Help document';
$lang->admin->info->feedback = 'Feedback and suggestion';
$lang->admin->info->faq = 'FAQ';
$lang->admin->info->extension = 'Extension';
$lang->admin->info->donation = 'Donation';
$lang->admin->info->service = 'Service fee';
$lang->admin->info->account = 'Community account';
$lang->admin->notice->join = "You can click %s or %s to join zentao community.";
$lang->admin->notice->ignore = "ignore";
$lang->admin->register->caption = 'Register zentao community';
$lang->admin->register->join = 'register';
$lang->admin->register->lblAccount = 'The account must be a series of letters and/or numbers, at least three';
$lang->admin->register->lblPasswd = 'Numbers and letters, at least six';
$lang->admin->register->notice->account = 'The account must be a series of letters and/or numbers, at least three';
$lang->admin->register->notice->password = 'The password must be a series of letters and/or numbers, at least six';
$lang->admin->register->notice->realname = 'The realname must not be empty';
$lang->admin->register->notice->email = 'Please input your correct email address';
$lang->admin->register->notice->notEqual = 'The password and confirm password is not equal';
$lang->admin->register->notice->registered = 'The username has been registered';
$lang->admin->register->notice->success = 'Register success';
$lang->admin->register->notice->failed = 'Register failed';
$lang->admin->login->caption = 'Login zentao community';
$lang->admin->login->join = 'login';
$lang->admin->login->notice->account = 'The account must be a series of letters and/or numbers, at least three';
$lang->admin->login->notice->password = 'The password must be a series of letters and/or numbers, at least six';
$lang->admin->login->notice->success = 'Login success';
$lang->admin->login->notice->failed = 'Login failed';
+38
View File
@@ -17,3 +17,41 @@ $lang->admin->group = '分组管理';
$lang->admin->welcome = '欢迎使用禅道管理软件后台管理系统';
$lang->admin->browseCompany = '浏览公司';
$lang->admin->info->caption = '禅道系统信息';
$lang->admin->info->urls = '相关链接';
$lang->admin->info->currentVersion = '当前版本';
$lang->admin->info->community = '禅道主页';
$lang->admin->info->ask = '禅道问答';
$lang->admin->info->document = '帮助文档';
$lang->admin->info->feedback = '反馈建议';
$lang->admin->info->faq = '常见问题';
$lang->admin->info->extension = '禅道插件';
$lang->admin->info->donation = '捐助禅道';
$lang->admin->info->service = '收费服务';
$lang->admin->info->account = '社区账号';
$lang->admin->notice->join = "您可以点击%s或%s禅道社区。";
$lang->admin->notice->ignore = "不再提示";
$lang->admin->register->caption = '注册禅道社区';
$lang->admin->register->join = '注册';
$lang->admin->register->lblAccount = '请设置您的用户名,英文字母和数字的组合。';
$lang->admin->register->lblPasswd = '请设置您的密码。数字和字母的组合,六位以上。';
$lang->admin->register->notice->account = '用户名必须是数字和字母组合,三位以上';
$lang->admin->register->notice->password = '密码必须是数字和字母组合,六位以上';
$lang->admin->register->notice->realname = '真实姓名不能为空';
$lang->admin->register->notice->email = '请填写正确的邮箱地址';
$lang->admin->register->notice->notEqual = '密码和确认密码不相等';
$lang->admin->register->notice->registered = '用户名已注册';
$lang->admin->register->notice->success = '注册成功';
$lang->admin->register->notice->failed = '注册失败';
$lang->admin->login->caption = '登录禅道社区';
$lang->admin->login->join = '登录';
$lang->admin->login->notice->account = '用户名必须是数字和字母组合,三位以上';
$lang->admin->login->notice->password = '密码必须是数字和字母组合,六位以上';
$lang->admin->login->notice->success = '登录成功';
$lang->admin->login->notice->failed = '登录失败';
+38
View File
@@ -17,3 +17,41 @@ $lang->admin->group = '分組管理';
$lang->admin->welcome = '歡迎使用禪道管理軟件後台管理系統';
$lang->admin->browseCompany = '瀏覽公司';
$lang->admin->info->caption = '禪道系統信息';
$lang->admin->info->urls = '相關鏈接';
$lang->admin->info->currentVersion = '當前版本';
$lang->admin->info->community = '禪道主頁';
$lang->admin->info->ask = '禪道問答';
$lang->admin->info->document = '幫助文檔';
$lang->admin->info->feedback = '反饋建議';
$lang->admin->info->faq = '常見問題';
$lang->admin->info->extension = '禪道插件';
$lang->admin->info->donation = '捐助禪道';
$lang->admin->info->service = '收費服務';
$lang->admin->info->account = '社區賬號';
$lang->admin->notice->join = "您可以點擊%s或%s禪道社區。";
$lang->admin->notice->ignore = "不再提示";
$lang->admin->register->caption = '註冊禪道社區';
$lang->admin->register->join = '註冊';
$lang->admin->register->lblAccount = '請設置您的用戶名。字母和數字的組合,三位以上。';
$lang->admin->register->lblPasswd = '請設置您的密碼。數字和字母的組合,六位以上。';
$lang->admin->register->notice->account = '用戶名必須是數字和字母組合,三位以上';
$lang->admin->register->notice->password = '密碼必須是數字和字母組合,六位以上';
$lang->admin->register->notice->realname = '真實姓名不能為空';
$lang->admin->register->notice->email = '請填寫正確的郵箱地址';
$lang->admin->register->notice->notEqual = '密碼和確認密碼不相等';
$lang->admin->register->notice->registered = '用戶名已註冊';
$lang->admin->register->notice->success = '註冊成功';
$lang->admin->register->notice->failed = '註冊失敗';
$lang->admin->login->caption = '登錄禪道社區';
$lang->admin->login->join = '登錄';
$lang->admin->login->notice->account = '用戶名必須是數字和字母組合,三位以上';
$lang->admin->login->notice->password = '密碼必須是數字和字母組合,六位以上';
$lang->admin->login->notice->success = '登錄成功';
$lang->admin->login->notice->failed = '登錄失敗';
+159
View File
@@ -13,6 +13,59 @@
<?php
class adminModel extends model
{
/**
* The api agent(use snoopy).
*
* @var object
* @access public
*/
public $agent;
/**
* The api root.
*
* @var string
* @access public
*/
public $apiRoot;
/**
* The construct function.
*
* @access public
* @return void
*/
public function __construct()
{
parent::__construct();
$this->setAgent();
}
/**
* Set the api agent.
*
* @access public
* @return void
*/
public function setAgent()
{
$this->agent = $this->app->loadClass('snoopy');
}
/**
* Post data form API
*
* @param string $url
* @param string $formvars
* @access public
* @return void
*/
public function postAPI($url, $formvars = "")
{
$this->agent->submit($url, $formvars);
return $this->agent->results;
}
/**
* Get status of zentaopms.
*
@@ -44,5 +97,111 @@ class adminModel extends model
*/
public function getStatOfSys()
{
}
/**
* Register zentao by API.
*
* @access public
* @return void
*/
public function registerByAPI()
{
$data = urlencode(json_encode($_POST));
$apiURL = 'http://www.zentao.com/user-apiRegister.html';
$response = $this->postAPI($apiURL, $data);
switch($response)
{
case 'success':
$this->dao->insert(TABLE_CONFIG)
->set('owner')->eq($this->app->user->account)
->set('`key`')->eq('account')
->set('section')->eq('global')
->set('value')->eq($this->post->account)
->exec(false);
echo js::alert($this->lang->admin->register->notice->success);
die(js::locate(inlink('index'), 'parent'));
break;
case 'failed':
echo js::alert($this->lang->admin->register->notice->failed);
break;
case 'userError':
echo js::alert($this->lang->admin->register->notice->account);
break;
case 'passwordError':
echo js::alert($this->lang->admin->register->notice->password);
break;
case 'realnameError':
echo js::alert($this->lang->admin->register->notice->realname);
break;
case 'emailError':
echo js::alert($this->lang->admin->register->notice->email);
break;
case 'notEqual':
echo js::alert($this->lang->admin->register->notice->notEqual);
break;
case 'registered':
echo js::alert($this->lang->admin->register->notice->registered);
break;
default:
echo js::alert($this->lang->admin->register->notice->failed);
}
}
/**
* Login zentao by API.
*
* @access public
* @return void
*/
public function loginByAPI()
{
$data = urlencode(json_encode($_POST));
$apiURL = 'http://www.zentao.com/user-apiLogin.html';
$response = $this->postAPI($apiURL, $data);
switch($response)
{
case 'success':
$this->dao->insert(TABLE_CONFIG)
->set('owner')->eq($this->app->user->account)
->set('`key`')->eq('account')
->set('section')->eq('global')
->set('value')->eq($this->post->account)
->exec(false);
echo js::alert($this->lang->admin->login->notice->success);
die(js::locate(inlink('index'), 'parent'));
break;
case 'userError':
echo js::alert($this->lang->admin->login->notice->account);
break;
case 'passwordError':
echo js::alert($this->lang->admin->login->notice->password);
break;
case 'failed':
echo js::alert($this->lang->admin->login->notice->failed);
break;
default:
echo js::alert($this->lang->admin->login->notice->failed);
}
}
/**
* Get pms sn.
*
* @access public
* @return void
*/
public function getSN()
{
$sn = $this->dao->select('value')->from(TABLE_CONFIG)->where('`key`')->eq('sn')->fetch('', false);
if($sn)
{
return $sn->value;
}
else
{
return '';
}
}
}
+52
View File
@@ -0,0 +1,52 @@
<?php
/**
* The view file of bug module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package admin
* @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php if(!$login):?>
<?php if(!$ignore):?>
<div id="notice">
<div class="f-left">
<?php echo sprintf($lang->admin->notice->join, html::a(inlink('register'), $lang->admin->register->join), html::a(inlink('login'), $lang->admin->login->join));?>
</div>
<div class="f-right">
<?php echo html::a(inlink('ignoreNotice'), $lang->admin->notice->ignore);?>
</div>
</div>
<?php endif;?>
<?php endif;?>
<table align='center' class='table-1'>
<caption><?php echo $lang->admin->info->caption;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->admin->info->currentVersion;?></th>
<td><?php echo $config->version;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->admin->info->urls;?></th>
<td class="content">
<p><?php echo html::a($config->url->community, $lang->admin->info->community, '_blank');?></p>
<p><?php echo html::a($config->url->ask, $lang->admin->info->ask, '_blank');?></p>
<p><?php echo html::a($config->url->document, $lang->admin->info->document, '_blank');?></p>
<p><?php echo html::a($config->url->feedback, $lang->admin->info->feedback, '_blank');?></p>
<p><?php echo html::a($config->url->faq, $lang->admin->info->faq, '_blank');?></p>
<p><?php echo html::a($config->url->extension, $lang->admin->info->extension, '_blank');?></p>
<p><?php echo html::a($config->url->donation, $lang->admin->info->donation, '_blank');?></p>
<p><?php echo html::a($config->url->service, $lang->admin->info->service, '_blank');?></p>
</td>
</tr>
<?php if($login):?>
<tr>
<th class='rowhead'><?php echo $lang->admin->info->account;?></th>
<td><?php echo $account;?></td>
</tr>
<?php endif;?>
</table>
<?php include '../../common/view/footer.html.php';?>
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* The view file of bug module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package admin
* @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<form method="post" target="hiddenwin">
<table align='center' class='table-6'>
<caption><?php echo $lang->admin->login->caption;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->user->account;?></th>
<td><?php echo html::input('account', '', "class='text-3'");?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->password;?></th>
<td><?php echo html::password('password', '', "class='text-3'");?></td>
</tr>
<tr>
<th><td colspan="2" class="a-center"><?php echo html::submitButton() . html::hidden('sn', $sn);?></td></th>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+51
View File
@@ -0,0 +1,51 @@
<?php
/**
* The view file of bug module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package admin
* @version $Id: view.html.php 2568 2012-02-09 06:56:35Z shiyangyangwork@yahoo.cn $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<form method="post" target="hiddenwin">
<table align='center' class='table-6'>
<caption><?php echo $lang->admin->register->caption;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->user->account;?></th>
<td><?php echo html::input('account', '', "class='text-3'") . '<font color="red">*</font>' . $lang->admin->register->lblAccount;?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->realname;?></th>
<td><?php echo html::input('realname', '', "class='text-3'") . '<font color="red">*</font>';?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->company;?></th>
<td><?php echo html::input('company', '', "class='text-3'");?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->phone;?></th>
<td><?php echo html::input('phone', '', "class='text-3'");?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->email;?></td>
<td><?php echo html::input('email', '', "class='text-3'") . '<font color="red">*</font>';?></td>
</tr>
<tr>
<th class="rowhead"><?php echo $lang->user->password;?></th>
<td><?php echo html::password('password1', '', "class='text-3'") . '<font color="red">*</font>' . $lang->admin->register->lblPasswd;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->user->password2;?></td>
<td><?php echo html::password('password2', '', "class='text-3'") . '<font color="red">*</font>';?></td>
</tr>
<tr>
<th><td colspan="2" class="a-center"><?php echo html::submitButton() . html::hidden('sn', $sn);?></td></th>
</tr>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+1
View File
@@ -215,6 +215,7 @@ $lang->user->menu->profile = array('link' => 'Profile|user|profile|account=%
$lang->user->menu->browse = array('link' => 'Manage user|company|browse|', 'float' => 'right');
/* Admin menu. */
$lang->admin->menu->index = array('link' => 'Index|admin|index', 'subModule' => 'admin');
$lang->admin->menu->extension = array('link' => 'Extension|extension|browse', 'subModule' => 'extension');
$lang->admin->menu->editor = array('link' => 'Extension editor|editor|index', 'subModule' => 'editor');
$lang->admin->menu->mail = array('link' => 'ConfigEmail|mail|set', 'subModule' => 'mail');
+1
View File
@@ -215,6 +215,7 @@ $lang->user->menu->profile = array('link' => '用户信息|user|profile|acco
$lang->user->menu->browse = array('link' => '用户管理|company|browse|', 'float' => 'right');
/* 后台管理菜单设置。*/
$lang->admin->menu->index = array('link' => '首页|admin|index', 'subModule' => 'admin');
$lang->admin->menu->extension = array('link' => '插件管理|extension|browse', 'subModule' => 'extension');
$lang->admin->menu->editor = array('link' => '扩展编辑器|editor|index', 'subModule' => 'editor');
$lang->admin->menu->mail = array('link' => 'Email配置|mail|set', 'subModule' => 'mail');
+1
View File
@@ -214,6 +214,7 @@ $lang->user->menu->profile = array('link' => '用戶信息|user|profile|acco
$lang->user->menu->browse = array('link' => '用戶管理|company|browse|', 'float' => 'right');
/* 後台管理菜單設置。*/
$lang->admin->menu->index = array('link' => '首頁|admin|index', 'subModule' => 'admin');
$lang->admin->menu->extension = array('link' => '插件管理|extension|browse', 'subModule' => 'extension');
$lang->admin->menu->editor = array('link' => '擴展編輯器|editor|index', 'subModule' => 'editor');
$lang->admin->menu->mail = array('link' => 'Email配置|mail|set', 'subModule' => 'mail');
+1
View File
@@ -287,6 +287,7 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
#featurebar .active a {color:#009900; font-weight:bold;}
#featurebar .active select {border:3px solid #009900;}
#notice {margin: 0 0 5px 0; background-color:#EFEFEF; height:28px; line-height:28px; padding-left:10px;}
/* Tree menu. */
#tree li {list-style-type:none;}
#tree .active {color:blue; font-weight:bold}