* add score init

This commit is contained in:
滔哥
2017-10-31 07:31:28 +08:00
parent a0e8b24f25
commit d42cf9b277
9 changed files with 259 additions and 92 deletions
+1
View File
@@ -88,6 +88,7 @@ CREATE TABLE `zt_score` (
`score` decimal(12,1) NOT NULL DEFAULT '0.0',
`after` decimal(12,1) NOT NULL DEFAULT '0.0',
`time` datetime NOT NULL,
`objectID` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `account` (`account`),
KEY `model` (`model`),
+1
View File
@@ -17,6 +17,7 @@ $lang->custom->setPublic = '设为公共';
$lang->custom->required = '必填项';
$lang->custom->score = '积分';
$lang->custom->scoreReset = '重置积分';
$lang->custom->scoreInit = '初始化积分';
$lang->custom->object['story'] = '需求';
$lang->custom->object['task'] = '任务';
+21 -21
View File
@@ -10,25 +10,25 @@
*/
?>
<?php include 'header.html.php'; ?>
<div class='main'>
<form method='post' class='form-condensed' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-100px text-top'><?php echo $lang->custom->score; ?></th>
<td><?php echo html::radio('score', $lang->custom->scoreList, isset($config->global->score) ? $config->global->score : 0, '', 'block'); ?></td>
</tr>
<tr>
<td></td>
<td><?php echo html::submitButton() ?> <?php echo html::a(inLink('resetScore'), "<i class='icon-refresh'></i> " . $lang->custom->scoreReset, '', "class='btn'");?></td>
</tr>
</table>
</form>
</div>
<script>
$(function()
{
$('#featurebar #scoreTab').addClass('active');
$('.side #<?php echo $moduleName?>Tab').addClass('active');
})
</script>
<div class='main'>
<form method='post' class='form-condensed' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='w-100px text-top'><?php echo $lang->custom->score; ?></th>
<td><?php echo html::radio('score', $lang->custom->scoreList, isset($config->global->score) ? $config->global->score : 0, '', 'block'); ?></td>
</tr>
<tr>
<td></td>
<td><?php echo html::submitButton() ?><?php isset($config->global->scoreInit) ? common::printLink('score', 'refresh', '', "<i class='icon-refresh'></i> " . $lang->custom->scoreReset, '', ' id="scoreRefresh" class="btn iframe" data-width="480"', true, true) : common::printLink('score', 'init', '', "<i class='icon-play'></i> " . $lang->custom->scoreInit, '', ' id="scoreInit" class="btn iframe" data-width="480"', true, true); ?></td>
</tr>
</table>
</form>
</div>
<script>
$(function()
{
$('#featurebar #scoreTab').addClass('active');
$('.side #<?php echo $moduleName?>Tab').addClass('active');
})
</script>
<?php include '../../common/view/footer.html.php'; ?>
+37 -37
View File
@@ -1,55 +1,55 @@
<?php
$config->score = new stdClass();
$config->score->model['user']['login'] = array('num' => 3, 'time' => 24, 'score' => 1, 'other' => '');
$config->score->model['user']['changePassword'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => array(1 => 2, 2 => 5));
$config->score->model['user']['editProfile'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['user']['login'] = array('num' => 3, 'time' => 24, 'score' => 1, 'ext' => '');
$config->score->model['user']['changePassword'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => array(1 => 2, 2 => 5));
$config->score->model['user']['editProfile'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['tutorial']['keepAll'] = array('num' => 1, 'time' => 0, 'score' => 100, 'other' => '');
$config->score->model['tutorial']['keepAll'] = array('num' => 1, 'time' => 0, 'score' => 100, 'ext' => '');
$config->score->model['ajax']['selectTheme'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['ajax']['selectLang'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['ajax']['showSearchMenu'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['ajax']['dragSelected'] = array('num' => 1, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['ajax']['lastNext'] = array('num' => 1, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['ajax']['switchToDataTable'] = array('num' => 1, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['ajax']['submitPage'] = array('num' => 1, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['ajax']['customMenu'] = array('num' => 1, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['ajax']['quickDump'] = array('num' => 1, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['ajax']['batchCreate'] = array('num' => 1, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['ajax']['batchEdit'] = array('num' => 1, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['ajax']['selectTheme'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['ajax']['selectLang'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['ajax']['showSearchMenu'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['ajax']['dragSelected'] = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['ajax']['lastNext'] = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['ajax']['switchToDataTable'] = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['ajax']['submitPage'] = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['ajax']['customMenu'] = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['ajax']['quickDump'] = array('num' => 1, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['ajax']['batchCreate'] = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['ajax']['batchEdit'] = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['doc']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['doc']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['todo']['create'] = array('num' => 5, 'time' => 24, 'score' => 1, 'other' => '');
$config->score->model['todo']['create'] = array('num' => 5, 'time' => 24, 'score' => 1, 'ext' => '');
$config->score->model['story']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['story']['close'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => array('createID' => 2));//每个需求被完成关闭,需求的创建者额外增加2分,关闭者增加1分
$config->score->model['story']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['story']['close'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array('createID' => 2));//每个需求被完成关闭,需求的创建者额外增加2分,关闭者增加1分
$config->score->model['task']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['task']['close'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['task']['finish'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => array(1 => 2, 2 => 1, 3 => 0));
$config->score->model['task']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['task']['close'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['task']['finish'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 2, 2 => 1, 3 => 0));
$config->score->model['bug']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['bug']['confirmBug'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => array(1 => 3, 2 => 2, 3 => 1));
$config->score->model['bug']['createFormCase'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['bug']['resolve'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => array(1 => 3, 2 => 2, 3 => 1));
$config->score->model['bug']['saveTplModal'] = array('num' => 0, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['bug']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['bug']['confirmBug'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 3, 2 => 2, 3 => 1));
$config->score->model['bug']['createFormCase'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['bug']['resolve'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => array(1 => 3, 2 => 2, 3 => 1));
$config->score->model['bug']['saveTplModal'] = array('num' => 0, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['testTask']['runCase'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['testTask']['runCase'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['testcase']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['testcase']['create'] = array('num' => 0, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['build']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['build']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['project']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['project']['close'] = array('num' => 0, 'time' => 0, 'score' => 0, 'other' => array('manager' => array(20, 10), 'member' => array(5, 5)));
$config->score->model['project']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['project']['close'] = array('num' => 0, 'time' => 0, 'score' => 0, 'ext' => array('manager' => array(20, 10), 'member' => array(5, 5)));
$config->score->model['productplan']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['productplan']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['release']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'other' => '');
$config->score->model['release']['create'] = array('num' => 0, 'time' => 0, 'score' => 10, 'ext' => '');
$config->score->model['block']['set'] = array('num' => 1, 'time' => 0, 'score' => 20, 'other' => '');
$config->score->model['block']['set'] = array('num' => 1, 'time' => 0, 'score' => 20, 'ext' => '');
$config->score->model['search']['saveQuery'] = array('num' => 1, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['search']['saveQueryAdvanced'] = array('num' => 1, 'time' => 0, 'score' => 1, 'other' => '');
$config->score->model['search']['saveQuery'] = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
$config->score->model['search']['saveQueryAdvanced'] = array('num' => 1, 'time' => 0, 'score' => 1, 'ext' => '');
+23
View File
@@ -59,4 +59,27 @@ class score extends control
{
$this->loadModel('score')->score('ajax', $method);
}
public function init($lastID = 0)
{
if(helper::isAjaxRequest())
{
$result = $this->score->init($lastID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($result['status'] == 'finish')
{
$this->send(array('result' => 'finished', 'message' => $this->lang->score->initFinish));
}
else
{
$this->send(array('result' => 'unfinished', 'message' => $this->lang->score->processed, 'lastID' => $result['lastID']));
}
}
$this->display();
}
public function refresh()
{
$this->display();
}
}
+15 -4
View File
@@ -1,8 +1,19 @@
<?php
$lang->score->common = '积分';
$lang->score->record = '积分记录';
$lang->score->current = '当前积分';
$lang->score->level = '等级积分';
$lang->score->common = '积分';
$lang->score->record = '积分记录';
$lang->score->current = '当前积分';
$lang->score->level = '等级积分';
$lang->score->init = '初始化';
$lang->score->initTips = '初始化将根据历史记录计算,执行时间可能会比较长.<br/><strong>请勿在未完成前关闭窗口</strong>';
$lang->score->initStart = '开始初始化';
$lang->score->initLoading = '正在初始化...';
$lang->score->initFinish = '初始化完成';
$lang->score->refresh = '重置积分';
$lang->score->refreshTips = '重置积分将对所有用户积分清零,执行时间可能会比较长.<br/><strong>请勿在未完成前关闭窗口</strong>';
$lang->score->refreshStart = '开始重置所有积分';
$lang->score->refreshLoading = '积分重置中...';
$lang->score->refreshFinish = '重置完成';
$lang->score->processed = '正在处理中...';
$lang->score->id = '编号';
$lang->score->userID = '用户ID';
+92 -29
View File
@@ -9,6 +9,8 @@
*/
class scoreModel extends model
{
public static $num = 0;
/**
* get user score logs
*
@@ -29,23 +31,27 @@ class scoreModel extends model
* @param string $model
* @param string $method
* @param string $param
* @param string $account
* @param string $time
*
* @access public
* @return bool
*/
public function score($model = '', $method = '', $param = '')
public function score($model = '', $method = '', $param = '', $account = '', $time = '')
{
if(empty($this->config->score->model[$model][$method])) return true;
$rule = $this->config->score->model[$model][$method];
$desc = $this->lang->score->models[$model];
$user = $this->app->user->account;
if(!isset($this->config->score->model[$model][$method]) || empty($this->config->score->model[$model][$method])) return true;
$rule = $this->config->score->model[$model][$method];
$desc = $this->lang->score->models[$model];
$user = empty($account) ? $this->app->user->account : $account;
$time = empty($time) ? helper::now() : $time;
$objectID = is_numeric($param) ? $param : 0;
switch($model)
{
case 'user':
if($method == 'login') $desc = $this->lang->score->methods[$model][$method] . 'IP:' . helper::getRemoteIp();
if($method == 'changePassword')
{
if(!empty($rule['other'][$param])) $rule['score'] = $rule['score'] + $rule['other'][$param];
if(!empty($rule['ext'][$param])) $rule['score'] = $rule['score'] + $rule['ext'][$param];
$desc = $this->lang->score->methods[$model][$method];
}
break;
@@ -63,8 +69,8 @@ class scoreModel extends model
if(!empty($createUser))
{
$newRule = $rule;
$newRule['score'] = $rule['other']['createID'];
$this->saveScore($createUser->openedBy, $newRule, $model, $method, $desc);
$newRule['score'] = $rule['ext']['createID'];
$this->saveScore($createUser->openedBy, $newRule, $model, $method, $desc, $objectID, $time);
unset($newRule);
}
}
@@ -76,7 +82,7 @@ class scoreModel extends model
$desc = $this->lang->score->methods[$model][$method] . 'ID:' . $param;
//每完成一个任务,增加初始积分1 + 工时积分round(工时 /10 * 预计 / 消耗) + 优先级积分(p1 2, p2, 1) 如果任务取消了,没有积分。
$task = $this->loadModel('task')->getById($param);
if(!empty($rule['other'][$task->pri])) $rule['score'] = $rule['score'] + $rule['other'][$task->pri];
if(!empty($rule['ext'][$task->pri])) $rule['score'] = $rule['score'] + $rule['ext'][$task->pri];
if(!empty($task->estimate)) $rule['score'] = $rule['score'] + round(($task->consumed / 10 * $task->estimate / $task->consumed), 1);
}
break;
@@ -94,10 +100,16 @@ class scoreModel extends model
if($method == 'saveTplModal') $desc = $this->lang->score->methods[$model][$method] . 'ID:' . $param;
if($method == 'confirmBug')
{
$user = $param->openedBy;
if(!empty($rule['other'][$param->severity])) $rule['score'] = $rule['score'] + $rule['other'][$param->severity];
$objectID = $param->id;
$user = $param->openedBy;
$desc .= 'ID:' . $param->id;
if(!empty($rule['ext'][$param->severity])) $rule['score'] = $rule['score'] + $rule['ext'][$param->severity];
}
if($method == 'resolve' && !empty($rule['ext'][$param->severity]))
{
$objectID = $param->id;
$rule['score'] = $rule['score'] + $rule['ext'][$param->severity];
}
if($method == 'resolve' && !empty($rule['other'][$param->severity])) $rule['score'] = $rule['score'] + $rule['other'][$param->severity];
break;
case 'testTask':
if($method == 'runCase') $desc = $this->lang->score->methods[$model][$method] . 'ID:' . $param;
@@ -109,20 +121,21 @@ class scoreModel extends model
if($method == 'create') $desc .= 'ID:' . $param;
if($method == 'close')
{
$desc = $this->lang->score->methods[$model][$method] . ',' . $desc . 'ID:' . $param->id;
$desc = $this->lang->score->methods[$model][$method] . ',' . $desc . 'ID:' . $param->id;
$objectID = $param->id;
if(!empty($param->PM))
{
$rule['score'] = $param->end > date('Y-m-d') ? $rule['other']['manager'][0] + $rule['other']['manager'][1] : $rule['other']['manager'][0];
$this->saveScore($param->PM, $rule, $model, $method, $desc);
$rule['score'] = $param->end > date('Y-m-d') ? $rule['ext']['manager'][0] + $rule['ext']['manager'][1] : $rule['ext']['manager'][0];
$this->saveScore($param->PM, $rule, $model, $method, $desc, $objectID, $time);
}
$teams = $this->dao->select('account')->from(TABLE_TEAM)->where('project')->eq($param->id)->fetchGroup('account');
if(!empty($teams))
{
$users = array_keys($teams);
$rule['score'] = $param->end > date('Y-m-d') ? $rule['other']['member'][0] + $rule['other']['member'][1] : $rule['other']['member'][0];
$rule['score'] = $param->end > date('Y-m-d') ? $rule['ext']['member'][0] + $rule['ext']['member'][1] : $rule['ext']['member'][0];
foreach($users as $user)
{
if($user != $param->PM) $this->saveScore($user, $rule, $model, $method, $desc);
if($user != $param->PM) $this->saveScore($user, $rule, $model, $method, $desc, $objectID, $time);
}
}
}
@@ -145,7 +158,7 @@ class scoreModel extends model
$desc = $this->lang->score->methods[$model][$method];
break;
}
$this->saveScore($user, $rule, $model, $method, $desc);
$this->saveScore($user, $rule, $model, $method, $desc, $objectID, $time);
}
/**
@@ -156,11 +169,13 @@ class scoreModel extends model
* @param string $model
* @param string $method
* @param string $desc
* @param int $objectID
* @param string $time
*
* @access private
* @return bool
*/
private function saveScore($account = '', $rule = array(), $model = '', $method = '', $desc = '')
private function saveScore($account = '', $rule = array(), $model = '', $method = '', $desc = '', $objectID = 0, $time = '')
{
if(!empty($rule['num']) || !empty($rule['time']))
{
@@ -171,7 +186,8 @@ class scoreModel extends model
}
else
{
$count = $this->dao->select('id')->from(TABLE_SCORE)->where('account')->eq($account)->andWhere('time')->between(date('Y-m-d 0:0:0'), date('Y-m-d 23:59:59'))->andWhere('model')->eq($model)->andWhere('method')->eq($method)->count();
$timestamp = empty($time) ? time() : strtotime($time);
$count = $this->dao->select('id')->from(TABLE_SCORE)->where('account')->eq($account)->andWhere('time')->between(date('Y-m-d 0:0:0', $timestamp), date('Y-m-d 23:59:59', $timestamp))->andWhere('model')->eq($model)->andWhere('method')->eq($method)->count();
if($count >= $rule['num']) return true;
}
}
@@ -181,15 +197,16 @@ class scoreModel extends model
{
$user = $this->loadModel('user')->getById($account);
$data = new stdClass();
$data->account = $account;
$data->model = $model;
$data->method = $method;
$data->desc = $desc;
$data->before = $user->score;
$data->score = $rule['score'];
$data->after = $user->score + $rule['score'];
$data->time = helper::now();
$data = new stdClass();
$data->account = $account;
$data->model = $model;
$data->method = $method;
$data->desc = $desc;
$data->objectID = $objectID;
$data->before = $user->score;
$data->score = $rule['score'];
$data->after = $user->score + $rule['score'];
$data->time = empty($time) ? helper::now() : $time;
$this->dao->insert(TABLE_SCORE)->data($data)->exec();
$this->dao->query("UPDATE " . TABLE_USER . " SET `score`=`score` + " . $rule['score'] . ",`score_level`=`score_level` + " . $rule['score'] . " WHERE `account`='" . $account . "'");
$this->dao->commit();
@@ -202,6 +219,7 @@ class scoreModel extends model
/**
* reset all user score and level score
*
* @access public
* @return void
*/
@@ -209,4 +227,49 @@ class scoreModel extends model
{
}
/**
* Score init from action
*
* @param int $lastID
*
* @access public
* @return array
*/
public function init($lastID = 0)
{
if($lastID == 0)
{
$this->dao->query("UPDATE " . TABLE_USER . " SET `score`=0,`score_level`=0");
$this->dao->query("TRUNCATE TABLE " . TABLE_SCORE);
}
$actions = $this->dao->select('*')->from(TABLE_ACTION)->where('id')->gt($lastID)->orderBy('id_asc')->limit(100)->fetchAll('id');
if(empty($actions))
{
$this->loadModel('setting')->setItem('system.common.global.scoreInit', 1);
return array('num' => 0, 'status' => 'finish');
}
foreach($actions as $action)
{
$param = $action->objectID;
if($action->objectType == 'project' && $action->action == 'closed') $param = $this->dao->findById($action->objectID)->from(TABLE_PROJECT)->fetch();
if($action->objectType == 'bug' && ($action->action == 'bugconfirmed' || $action->action == 'resolved')) $param = $this->dao->findById($action->objectID)->from(TABLE_BUG)->fetch();
$this->score($action->objectType, $this->fix_key($action->action), $param, $action->actor, $action->date);
}
return array('status' => 'more', 'lastID' => max(array_keys($actions)));
}
/**
* fix action type for score
*
* @param $string
*
* @access private
* @return mixed
*/
private function fix_key($string)
{
$strings = array('created' => 'create', 'closed' => 'close', 'finished' => 'finish', 'bugconfirmed' => 'confirmBug', 'resolved' => 'resolve');
return isset($strings[$string]) ? $strings[$string] : $string;
}
}
+64
View File
@@ -0,0 +1,64 @@
<?php
/**
* The init view file of score module of ZenTaoPMS.
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Memory <lvtao@cnezsoft.com>
* @package score
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php'; ?>
<div class="alert with-icon" id="score_start">
<i class="icon-inbox"></i>
<div class="content">
<h4><?php echo $lang->score->init; ?></h4>
<hr>
<p><?php echo $lang->score->initTips; ?></p>
<p>
<button class="btn btn-primary" id="score_init"><?php echo $lang->score->initStart; ?></button>
</p>
</div>
</div>
<div class="alert alert-info with-icon hidden" id="score_loading">
<i class="icon-info-sign"></i>
<h4><?php echo $lang->score->initLoading; ?></h4>
<hr/>
<p><?php echo $lang->score->initTips; ?></p>
<p id="loading_content"></p>
</div>
<div class="alert alert-success with-icon hidden" id="score_finish">
<i class="icon-ok-sign"></i>
<div class="content">
<strong><?php echo $lang->score->initFinish; ?></strong>
</div>
</div>
<script>
$("#score_init").on('click', function()
{
$("#score_start").addClass('hidden');
$("#score_loading").removeClass('hidden');
score_init(0);
});
function score_init(lastID)
{
$.getJSON(createLink('score', 'init', 'lastID=' + lastID), function(response)
{
if(response.result == 'finished')
{
$("#score_loading").addClass('hidden');
$("#score_finish").removeClass('hidden');
setTimeout(function(){parent.location.reload();}, 2000);
return false;
}
else
{
$('#loading_content').html("<li class='text-success' style='color:#"+(Math.random()*0xffffff<<0).toString(16)+"'>" + response.message + "</li>");
setTimeout(function(){score_init(response.lastID);}, 2000);
}
});
}
</script>
<?php include '../../common/view/footer.html.php'; ?>
+5 -1
View File
@@ -705,6 +705,11 @@ function checkTable($table)
var isChecked = $checkbox.prop('checked');
if(!$this.is(':checkbox'))
{
if(!$.cookie('ajax_dragSelected') && $checkbox.size() > 2)
{
$.cookie('ajax_dragSelected', 'on', {expires: config.cookieLife, path: config.webRoot});
$.get(createLink('score', 'ajax', "method=dragSelected"));
}
isChecked = checked === true || checked === false ? checked : !isChecked;
$checkbox.prop('checked', isChecked);
}
@@ -714,7 +719,6 @@ function checkTable($table)
$tr.closest('.table').find('.rows-selector').prop('checked', false);
}
};
var isSelectableTable = $table.hasClass('table-selectable');
$table.selectable(