public function process(TrackerManager $tracker_manager, $request, $current_user)
 {
     if ($request->get('submit')) {
         if ($request->exist('stop_notification')) {
             if ($this->tracker->stop_notification != $request->get('stop_notification')) {
                 $this->tracker->stop_notification = $request->get('stop_notification') ? 1 : 0;
                 $dao = new TrackerDao();
                 if ($dao->save($this->tracker)) {
                     $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin_notification', 'successfully_updated'));
                 }
             }
         }
         if ($global_notification_data = $request->get('global_notification')) {
             if (!empty($global_notification_data)) {
                 $this->processGlobalNotificationData($global_notification_data);
             }
         }
     } else {
         if ($request->get('action') == 'remove_global') {
             $this->removeGlobalNotification($request->get('global_notification_id'));
         }
     }
     $this->displayAdminNotifications($tracker_manager, $request, $current_user);
     $reminderRenderer = new Tracker_DateReminderRenderer($this->tracker);
     if ($this->tracker->userIsAdmin($current_user)) {
         $reminderRenderer->displayDateReminders($request);
     }
     $reminderRenderer->displayFooter($tracker_manager);
 }
Beispiel #2
0
 protected function editOptions($request)
 {
     $project = ProjectManager::instance()->getProject($this->group_id);
     $old_item_name = $this->getItemName();
     $old_name = $this->getName();
     $this->name = trim($request->getValidated('name', 'string', ''));
     $this->description = trim($request->getValidated('description', 'text', ''));
     $this->item_name = trim($request->getValidated('item_name', 'string', ''));
     $this->allow_copy = $request->getValidated('allow_copy') ? 1 : 0;
     $this->submit_instructions = $request->getValidated('submit_instructions', 'text', '');
     $this->browse_instructions = $request->getValidated('browse_instructions', 'text', '');
     $this->instantiate_for_new_projects = $request->getValidated('instantiate_for_new_projects') ? 1 : 0;
     if (!$this->name || !$this->description || !$this->item_name) {
         $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'name_requ'));
     } else {
         if ($old_name != $this->name) {
             if (TrackerFactory::instance()->isNameExists($this->name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'name_already_exists', $this->name));
                 return false;
             }
         }
         if ($old_item_name != $this->item_name) {
             if (!$this->itemNameIsValid($this->item_name)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'invalid_shortname', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             if (TrackerFactory::instance()->isShortNameExists($this->item_name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'shortname_already_exists', $this->item_name));
                 return false;
             }
             $reference_manager = ReferenceManager::instance();
             if (!$reference_manager->checkKeyword($this->item_name)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'invalid_shortname', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             if ($reference_manager->_isKeywordExists($this->item_name, $this->group_id)) {
                 $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_common_type', 'shortname_already_exists', $this->item_name, CODENDI_PURIFIER_CONVERT_HTML));
                 return false;
             }
             //Update reference and cross references
             //WARNING this replace existing reference(s) so that all old_item_name reference won't be extracted anymore
             $reference_manager->updateProjectReferenceShortName($this->group_id, $old_item_name, $this->item_name);
         }
         $dao = new TrackerDao();
         if ($dao->save($this)) {
             $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('plugin_tracker_admin', 'successfully_updated'));
         } else {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('global', 'error'));
         }
     }
 }