Beispiel #1
0
 public function process(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     //TODO: log the admin actions (add a formElement, ...) ?
     $hp = Codendi_HTMLPurifier::instance();
     $func = (string) $request->get('func');
     switch ($func) {
         case 'new-artifact':
             if ($this->userCanSubmitArtifact($current_user)) {
                 $this->displaySubmit($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'new-artifact-link':
             $link = $request->get('id');
             if ($this->userCanSubmitArtifact($current_user)) {
                 $this->displaySubmit($layout, $request, $current_user, $link);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
             }
             break;
         case 'delete':
             if ($this->userCanDeleteTracker($current_user)) {
                 if ($this->getTrackerFactory()->markAsDeleted($this->id)) {
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'delete_success', $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML)));
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'tracker_deleted', $GLOBALS['sys_email_admin']), CODENDI_PURIFIER_FULL);
                 } else {
                     $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'deletion_failed', $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML)));
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
             }
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $this->group_id);
             break;
         case 'admin':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdmin($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-editoptions':
             if ($this->userIsAdmin($current_user)) {
                 if ($request->get('update')) {
                     $this->editOptions($request);
                 }
                 $this->displayAdminOptions($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdminPerms($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms-tracker':
             if ($this->userIsAdmin($current_user)) {
                 if ($request->get('update')) {
                     //TODO : really bad! _REQUEST must be processed before using it, or refactor: use request object
                     plugin_tracker_permission_process_update_tracker_permissions($this->getGroupId(), $this->getId(), $_REQUEST);
                 }
                 $this->displayAdminPermsTracker($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms-fields':
             if ($this->userIsAdmin($current_user)) {
                 if ($request->exist('update')) {
                     if ($request->exist('permissions') && is_array($request->get('permissions'))) {
                         plugin_tracker_permission_process_update_fields_permissions($this->getGroupId(), $this->getId(), Tracker_FormElementFactory::instance()->getUsedFields($this), $request->get('permissions'));
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_userperms', 'perm_upd'));
                     }
                 }
                 $this->displayAdminPermsFields($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-formElements':
             if ($this->userIsAdmin($current_user)) {
                 if (is_array($request->get('add-formElement'))) {
                     list($formElement_id, ) = each($request->get('add-formElement'));
                     if (Tracker_FormElementFactory::instance()->addFormElement($formElement_id)) {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'field_added'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . (int) $this->getId() . '&func=admin-formElements');
                     }
                 } else {
                     if (is_array($request->get('create-formElement'))) {
                         list($type, ) = each($request->get('create-formElement'));
                         if ($request->get('docreate-formElement') && is_array($request->get('formElement_data'))) {
                             try {
                                 $this->createFormElement($type, $request->get('formElement_data'), $current_user);
                             } catch (Exception $e) {
                                 $GLOBALS['Response']->addFeedback('error', $e->getMessage());
                             }
                             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => $this->getId(), 'func' => $func)));
                         } else {
                             Tracker_FormElementFactory::instance()->displayAdminCreateFormElement($layout, $request, $current_user, $type, $this);
                             exit;
                         }
                     }
                 }
                 $this->displayAdminFormElements($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-formElement-update':
         case 'admin-formElement-remove':
         case 'admin-formElement-delete':
             if ($this->userIsAdmin($current_user)) {
                 if ($formElement = Tracker_FormElementFactory::instance()->getFormElementById((int) $request->get('formElement'))) {
                     $formElement->process($layout, $request, $current_user);
                 } else {
                     $this->displayAdminFormElements($layout, $request, $current_user);
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-semantic':
             if ($this->userIsAdmin($current_user)) {
                 $this->getTrackerSemanticManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-notifications':
             if ($this->userIsAdmin($current_user)) {
                 $this->getDateReminderManager()->processReminder($layout, $request, $current_user);
                 $this->getNotificationsManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'notifications':
             // you just need to be registered to have access to this part
             if ($current_user->isLoggedIn()) {
                 $this->getDateReminderManager()->processReminder($layout, $request, $current_user);
                 $this->getNotificationsManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'display_reminder_form':
             print $this->getDateReminderManager()->getDateReminderRenderer()->getNewDateReminderForm();
             break;
         case 'admin-canned':
             // TODO : project members can access this part ?
             if ($this->userIsAdmin($current_user)) {
                 $this->getCannedResponseManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-workflow':
             if ($this->userIsAdmin($current_user)) {
                 $this->getWorkflowManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-csvimport':
             $session = new Codendi_Session();
             if ($this->userIsAdmin($current_user)) {
                 if ($request->exist('action') && $request->get('action') == 'import_preview' && array_key_exists('csv_filename', $_FILES)) {
                     // display preview before importing artifacts
                     $this->displayImportPreview($layout, $request, $current_user, $session);
                 } elseif ($request->exist('action') && $request->get('action') == 'import') {
                     $csv_header = $session->get('csv_header');
                     $csv_body = $session->get('csv_body');
                     if ($this->importFromCSV($layout, $request, $current_user, $csv_header, $csv_body)) {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_import', 'import_succeed'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
                     } else {
                         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin_import', 'import_failed'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
                     }
                 }
                 $this->displayAdminCSVImport($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-export':
             if ($this->userIsAdmin($current_user)) {
                 // TODO: change directory
                 $this->sendXML($this->exportToXML());
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-dependencies':
             if ($this->userIsAdmin($current_user)) {
                 $this->getRulesManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'submit-artifact':
             $action = new Tracker_Action_CreateArtifact($this, $this->getTrackerArtifactFactory(), $this->getTrackerFactory(), $this->getFormElementFactory());
             $action->process($layout, $request, $current_user);
             break;
         case 'admin-hierarchy':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdminItemHeader($layout, 'hierarchy');
                 $this->getHierarchyController($request)->edit();
                 $this->displayFooter($layout);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-hierarchy-update':
             if ($this->userIsAdmin($current_user)) {
                 $this->getHierarchyController($request)->update();
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         default:
             $nothing_has_been_done = true;
             EventManager::instance()->processEvent(TRACKER_EVENT_PROCESS, array('func' => $func, 'tracker' => $this, 'layout' => $layout, 'request' => $request, 'user' => $current_user, 'nothing_has_been_done' => &$nothing_has_been_done));
             if ($nothing_has_been_done) {
                 //If there is nothing to do, display a report
                 if ($this->userCanView($current_user)) {
                     $this->displayAReport($layout, $request, $current_user);
                 }
             }
             break;
     }
     return false;
 }
Beispiel #2
0
 public function redirectUrlAfterArtifactSubmission(Codendi_Request $request, $tracker_id, $artifact_id)
 {
     return parent::redirectUrlAfterArtifactSubmission($request, $tracker_id, $artifact_id);
 }
Beispiel #3
0
 public function process(Tracker_IDisplayTrackerLayout $layout, $request, $current_user)
 {
     //TODO: log the admin actions (add a formElement, ...) ?
     $hp = Codendi_HTMLPurifier::instance();
     $func = (string) $request->get('func');
     switch ($func) {
         case 'new-artifact':
             if ($this->userCanSubmitArtifact($current_user)) {
                 $this->displaySubmit($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'get-create-in-place':
             if ($this->userCanSubmitArtifact($current_user)) {
                 $artifact_link_id = $request->get('artifact-link-id');
                 $render_with_javascript = $request->get('fetch-js') == 'false' ? false : true;
                 $renderer = new Tracker_Artifact_Renderer_CreateInPlaceRenderer($this, TemplateRendererFactory::build()->getRenderer(dirname(TRACKER_BASE_DIR) . '/templates'));
                 $renderer->display($artifact_link_id, $render_with_javascript);
             } else {
                 $GLOBALS['Response']->send400JSONErrors();
             }
             break;
         case 'new-artifact-link':
             $link = $request->get('id');
             if ($this->userCanSubmitArtifact($current_user)) {
                 $this->displaySubmit($layout, $request, $current_user, $link);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
             }
             break;
         case 'delete':
             if ($this->userCanDeleteTracker($current_user)) {
                 if ($this->getTrackerFactory()->markAsDeleted($this->id)) {
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'delete_success', $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML)));
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'tracker_deleted', $GLOBALS['sys_email_admin']), CODENDI_PURIFIER_FULL);
                     $reference_manager = ReferenceManager::instance();
                     $ref = $reference_manager->loadReferenceFromKeywordAndNumArgs(strtolower($this->getItemName()), $this->getGroupId(), 1);
                     if ($ref) {
                         if ($reference_manager->deleteReference($ref)) {
                             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_reference', 't_r_deleted'));
                         }
                     }
                     EventManager::instance()->processEvent(TRACKER_EVENT_TRACKER_DELETE, array('tracker' => $this));
                 } else {
                     $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'deletion_failed', $hp->purify($this->name, CODENDI_PURIFIER_CONVERT_HTML)));
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
             }
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?group_id=' . $this->group_id);
             break;
         case 'admin':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdmin($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-editoptions':
             if ($this->userIsAdmin($current_user)) {
                 if ($request->get('update')) {
                     $this->editOptions($request);
                 }
                 $this->displayAdminOptions($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdminPerms($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms-tracker':
             if ($this->userIsAdmin($current_user)) {
                 $this->getPermissionController()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-perms-fields':
             if ($this->userIsAdmin($current_user)) {
                 if ($request->exist('update')) {
                     if ($request->exist('permissions') && is_array($request->get('permissions'))) {
                         plugin_tracker_permission_process_update_fields_permissions($this->getGroupId(), $this->getId(), Tracker_FormElementFactory::instance()->getUsedFields($this), $request->get('permissions'));
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('project_admin_userperms', 'perm_upd'));
                     }
                 }
                 $this->displayAdminPermsFields($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-formElements':
             if ($this->userIsAdmin($current_user)) {
                 if (is_array($request->get('add-formElement'))) {
                     list($formElement_id, ) = each($request->get('add-formElement'));
                     if (Tracker_FormElementFactory::instance()->addFormElement($formElement_id)) {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_index', 'field_added'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . (int) $this->getId() . '&func=admin-formElements');
                     }
                 } else {
                     if (is_array($request->get('create-formElement'))) {
                         list($type, ) = each($request->get('create-formElement'));
                         if ($request->get('docreate-formElement') && is_array($request->get('formElement_data'))) {
                             try {
                                 $this->createFormElement($type, $request->get('formElement_data'), $current_user);
                             } catch (Exception $e) {
                                 $GLOBALS['Response']->addFeedback('error', $e->getMessage());
                             }
                             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?' . http_build_query(array('tracker' => $this->getId(), 'func' => $func)));
                         } else {
                             Tracker_FormElementFactory::instance()->displayAdminCreateFormElement($layout, $request, $current_user, $type, $this);
                             exit;
                         }
                     }
                 }
                 $this->displayAdminFormElements($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-formElement-update':
         case 'admin-formElement-remove':
         case 'admin-formElement-delete':
             if ($this->userIsAdmin($current_user)) {
                 if ($formElement = Tracker_FormElementFactory::instance()->getFormElementById((int) $request->get('formElement'))) {
                     $formElement->process($layout, $request, $current_user);
                 } else {
                     $this->displayAdminFormElements($layout, $request, $current_user);
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-semantic':
             if ($this->userIsAdmin($current_user)) {
                 $this->getTrackerSemanticManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-notifications':
             if ($this->userIsAdmin($current_user)) {
                 $this->getDateReminderManager()->processReminder($layout, $request, $current_user);
                 $this->getNotificationsManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'notifications':
             // you just need to be registered to have access to this part
             if ($current_user->isLoggedIn()) {
                 $this->getDateReminderManager()->processReminder($layout, $request, $current_user);
                 $this->getNotificationsManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'display_reminder_form':
             print $this->getDateReminderManager()->getDateReminderRenderer()->getNewDateReminderForm();
             break;
         case 'admin-canned':
             // TODO : project members can access this part ?
             if ($this->userIsAdmin($current_user)) {
                 $this->getCannedResponseManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case Workflow::FUNC_ADMIN_RULES:
         case Workflow::FUNC_ADMIN_CROSS_TRACKER_TRIGGERS:
         case Workflow::FUNC_ADMIN_TRANSITIONS:
         case Workflow::FUNC_ADMIN_GET_TRIGGERS_RULES_BUILDER_DATA:
         case Workflow::FUNC_ADMIN_ADD_TRIGGER:
         case Workflow::FUNC_ADMIN_DELETE_TRIGGER:
             if ($this->userIsAdmin($current_user)) {
                 $this->getWorkflowManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-csvimport':
             $session = new Codendi_Session();
             if ($this->userIsAdmin($current_user)) {
                 if ($request->exist('action') && $request->get('action') == 'import_preview' && array_key_exists('csv_filename', $_FILES)) {
                     // display preview before importing artifacts
                     $this->displayImportPreview($layout, $request, $current_user, $session);
                 } elseif ($request->exist('action') && $request->get('action') == 'import') {
                     $csv_header = $session->get('csv_header');
                     $csv_body = $session->get('csv_body');
                     if ($this->importFromCSV($layout, $request, $current_user, $csv_header, $csv_body)) {
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_import', 'import_succeed'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
                     } else {
                         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin_import', 'import_failed'));
                         $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
                     }
                 }
                 $this->displayAdminCSVImport($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-export':
             if ($this->userIsAdmin($current_user)) {
                 // TODO: change directory
                 $xml_element = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><tracker />');
                 $this->sendXML($this->exportToXML($xml_element));
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-dependencies':
             if ($this->userIsAdmin($current_user)) {
                 $this->getGlobalRulesManager()->process($layout, $request, $current_user);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'submit-artifact':
             $action = new Tracker_Action_CreateArtifact($this, $this->getTrackerArtifactFactory(), $this->getTrackerFactory(), $this->getFormElementFactory());
             $action->process($layout, $request, $current_user);
             break;
         case 'submit-copy-artifact':
             $logger = new Tracker_XML_Importer_CopyArtifactInformationsAggregator(new BackendLogger());
             $xml_importer = $this->getArtifactXMLImporterForArtifactCopy($logger);
             $artifact_factory = $this->getTrackerArtifactFactory();
             $file_xml_updater = $this->getFileXMLUpdater();
             $export_children_collector = $this->getChildrenCollector($request);
             $file_path_xml_exporter = new Tracker_XML_Exporter_LocalAbsoluteFilePathXMLExporter();
             $artifact_xml_exporter = $this->getArtifactXMLExporter($export_children_collector, $file_path_xml_exporter, $current_user);
             $action = new Tracker_Action_CopyArtifact($this, $artifact_factory, $artifact_xml_exporter, $xml_importer, $this->getChangesetXMLUpdater(), $file_xml_updater, new Tracker_XML_Exporter_ChildrenXMLExporter($artifact_xml_exporter, $file_xml_updater, $artifact_factory, $export_children_collector), new Tracker_XML_Importer_ChildrenXMLImporter($xml_importer, $this->getTrackerFactory(), $this->getTrackerArtifactFactory(), new Tracker_XML_ChildrenCollector()), new Tracker_XML_Importer_ArtifactImportedMapping(), $logger);
             $action->process($layout, $request, $current_user);
             break;
         case 'submit-artifact-in-place':
             $action = new Tracker_Action_CreateArtifactFromModal($request, $this, $this->getTrackerArtifactFactory());
             $action->process($current_user);
             break;
         case 'admin-hierarchy':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdminItemHeader($layout, 'hierarchy');
                 $this->getHierarchyController($request)->edit();
                 $this->displayFooter($layout);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-hierarchy-update':
             if ($this->userIsAdmin($current_user)) {
                 $this->getHierarchyController($request)->update();
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-clean':
             if ($this->userIsAdmin($current_user)) {
                 $this->displayAdminClean($layout);
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-delete-artifact-confirm':
             if ($this->userIsAdmin($current_user)) {
                 $token = new CSRFSynchronizerToken(TRACKER_BASE_URL . '/?tracker=' . (int) $this->id . '&amp;func=admin-delete-artifact-confirm');
                 $token->check();
                 $artifact_id = $request->getValidated('id', 'uint', 0);
                 $artifact = $this->getTrackerArtifactFactory()->getArtifactById($artifact_id);
                 if ($artifact) {
                     $this->displayAdminConfirmDelete($layout, $artifact);
                 } else {
                     $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'clean_error_noart', array($request->get('id'))));
                     $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId() . '&func=admin-clean');
                 }
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'admin-delete-artifact':
             if ($this->userIsAdmin($current_user)) {
                 $token = new CSRFSynchronizerToken(TRACKER_BASE_URL . '/?tracker=' . (int) $this->id . '&amp;func=admin-delete-artifact');
                 $token->check();
                 if ($request->exist('confirm')) {
                     $artifact = $this->getTrackerArtifactFactory()->getArtifactById($request->get('id'));
                     if ($artifact && $artifact->getTrackerId() == $this->getId()) {
                         $artifact->delete($current_user);
                         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin', 'clean_info_deleted', array($request->get('id'))));
                     } else {
                         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'clean_error_noart', array($request->get('id'))));
                     }
                 } else {
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin', 'clean_cancel_deleted'));
                 }
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId() . '&func=admin');
             } else {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             break;
         case 'create_new_public_report':
             if (!$this->userIsAdmin($current_user)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_admin', 'access_denied'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             $name = $request->get('new_report_name');
             $validator = new Valid_String('new_report_name');
             $validator->required();
             if (!$request->valid($validator)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker', 'create_new_report_invalid'));
                 $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             }
             $hp = Codendi_HTMLPurifier::instance();
             $hp->purify($name);
             $report = new Tracker_Report(0, $name, 'Public rapport', 0, 0, null, 0, $this->getId(), 1, null, 0);
             $report->criterias = array();
             $this->getReportFactory()->saveObject($this->id, $report);
             $GLOBALS['Response']->redirect(TRACKER_BASE_URL . '/?tracker=' . $this->getId());
             break;
         default:
             if ($this->userCanView($current_user)) {
                 $this->displayAReport($layout, $request, $current_user);
             }
             break;
     }
     return false;
 }