* adjust for limited user.

This commit is contained in:
wangyidong
2017-09-26 11:08:11 +08:00
parent 87b37b3a67
commit 50460830e2
34 changed files with 85 additions and 204 deletions
-1
View File
@@ -1,3 +1,2 @@
ALTER TABLE `zt_bug` ADD `activatedDate` datetime NOT NULL AFTER `activatedCount`;
ALTER TABLE `zt_user` ADD `limitedUser` varchar(8) NOT NULL default 'no' AFTER `role`;
ALTER TABLE `zt_team` ADD `limitedUser` varchar(8) NOT NULL default 'no' AFTER `role`;
+1 -3
View File
@@ -2243,8 +2243,6 @@ class bugModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($object)) return false;
if($action == 'confirmbug') return $object->status == 'active' and $object->confirmed == 0;
if($action == 'resolve') return $object->status == 'active';
if($action == 'close') return $object->status == 'resolved';
@@ -2405,7 +2403,7 @@ class bugModel extends model
case 'actions':
$params = "bugID=$bug->id";
common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true);
common::printIcon('bug', 'assignTo', $params, '', 'list', '', '', 'iframe', true);
common::printIcon('bug', 'assignTo', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true);
common::printIcon('bug', 'edit', $params, $bug, 'list');
+10 -10
View File
@@ -37,16 +37,15 @@ js::set('branch', $branch);
$misc = common::hasPriv('bug', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'";
$link = common::hasPriv('bug', 'create') ? $this->createLink('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID") : '#';
echo html::a($link, "<i class='icon icon-plus'></i>" . $lang->bug->create, '', $misc);
$misc = common::hasPriv('bug', 'batchCreate') ? '' : "disabled";
$link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#';
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<button type='button' class='btn btn-primary dropdown-toggle <?php echo $misc?>' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu right'>
<?php
$misc = common::hasPriv('bug', 'batchCreate') ? '' : "class=disabled";
$link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#';
echo "<li>" . html::a($link, $lang->bug->batchCreate, '', $misc) . "</li>";
?>
<?php echo "<li>" . html::a($link, $lang->bug->batchCreate, '', "class='$misc'") . "</li>";?>
</ul>
</div>
</li>
@@ -129,15 +128,16 @@ js::set('branch', $branch);
$link = common::hasPriv('bug', 'create') ? $this->createLink('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID") : '#';
echo html::a($link, "<i class='icon icon-plus'></i>" . $lang->bug->create, '', $misc);
}
$misc = common::hasPriv('bug', 'batchCreate') ? '' : "disabled";
$link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#';
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<button type='button' class='btn btn-primary dropdown-toggle <?php echo $misc?>' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('bug', 'batchCreate') ? '' : "class=disabled";
$link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#';
echo "<li>" . html::a($link, $lang->bug->batchCreate, '', $misc) . "</li>";
echo "<li>" . html::a($link, $lang->bug->batchCreate, '', "class='$misc'") . "</li>";
?>
</ul>
</div>
+3 -3
View File
@@ -240,7 +240,7 @@
<table class='table table-data table-condensed table-borderless table-fixed'>
<tr>
<th class='w-60px'><?php echo $lang->bug->openedBy;?></th>
<td> <?php echo $users[$bug->openedBy] . $lang->at . $bug->openedDate;?></td>
<td> <?php echo zget($users, $bug->openedBy) . $lang->at . $bug->openedDate;?></td>
</tr>
<tr>
<th><?php echo $lang->bug->openedBuild;?></th>
@@ -260,7 +260,7 @@
</tr>
<tr>
<th><?php echo $lang->bug->lblResolved;?></th>
<td><?php if($bug->resolvedBy) echo $users[$bug->resolvedBy] . $lang->at . $bug->resolvedDate;?></td>
<td><?php if($bug->resolvedBy) echo zget($users, $bug->resolvedBy) . $lang->at . $bug->resolvedDate;?></td>
</tr>
<tr>
<th><?php echo $lang->bug->resolvedBuild;?></th>
@@ -277,7 +277,7 @@
</tr>
<tr>
<th><?php echo $lang->bug->closedBy;?></th>
<td><?php if($bug->closedBy) echo $users[$bug->closedBy] . $lang->at . $bug->closedDate;?></td>
<td><?php if($bug->closedBy) echo zget($users, $bug->closedBy) . $lang->at . $bug->closedDate;?></td>
</tr>
<tr>
<th><?php echo $lang->bug->lblLastEdited;?></th>
-15
View File
@@ -407,19 +407,4 @@ class buildModel extends model
$this->loadModel('action')->create('bug', $unlinkBugID, 'unlinkedfrombuild', '', $buildID);
}
}
/**
* Judge an action is clickable or not.
*
* @param object $project
* @param string $action
* @access public
* @return bool
*/
public static function isClickable($build, $action)
{
if(!common::limitedUser($build)) return false;
return true;
}
}
+16 -19
View File
@@ -674,7 +674,7 @@ class commonModel extends model
if(strtolower($module) == 'story' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create');
if(strtolower($module) == 'bug' and strtolower($method) == 'tostory') ($module = 'story') and ($method = 'create');
if(strtolower($module) == 'bug' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create');
if(!commonModel::hasPriv($module, $method)) return false;
if(!commonModel::hasPriv($module, $method, $object)) return false;
$link = helper::createLink($module, $method, $vars, '', $onlyBody);
/* Set the icon title, try search the $method defination in $module's lang or $common's lang. */
@@ -1140,7 +1140,7 @@ class commonModel extends model
if(isset($rights[$module][$method]))
{
if(!commonModel::limitedUser($object, $module, $method)) return false;
if(!commonModel::hasDBPriv($object, $module, $method)) return false;
if(empty($acls['views'])) return true;
$menu = isset($lang->menugroup->$module) ? $lang->menugroup->$module : $module;
@@ -1157,29 +1157,26 @@ class commonModel extends model
return false;
}
public static function limitedUser($object, $module = null, $method = null)
public static function hasDBPriv($object, $module = null, $method = null)
{
global $app;
if(!empty($app->user->admin) || $app->user->account == 'guest') return true;
if(!empty($app->user->admin)) return true;
// limited project
$limitedProject = false;
if(!empty($module) && $module == 'task' && !empty($object->project) ||
!empty($module) && $module == 'task' && !empty($object->id))
if(!empty($module) && $module == 'task' && !empty($object->project) or
!empty($module) && $module == 'project' && !empty($object->id))
{
$objectID = '';
if(!empty($object->id)) $objectID = $object->id;
if(!empty($object->id)) $objectID = $object->id;
if(!empty($object->id) && !empty($object->project)) $objectID = $object->project;
$sessionKey = $app->user->account . 'project' . $objectID;
if(!empty($_SESSION[$sessionKey]) && $_SESSION[$sessionKey] == $objectID)
{
$limitedProject = true;
}
$limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : '';
if(strpos(",{$limitedProjects},", ",$objectID,") !== false) $limitedProject = true;
}
if(!empty($app->user->limitedUser) && $app->user->limitedUser === 'no' && !$limitedProject) return true;
if(empty($app->user->rights['rights']['my']['limited']) && !$limitedProject) return true;
if(!is_null($method) && strpos($method, 'batch') === 0) return false;
if(!is_null($method) && strpos($method, 'link') === 0) return false;
@@ -1188,12 +1185,12 @@ class commonModel extends model
if(is_null($object)) return true;
if(!empty($object->openedBy) && $object->openedBy == $app->user->account ||
!empty($object->addedBy) && $object->addedBy == $app->user->account ||
!empty($object->assignedTo) && $object->assignedTo == $app->user->account ||
!empty($object->finishedBy) && $object->finishedBy == $app->user->account ||
!empty($object->canceledBy) && $object->canceledBy == $app->user->account ||
!empty($object->closedBy) && $object->closedBy == $app->user->account ||
if(!empty($object->openedBy) && $object->openedBy == $app->user->account or
!empty($object->addedBy) && $object->addedBy == $app->user->account or
!empty($object->assignedTo) && $object->assignedTo == $app->user->account or
!empty($object->finishedBy) && $object->finishedBy == $app->user->account or
!empty($object->canceledBy) && $object->canceledBy == $app->user->account or
!empty($object->closedBy) && $object->closedBy == $app->user->account or
!empty($object->lastEditedBy) && $object->lastEditedBy == $app->user->account)
{
return true;
+1 -3
View File
@@ -49,7 +49,6 @@ js::set('confirmDelete', $lang->user->confirmDelete);
<th><?php common::printOrderLink('join', $orderBy, $vars, $lang->user->join);?></th>
<th><?php common::printOrderLink('last', $orderBy, $vars, $lang->user->last);?></th>
<th><?php common::printOrderLink('visits', $orderBy, $vars, $lang->user->visits);?></th>
<th><?php common::printOrderLink('limitedUser', $orderBy, $vars, $lang->user->limitedUser);?></th>
<th class='w-90px'><?php echo $lang->actions;?></th>
</tr>
</thead>
@@ -76,7 +75,6 @@ js::set('confirmDelete', $lang->user->confirmDelete);
<td><?php echo $user->join;?></td>
<td><?php if($user->last) echo date('Y-m-d', $user->last);?></td>
<td><?php echo $user->visits;?></td>
<td><?php echo $lang->user->limitedUserList[$user->limitedUser];?></td>
<td class='text-left'>
<?php
common::printIcon('user', 'edit', "userID=$user->id&from=company", '', 'list');
@@ -96,7 +94,7 @@ js::set('confirmDelete', $lang->user->confirmDelete);
</tbody>
<tfoot>
<tr>
<td colspan='12'>
<td colspan='11'>
<div class='table-actions clearfix'>
<?php
if($canBatchEdit) echo html::selectButton();
-15
View File
@@ -1158,19 +1158,4 @@ class docModel extends model
return $teams;
}
/**
* Judge an action is clickable or not.
*-
* @param object $product-
* @param string $action-
* @access public
* @return void
*/
public static function isClickable($doc, $action)
{
if(!common::limitedUser($doc)) return false;
return true;
}
}
+2
View File
@@ -84,6 +84,7 @@ $lang->resource->my->changePassword = 'changePassword';
$lang->resource->my->unbind = 'unbind';
$lang->resource->my->manageContacts = 'manageContacts';
$lang->resource->my->deleteContacts = 'deleteContacts';
$lang->resource->my->limited = 'limited';
$lang->my->methodOrder[0] = 'index';
$lang->my->methodOrder[5] = 'todo';
@@ -100,6 +101,7 @@ $lang->my->methodOrder[55] = 'changePassword';
$lang->my->methodOrder[60] = 'unbind';
$lang->my->methodOrder[65] = 'manageContacts';
$lang->my->methodOrder[75] = 'deleteContacts';
$lang->my->methodOrder[80] = 'limited';
/* Todo. */
$lang->resource->todo = new stdclass();
+1
View File
@@ -17,6 +17,7 @@ $lang->my->changePassword = 'Edit Password';
$lang->my->unbind = 'Unbind Ranger';
$lang->my->manageContacts = 'Maintain Contact';
$lang->my->deleteContacts = 'Delete Contact';
$lang->my->limited = 'Restricted operation (editing only content related to itself)';
$lang->my->taskMenu = new stdclass();
$lang->my->taskMenu->assignedToMe = 'Assigned to Me';
+1
View File
@@ -17,6 +17,7 @@ $lang->my->changePassword = '修改密码';
$lang->my->unbind = '解除然之绑定';
$lang->my->manageContacts = '维护联系人';
$lang->my->deleteContacts = '删除联系人';
$lang->my->limited = '受限操作(只能编辑与自己相关的内容)';
$lang->my->taskMenu = new stdclass();
$lang->my->taskMenu->assignedToMe = '指派给我';
-4
View File
@@ -54,10 +54,6 @@
<th><?php echo $lang->group->priv;?></th>
<td><?php foreach($groups as $group) echo $group->name . ' '; ?></td>
</tr>
<tr>
<th><?php echo $lang->user->limitedUser;?></th>
<td><?php echo $lang->user->limitedUserList[$user->limitedUser];?></td>
</tr>
<tr>
<th><?php echo $lang->user->commiter;?></th>
<td><?php echo $user->commiter;?></td>
-2
View File
@@ -830,8 +830,6 @@ class productModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($product)) return false;
if($action == 'close') return $product->status != 'closed';
return true;
+5 -6
View File
@@ -70,16 +70,15 @@
$link = common::hasPriv('story', 'create') ? $this->createLink('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID") : '#';
echo html::a($link, "<i class='icon icon-plus'></i>" . $lang->story->create, '', $misc);
}
$misc = common::hasPriv('story', 'batchCreate') ? '' : "disabled";
$link = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID") : '#';
?>
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
<button type="button" class="btn btn-primary dropdown-toggle <?php echo $misc?>" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('story', 'batchCreate') ? '' : "class=disabled";
$link = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID") : '#';
echo "<li>" . html::a($link, $lang->story->batchCreate, '', $misc) . "</li>";
?>
<?php echo "<li>" . html::a($link, $lang->story->batchCreate, '', "class='$misc'") . "</li>";?>
</ul>
</div>
</div>
-15
View File
@@ -304,19 +304,4 @@ class productplanModel extends model
$this->dao->update(TABLE_BUG)->set('plan')->eq(0)->where('id')->eq((int)$bugID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'unlinkedfromplan', '', $planID);
}
/**
* Judge an action is clickable or not.
*-
* @param object $product-
* @param string $action-
* @access public
* @return void
*/
public static function isClickable($productPlan, $action)
{
if(!common::limitedUser($productPlan)) return false;
return true;
}
}
+3 -2
View File
@@ -102,7 +102,6 @@ class project extends control
$this->view->childProjects = $childProjects;
$this->view->products = $products;
$this->view->teamMembers = $teamMembers;
$this->view->actions = $actions;
return $project;
}
@@ -538,6 +537,8 @@ class project extends control
$this->loadModel('user');
$this->app->loadLang('testcase');
$this->project->getLimitedProject();
/* Save session. */
$this->app->session->set('storyList', $this->app->getURI(true));
@@ -597,6 +598,7 @@ class project extends control
$this->view->title = $title;
$this->view->position = $position;
$this->view->productID = $productID;
$this->view->project = $project;
$this->view->stories = $stories;
$this->view->summary = $this->product->summary($stories);
$this->view->orderBy = $orderBy;
@@ -610,7 +612,6 @@ class project extends control
$this->view->users = $users;
$this->view->pager = $pager;
$this->view->branchGroups = $branchGroups;
$this->view->limitedUser = $this->app->user->limitedUser == 'yes' ? true : false;
$this->display();
}
+2 -7
View File
@@ -1751,8 +1751,6 @@ class projectModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($project, 'project')) return false;
if($action == 'start') return $project->status == 'wait';
if($action == 'close') return $project->status != 'done';
if($action == 'suspend') return $project->status == 'wait' or $project->status == 'doing';
@@ -1882,11 +1880,8 @@ class projectModel extends model
if($this->app->user->admin) return true;
/* Get all teams of all projects and group by projects, save it as static. */
$teams = $this->dao->select('project, limitedUser')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->fetchAll('project');
foreach($teams as $projectID => $object)
{
if($object->limitedUser == 'yes') $this->session->set($this->app->user->account . 'project' . $object->project, $object->project);
}
$projects = $this->dao->select('project, limitedUser')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->andWhere('limitedUser')->eq('yes')->orderBy('project asc')->fetchPairs('project', 'project');
$_SESSION['limitedProjects'] = join(',', $projects);
}
/**
+5 -4
View File
@@ -119,6 +119,7 @@
</td>
<td>
<?php
$hasDBPriv = common::hasDBPriv($project, 'project');
$param = "projectID={$project->id}&story={$story->id}&moduleID={$story->module}";
$lang->task->create = $lang->project->wbs;
@@ -129,16 +130,16 @@
}
else
{
if(!$limitedUser) common::printIcon('task', 'create', $param, $story, 'list', 'plus-border', '', 'btn-task-create');
if($hasDBPriv) common::printIcon('task', 'create', $param, '', 'list', 'plus-border', '', 'btn-task-create');
}
$lang->task->batchCreate = $lang->project->batchWBS;
if(!$limitedUser) common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", $story, 'list', 'plus-sign');
if($hasDBPriv) common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", '', 'list', 'plus-sign');
$lang->testcase->batchCreate = $lang->testcase->create;
if($productID && !$limitedUser) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", $story, 'list', 'sitemap');
if($productID && $hasDBPriv) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', 'list', 'sitemap');
if(common::hasPriv('project', 'unlinkStory') && !$limitedUser)
if(common::hasPriv('project', 'unlinkStory', $project))
{
$unlinkURL = $this->createLink('project', 'unlinkStory', "projectID=$project->id&storyID=$story->id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"storyList\",confirmUnlinkStory)", '<i class="icon-unlink"></i>', '', "class='btn-icon' title='{$lang->project->unlinkStory}'");
+5 -6
View File
@@ -126,16 +126,15 @@
$misc = common::hasPriv('task', 'create', $project) ? "class='btn btn-primary'" : "class='btn btn-primary disabled'";
$link = common::hasPriv('task', 'create', $project) ? $this->createLink('task', 'create', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#';
echo html::a($link, "<i class='icon icon-plus'></i>" . $lang->task->create, '', $misc);
$misc = common::hasPriv('task', 'batchCreate', $project) ? '' : "disabled";
$link = common::hasPriv('task', 'batchCreate', $project) ? $this->createLink('task', 'batchCreate', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#';
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<button type='button' class='btn btn-primary dropdown-toggle <?php echo $misc?>' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('task', 'batchCreate', $project) ? '' : "class=disabled";
$link = common::hasPriv('task', 'batchCreate', $project) ? $this->createLink('task', 'batchCreate', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#';
echo "<li>" . html::a($link, $lang->task->batchCreate, '', $misc) . "</li>";
?>
<?php echo "<li>" . html::a($link, $lang->task->batchCreate, '', "class='$misc'") . "</li>";?>
</ul>
</div>
</div>
+1 -1
View File
@@ -27,7 +27,7 @@
}
else
{
if($app->user->limitedUser === 'no') common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers, '', "class='btn btn-primary manage-team-btn'");
if(!empty($app->user->admin) or empty($app->user->rights['rights']['my']['limited'])) common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers, '', "class='btn btn-primary manage-team-btn'");
}
?>
</div>
-15
View File
@@ -319,19 +319,4 @@ class releaseModel extends model
$this->dao->update(TABLE_RELEASE)->set('status')->eq($status)->where('id')->eq($releaseID)->exec();
return dao::isError();
}
/**
* Judge an action is clickable or not.
*-
* @param object $product-
* @param string $action-
* @access public
* @return void
*/
public static function isClickable($release, $action)
{
if(!common::limitedUser($release)) return false;
return true;
}
}
-2
View File
@@ -2186,8 +2186,6 @@ class storyModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($story)) return false;
if($action == 'change') return $story->status != 'closed';
if($action == 'review') return $story->status == 'draft' or $story->status == 'changed';
if($action == 'close') return $story->status != 'closed';
+1 -3
View File
@@ -1613,8 +1613,6 @@ class taskModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($task, 'task')) return false;
if($action == 'assignto') return $task->status != 'closed' and $task->status != 'cancel';
if($action == 'start') return $task->status == 'wait';
if($action == 'restart') return $task->status == 'pause';
@@ -1774,7 +1772,7 @@ class taskModel extends model
}
common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true);
common::printIcon('task', 'edit',"taskID=$task->id", '', 'list');
common::printIcon('task', 'edit',"taskID=$task->id", $task, 'list');
break;
}
echo '</td>';
+3 -5
View File
@@ -932,8 +932,6 @@ class testcaseModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($case)) return false;
if($action == 'createbug') return $case->caseFails > 0;
if($action == 'review') return $case->status == 'wait';
@@ -1313,13 +1311,13 @@ class testcaseModel extends model
echo $case->stepNumber;
break;
case 'actions':
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', '', '', 'results iframe', '', "data-width='90%'");
common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", $case, 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", $case, 'list', '', '', 'results iframe', '', "data-width='90%'");
if($this->config->testcase->needReview or !empty($this->config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'review', '', 'iframe');
common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list');
common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'list', 'copy');
if(common::hasPriv('testcase', 'delete'))
if(common::hasPriv('testcase', 'delete', $case))
{
$deleteURL = helper::createLink('testcase', 'delete', "caseID=$case->id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"batchForm\",confirmDelete)", '<i class="icon-remove"></i>', '', "title='{$this->lang->testcase->delete}' class='btn-icon'");
+10 -12
View File
@@ -23,16 +23,15 @@
$misc = common::hasPriv('testcase', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'";
$link = common::hasPriv('testcase', 'create') ? $this->createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
echo html::a($link, "<i class='icon-plus'></i>" . $lang->testcase->create, '', $misc);
$misc = common::hasPriv('testcase', 'batchCreate') ? '' : "disabled";
$link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<button type='button' class='btn btn-primary dropdown-toggle <?php echo $misc?>' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('testcase', 'batchCreate') ? '' : "class=disabled";
$link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', $misc) . "</li>";
?>
<?php echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', "class='$misc'") . "</li>";?>
</ul>
</div>
</li>
@@ -208,16 +207,15 @@
$misc = common::hasPriv('testcase', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'";
$link = common::hasPriv('testcase', 'create') ? $this->createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
echo html::a($link, "<i class='icon-plus'></i>" . $lang->testcase->create, '', $misc);
$misc = common::hasPriv('testcase', 'batchCreate') ? '' : "disabled";
$link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
?>
<button type='button' class='btn btn-primary dropdown-toggle' data-toggle='dropdown'>
<button type='button' class='btn btn-primary dropdown-toggle <?php echo $misc?>' data-toggle='dropdown'>
<span class='caret'></span>
</button>
<ul class='dropdown-menu pull-right'>
<?php
$misc = common::hasPriv('testcase', 'batchCreate') ? '' : "class=disabled";
$link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#';
echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', $misc) . "</li>";
?>
<?php echo "<li>" . html::a($link, $lang->testcase->batchCreate, '', "class='$misc'") . "</li>";?>
</ul>
</div>
</div>
-15
View File
@@ -804,19 +804,4 @@ class testsuiteModel extends model
}
}
}
/**
* Judge an action is clickable or not.
*-
* @param object $product-
* @param string $action-
* @access public
* @return void
*/
public static function isClickable($testsuite, $action)
{
if(!common::limitedUser($testsuite)) return false;
return true;
}
}
+3 -5
View File
@@ -1099,8 +1099,6 @@ class testtaskModel extends model
{
$action = strtolower($action);
if(!common::limitedUser($testtask)) return false;
if($action == 'start') return $testtask->status == 'wait';
if($action == 'block') return ($testtask->status == 'doing' || $testtask->status == 'wait');
if($action == 'activate') return ($testtask->status == 'blocked' || $testtask->status == 'done');
@@ -1194,10 +1192,10 @@ class testtaskModel extends model
echo $run->stepNumber;
break;
case 'actions':
common::printIcon('testtask', 'runCase', "id=$run->id", '', 'list', '', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "id=$run->id", '', 'list', '', '', 'iframe', '', "data-width='90%'");
common::printIcon('testtask', 'runCase', "id=$run->id", $run, 'list', '', '', 'runCase iframe', false, "data-width='95%'");
common::printIcon('testtask', 'results', "id=$run->id", $run, 'list', '', '', 'iframe', '', "data-width='90%'");
if(common::hasPriv('testtask', 'unlinkCase'))
if(common::hasPriv('testtask', 'unlinkCase', $run))
{
$unlinkURL = helper::createLink('testtask', 'unlinkCase', "caseID=$run->id&confirm=yes");
echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"casesForm\",confirmUnlink)", '<i class="icon-unlink"></i>', '', "title='{$this->lang->testtask->unlinkCase}' class='btn-icon'");
+2 -2
View File
@@ -6,8 +6,8 @@ $config->user->edit = new stdclass();
$config->user->create->requiredFields = 'account,realname,password,password1,password2';
$config->user->edit->requiredFields = 'account,realname';
$config->user->customBatchCreateFields = 'dept,email,gender,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode,limitedUser';
$config->user->customBatchEditFields = 'dept,email,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode,limitedUser';
$config->user->customBatchCreateFields = 'dept,email,gender,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode';
$config->user->customBatchEditFields = 'dept,email,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode';
$config->user->custom = new stdclass();
$config->user->custom->batchCreateFields = 'dept,email,gender';
+10 -15
View File
@@ -68,16 +68,16 @@ $lang->user->asGuest = "游客访问";
$lang->user->goback = "返回前一页";
$lang->user->deleted = '(已删除)';
$lang->user->profile = '档案';
$lang->user->project = $lang->projectCommon;
$lang->user->task = '任务';
$lang->user->bug = '缺陷';
$lang->user->test = '测试';
$lang->user->testTask = '测试任务';
$lang->user->testCase = '测试用例';
$lang->user->todo = '待办';
$lang->user->story = '需求';
$lang->user->dynamic = '动态';
$lang->user->profile = '档案';
$lang->user->project = $lang->projectCommon;
$lang->user->task = '任务';
$lang->user->bug = '缺陷';
$lang->user->test = '测试';
$lang->user->testTask = '测试任务';
$lang->user->testCase = '测试用例';
$lang->user->todo = '待办';
$lang->user->story = '需求';
$lang->user->dynamic = '动态';
$lang->user->openedBy = '由他创建';
$lang->user->assignedTo = '指派给他';
@@ -97,10 +97,6 @@ $lang->user->lockWarning = "您还有%s次尝试机会。";
$lang->user->loginLocked = "密码尝试次数太多,请联系管理员解锁,或%s分钟后重试。";
$lang->user->weakPassword = "您的密码强度小于系统设定。";
$lang->user->limitedUser = '受限用户';
$lang->user->limitedUserList['no'] = '否';
$lang->user->limitedUserList['yes'] = '是';
$lang->user->roleList[''] = '';
$lang->user->roleList['dev'] = '研发';
$lang->user->roleList['qa'] = '测试';
@@ -138,7 +134,6 @@ $lang->user->placeholder->role = '职位影响内容和用户列表的顺
$lang->user->placeholder->group = '分组决定用户的权限列表。';
$lang->user->placeholder->commiter = '版本控制系统(subversion)中的帐号';
$lang->user->placeholder->verify = '需要输入你的密码加以验证';
$lang->user->placeholder->limitedUser = '只能编辑与自己相关的内容。';
$lang->user->placeholder->passwordStrength[1] = '6位以上,包含大小写字母,数字。';
$lang->user->placeholder->passwordStrength[2] = '10位以上,包含大小写字母,数字,特殊字符。';
-3
View File
@@ -298,8 +298,6 @@ class userModel extends model
$data[$i]->address = $users->address[$i];
$data[$i]->zipcode = $users->zipcode[$i];
$data[$i]->limitedUser = $users->limitedUser[$i];
/* Change for append field, such as feedback.*/
if(!empty($this->config->user->batchAppendFields))
{
@@ -467,7 +465,6 @@ class userModel extends model
$users[$id]['phone'] = $data->phone[$id];
$users[$id]['address'] = $data->address[$id];
$users[$id]['zipcode'] = $data->zipcode[$id];
$users[$id]['limitedUser'] = $data->limitedUser[$id];
$users[$id]['dept'] = $data->dept[$id] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $data->dept[$id];
$users[$id]['role'] = $data->role[$id] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : 0) : $data->role[$id];
-2
View File
@@ -55,7 +55,6 @@ $minWidth = (count($visibleFields) > 5) ? 'w-150px' : '';
<th class='w-120px<?php echo zget($visibleFields, 'phone', ' hidden')?>'> <?php echo $lang->user->phone;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'address', ' hidden')?>'> <?php echo $lang->user->address;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'zipcode', ' hidden')?>'> <?php echo $lang->user->zipcode;?></th>
<th class='w-90px<?php echo zget($visibleFields, 'limitedUser', ' hidden')?>'> <?php echo $lang->user->limitedUser;?></th>
</tr>
</thead>
<?php $depts = $depts + array('ditto' => $lang->user->ditto)?>
@@ -90,7 +89,6 @@ $minWidth = (count($visibleFields) > 5) ? 'w-150px' : '';
<td class='<?php echo zget($visibleFields, 'phone', 'hidden')?>'> <?php echo html::input("phone[$i]", '', "class='form-control' autocomplete='off'");?></td>
<td class='<?php echo zget($visibleFields, 'address', 'hidden')?>'> <?php echo html::input("address[$i]", '', "class='form-control' autocomplete='off'");?></td>
<td class='<?php echo zget($visibleFields, 'zipcode', 'hidden')?>'> <?php echo html::input("zipcode[$i]", '', "class='form-control' autocomplete='off'");?></td>
<td <?php echo zget($visibleFields, 'limitedUser', "class='hidden'")?>> <?php echo html::radio("limitedUser[$i]", $lang->user->limitedUserList, 'no');?></td>
</tr>
<?php endfor;?>
<tr>
-2
View File
@@ -51,7 +51,6 @@ $minWidth = (count($visibleFields) > 7) ? 'w-120px' : '';
<th class='w-120px<?php echo zget($visibleFields, 'phone', ' hidden')?>'> <?php echo $lang->user->phone;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'address', ' hidden')?>'> <?php echo $lang->user->address;?></th>
<th class='w-120px<?php echo zget($visibleFields, 'zipcode', ' hidden')?>'> <?php echo $lang->user->zipcode;?></th>
<th class='w-90px <?php echo zget($visibleFields, 'limitedUser', ' hidden')?>'> <?php echo $lang->user->limitedUser;?></th>
</tr>
</thead>
<?php $depts = array('ditto' => $lang->user->ditto) + $depts;?>
@@ -81,7 +80,6 @@ $minWidth = (count($visibleFields) > 7) ? 'w-120px' : '';
<td class='<?php echo zget($visibleFields, 'phone', 'hidden')?>'> <?php echo html::input("phone[$user->id]", $user->phone, "class='form-control' autocomplete='off'");?></td>
<td class='<?php echo zget($visibleFields, 'address', 'hidden')?>'> <?php echo html::input("address[$user->id]", $user->address, "class='form-control' autocomplete='off'");?></td>
<td class='<?php echo zget($visibleFields, 'zipcode', 'hidden')?>'> <?php echo html::input("zipcode[$user->id]", $user->zipcode, "class='form-control' autocomplete='off'");?></td>
<td <?php echo zget($visibleFields, 'limitedUser', "class='hidden'")?>> <?php echo html::radio("limitedUser[$user->id]", $lang->user->limitedUserList, $user->limitedUser);?></td>
</tr>
<?php endforeach;?>
<tr>
-5
View File
@@ -61,11 +61,6 @@
<td><?php echo html::select('group', $groupList, '', "class='form-control chosen'");?></td>
<td><?php echo $lang->user->placeholder->group?></td>
</tr>
<tr>
<th><?php echo $lang->user->limitedUser;?></th>
<td><?php echo html::radio('limitedUser', $lang->user->limitedUserList, 'no');?></td>
<td><?php echo $lang->user->placeholder->limitedUser?></td>
</tr>
<tr>
<th><?php echo $lang->user->email;?></th>
<td><?php echo html::input('email', '', "class='form-control' autocomplete='off'");?></td>
-2
View File
@@ -71,8 +71,6 @@
<tr>
<th><?php echo $lang->user->commiter;?></th>
<td><?php echo html::input('commiter', $user->commiter, "class='form-control' autocomplete='off'");?></td>
<th><?php echo $lang->user->limitedUser;?></th>
<td><?php echo html::radio('limitedUser', $lang->user->limitedUserList, $user->limitedUser);?></td>
</tr>
</table>
<table align='center' class='table table-form'>