ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10582


Ignore:
Timestamp:
Jan 31, 2009, 9:30:31 PM (10 years ago)
Author:
ebihara
Message:

#3544:changed the execution filter catches opRuntimeException now

Location:
OpenPNE3/trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_frontend/i18n/messages.ja.xml

    r10545 r10582  
    463463        <target>メンバー登録</target>
    464464      </trans-unit>
     465      <trans-unit id="">
     466        <source>Cannot add an image any more.</source>
     467        <target>これ以上画像を追加できません。</target>
     468      </trans-unit>
    465469    </body>
    466470  </file>
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/actions/actions.class.php

    r10340 r10582  
    9898  public function executeConfigImage($request)
    9999  {
    100     if ($request->isXmlHttpRequest())
    101     {
    102       $this->setLayout('plain');
    103     }
    104 
    105100    $options = array('member' => $this->getUser()->getMember());
    106101    $this->form = new MemberImageForm(array(), $options);
     
    108103    if ($request->isMethod('post'))
    109104    {
    110       $this->form->bindAndSave($request->getParameter('member_image'), $request->getFiles('member_image'));
    111       $this->redirect('member/configImage');
     105      try
     106      {
     107        $this->form->bindAndSave($request->getParameter('member_image'), $request->getFiles('member_image'));
     108        $this->redirect('member/configImage');
     109      }
     110      catch (opRuntimeException $e)
     111      {
     112        $this->getUser()->setFlash('error', $e->getMessage());
     113      }
    112114    }
    113115  }
  • OpenPNE3/trunk/lib/filter/sfOpenPNEExecutionFilter.class.php

    r10003 r10582  
    3030    )));
    3131
    32     $result = parent::handleAction($filterChain, $actionInstance);
     32    try
     33    {
     34      $result = parent::handleAction($filterChain, $actionInstance);
     35    }
     36    catch (opRuntimeException $e)
     37    {
     38      $this->forwardToErrorAction();
     39    }
    3340
    3441    $dispatcher->notify(new sfEvent($this, 'op_action.post_execute_'.$moduleName.'_'.$actionName, array(
     
    6774    }
    6875  }
     76
     77  protected function forwardToErrorAction()
     78  {
     79    $this->context->getController()->forward('default', 'error');
     80
     81    throw new sfStopException();
     82  }
    6983}
  • OpenPNE3/trunk/lib/form/MemberImageForm.class.php

    r10003 r10582  
    4141    if ($count >= 3)
    4242    {
    43       throw new sfException('Cannot add an image any more.');
     43      throw new opRuntimeException('Cannot add an image any more.');
    4444    }
    4545
  • OpenPNE3/trunk/test/functional/pc_frontend/memberActionsTest.php

    r10580 r10582  
    4141  )))
    4242  ->isStatusCode(200)
     43  ->with('response')->begin()
     44  ->checkElement('#flashError td:contains("これ以上画像を追加できません。")', true)
     45  ->end()
    4346;
Note: See TracChangeset for help on using the changeset viewer.