Exemplo n.º 1
0
 public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
 {
     if ($this->workflow_factory->deleteWorkflow($request->get('delete'))) {
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('workflow_admin', 'deleted'));
         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => (int) $this->tracker->id, 'func' => Workflow::FUNC_ADMIN_TRANSITIONS)));
     }
 }
Exemplo n.º 2
0
 public function process(Tracker_IDisplayTrackerLayout $layout, Codendi_Request $request, PFUser $current_user)
 {
     if (!$this->tracker->userCanSubmitArtifact($current_user)) {
         $this->logsErrorAndRedirectToTracker('plugin_tracker_admin', 'access_denied');
         return;
     }
     $from_artifact = $this->artifact_factory->getArtifactByIdUserCanView($current_user, $request->get('from_artifact_id'));
     if (!$from_artifact || $from_artifact->getTracker() !== $this->tracker) {
         $this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
         return;
     }
     $from_changeset = $from_artifact->getChangeset($request->get('from_changeset_id'));
     if (!$from_changeset) {
         $this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
         return;
     }
     $submitted_values = $request->get('artifact');
     if (!is_array($submitted_values)) {
         $this->logsErrorAndRedirectToTracker('plugin_tracker_include_type', 'error_missing_param');
         return;
     }
     try {
         $this->processCopy($from_changeset, $current_user, $submitted_values);
     } catch (Tracker_XML_Exporter_TooManyChildrenException $exception) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_artifact', 'copy_too_many_children', array(Tracker_XML_ChildrenCollector::MAX)));
         $this->redirectToArtifact($from_artifact);
     }
 }
Exemplo n.º 3
0
 public function index(Codendi_Request $request)
 {
     if (!$request->get('type_of_search')) {
         $request->set('type_of_search', Search_SearchProject::NAME);
     }
     $this->results($request);
 }
Exemplo n.º 4
0
 /**
  * @see Cardwall_OnTop_Config_Command::execute()
  */
 public function execute(Codendi_Request $request)
 {
     if ($request->get('new_column')) {
         $this->dao->create($this->tracker->getId(), $request->get('new_column'));
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_cardwall', 'on_top_column_added'));
     }
 }
Exemplo n.º 5
0
 private function getControllerFromRequest(Codendi_Request $request)
 {
     if ($request->get('pane') == 'gerrit_servers_admin') {
         return new Git_AdminGerritController($this->csrf, $this->gerrit_server_factory);
     } else {
         return new Git_AdminMirrorController($this->csrf, $this->git_mirror_mapper, $this->git_mirror_resource_restrictor, $this->project_manager, $this->git_mirror_manifest_manager, $this->git_system_event_manager);
     }
 }
Exemplo n.º 6
0
 protected function enhanceRedirect(Codendi_Request $request)
 {
     $from_aid = $request->get('from_aid');
     if ($from_aid != null) {
         $this->redirect->query_parameters['from_aid'] = $from_aid;
     }
     parent::enhanceRedirect($request);
 }
 public function update(Codendi_Request $request, Response $response)
 {
     $emailgateway_mode = $request->get('emailgateway_mode');
     if ($emailgateway_mode && $this->config->setEmailgatewayMode($emailgateway_mode)) {
         $response->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('admin_main', 'successfully_updated'));
     }
     $response->redirect($_SERVER['REQUEST_URI']);
 }
Exemplo n.º 8
0
 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 sendResponse(Codendi_Request $request, $feedback_level, $message, $unsubscribe)
 {
     if ($request->isAjax()) {
         $this->sendAjaxResponse($unsubscribe, $message);
         return;
     }
     $GLOBALS['Response']->addFeedback($feedback_level, $message);
     $GLOBALS['Response']->redirect($this->artifact->getUri());
 }
 public function update(Codendi_Request $request, Response $response)
 {
     $emailgateway_mode = $request->get('emailgateway_mode');
     if ($emailgateway_mode && $this->config->setEmailgatewayMode($emailgateway_mode)) {
         $response->addFeedback(Feedback::INFO, $GLOBALS['Language']->getText('plugin_tracker_config', 'successfully_updated'));
     }
     $this->event_manager->processEvent(Event::UPDATE_ALIASES, null);
     $response->redirect($_SERVER['REQUEST_URI']);
 }
 private function linkArtifact(PFUser $current_user, Tracker_Artifact $new_artifact)
 {
     $artifact_link_id = $this->request->get('artifact-link-id');
     $source_artifact = $this->tracker_artifact_factory->getArtifactById($artifact_link_id);
     if (!$source_artifact) {
         return;
     }
     $source_artifact->linkArtifact($new_artifact->getId(), $current_user);
 }
Exemplo n.º 12
0
 /**
  * @return Tracker_Artifact_View_View
  */
 private function getRequestedView(Codendi_Request $request)
 {
     if (isset($this->views[$request->get('view')])) {
         return $this->views[$request->get('view')];
     } else {
         list(, $first_view) = each($this->views);
         return $first_view;
     }
 }
 public function route(Codendi_Request $request)
 {
     $controller = new Project_OneStepCreation_OneStepCreationController($request, $this->project_manager, $this->custom_description_factory, $this->trove_cat_factory);
     if ($request->get('create_project')) {
         $controller->create();
     } else {
         $controller->index();
     }
 }
Exemplo n.º 14
0
 /**
  * @see Cardwall_OnTop_Config_Command::execute()
  */
 public function execute(Codendi_Request $request)
 {
     if ($request->get('add_mapping_on')) {
         $new_mapping_tracker = $this->tracker_factory->getTrackerById($request->get('add_mapping_on'));
         if ($new_mapping_tracker && $this->dao->create($this->tracker->getId(), $new_mapping_tracker->getId(), null)) {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_cardwall', 'on_top_mapping_added', array($new_mapping_tracker->getName())));
         }
     }
 }
 private function updateGerritServers(Codendi_Request $request)
 {
     $request_gerrit_servers = $request->get('gerrit_servers');
     if (is_array($request_gerrit_servers)) {
         $this->csrf->check();
         $this->fetchGerritServers();
         $this->updateServers($request_gerrit_servers);
         $GLOBALS['Response']->redirect('/plugins/git/admin/?pane=gerrit_servers_admin');
     }
 }
Exemplo n.º 16
0
 /**
  * @return boolean
  */
 private function getSendNotificationsFromRequest(Codendi_Request $request)
 {
     $send_notifications = false;
     if ($request->exist('notify')) {
         if ($request->get('notify') == 'ok') {
             $send_notifications = true;
         }
     }
     return $send_notifications;
 }
Exemplo n.º 17
0
 public function route()
 {
     if (!$this->request->getCurrentUser()->isSuperUser()) {
         $this->controller->notSiteAdmin();
     } elseif ($this->request->get('update')) {
         $this->controller->update();
     } else {
         $this->controller->index();
     }
 }
Exemplo n.º 18
0
 public function display()
 {
     $git_php_viewer = new GitViews_GitPhpViewer($this->repository, $this->controller->getPlugin()->getConfigurationParameter('gitphp_path'));
     if ($this->request->get('noheader') == 1) {
         $view = new GitViews_ShowRepo_Download($git_php_viewer);
     } else {
         $view = new GitViews_ShowRepo_Content($this->repository, $git_php_viewer, $this->request->getCurrentUser(), $this->controller, $this->url_manager, $this->driver_factory, $this->gerrit_usermanager, $this->mirror_data_mapper, $this->gerrit_servers, $this->controller->getPlugin()->getThemePath());
     }
     $view->display();
 }
 private function getSourceArtifact()
 {
     $source_artifact = null;
     if ($this->request->get('func') == 'new-artifact-link') {
         $source_artifact = $this->artifact_factory->getArtifactById($this->request->get('id'));
     } elseif ($this->request->get('child_milestone')) {
         $source_artifact = $this->artifact_factory->getArtifactById($this->request->get('child_milestone'));
     }
     return $source_artifact;
 }
 protected function fetchFormElements(Codendi_Request $request)
 {
     $html = '';
     $html .= '<div class="tracker_artifact">';
     foreach ($this->tracker->getFormElements() as $form_element) {
         $html .= $form_element->fetchSubmit($request->get('artifact'));
     }
     $html .= '</div>';
     return $html;
 }
Exemplo n.º 21
0
function register_valid(Codendi_Request $request)
{
    global $Language;
    if (!$request->existAndNonEmpty('Update')) {
        return false;
    }
    if (!$request->existAndNonEmpty('user_id')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_userid'));
        return false;
    }
    if (!$request->existAndNonEmpty('form_pw')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_nopasswd'));
        return false;
    }
    if ($request->get('form_pw') != $request->get('form_pw2')) {
        $GLOBALS['Response']->addFeedback('error', $Language->getText('admin_user_changepw', 'error_passwd'));
        return false;
    }
    $errors = array();
    if (!account_pwvalid($request->get('form_pw'), $errors)) {
        foreach ($errors as $e) {
            $GLOBALS['Response']->addFeedback('error', $e);
        }
        return false;
    }
    // if we got this far, it must be good
    $user_manager = UserManager::instance();
    $user = $user_manager->getUserById($request->get('user_id'));
    $user->setPassword($request->get('form_pw'));
    if (!$user_manager->updateDb($user)) {
        $GLOBALS['Response']->addFeedback(Feedback::ERROR, $Language->getText('admin_user_changepw', 'error_update'));
        return false;
    }
    return true;
}
 /**
  * @see Cardwall_OnTop_Config_Command::execute()
  */
 public function execute(Codendi_Request $request)
 {
     if (is_array($request->get('custom_mapping'))) {
         foreach ($request->get('custom_mapping') as $mapping_tracker_id => $is_custom) {
             $mapping_tracker = $this->tracker_factory->getTrackerById($mapping_tracker_id);
             if ($this->canDelete($is_custom, $mapping_tracker) && $this->delete($mapping_tracker)) {
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_cardwall', 'on_top_mapping_removed', array($mapping_tracker->getName())));
             }
         }
     }
 }
 private function fetchNewArtifactForm(Codendi_Request $request, PFUser $current_user)
 {
     $html = '';
     $html .= '<input type="hidden" name="link-artifact-id" value="' . $this->source_artifact->getId() . '" />';
     if ($request->get('immediate')) {
         $html .= '<input type="hidden" name="immediate" value="1" />';
     }
     $html .= $this->fetchFormElements($request, $current_user);
     $html .= '<input class="btn btn-primary" type="submit" id="tracker_artifact_submit" value="' . $GLOBALS['Language']->getText('global', 'btn_submit') . '" />';
     return $html;
 }
Exemplo n.º 24
0
 /**
  * @see Cardwall_OnTop_Config_Command::execute()
  */
 public function execute(Codendi_Request $request)
 {
     if ($request->get('column')) {
         foreach ($request->get('column') as $id => $column_definition) {
             $column_label = $column_definition['label'];
             if (!empty($column_label) && $this->dao->save($this->tracker->getId(), $id, $column_label)) {
                 $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_cardwall', 'on_top_column_changed', array($column_label)));
             }
         }
     }
 }
 /**
  * Process the request
  *
  * @param Tracker_IDisplayTrackerLayout  $layout          Displays the page header and footer
  * @param Codendi_Request                $request         The data coming from the user
  * @param PFUser                         $current_user    The user who mades the request
  *
  * @return void
  */
 public function process(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     switch ($request->get('func')) {
         case 'toggle-collapse':
             $current_user = $request->getCurrentUser();
             $current_user->togglePreference('fieldset_' . $this->getId(), 1, 0);
             break;
         default:
             parent::process($layout, $request, $current_user);
     }
 }
Exemplo n.º 26
0
 /**
  * Returns true when the $request contains sufficent data to create a valid
  * Planning.
  * 
  * Existing planning update validation is not implemented yet.
  * 
  * @param Codendi_Request $request
  * 
  * @return bool
  */
 public function isValid(Codendi_Request $request)
 {
     $group_id = $request->get('group_id');
     $planning_id = $request->get('planning_id');
     $planning_parameters = $request->get('planning');
     if (!$planning_parameters) {
         $planning_parameters = array();
     }
     $planning_parameters = PlanningParameters::fromArray($planning_parameters);
     return $this->nameIsPresent($planning_parameters) && $this->backlogTrackerIdIsPresentAndIsAPositiveIntegers($planning_parameters) && $this->planningTrackerIdIsPresentAndIsAPositiveInteger($planning_parameters) && $this->planningTrackerIsNotThePlanningTrackerOfAnotherPlanningInTheSameProject($group_id, $planning_id, $planning_parameters);
 }
Exemplo n.º 27
0
 public function route(Codendi_Request $request)
 {
     if ($request->existAndNonEmpty('type_of_search')) {
         if ($request->isAjax()) {
             $this->controller->ajaxResults($request);
         } else {
             $this->controller->results($request);
         }
     } else {
         $this->controller->index($request);
     }
 }
Exemplo n.º 28
0
 /**
  * Process the artifact functions
  *
  * @param Transition      $transition   The transition
  * @param Codendi_Request $request      The data from the user
  * @param PFUser            $current_user The current user
  *
  * @return void
  */
 public function process(Transition $transition, Codendi_Request $request, PFUser $current_user)
 {
     $transition_condition_factory = $this->getConditionFactory();
     // Create new condition
     if ($request->existAndNonEmpty('add_notempty_condition')) {
         $transition_condition_factory->addCondition($transition, $request->get('add_notempty_condition'));
     }
     // Loop over defined actions and update them if relevant
     foreach ($transition->getConditions() as $condition) {
         $condition->process($request);
     }
 }
 /**
  * Extract the redirection parameters contained in the request
  * @param Codendi_Request $request
  * @return array || null containing pane, planning_id, artifact_id and action
  */
 public function extractParametersFromRequest(Codendi_Request $request)
 {
     $planning = $request->get('planning');
     if (!is_array($planning) || !count($planning)) {
         return;
     }
     list($pane_identifier, $from_planning) = each($planning);
     if (is_array($from_planning) && count($from_planning)) {
         list($planning_id, $planning_artifact_id) = each($from_planning);
         return array(self::PANE => $pane_identifier, self::PLANNING_ID => $planning_id, self::ARTIFACT_ID => $planning_artifact_id, self::ACTION => 'show');
     }
 }
 /**
  * Process the artifact functions
  *
  * @param Transition      $transition   The transition
  * @param Codendi_Request $request      The data from the user
  * @param PFUser            $current_user The current user
  *
  * @return void
  */
 public function process(Transition $transition, Codendi_Request $request, PFUser $current_user)
 {
     $tpaf = $this->getPostActionFactory();
     // Create new post-action
     if ($request->existAndNonEmpty('add_postaction')) {
         $tpaf->addPostAction($transition, $request->get('add_postaction'));
     }
     // Loop over defined actions and update them if relevant
     foreach ($transition->getAllPostActions() as $post_action) {
         $post_action->process($request);
     }
 }