コード例 #1
0
 /**
  * Add commands that create items in the folder.
  * @param FOLDER $folder
  * @access private
  */
 protected function _add_creators($folder)
 {
     $cmd = $this->make_command();
     $cmd->id = 'new_job';
     $cmd->caption = 'New job';
     if ($folder->is_organizational()) {
         $cmd->link = "select_folder.php?page_name=create_job.php";
     } else {
         $cmd->link = "create_job.php?id={$folder->id}";
     }
     $cmd->icon = '{app_icons}buttons/new_job';
     $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $folder);
     $cmd->importance = Command_importance_high + Command_importance_increment;
     $this->append($cmd);
     $cmd = $this->make_command();
     $cmd->id = 'new_change';
     $cmd->caption = 'New change';
     if ($folder->is_organizational()) {
         $cmd->link = "select_folder.php?page_name=create_change.php";
     } else {
         $cmd->link = "create_change.php?id={$folder->id}";
     }
     $cmd->icon = '{app_icons}buttons/new_change';
     $cmd->executable = $this->login->is_allowed(Privilege_set_entry, Privilege_create, $folder);
     $cmd->importance = Command_importance_high;
     $this->append($cmd);
     if (!$folder->is_organizational()) {
         $cmd = $this->make_command();
         $cmd->id = 'new_release';
         $cmd->caption = 'New release';
         $cmd->icon = '{app_icons}buttons/new_release';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
         $cmd->link = "create_release.php?id={$folder->trunk_id}";
         $cmd = $this->make_command();
         $cmd->id = 'new_branch';
         $cmd->caption = 'New branch';
         $branch = $folder->trunk();
         if (isset($branch)) {
             $cmd->link = "create_branch.php?id={$folder->id}&branch_id={$branch->id}";
         } else {
             $cmd->link = "create_branch.php?id={$folder->id}";
         }
         $cmd->icon = '{app_icons}buttons/new_branch';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
         $cmd = $this->make_command();
         $cmd->id = 'new_component';
         $cmd->caption = 'New component';
         $cmd->link = "create_component.php?id={$folder->id}";
         $cmd->icon = '{app_icons}buttons/new_component';
         $cmd->executable = $this->login->is_allowed(Privilege_set_folder, Privilege_modify, $folder);
         $cmd->importance = Command_importance_low + Command_importance_increment;
         $this->append($cmd);
     }
 }