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

Changeset 9663


Ignore:
Timestamp:
Dec 24, 2008, 7:17:54 PM (11 years ago)
Author:
ShogoKawahara
Message:

#3119:added ability to update, and to delete the OpenSocial application

Location:
OpenPNE3/plugins/opOpenSocialPlugin/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/actions/actions.class.php

    r9616 r9663  
    3030    $this->applicationConfigForm = new ApplicationConfigForm();
    3131
    32     if (!$request->isMethod('post'))
     32    if (!$request->isMethod(sfRequest::POST))
    3333    {
    3434      return sfView::SUCCESS;
     
    112112  {
    113113    $this->profileConfigForm = new OpenSocialPersonFieldConfigForm();
    114     if (!$request->isMethod('post'))
     114    if (!$request->isMethod(sfRequest::POST))
    115115    {
    116116      return sfView::SUCCESS;
     
    124124    return sfView::SUCCESS;
    125125  }
     126
     127  /**
     128   * Executes deleteApplication action
     129   *
     130   * @param sfRequest $request A request object
     131   */
     132  public function executeDeleteApplication($request)
     133  {
     134    $application_id = $request->getParameter('id', false);
     135    if (!$application_id)
     136    {
     137      return $this->redirect('application/list');
     138    }
     139
     140    $application = ApplicationPeer::retrieveByPk($application_id);
     141    if (!$application)
     142    {
     143      return $this->redirect('application/list');
     144    }
     145
     146    if ($request->isMethod(sfRequest::POST))
     147    {
     148      $application->delete();
     149      return $this->redirect('application/list');
     150    }
     151
     152    return sfView::SUCCESS;
     153  }
     154
     155  /**
     156   * Executes updateApplication action
     157   *
     158   * @param sfRequest $request A request object
     159   */
     160  public function executeUpdateApplication($request)
     161  {
     162    $application_id = $request->getParameter('id',false);
     163    if (!$application_id)
     164    {
     165      return $this->redirect('application/list');
     166    }
     167
     168    $application = ApplicationPeer::retrieveByPk($application_id);
     169    if (!$application)
     170    {
     171      return $this->redirect('application/list');
     172    }
     173
     174    try
     175    {
     176      ApplicationPeer::addApplication($application->getUrl(), $this->getUser()->getCulture(),true);
     177    }
     178    catch (Exception $e)
     179    {
     180    }
     181
     182    return $this->redirect('application/info?id='.$application->getId());
     183  }
    126184}
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/apps/pc_backend/modules/application/templates/infoSuccess.php

    r9541 r9663  
    55<h2><?php echo __('アプリケーション詳細') ?></h2>
    66<table>
    7 <tr><th>アプリケーション名</th><td><?php echo $application->getTitle() ?></td></tr>
    8 <tr><th>アプリケーションURL</th><td><?php echo $application->getUrl() ?></td></tr>
    9 <tr><th>インストールしているユーザ</th><td><?php echo $application->countInstalledMember() ?></td></tr>
     7<tr><th><?php echo __('アプリケーション名') ?></th><td><?php echo $application->getTitle() ?></td></tr>
     8<tr><th><?php echo __('アプリケーションURL') ?></th><td><?php echo $application->getUrl() ?></td></tr>
     9<tr><th><?php echo __('スクリーンショット') ?></th><td><?php
     10if ($application->getScreenshot())
     11{
     12  echo image_tag($application->getScreenshot(), array('alt' => $application->getTitle()));
     13}
     14?></td></tr>
     15<tr><th><?php echo __('サムネイル') ?></th><td><?php
     16if ($application->getThumbnail())
     17{
     18  echo image_tag($application->getThumbnail(), array('alt' => $application->getTitle()));
     19}
     20?></td></td></tr>
     21<tr><th><?php echo __('作成者') ?></th><td><?php
     22if ($application->getAuthorEmail())
     23{
     24  echo mail_to($application->getAuthorEmail(), $application->getAuthor(), array('encode' => true));
     25}
     26else
     27{
     28  echo $application->getAuthor();
     29}
     30?></td></tr>
     31<tr><th><?php echo __('詳細') ?></th><td><?php echo $application->getDescription() ?></td></tr>
     32<tr><th><?php echo __('最終更新日') ?></th><td><?php echo $application->getUpdatedAt() ?></td></tr>
     33<tr><th><?php echo __('インストールしているユーザ') ?></th><td><?php echo $application->countInstalledMember() ?></td></tr>
     34<tr><td colspan="2">
     35<?php echo link_to(__('削除'),'application/deleteApplication?id='.$sf_request->getParameter('id')) ?>
     36<?php echo link_to(__('更新'),'application/updateApplication?id='.$sf_request->getParameter('id')) ?>
     37</td></tr>
    1038</table>
    11 
  • OpenPNE3/plugins/opOpenSocialPlugin/trunk/lib/model/ApplicationPeer.php

    r9507 r9663  
    5858      'gadgets' => array(array('url' => $url,'moduleId' => 1))
    5959    ));
     60    $_GET['nocache'] = 1;
    6061    $handler = new MetadataHandler();
    6162    $response = $handler->process($req);
Note: See TracChangeset for help on using the changeset viewer.