Example #1
0
 public function preExecute()
 {
     $this->logMessage('Action: [' . $this->getContext()->getActionName() . ']');
     //if ($this->getContext()->getActionName() != 'userLatestPosts')
     //{
     $this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project'));
     $this->forward404Unless($this->project, 'Project not found, unable to retrieve forums');
     //}
     $this->anonymousPosting = sfConfig::get('app_nahoWikiPlugin_allow_anonymous_edit', false);
     $this->startPage = sfConfig::get('app_nahoWikiPlugin_start_page', 'index');
     $this->credentialsPost = sfConfig::get('app_nahoWikiPlugin_credentials_edit', array());
     $this->tab = sfConfig::get('app_tab_project_forums');
 }
Example #2
0
 /**
  * Executes Sandbox2 action
  *
  */
 public function executeSandbox2()
 {
     $this->forward404Unless($this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')), 'Project not found');
     $this->forward404Unless($this->getUser()->isAuthenticated() && $this->project->isAdmin($this->getUser()->getId()));
     $form = $this->project->getForm($this->getRequestParameter('form'));
     if ($form == null) {
         $this->project->setDefaultForm($this->getRequestParameter('form'));
     }
     $area = $this->getRequestParameter('area');
     $widget = $this->getRequestParameter('id');
     $widget = explode('_', $widget);
     $widget = $widget[0];
     $setting = $this->getRequestParameter('setting');
     switch ($area) {
         case '1':
             $form->setWidget1($widget);
             if (isset($setting)) {
                 $form->setWidget1Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '2':
             $form->setWidget2($widget);
             if (isset($setting)) {
                 $form->setWidget2Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '3':
             $form->setWidget3($widget);
             if (isset($setting)) {
                 $form->setWidget3Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
         case '4':
             $form->setWidget4($widget);
             if (isset($setting)) {
                 $form->setWidget4Setting($this->getRequestParameter('setting'));
             }
             $form->save();
             break;
     }
     $this->area = $area;
     $this->widget = $widget;
     $this->form = $form;
 }
Example #3
0
 /**
  * Executes handleErrorUpdateMilestone action
  *
  */
 public function handleErrorUpdateMilestone()
 {
     $this->forward404Unless($this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')), 'Project does not exist, using slug [' . $this->getRequestParameter('project') . ']');
     $this->tab = sfConfig::get('app_tab_project_team');
     $this->position = ProjectPositionPeer::retrieveByUuid($this->getRequestParameter('position'));
     if ($this->position == null) {
         $this->position = new ProjectPosition();
     }
     $this->setTemplate('updateMilestone');
     return sfView::SUCCESS;
 }
Example #4
0
 public function executeEdit()
 {
     $this->project = ProjectPeer::retrieveBySlug($this->getRequestParameter('slug'));
     $this->forward404Unless($this->project, 'Project not found, unable to retrieve wiki');
     $this->wiki = $this->project->getWiki();
     $this->setPage();
     // Do not reject here if not canEdit, cause it then fallbacks on "view source" feature
     $this->forward403Unless($this->canView);
     // Generate the username (this is done by the Revision model)
     $tmp_revision = new nahoWikiRevision();
     $tmp_revision->initUserName();
     $this->userName = $tmp_revision->getUserName();
     // Save changes
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         // Here we must be able to edit
         $this->forward403Unless($this->canEdit);
         if (!$this->page->isNew()) {
             $this->revision->archiveContent();
             $this->initNewRevision();
         }
         $this->revision->setContent($this->getRequestParameter('content'));
         $this->revision->setComment($this->getRequestParameter('comment'));
         if (!$this->getRequestParameter('request-preview')) {
             $this->revision->save();
         }
         $this->page->setLatestRevision($this->revision->getRevision());
         if (!$this->getRequestParameter('request-preview')) {
             $this->page->save();
             $this->redirect('nahoWiki/view?slug=' . $this->project->getSlug() . '&page=' . $this->page->getName());
         }
     }
     return sfView::SUCCESS;
 }