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

Changeset 11037


Ignore:
Timestamp:
Mar 17, 2009, 9:42:19 PM (13 years ago)
Author:
ShogoKawahara
Message:

#3727:fixed filename misses

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/branches/kawahara_mobile/lib/action
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/kawahara_mobile/lib/action/opCommunityTopicPluginTopicActions.class.php

    r11036 r11037  
    1010
    1111/**
    12  * opCommunityTopicPluginTopicCommentActions
     12 * opCommunityTopicPluginTopicActions
    1313 *
    1414 * @package    OpenPNE
     
    1919 * @author     Shogo Kawahara <kawahara@tejimaya.net>
    2020 */
    21 class opCommunityTopicPluginTopicCommentActions extends sfActions
     21
     22class opCommunityTopicPluginTopicActions extends sfActions
    2223{
    2324  /**
     
    2829    $object = $this->getRoute()->getObject();
    2930
    30     if ($object instanceof CommunityTopic)
     31    if ($object instanceof Community)
     32    {
     33      $this->community = $object;
     34    }
     35    elseif ($object instanceof CommunityTopic)
    3136    {
    3237      $this->communityTopic = $object;
    3338      $this->community = $this->communityTopic->getCommunity();
    3439    }
    35     elseif ($object instanceof CommunityTopicComment)
     40  }
     41
     42  /**
     43   * Executes listCommunity action
     44   *
     45   * @param sfRequest $request A request object
     46   */
     47  public function executeListCommunity($request)
     48  {
     49    $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     50
     51    if (!$this->size)
    3652    {
    37       $this->communityTopicComment = $object;
    38       $this->communityTopic = $this->communityTopicComment->getCommunityTopic();
    39       $this->community = $this->communityTopic->getCommunity();
     53      $this->size = 20;
    4054    }
     55
     56    $this->pager = CommunityTopicPeer::getCommunityTopicListPager($this->community->getId(), $request->getParameter('page'), $this->size);
     57  }
     58
     59  /**
     60   * Executes show action
     61   *
     62   * @param sfRequest $request A request object
     63   */
     64  public function executeShow($request)
     65  {
     66    $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     67
     68    $this->form = new CommunityTopicCommentForm();
     69  }
     70
     71  /**
     72   * Executes new action
     73   *
     74   * @param sfRequest $request A request object
     75   */
     76  public function executeNew($request)
     77  {
     78    $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     79
     80    $this->form = new CommunityTopicForm();
    4181  }
    4282
     
    4888  public function executeCreate($request)
    4989  {
    50     $this->forward404Unless($this->communityTopic->isCreatableCommunityTopicComment($this->getUser()->getMemberId()));
     90    $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
    5191
    52     $this->form = new CommunityTopicCommentForm();
     92    $this->form = new CommunityTopicForm();
    5393    $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
    54     $this->form->getObject()->setCommunityTopic($this->communityTopic);
    55     $this->form->bind($request->getParameter($this->form->getName()));
    56     if ($this->form->isValid())
    57     {
    58       $this->form->save();
    59       $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
    60     }
     94    $this->form->getObject()->setCommunity($this->community);
     95    $this->processForm($request, $this->form);
    6196
    62     $this->setTemplate('../../communityTopic/templates/show');
     97    $this->setTemplate('new');
     98  }
     99 
     100  /**
     101   * Executes edit action
     102   *
     103   * @param sfRequest $request A request object
     104   */
     105  public function executeEdit($request)
     106  {
     107    $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
     108
     109    $this->form = new CommunityTopicForm($this->communityTopic);
     110  }
     111 
     112  /**
     113   * Executes update action
     114   *
     115   * @param sfRequest $request A request object
     116   */
     117  public function executeUpdate($request)
     118  {
     119    $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
     120
     121    $this->form = new CommunityTopicForm($this->communityTopic);
     122    $this->processForm($request, $this->form);
     123
     124    $this->setTemplate('edit');
    63125  }
    64126
     127
    65128  /**
    66    * Executes delete confirm action
     129   * Executes deleteConfirm action
    67130   *
    68    * @param sfRequest $request A redirect object
     131   * @param sfRequest $request A request object
    69132   */
    70   public function executeDeleteConfirm($request)
     133  public function executeDeleteConfirm(sfWebRequest $request)
    71134  {
    72     $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));
     135    $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
    73136
    74137    $this->form = new sfForm();
    75138  }
    76 
     139 
    77140  /**
    78141   * Executes delete action
    79142   *
    80    * @param sfRequest $request A redirect object
     143   * @param sfRequest $request A request object
    81144   */
    82145  public function executeDelete($request)
     
    84147    $request->checkCSRFProtection();
    85148
    86     $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));
     149    $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
    87150
    88     $this->communityTopicComment->delete();
     151    $this->communityTopic->delete();
    89152
    90     $this->getUser()->setFlash('notice', 'The comment was deleted successfully.');
     153    $this->getUser()->setFlash('notice', 'The community topic was deleted successfully.');
    91154
    92     $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
     155    $this->redirect('community/home?id='.$this->community->getId());
     156  }
     157
     158  protected function processForm($request, sfForm $form)
     159  {
     160    $form->bind(
     161      $request->getParameter($form->getName())
     162    );
     163
     164    if ($form->isValid())
     165    {
     166      $communityTopic = $form->save();
     167
     168      $this->redirect('@communityTopic_show?id='.$communityTopic->getId());
     169    }
    93170  }
    94171}
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/kawahara_mobile/lib/action/opCommunityTopicPluginTopicCommentActions.class.php

    r11036 r11037  
    1010
    1111/**
    12  * opCommunityTopicPluginTopicActions
     12 * opCommunityTopicPluginTopicCommentActions
    1313 *
    1414 * @package    OpenPNE
     
    1919 * @author     Shogo Kawahara <kawahara@tejimaya.net>
    2020 */
    21 
    22 class opCommunityTopicPluginTopicActions extends sfActions
     21class opCommunityTopicPluginTopicCommentActions extends sfActions
    2322{
    2423  /**
     
    2928    $object = $this->getRoute()->getObject();
    3029
    31     if ($object instanceof Community)
    32     {
    33       $this->community = $object;
    34     }
    35     elseif ($object instanceof CommunityTopic)
     30    if ($object instanceof CommunityTopic)
    3631    {
    3732      $this->communityTopic = $object;
    3833      $this->community = $this->communityTopic->getCommunity();
    3934    }
    40   }
    41 
    42   /**
    43    * Executes listCommunity action
    44    *
    45    * @param sfRequest $request A request object
    46    */
    47   public function executeListCommunity($request)
    48   {
    49     $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
    50 
    51     if (!$this->size)
     35    elseif ($object instanceof CommunityTopicComment)
    5236    {
    53       $this->size = 20;
     37      $this->communityTopicComment = $object;
     38      $this->communityTopic = $this->communityTopicComment->getCommunityTopic();
     39      $this->community = $this->communityTopic->getCommunity();
    5440    }
    55 
    56     $this->pager = CommunityTopicPeer::getCommunityTopicListPager($this->community->getId(), $request->getParameter('page'), $this->size);
    57   }
    58 
    59   /**
    60    * Executes show action
    61    *
    62    * @param sfRequest $request A request object
    63    */
    64   public function executeShow($request)
    65   {
    66     $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
    67 
    68     $this->form = new CommunityTopicCommentForm();
    69   }
    70 
    71   /**
    72    * Executes new action
    73    *
    74    * @param sfRequest $request A request object
    75    */
    76   public function executeNew($request)
    77   {
    78     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
    79 
    80     $this->form = new CommunityTopicForm();
    8141  }
    8242
     
    8848  public function executeCreate($request)
    8949  {
    90     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     50    $this->forward404Unless($this->communityTopic->isCreatableCommunityTopicComment($this->getUser()->getMemberId()));
    9151
    92     $this->form = new CommunityTopicForm();
     52    $this->form = new CommunityTopicCommentForm();
    9353    $this->form->getObject()->setMemberId($this->getUser()->getMemberId());
    94     $this->form->getObject()->setCommunity($this->community);
    95     $this->processForm($request, $this->form);
     54    $this->form->getObject()->setCommunityTopic($this->communityTopic);
     55    $this->form->bind($request->getParameter($this->form->getName()));
     56    if ($this->form->isValid())
     57    {
     58      $this->form->save();
     59      $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
     60    }
    9661
    97     $this->setTemplate('new');
    98   }
    99  
    100   /**
    101    * Executes edit action
    102    *
    103    * @param sfRequest $request A request object
    104    */
    105   public function executeEdit($request)
    106   {
    107     $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
    108 
    109     $this->form = new CommunityTopicForm($this->communityTopic);
    110   }
    111  
    112   /**
    113    * Executes update action
    114    *
    115    * @param sfRequest $request A request object
    116    */
    117   public function executeUpdate($request)
    118   {
    119     $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
    120 
    121     $this->form = new CommunityTopicForm($this->communityTopic);
    122     $this->processForm($request, $this->form);
    123 
    124     $this->setTemplate('edit');
     62    $this->setTemplate('../../communityTopic/templates/show');
    12563  }
    12664
    127 
    12865  /**
    129    * Executes deleteConfirm action
     66   * Executes delete confirm action
    13067   *
    131    * @param sfRequest $request A request object
     68   * @param sfRequest $request A redirect object
    13269   */
    133   public function executeDeleteConfirm(sfWebRequest $request)
     70  public function executeDeleteConfirm($request)
    13471  {
    135     $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
     72    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));
    13673
    13774    $this->form = new sfForm();
    13875  }
    139  
     76
    14077  /**
    14178   * Executes delete action
    14279   *
    143    * @param sfRequest $request A request object
     80   * @param sfRequest $request A redirect object
    14481   */
    14582  public function executeDelete($request)
     
    14784    $request->checkCSRFProtection();
    14885
    149     $this->forward404Unless($this->communityTopic->isEditable($this->getUser()->getMemberId()));
     86    $this->forward404Unless($this->communityTopicComment->isDeletable($this->getUser()->getMemberId()));
    15087
    151     $this->communityTopic->delete();
     88    $this->communityTopicComment->delete();
    15289
    153     $this->getUser()->setFlash('notice', 'The community topic was deleted successfully.');
     90    $this->getUser()->setFlash('notice', 'The comment was deleted successfully.');
    15491
    155     $this->redirect('community/home?id='.$this->community->getId());
    156   }
    157 
    158   protected function processForm($request, sfForm $form)
    159   {
    160     $form->bind(
    161       $request->getParameter($form->getName())
    162     );
    163 
    164     if ($form->isValid())
    165     {
    166       $communityTopic = $form->save();
    167 
    168       $this->redirect('@communityTopic_show?id='.$communityTopic->getId());
    169     }
     92    $this->redirect('@communityTopic_show?id='.$this->communityTopic->getId());
    17093  }
    17194}
Note: See TracChangeset for help on using the changeset viewer.