public function componentEditAgileBoard() { $i18n = framework\Context::getI18n(); $this->autosearches = array(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES => $i18n->__('Project open issues (recommended)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES_INCLUDING_SUBPROJECTS => $i18n->__('Project open issues (including subprojects)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES => $i18n->__('Project closed issues'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES_INCLUDING_SUBPROJECTS => $i18n->__('Project closed issues (including subprojects)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_REPORTED_THIS_MONTH => $i18n->__('Project issues reported last month'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_WISHLIST => $i18n->__('Project wishlist')); $this->savedsearches = \thebuggenie\core\entities\tables\SavedSearches::getTable()->getAllSavedSearchesByUserIDAndPossiblyProjectID(framework\Context::getUser()->getID(), $this->board->getProject()->getID()); $this->issuetypes = $this->board->getProject()->getIssuetypeScheme()->getIssuetypes(); $this->swimlane_groups = array('priority' => $i18n->__('Issue priority'), 'severity' => $i18n->__('Issue severity'), 'category' => $i18n->__('Issue category')); $this->priorities = \thebuggenie\core\entities\Priority::getAll(); $this->severities = \thebuggenie\core\entities\Severity::getAll(); $this->categories = \thebuggenie\core\entities\Category::getAll(); $fakecolumn = new entities\BoardColumn(); $fakecolumn->setBoard($this->board); $this->fakecolumn = $fakecolumn; }
/** * The project board whiteboard page * * @Route(url="/boards/:board_id/whiteboard") * * @param framework\Request $request */ public function runWhiteboard(framework\Request $request) { $this->forward403unless($this->_checkProjectPageAccess('project_planning')); $this->board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']); $this->forward403unless($this->board instanceof entities\AgileBoard); try { if ($request->isPost()) { $columns = $request['columns']; $saved_columns = array(); $cc = 1; if (is_array($columns)) { foreach ($columns as $details) { if ($details['column_id']) { $column = entities\BoardColumn::getB2DBTable()->selectById($details['column_id']); } else { $column = new entities\BoardColumn(); $column->setBoard($this->board); } if (!$column instanceof entities\BoardColumn) { throw new \Exception($this->getI18n()->__('There was an error trying to save column %column', array('%column' => $details['column_id']))); } $column->setName($details['name']); $column->setSortOrder($details['sort_order']); if (array_key_exists('min_workitems', $details)) { $column->setMinWorkitems($details['min_workitems']); } if (array_key_exists('max_workitems', $details)) { $column->setMaxWorkitems($details['max_workitems']); } $column->setStatusIds(explode(',', $details['status_ids'])); $column->save(); $saved_columns[$column->getID()] = $column->getID(); $cc++; } } foreach ($this->board->getColumns() as $column) { if (!array_key_exists($column->getID(), $saved_columns)) { $column->delete(); } } return $this->renderJSON(array('forward' => $this->getRouting()->generate('agile_whiteboard', array('project_key' => $this->board->getProject()->getKey(), 'board_id' => $this->board->getID())))); } } catch (\Exception $e) { $this->getResponse()->setHttpStatus(400); return $this->renderJSON(array('error' => $e->getMessage())); } $this->selected_milestone = $this->board->getDefaultSelectedMilestone(); }