コード例 #1
0
 /**
  * @param BRANCH $branch Branch from which releases are retrieved.
  */
 public function __construct($branch)
 {
     $folder = $branch->parent_folder();
     parent::__construct($folder);
     $this->_branch = $branch;
     release_query_order($this);
 }
コード例 #2
0
 /**
  * Delete the given object.
  * @param BRANCH $obj
  * @access private
  */
 public function commit($obj)
 {
     if ($this->value_for('purge')) {
         $options = new PURGE_OPTIONS();
         $options->sub_history_item_publication_state = false;
         $obj->purge($options);
     } else {
         $obj->delete();
     }
 }
コード例 #3
0
 /**
  * @param BRANCH $branch Branch for which comments are retrieved.
  */
 public function __construct($branch)
 {
     $folder = $branch->parent_folder();
     parent::__construct($folder);
     $this->_branch = $branch;
     $table_names = $this->app->table_names;
     $this->add_select('entry.kind as entry_kind, chng.number as chng_number, chng.job_id as chng_job_id, etob.branch_release_id' . ', jtob.branch_status, jtob.branch_priority, jtob.branch_closer_id' . ', jtob.branch_time_closed, entry.time_created as job_time_created');
     $this->add_table("{$table_names->changes} chng", 'chng.entry_id = entry.id', 'LEFT');
     $this->add_table("{$table_names->jobs} job", 'job.entry_id = entry.id', 'LEFT');
     $this->add_table("{$table_names->entries_to_branches} etob", 'etob.entry_id = entry.id');
     $this->add_table("{$table_names->jobs_to_branches} jtob", 'jtob.entry_to_branch_id = etob.id', 'LEFT');
 }
コード例 #4
0
 /**
  * Return the most likely candidate.
  * If there is a newer release, that is returned and all jobs/changes in this
  * release are assigned to that one. If not, jobs/changes are assigned to no
  * release in this branch.
  * 
  * @return RELEASE
  */
 public function replacement_release()
 {
     if (!isset($this->_replacement_release)) {
         $release_query = $this->branch->release_query();
         $release_query->set_order('rel.time_next_deadline DESC');
         /** @var RELEASE[] $releases */
         $releases = $release_query->objects();
         /* Look for this release in the list of releases for this branch. If it's found,
            get the next release in the list, if it exists. If there is no newer release,
            relegate all jobs and changes back to 'unassigned' release. */
         $index = 0;
         $current_index = 0;
         while (!$current_index && $index < sizeof($releases)) {
             if ($releases[$index]->id == $this->release->id) {
                 $current_index = $index;
             }
             $index += 1;
         }
         while (!isset($this->_replacement_release) && $current_index > 0) {
             $current_index--;
             if ($releases[$current_index]->planned()) {
                 $this->_replacement_release = $releases[$current_index];
             }
         }
         if (!isset($this->_replacement_release)) {
             $this->_replacement_release = null;
         }
     }
     return $this->_replacement_release;
 }
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
 /**
  * @param BRANCH $branch Branch for which entries are retrieved.
  */
 public function __construct($branch)
 {
     $folder = $branch->parent_folder();
     parent::__construct($folder);
     $this->_branch = $branch;
 }
コード例 #7
0
    /**
     * Shows parent/latest release for a branch in HTML.
     * @param BRANCH $obj
     */
    protected function _echo_details_as_html($obj)
    {
        ?>
  <table class="basic columns left-labels">
    <tr>
      <th>State</th>
      <td>
        <?php 
        echo $obj->state_as_string();
        ?>
      </td>
    </tr>
<?php 
        $parent_release = $obj->parent_release();
        if ($parent_release) {
            $parent_branch = $parent_release->branch();
            ?>
    <tr>
      <th>Parent</th>
      <td>
      <?php 
            echo $parent_branch->title_as_link();
            echo $this->app->display_options->object_separator;
            echo $parent_release->title_as_link();
            ?>
      </td>
    </tr>
<?php 
        }
        if ($obj->exists()) {
            $latest_release = $obj->latest_release();
            if ($latest_release) {
                $rel_text = $latest_release->title_as_link();
            } else {
                $rel_text = 'not released';
            }
            ?>
    <tr>
      <th>Latest</th>
      <td><?php 
            echo $rel_text;
            ?>
</td>
    </tr>
<?php 
            $next_release = $obj->next_release();
            if ($next_release) {
                $rel_text = $next_release->title_as_link();
            } else {
                $rel_text = 'none planned';
            }
            ?>
    <tr>
      <th>Next</th>
      <td><?php 
            echo $rel_text;
            ?>
</td>
    </tr>
<?php 
        }
        ?>
  </table>
<?php 
    }
コード例 #8
0
 /**
  * Delete the given object.
  * @param BRANCH $obj
  * @access private
  */
 public function commit($obj)
 {
     $options = new PURGE_OPTIONS();
     $options->sub_history_item_publication_state = $this->value_for('sub_history_item_publication_state');
     $obj->purge($options);
 }
コード例 #9
0
 /**
  * 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();
 }