* Finish task #73291.

This commit is contained in:
tianshujie
2022-11-11 08:45:30 +08:00
parent b544c67d26
commit 84d69fca51
4 changed files with 59 additions and 35 deletions
+7 -7
View File
@@ -100,17 +100,17 @@ $config->program->dtable->fieldList['progress']['title'] = $lang->program->progr
$config->program->dtable->fieldList['progress']['width'] = 100;
$config->program->dtable->fieldList['progress']['type'] = 'circleProgress';
$config->program->dtable->fieldList['actions']['name'] = 'actions';
$config->program->dtable->fieldList['actions']['title'] = $lang->actions;
$config->program->dtable->fieldList['actions']['width'] = 160;
$config->program->dtable->fieldList['actions']['type'] = 'actions';
$config->program->dtable->fieldList['actions']['fixed'] = 'right';
$config->program->dtable->fieldList['actions']['module'] = 'program';
$config->program->dtable->fieldList['actions']['name'] = 'actions';
$config->program->dtable->fieldList['actions']['title'] = $lang->actions;
$config->program->dtable->fieldList['actions']['width'] = 160;
$config->program->dtable->fieldList['actions']['type'] = 'actions';
$config->program->dtable->fieldList['actions']['fixed'] = 'right';
$config->program->dtable->fieldList['actions']['module'] = 'program';
global $app;
$app->loadLang('project');
$config->program->actionsMap['normal'] = array('start', 'suspend', 'close', 'activate', 'edit', 'create', 'delete', 'team', 'group');
$config->program->actionsMap['other'] = array('start', 'suspend', 'close', 'activate');
$config->program->actionsMap['other'] = true;
$config->program->actionsMap['more'] = array('link', 'whitelist', 'delete');
$config->program->actionsMap['hint']['create'] = $lang->program->children;
$config->program->actionsMap['hint']['delete'] = $lang->delete;
+40 -19
View File
@@ -1759,19 +1759,29 @@ class programModel extends model
if($program->type == 'program' && strpos(",{$this->app->user->view->programs},", ",$program->id,") !== false)
{
if(($program->status == 'wait' or $program->status == 'suspended') and $canStartProgram) $actionsMap[] = 'start';
if($program->status == 'doing' and $canCloseProgram) $actionsMap[] = 'close';
if($program->status == 'closed' and $canActivateProgram) $actionsMap[] = 'activate';
$normalActions = array('start', 'close', 'activate');
foreach($normalActions as $action)
{
if($action == 'start' and (!$canStartProgram or ($program->status != 'wait' and $program->status != 'suspended'))) continue;
if($action == 'close' and (!$canCloseProgram or $program->status != 'doing')) continue;
if($action == 'activate' and (!$canActivateProgram or $program->status != 'closed')) continue;
$item = new stdclass();
$item->name = $action;
$item->hint = $this->lang->program->$action;
$actionsMap[] = $item;
}
if($canSuspendProgram or ($canClose && $program->status != 'doing') or ($canActivateProgram and $program->status != 'closed'))
{
$other = new stdclass();
$other->name = 'other';
$other->dropdown = new stdclass();
$other->dropdown->items = array();
$other->name = 'other';
$other->items = array();
$otherActions = array('suspend', 'close', 'activate');
foreach($otherActions as $action)
{
if($action == 'close' and $program->status == 'doing') continue;
if(!common::hasPriv('program', $action)) continue;
$item = new stdclass();
@@ -1779,37 +1789,48 @@ class programModel extends model
$item->text = $this->lang->program->$action;
if(!$this->isClickable($program, $action)) $item->disabled = true;
$other->dropdown->items[] = $item;
$other->items[] = $item;
}
$actionsMap[] = $other;
}
if(common::hasPriv('program', 'edit')) $actionsMap[] = 'edit';
if(common::hasPriv('program', 'create'))
$normalActions = array('edit', 'create', 'delete');
foreach($normalActions as $action)
{
if(!common::hasPriv('program', $action)) continue;
$item = new stdclass();
$item->name = 'create';
if($program->status == 'closed') $item->disabled = true;
$item->name = $action;
$item->hint = $this->lang->program->$action;
if($action == 'create' and $program->status == 'closed') $item->disabled = true;
$actionsMap[] = $item;
}
if(common::hasPriv('program', 'delete')) $actionsMap[] = 'delete';
}
elseif($program->type == 'project')
{
if(($program->status == 'wait' or $program->status == 'suspended') and $canStartProject) $actionsMap[] = 'start';
if($program->status == 'doing' and $canCloseProject) $actionsMap[] = 'close';
if($program->status == 'closed' and $canActivateProject) $actionsMap[] = 'activate';
$normalActions = array('start', 'close', 'activate');
foreach($normalActions as $action)
{
if($action == 'start' and (!$canStartProject or ($program->status != 'wait' and $program->status != 'suspended'))) continue;
if($action == 'close' and (!$canCloseProject or $program->status != 'doing')) continue;
if($action == 'activate' and (!$canActivateProgram or $program->status != 'closed')) continue;
$item = new stdclass();
$item->name = $action;
$item->hint = $this->lang->project->$action;
$actionsMap[] = $item;
}
if($canSuspendProject or ($canCloseProject and $program->status != 'doing') or ($canActivateProject and $program->status != 'closed'))
{
$other = new stdclass();
$other->name = 'other';
$other->dropdown = new stdclass();
$other->dropdown->items = array();
$other->name = 'other';
$other->items = array();
$otherActions = array('suspend', 'close', 'activate');
foreach($otherActions as $action)
{
if($action == 'close' and $program->status == 'doing') continue;
if(!common::hasPriv('project', $action)) continue;
$item = new stdclass();
@@ -1817,7 +1838,7 @@ class programModel extends model
$item->text = $this->lang->project->$action;
if(!$this->project->isClickable($program, $action)) $item->disabled = true;
$other->dropdown->items[] = $item;
$other->items[] = $item;
}
$actionsMap[] = $other;
+1 -1
View File
@@ -14,7 +14,7 @@ if(common::hasPriv('project', 'batchEdit') and $programType != 'bygrid' and $has
$toolbar->append(html::checkbox('editProject', array('1' => $lang->project->edit), '', $this->cookie->editProject ? 'checked=checked' : ''));
}
$toolbar->append('<a class="querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> ' . $lang->user->search . '</a>');
$toolbar->append('<a id="searchFormBtn"><i class="icon icon-search"></i> <span>' . $lang->user->search . '</span></a>');
/* Set actionbar. */
$actionbar = actionbar();