* finish task #2524.

This commit is contained in:
wangyidong
2016-04-12 11:23:05 +08:00
parent b1e147fec3
commit cb5d368c48
9 changed files with 91 additions and 2 deletions
+2
View File
@@ -66,6 +66,8 @@ $lang->ipLimited = "<html><head><meta http-equiv='Content-Type' content='text
$lang->unfold = '+';
$lang->fold = '-';
$lang->hideNotCheck = 'Hide not checked field';
$lang->quitNovice = 'Quit novice';
$lang->enterNovice = 'Enter novice';
$lang->preShortcutKey = '[Shortcut key:←]';
$lang->nextShortcutKey = '[Shortcut key:→]';
+1 -1
View File
@@ -100,7 +100,7 @@ $lang->company->menuOrder[0] = 'name';
$lang->company->menuOrder[5] = 'browseUser';
$lang->company->menuOrder[10] = 'dept';
$lang->company->menuOrder[15] = 'browseGroup';
$lang->company->menuOrder[20] = 'edit';
$lang->company->menuOrder[20] = 'view';
$lang->company->menuOrder[25] = 'dynamic';
$lang->company->menuOrder[30] = 'addGroup';
$lang->company->menuOrder[35] = 'batchAddUser';
+2
View File
@@ -66,6 +66,8 @@ $lang->ipLimited = "<html><head><meta http-equiv='Content-Type' content='text
$lang->unfold = '+';
$lang->fold = '-';
$lang->hideNotCheck = '页面隐藏取消选中字段';
$lang->quitNovice = '退出新手';
$lang->enterNovice = '进入新手';
$lang->preShortcutKey = '[快捷键:←]';
$lang->nextShortcutKey = '[快捷键:→]';
+43 -1
View File
@@ -31,6 +31,7 @@ class commonModel extends model
$this->loadCustomFromDB();
if(!$this->checkIP()) die($this->lang->ipLimited);
if($this->app->getViewType() == 'mhtml') $this->setMobileMenu();
if(self::inNoviceMode()) $this->setNoviceMenu();
$this->app->loadLang('company');
}
}
@@ -248,7 +249,6 @@ class commonModel extends model
{
$isGuest = $app->user->account == 'guest';
echo "<div class='dropdown' id='userMenu'>";
echo "<a href='javascript:;' data-toggle='dropdown'><i class='icon-user'></i> " . $app->user->realname . " <span class='caret'></span></a>";
@@ -258,6 +258,10 @@ class commonModel extends model
{
echo '<li>' . html::a(helper::createLink('my', 'profile', '', '', true), $lang->profile, '', "class='iframe' data-width='600'") . '</li>';
echo '<li>' . html::a(helper::createLink('my', 'changepassword', '', '', true), $lang->changePassword, '', "class='iframe' data-width='500'") . '</li>';
$inNovice = self::inNoviceMode();
echo '<li>' . html::a(helper::createLink('misc', 'ajaxSaveNovice', "novice=" . ($inNovice ? 'false' : 'true') . '&reload=true'), $inNovice ? $lang->quitNovice : $lang->enterNovice, 'hiddenwin') . '</li>';
echo "<li class='divider'></li>";
}
@@ -298,6 +302,31 @@ class commonModel extends model
echo html::a(helper::createLink('misc', 'about'), $lang->aboutZenTao, '', "class='about iframe' data-width='900' data-headerless='true' data-class='modal-about'");
}
/**
* Set novice menu.
*
* @access public
* @return void
*/
public function setNoviceMenu()
{
$this->lang->menuOrder[10] = 'company';
$this->lang->menuOrder[15] = 'product';
$this->lang->menuOrder[20] = 'project';
$this->lang->menuOrder[25] = 'qa';
$this->lang->menuOrder[30] = 'doc';
$this->lang->menuOrder[35] = 'report';
$this->lang->product->menuOrder[15] = 'plan';
$this->lang->product->menuOrder[20] = 'release';
$this->lang->product->menuOrder[25] = 'roadmap';
$this->lang->product->menuOrder[30] = 'dynamic';
$this->lang->story->menuOrder = $this->lang->product->menuOrder;
$this->lang->productplan->menuOrder = $this->lang->product->menuOrder;
$this->lang->release->menuOrder = $this->lang->product->menuOrder;
$this->lang->branch->menuOrder = $this->lang->product->menuOrder;
}
/**
* Set mobile menu.
*
@@ -1273,6 +1302,19 @@ class commonModel extends model
$httpHost = $_SERVER['HTTP_HOST'];
return "$httpType://$httpHost";
}
/**
* Check in novice mode.
*
* @static
* @access public
* @return bool
*/
public static function inNoviceMode()
{
global $config;
return (isset($config->global->novice) and $config->global->novice == 'true');
}
}
class common extends commonModel
+9
View File
@@ -27,6 +27,15 @@ function ajaxIgnoreBrowser(){$.get(createLink('misc', 'ajaxIgnoreBrowser'));}
$(function(){showBrowserNotice()});
</script>
<?php endif;?>
<?php if(!isset($config->global->novice) and $this->loadModel('misc')->checkNovice()):?>
<script>
novice = confirm('<?php echo $lang->misc->novice?>');
$.get(createLink('misc', 'ajaxSaveNovice', 'novice=' + (novice ? 'true' : 'false')), function()
{
if(novice) location.href=location.href;
});
</script>
<?php endif;?>
<?php
js::set('onlybody', $onlybody); // set the onlybody var.
+13
View File
@@ -197,4 +197,17 @@ class misc extends control
{
$this->loadModel('setting')->setItem($this->app->user->account . '.common.global.browserNotice', 'true');
}
/**
* Ajax save novice result.
*
* @param string $novice
* @access public
* @return void
*/
public function ajaxSaveNovice($novice = 'true', $reload = 'false')
{
$this->loadModel('setting')->setItem($this->app->user->account . '.common.global.novice', $novice);
if($reload == 'true') die(js::reload('parent'));
}
}
+1
View File
@@ -59,3 +59,4 @@ $lang->misc->needRepair = "Repair Table";
$lang->misc->repairTable = "The database table can cause of damage because of power failure, need to check and repair!!";
$lang->misc->tableName = "Table name";
$lang->misc->tableStatus = "Table status";
$lang->misc->novice = "You may use the ZenTao first, whether to enter the novice mode?";
+1
View File
@@ -59,3 +59,4 @@ $lang->misc->needRepair = "修复表";
$lang->misc->repairTable = "数据库表可以因为断电原因损坏,需要检查修复!!";
$lang->misc->tableName = "表名";
$lang->misc->tableStatus = "状态";
$lang->misc->novice = "您可能初次使用禅道,是否进入新手模式?";
+19
View File
@@ -42,4 +42,23 @@ class miscModel extends model
}
return $tables;
}
/**
* Check novice.
*
* @access public
* @return bool
*/
public function checkNovice()
{
$account = $this->app->user->account;
if($account == 'guest') return false;
$count = $this->dao->select('count(*) as count')->from(TABLE_ACTION)->where('actor')->eq($account)->fetch('count');
if($count < 10) return true;
$this->loadModel('setting')->setItem($account . '.common.global.nevice', 'false');
return false;
}
}