/** * @param RELEASE $obj * @access private */ protected function _draw_box($obj) { $creator = $obj->creator(); $this->_display_start_minimal_commands_block($obj); ?> <h3> <?php echo $this->obj_link($obj); ?> </h3> <p class="info-box-top"> <?php echo 'Created '; if ($this->show_user) { echo 'by ' . $creator->title_as_link() . ' - '; } echo $obj->time_created->format(); if (!$obj->time_created->equals($obj->time_modified)) { $modifier = $obj->modifier(); echo '<br>Updated '; if ($this->show_user) { echo 'by ' . $modifier->title_as_link() . ' - '; } echo $obj->time_modified->format(); } ?> </p> <div class="text-flow"> <p> <?php $menu = $this->context->make_menu(); $menu->renderer->separator_class = $this->app->display_options->object_class; if ($this->show_folder) { $folder = $obj->parent_folder(); $menu->append($folder->title_as_link()); } $branch = $obj->branch(); if ($this->show_branch && isset($branch)) { $menu->append($branch->title_as_link()); } $menu->display(); ?> </p> <?php $status = $obj->status(); echo $status->as_html(); ?> <?php echo $obj->description_as_html(); ?> </div> <?php $this->_display_finish_minimal_commands_block(); }
/** * Shows testing/ship dates for a release in HTML. * @param RELEASE $obj */ protected function _echo_details_as_html($obj) { $status = $obj->status(); ?> <table class="basic columns left-labels"> <tr> <th>Test Date</th> <td><?php echo $status->test->as_html(); ?> </td> </tr> <tr> <th>Ship Date</th> <td><?php echo $status->ship->as_html(); ?> </td> </tr> </table> <?php }
/** * @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); }
/** * @param RELEASE $release * @param boolean $text_only Omit all tags if True. */ public function __construct($release, $text_only) { parent::__construct($release->app); $this->test = new RELEASE_DATE_STATUS($release, $release->time_tested, $release->time_testing_scheduled, !$release->planned()); $this->ship = new RELEASE_DATE_STATUS($release, $release->time_shipped, $release->time_scheduled); }
/** * @param RELEASE $release */ public function __construct($release) { parent::__construct($release->app); $this->release = $release; $this->branch = $release->branch(); }
/** * Draw a release in the list. * If the job and changes counts are 0, then assume that the entries for * that release weren't in the list and retrieve the counts. * @param RELEASE $release * @param integer $num_jobs Number of jobs in this release. Can be empty. * @param integer $num_changes Number of changes in this release. Can be empty. * @access private */ protected function _draw_release($release, $num_jobs, $num_changes) { if (!$num_changes) { $chng_query = $release->change_query(); $num_changes = $chng_query->size(); } if (!$num_jobs) { $job_query = $release->job_query(); $num_jobs = $job_query->size(); } $t = $release->title_formatter(); $t->set_name('view_release_change_log.php'); ?> <h2> <?php echo $release->title_as_link($t); ?> </h2> <table class="basic columns left-labels"> <tr> <th>Jobs</th> <td><?php echo $num_jobs; ?> </td> </tr> <tr> <th>Changes</th> <td><?php echo $num_changes; ?> </td> </tr> <tr> <th></th> <td> <?php $status = $release->status(); echo $status->as_html(); ?> </td> </tr> </table> <?php if ($this->show_description) { $munger = $release->html_formatter(); $desc = $release->description_as_html($munger); if ($desc) { ?> <div class="text-flow"> <?php echo $desc; ?> </div> <?php } } if ($this->show_user || $this->show_date) { $t = $release->time_created->formatter(); $t->type = Date_time_format_date_and_time; $creator = $release->creator(); ?> <p class="info-box-bottom"> Created <?php if ($this->show_user) { ?> by <?php echo $creator->title_as_link(); ?> <?php } if ($this->show_date) { ?> on <?php echo $release->time_created->format($t); } ?> </p> <?php } }
/** * Store the form's values for this change. * @param RELEASE $obj * @access private */ protected function _store_to_object($obj) { $obj->summary = $this->value_for('summary'); /** @var DATE_TIME $time_scheduled */ $time_scheduled = $this->value_for('time_scheduled'); $obj->set_time_scheduled($time_scheduled); /** @var DATE_TIME $time_testing_scheduled */ $time_testing_scheduled = $this->value_for('time_testing_scheduled'); $obj->set_time_testing_scheduled($time_testing_scheduled); $obj->branch_id = $this->value_for('branch_id'); parent::_store_to_object($obj); switch ($this->value_for('state')) { case Hidden: $obj->hide(Defer_database_update); break; case Planned: $obj->plan(Defer_database_update); break; case Testing: $obj->test(Defer_database_update); break; case Shipped: $obj->ship(Defer_database_update); break; case Locked: $obj->lock(Defer_database_update); break; } }
/** * Delete the given object. * @param RELEASE $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); }
/** * 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(); }