public function __construct(Codendi_Request $request) { $this->project = $request->getProject(); $this->words = $request->get('words'); $this->offset = intval($request->getValidated('offset', 'uint', 0)); $this->exact = $request->getValidated('exact', 'uint', false); $this->trackerv3id = $request->getValidated('atid', 'uint', 0); $this->forum_id = $request->getValidated('forum_id', 'uint', 0); $this->is_ajax = $request->isAjax(); $this->type_of_search = $request->get('type_of_search'); }
private function getUGroup(Codendi_Request $request) { $ugroup_id = $request->getValidated('ugroup_id', 'uint', 0); if (!$ugroup_id) { exit_error($GLOBALS['Language']->getText('global', 'error'), 'The ugroup ID is missing'); } return $this->ugroup_manager->getById($ugroup_id); }
private function updateLabels($new_access_value) { if ($new_access_value === ForgeAccess::RESTRICTED) { $this->manager->updateLabels(trim($this->request->getValidated('ugroup_authenticated_users', 'string', '')), trim($this->request->getValidated('ugroup_registered_users', 'string', ''))); } else { $this->manager->updateLabels('', ''); } }
public function linkWithParents(Codendi_Request $request, Tracker_Artifact $artifact) { $user = $request->getCurrentUser(); $ancestors = $artifact->getAllAncestors($user); if (count($ancestors) == 0) { $artifact_id = (int) $request->getValidated('link-artifact-id', 'uint', 0); $source_artifact = $this->artifact_factory->getArtifactById($artifact_id); if ($source_artifact) { foreach ($source_artifact->getAllAncestors($user) as $ancestor) { $ancestor->linkArtifact($artifact->getId(), $user); } } } }
public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user) { try { if (!$request->isPost()) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, 'Method must be post'); $GLOBALS['Response']->sendStatusCode(405); return false; } $rule = $this->rule_manager->getRuleById($request->getValidated('id', 'uint', 0)); $this->rule_manager->delete($this->tracker, $rule); } catch (Tracker_Exception $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); $GLOBALS['Response']->sendStatusCode(400); } }
public function doCreateTracker(Project $project, Codendi_Request $request) { $is_error = false; $new_tracker = null; $name = trim($request->get('name')); $description = trim($request->get('description')); $itemname = trim($request->get('itemname')); $atid_template = $request->getValidated('atid_template', 'uint', 0); // First try XML if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'xml') { $vFile = new Valid_File('tracker_new_xml_file'); $vFile->required(); if ($request->validFile($vFile)) { try { $user_finder = new XMLImportHelper(UserManager::instance()); $new_tracker = TrackerXmlImport::build($user_finder)->createFromXMLFileWithInfo($project->getID(), $_FILES["tracker_new_xml_file"]["tmp_name"], $name, $description, $itemname); } catch (XML_ParseException $exception) { $this->displayCreateTrackerFromXMLErrors($project, $exception->getErrors(), $exception->getFileLines()); } catch (TrackerFromXmlException $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); } } } else { if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'tv3') { $atid = $request->get('tracker_new_tv3'); $user = UserManager::instance()->getCurrentUser(); $new_tracker = $this->getTrackerFactory()->createFromTV3($user, $atid, $project, $name, $description, $itemname); } else { if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'migrate_from_tv3') { $tracker_id = $request->get('tracker_new_tv3'); if ($this->getTV3MigrationManager()->askForMigration($project, $tracker_id, $name, $description, $itemname)) { $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $project->group_id); } } else { // Otherwise tries duplicate $duplicate = $this->getTrackerFactory()->create($project->getId(), -1, $atid_template, $name, $description, $itemname); $new_tracker = $duplicate['tracker']; } } } if ($new_tracker) { $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $project->group_id . '&tracker=' . $new_tracker->id); } else { $tracker_template = $this->getTrackerFactory()->getTrackerById($atid_template); $this->displayCreateTracker($project, $request, $name, $description, $itemname, $tracker_template); } }
/** * Routes some milestone-related requests. * * TODO: * - merge into AgileDashboardRouter::route() * * @param Codendi_Request $request */ public function routeShowPlanning(Codendi_Request $request) { $aid = $request->getValidated('aid', 'int', 0); switch ($aid) { case -1: $controller = new Planning_ArtifactCreationController($this->planning_factory, $request); $this->executeAction($controller, 'createArtifact'); break; case 0: $controller = new Planning_MilestoneSelectorController($request, $this->milestone_factory); $this->executeAction($controller, 'show'); /* no break */ /* no break */ default: $controller = $this->milestone_controller_factory->getMilestoneController($request); $action_arguments = array(); $this->renderAction($controller, 'show', $request, $action_arguments, array('body_class' => array('agiledashboard_planning'))); } }
/** * Returns HTML code to display the artifact history * * @param Codendi_Request $request The data from the user * * @return String The valid followup comment format */ private function validateCommentFormat($request, $comment_format_field_name) { $default_format = Tracker_Artifact_Changeset_Comment::TEXT_COMMENT; $formats = array(Tracker_Artifact_Changeset_Comment::TEXT_COMMENT, Tracker_Artifact_Changeset_Comment::HTML_COMMENT); $comment_format = $request->getValidated($comment_format_field_name, new Valid_WhiteList($comment_format_field_name, $formats), $default_format); return $comment_format; }
/** * Routes some milestone-related requests. * * TODO: * - merge into AgileDashboardRouter::route() * * @param Codendi_Request $request */ public function routeShowPlanning(Codendi_Request $request) { $aid = $request->getValidated('aid', 'int', 0); switch ($aid) { case -1: $controller = new Planning_ArtifactCreationController($this->getPlanningFactory(), $request); $this->executeAction($controller, 'createArtifact'); break; case 0: $controller = new Planning_MilestoneSelectorController($request, $this->getMilestoneFactory()); $this->executeAction($controller, 'show'); default: $controller = $this->buildMilestoneController($request); $action_arguments = array($this->getViewBuilder($request)); $this->renderAction($controller, 'show', $request, $action_arguments); } }
private function newVersionApprovalTable(Codendi_Request $request, Docman_Item $item, PFUser $user) { $vImport = new Valid_WhiteList('app_table_import', array('copy', 'reset', 'empty')); $vImport->required(); $import = $request->getValidated('app_table_import', $vImport, false); if ($import) { $atf = Docman_ApprovalTableFactoriesFactory::getFromItem($item); $atf->createTable($user->getId(), $request->get('app_table_import')); } }
public function doCreateTracker(Project $project, Codendi_Request $request) { $is_error = false; $new_tracker = null; $name = trim($request->get('name')); $description = trim($request->get('description')); $itemname = trim($request->get('itemname')); $atid_template = $request->getValidated('atid_template', 'uint', 0); // First try XML if ($request->existAndNonEmpty('create_mode') && $request->get('create_mode') == 'xml') { $vFile = new Valid_File('tracker_new_xml_file'); $vFile->required(); if ($request->validFile($vFile)) { $new_tracker = $this->importTracker($project, $name, $description, $itemname, $_FILES["tracker_new_xml_file"]["tmp_name"]); } } else { // Otherwise tries duplicate $duplicate = $this->getTrackerFactory()->create($project->getId(), -1, $atid_template, $name, $description, $itemname); $new_tracker = $duplicate['tracker']; } if ($new_tracker) { $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $project->group_id . '&tracker=' . $new_tracker->id); } else { $tracker_template = $this->getTrackerFactory()->getTrackerById($atid_template); $this->displayCreateTracker($project, $request, $name, $description, $itemname, $tracker_template); } }
/** * * @param Tracker_IDisplayTrackerLayout $layout * @param Codendi_Request $request * @param User $current_user */ public function process(Tracker_IDisplayTrackerLayout $layout, $request, $current_user) { switch ($request->get('func')) { case self::FUNC_SHOW_BURNDOWN: try { $artifact_id = $request->getValidated('src_aid', 'uint', 0); $artifact = Tracker_ArtifactFactory::instance()->getArtifactById($artifact_id); if (!$artifact) { return false; } $this->fetchBurndownImage($artifact, $current_user); } catch (Tracker_FormElement_Field_BurndownException $e) { $this->displayErrorImage($GLOBALS['Language']->getText('plugin_tracker', $e->getMessage())); } break; default: parent::process($layout, $request, $current_user); } }
private function getSourceArtifact(Codendi_Request $request, $key) { $artifact_id = (int) $request->getValidated($key, 'uint', 0); return $this->artifact_factory->getArtifactById($artifact_id); }
public function process(Codendi_Request $request) { switch ($request->get('action')) { case 'toggle_user_autostack_column': $display_preferences_controller = new Cardwall_UserPreferences_UserPreferencesController($request); $display_preferences_controller->toggleAutostack(); break; case 'toggle_user_display_avatar': $display_preferences_controller = new Cardwall_UserPreferences_UserPreferencesController($request); $display_preferences_controller->toggleUserDisplay(); break; case 'get-card': try { $single_card_builder = new Cardwall_SingleCardBuilder($this->getConfigFactory(), new Cardwall_CardFields(UserManager::instance(), Tracker_FormElementFactory::instance()), Tracker_ArtifactFactory::instance(), PlanningFactory::build()); $controller = new Cardwall_CardController($request, $single_card_builder->getSingleCard($request->getCurrentUser(), $request->getValidated('id', 'uint', 0), $request->getValidated('planning_id', 'uint', 0))); $controller->getCard(); } catch (Exception $exception) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $exception->getMessage()); $GLOBALS['Response']->sendStatusCode(400); } break; default: echo 'Hello !'; } }
private function processBoomerangDatas(Codendi_Request $request) { $csrf = $this->getCSRFToken(); $csrf->check(); $cache_folder = $this->getCacheFolder(); if (!file_exists($cache_folder)) { mkdir($cache_folder, 0755, TRUE); } $page_load_time = $request->getValidated('t_done', 'uint', 0); $dom_content_load_time = 0; $boomerang_other_measures = $this->makeArrayFromStringHashTable($request->getValidated('t_other', 'string', '')); if (array_key_exists('boomr_fb', $boomerang_other_measures)) { $dom_content_load_time = (int) $boomerang_other_measures['boomr_fb']; $dom_content_load_time = $dom_content_load_time > 0 ? $dom_content_load_time : 0; } parse_str(parse_url($request->getValidated('u', 'string', ''), PHP_URL_QUERY), $url_parameters); $group_id = array_key_exists('group_id', $url_parameters) ? $url_parameters['group_id'] : null; $project_manager = ProjectManager::instance(); if (!$project_manager->getProject($group_id)) { $group_id = 0; } $datas = array("page_loading" => $page_load_time, "dom_loading" => $dom_content_load_time); if ($datas["page_loading"] == 0 || $datas["dom_loading"] == 0 || $group_id == 0) { exit; } $boomerangDatasProcessor = new BoomerangDatasProcessor($cache_folder, $datas, $group_id); $boomerangDatasProcessor->handle(); }