/**
  * @param RELEASE $obj Configure commands for this object.
  */
 public function __construct($obj)
 {
     parent::__construct($obj->app);
     $folder = $obj->parent_folder();
     $branch = $obj->branch();
     if (!$folder->is_organizational()) {
         $this->append_group('Add');
         $cmd = $this->make_command();
         $cmd->id = 'new_job';
         $cmd->caption = 'New job';
         $cmd->link = "create_job.php?id={$folder->id}&branch_id={$branch->id}&release_id={$obj->id}";
         $cmd->icon = '{app_icons}buttons/new_job';
         $cmd->executable = !$obj->locked() && $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={$branch->id}&release_id={$obj->id}";
         $cmd->icon = '{app_icons}buttons/new_change';
         $cmd->executable = !$obj->locked() && $this->login->is_allowed(Privilege_set_entry, Privilege_create, $obj);
         $cmd->importance = Command_importance_high + Command_importance_increment;
         $this->append($cmd);
     }
     $this->append_group('Edit');
     $cmd = $this->make_command();
     $cmd->id = 'edit';
     $cmd->caption = 'Edit';
     $cmd->link = "edit_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/edit';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, Privilege_modify, $obj);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'delete';
     $cmd->caption = 'Delete';
     $cmd->link = "delete_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/delete';
     $cmd->executable = !$obj->deleted() && $this->login->is_allowed(Privilege_set_release, Privilege_delete, $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_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/purge';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, Privilege_purge, $obj);
     $cmd->importance = Command_importance_high - 2 * Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'ship';
     $cmd->caption = 'Ship';
     $cmd->link = "ship_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/ship';
     $cmd->executable = $obj->planned() && $this->login->is_allowed(Privilege_set_release, Privilege_modify, $obj);
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $this->append_group('View');
     $cmd = $this->make_command();
     $cmd->id = 'print';
     $cmd->caption = 'Print';
     $cmd->link = "view_release_change_log.php?id={$obj->id}&printable=1";
     $cmd->icon = '{icons}buttons/print';
     $cmd->executable = true;
     $cmd->importance = Command_importance_low;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'send';
     $cmd->caption = 'Send';
     $cmd->link = "send_release.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/send';
     $cmd->executable = true;
     $cmd->importance = Command_importance_high - Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'history';
     $cmd->caption = 'View history';
     $cmd->link = "view_release_history.php?id={$obj->id}";
     $cmd->icon = '{icons}buttons/history';
     $cmd->executable = $this->login->is_allowed(Privilege_set_release, 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_release_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();
 }