diff --git a/module/program/config.php b/module/program/config.php
index 66a26b17e0..be78746b41 100644
--- a/module/program/config.php
+++ b/module/program/config.php
@@ -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;
diff --git a/module/program/model.php b/module/program/model.php
index 8c03291209..993a190e9d 100644
--- a/module/program/model.php
+++ b/module/program/model.php
@@ -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;
diff --git a/module/program/ui/browse.html.php b/module/program/ui/browse.html.php
index 6eab2fc887..125c59be77 100644
--- a/module/program/ui/browse.html.php
+++ b/module/program/ui/browse.html.php
@@ -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(' ' . $lang->user->search . '');
+$toolbar->append(' ' . $lang->user->search . '');
/* Set actionbar. */
$actionbar = actionbar();
diff --git a/zin/wg/dtable/v1.php b/zin/wg/dtable/v1.php
index e4e3ce8564..6842c6b1d2 100644
--- a/zin/wg/dtable/v1.php
+++ b/zin/wg/dtable/v1.php
@@ -159,16 +159,19 @@ class column extends wg
$actionsMap->$actionType->hint = $lang->more;
- $items = array();
- foreach($actions as $action)
+ if($actionType == 'more')
{
- $item = new stdclass();
- $item->name = $action;
- $item->icon = $config->actionsMap->icon->$action;
- if(isset($actionsList['text'][$action])) $item->text = $actionsList['text'][$action];
- $items[] = $item;
+ $items = array();
+ foreach($actions as $action)
+ {
+ $item = new stdclass();
+ $item->name = $action;
+ $item->icon = $config->actionsMap->icon->$action;
+ if(isset($actionsList['text'][$action])) $item->text = $actionsList['text'][$action];
+ $items[] = $item;
+ }
+ $actionsMap->$actionType->dropdown->items = $items;
}
- $actionsMap->$actionType->dropdown->items = $items;
}
}