Changeset 85

Show
Ignore:
Timestamp:
04/07/09 17:00:11 (1 year ago)
Author:
nperriault
Message:

1.0: added a problem reporting system

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/apps/main/config/routing.yml

    r37 r85  
     1# Page problem 
     2report_problem_url: 
     3  url:   /report 
     4  param: { module: utils, action: reportPageProblem } 
     5   
    16# I18N relocate 
    27i18n_relocate: 
  • branches/1.0/apps/main/modules/mail/actions/actions.class.php

    r2 r85  
    2424    $this->activation = $this->getRequest()->getAttribute('activation'); 
    2525  } 
     26 
     27  public function executeReportPageProblem() 
     28  { 
     29  }   
    2630   
    2731  public function executeResendActivation() 
  • branches/1.0/apps/main/modules/utils/actions/actions.class.php

    r2 r85  
    156156    return $redirect; 
    157157  } 
     158   
     159  public function executeReportPageProblem() 
     160  { 
     161    if ($this->getRequest()->getMethod() == sfrequest::POST) 
     162    { 
     163      $this->pageUrl = $this->getRequestParameter('pageUrl'); 
     164       
     165      // Sends a mail with the user report and the page url 
     166      $mailSent = $this->sendSwiftSmtpPlainMail('mail', 'reportPageProblem', 
     167                                                sfConfig::get('app_contact_default_recipient'), 
     168                                                $this->__('Page problem report'), 
     169                                                array('reply-to' => array('address' => $this->getRequestParameter('email', sfConfig::get('app_contact_default_recipient'))))); 
     170      if (!$mailSent) 
     171      { 
     172        $this->getRequest()->setError('errors', $this->__('Unable to send your message. Please try again later.')); 
     173 
     174        return sfView::SUCCESS; 
     175      } 
     176       
     177      $this->setFlash('notice', $this->__('Your report has been successfully sent, thanks.')); 
     178      $this->redirect('@homepage'); 
     179    } 
     180    else if (!preg_match('#^(http|https)://#i', $this->pageUrl = trim($this->getRequest()->getReferer()))) 
     181    { 
     182      $this->setFlash('warning', $this->__('You must activate referer sending to report a problem with an url.')); 
     183      $this->logMessage(sprintf($this->__('"%s" is not a correct referer'), $this->pageUrl)); 
     184      $this->redirect('@homepage'); 
     185    } 
     186  } 
     187   
     188  public function handleErrorReportPageProblem() 
     189  { 
     190    return sfView::SUCCESS; 
     191  } 
    158192 
    159193} 
  • branches/1.0/apps/main/modules/utils/config/view.yml

    r2 r85  
    22  metas: 
    33    title:        Contact - Symfonians 
    4     robots:       noindex, nofollow 
     4    robots:       "noindex, nofollow" 
    55 
    66error404Success: 
    77  metas: 
    88    title:        Page Not Found - Symfonians 
    9     robots:       noindex, nofollow 
     9    robots:       "noindex, nofollow" 
     10 
     11reportPageProblemSuccess: 
     12  metas: 
     13    title:        Report a problem - Symfonians 
     14    robots:       "noindex, nofollow" 
  • branches/1.0/apps/main/templates/layout.php

    r80 r85  
    5555    <div id="footer"> 
    5656      <p> 
     57        <?php echo link_to(__('Report a problem on this page'), '@report_problem_url') ?> - 
    5758        <?php echo __('Powered by %symfony%, icons by %famfamfam%, code and design by %NiKo%', 
    5859                    array('%symfony%'   => link_to(image_tag('symfony.png', 'alt=Symfony style=vertical-align:top;padding:0 .1em'), 'http://www.symfony-project.org/'),