/** * @param BRANCH $obj Configure commands for this branch. */ public function __construct($obj) { parent::__construct($obj->app); $folder = $obj->parent_folder(); if (!$folder->is_organizational() && !$obj->locked()) { $this->append_group('Create'); $cmd = $this->make_command(); $cmd->id = 'new_job'; $cmd->caption = 'New job'; $cmd->link = "create_job.php?id={$folder->id}&branch_id={$obj->id}"; $cmd->icon = '{app_icons}buttons/new_job'; $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $obj); $cmd->importance = Command_importance_high + Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'new_change'; $cmd->caption = 'New change'; $cmd->link = "create_change.php?id={$folder->id}&branch_id={$obj->id}"; $cmd->icon = '{app_icons}buttons/new_change'; $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $obj); $cmd->importance = Command_importance_high + Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'new_release'; $cmd->caption = 'New release'; $cmd->link = "create_release.php?id={$obj->id}"; $cmd->icon = '{app_icons}buttons/new_release'; $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $obj); $cmd->importance = Command_importance_low; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'new_branch'; $cmd->caption = 'New branch'; $cmd->link = "create_branch.php?id={$folder->id}&branch_id={$obj->id}"; $cmd->icon = '{app_icons}buttons/new_branch'; $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $obj); $cmd->importance = Command_importance_high - 2 * Command_importance_increment; $cmd->importance = Command_importance_low; $this->append($cmd); } $cmd = $this->make_command(); $this->append_group('Edit'); $cmd->id = 'edit'; $cmd->caption = 'Edit'; $cmd->link = "edit_branch.php?id={$obj->id}"; $cmd->icon = '{icons}buttons/edit'; $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $obj); $cmd->importance = Command_importance_high - Command_importance_increment; $this->append($cmd); if (!$folder->is_root()) { $cmd = $this->make_command(); $cmd->id = 'delete'; $cmd->caption = 'Delete'; $cmd->link = "delete_branch.php?id={$obj->id}"; $cmd->icon = '{icons}buttons/delete'; $cmd->executable = !$obj->deleted() && $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $obj); $cmd->importance = Command_importance_high - 2 * Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'purge'; $cmd->caption = 'Purge'; $cmd->link = "purge_branch.php?id={$obj->id}"; $cmd->icon = '{icons}buttons/purge'; $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_purge, $obj); $cmd->importance = Command_importance_high - 2 * Command_importance_increment; $this->append($cmd); } $this->append_group('View'); $cmd = $this->make_command(); $cmd->id = 'print'; $cmd->caption = 'Print'; $cmd->link = "view_branch_change_log.php?id={$obj->id}&printable=1"; $cmd->icon = '{icons}buttons/print'; $cmd->executable = true; $cmd->importance = Command_importance_high - Command_importance_increment; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'history'; $cmd->caption = 'History'; $cmd->link = "view_branch_history.php?id={$obj->id}"; $cmd->icon = '{icons}buttons/history'; $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_view_history, $obj); $cmd->importance = Command_importance_low; $this->append($cmd); $cmd = $this->make_command(); $cmd->id = 'change_log'; $cmd->caption = 'View change log'; $cmd->link = "view_branch_change_log.php?id={$obj->id}"; $cmd->icon = '{app_icons}buttons/change_log'; $cmd->executable = true; $cmd->importance = Command_importance_high; $this->append($cmd); }
/** * Should controls for this branch be disabled? * @param BRANCH $branch * @param RELEASE $release * @return bool * @access private */ protected function _branch_is_locked($branch, $release) { return $branch->locked() || isset($release) && $release->locked() && !$this->cloning(); }