/**
  * Does this form hold valid data for this change?
  * @param CHANGE $obj
  * @access private
  */
 protected function _post_validate($obj)
 {
     parent::_post_validate($obj);
     if (!$this->value_for('title') && !$this->value_for('description')) {
         $this->record_error('title', 'Please provide a title or description.');
     }
 }
Example #2
0
 /**
  * Draw the selectors for branch properties.
  * If the branch or release is locked, the values should be displayed as read-only.
  * @param BRANCH $branch
  * @param FORM_RENDERER $renderer
  * @param boolean $visible Is this branch enabled for this project entry?
  * @param RELEASE $release Release in this branch (may be empty).
  * @access private
  */
 protected function _draw_branch_info_controls($branch, $renderer, $visible, $release)
 {
     /* Get the list of statuses for this branch. */
     $selected_status = $this->value_for("branch_{$branch->id}_status");
     /** @var $display_options PROJECT_APPLICATION_DISPLAY_OPTIONS */
     $display_options = $this->app->display_options;
     if ($this->cloning() || !$this->object_exists()) {
         $statuses = $display_options->job_statuses();
     } else {
         $statuses = $display_options->job_statuses_for($selected_status);
     }
     if ($this->_branch_is_locked($branch, $release)) {
         if ($visible) {
             $renderer->draw_hidden("branch_{$branch->id}_status");
             $renderer->draw_hidden("branch_{$branch->id}_priority");
             $status = $statuses[$selected_status];
             $renderer->draw_text_row('Status', $this->context->get_icon_with_text($status->icon, Sixteen_px, $status->title));
             $renderer->draw_error_row("branch_{$branch->id}_status");
             $priorities = $display_options->job_priorities();
             $priority = $priorities[$this->value_for("branch_{$branch->id}_priority")];
             $renderer->draw_text_row('Priority', $this->context->get_icon_with_text($priority->icon, Sixteen_px, $priority->title));
             $renderer->draw_error_row("branch_{$branch->id}_priority");
         }
     } else {
         // Draw statuses
         $props = $renderer->make_list_properties();
         $props->css_class = 'medium';
         foreach ($statuses as $status) {
             $props->add_item($status->title, $status->value);
         }
         $renderer->draw_drop_down_row("branch_{$branch->id}_status", $props);
         // Draw priorities
         $props = $renderer->make_list_properties();
         $props->css_class = 'medium';
         $priorities = $display_options->job_priorities();
         foreach ($priorities as $priority) {
             $props->add_item($priority->title, $priority->value);
         }
         $renderer->draw_drop_down_row("branch_{$branch->id}_priority", $props);
     }
     // Draw inherited properties
     parent::_draw_branch_info_controls($branch, $renderer, $visible, $release);
 }