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

Changeset 9440


Ignore:
Timestamp:
Dec 1, 2008, 5:25:27 AM (12 years ago)
Author:
ebihara
Message:

#3030:added and changed some actions to follow PEAR channel server REST interface

Location:
OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules
Files:
17 added
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules/pluginChannel_c/actions/actions.class.php

    r9244 r9440  
    66 * @package    OpenPNE
    77 * @subpackage pluginChannel_c
    8  * @author     Your name here
    9  * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
     8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
    109 */
    1110class pluginChannel_cActions extends sfActions
    1211{
    1312 /**
    14   * Executes index action
     13  * Executes categories action
    1514  *
    1615  * @param sfRequest $request A request object
    1716  */
    18   public function executeIndex($request)
     17  public function executeCategories($request)
    1918  {
    20     $this->forward('default', 'module');
     19    return sfView::SUCCESS;
     20  }
     21
     22 /**
     23  * Executes info action
     24  *
     25  * @param sfRequest $request A request object
     26  */
     27  public function executeInfo($request)
     28  {
     29    $this->forward404Unless('general' === $request->getParameter('category'));
     30
     31    return sfView::SUCCESS;
     32  }
     33
     34 /**
     35  * Executes packages action
     36  *
     37  * @param sfRequest $request A request object
     38  */
     39  public function executePackages($request)
     40  {
     41    $this->forward404Unless('general' === $request->getParameter('category'));
     42
     43    $this->packages = opPluginChannelPackagePeer::retrievesAll();
     44
     45    return sfView::SUCCESS;
     46  }
     47
     48 /**
     49  * Executes packagesinfo action
     50  *
     51  * @param sfRequest $request A request object
     52  */
     53  public function executePackagesinfo($request)
     54  {
     55    $this->forward404Unless('general' === $request->getParameter('category'));
     56
     57    $this->packages = opPluginChannelPackagePeer::retrievesAll();
     58
     59    return sfView::SUCCESS;
    2160  }
    2261}
  • OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules/pluginChannel_m/actions/actions.class.php

    r9261 r9440  
    1010class pluginChannel_mActions extends sfActions
    1111{
     12 /**
     13  * Executes allmaintainers action
     14  *
     15  * @param sfRequest $request A request object
     16  */
     17  public function executeAllmaintainers($request)
     18  {
     19    $this->pneids = MemberConfigPeer::retrievesByName('pneid');
     20
     21    return sfView::SUCCESS;
     22  }
     23
    1224 /**
    1325  * Executes info action
  • OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules/pluginChannel_m/templates/infoSuccess.php

    r9261 r9440  
    11<?xml version="1.0" encoding="UTF-8" ?>
    22<m xmlns="http://pear.php.net/dtd/rest.maintainer"
    3     xsi:schemaLocation="http://pear.php.net/dtd/rest.maintainer
    4     http://pear.php.net/dtd/rest.maintainer.xsd">
    5  <h><?php echo $account ?></h>
    6  <n><?php echo $member->getName() ?></n>
     3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     4 xmlns:xlink="http://www.w3.org/1999/xlink"
     5 xsi:schemaLocation="http://pear.php.net/dtd/rest.maintainer http://pear.php.net/dtd/rest.maintainer.xsd">
     6  <h><?php echo $account ?></h>
     7  <n><?php echo $member->getName() ?></n>
    78</m>
  • OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules/pluginChannel_p/actions/actions.class.php

    r9244 r9440  
    66 * @package    OpenPNE
    77 * @subpackage pluginChannel_p
    8  * @author     Your name here
    9  * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
     8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
    109 */
    1110class pluginChannel_pActions extends sfActions
    1211{
    1312 /**
    14   * Executes index action
     13  * Executes packages action
    1514  *
    1615  * @param sfRequest $request A request object
    1716  */
    18   public function executeIndex($request)
     17  public function executePackages($request)
    1918  {
    20     $this->forward('default', 'module');
     19    $this->packages = opPluginChannelPackagePeer::retrievesAll();
     20
     21    return sfView::SUCCESS;
     22  }
     23
     24 /**
     25  * Executes info action
     26  *
     27  * @param sfRequest $request A request object
     28  */
     29  public function executeInfo($request)
     30  {
     31    $packageName = $request->getParameter('package');
     32    $this->package = opPluginChannelPackagePeer::retrieveByName($packageName);
     33
     34    $this->forward404Unless($this->package);
     35
     36    return sfView::SUCCESS;
     37  }
     38
     39 /**
     40  * Executes maintainers action
     41  *
     42  * @param sfRequest $request A request object
     43  */
     44  public function executeMaintainers($request)
     45  {
     46    $packageName = $request->getParameter('package');
     47    $this->package = opPluginChannelPackagePeer::retrieveByName($packageName);
     48
     49    $this->forward404Unless($this->package);
     50
     51    return sfView::SUCCESS;
    2152  }
    2253}
  • OpenPNE3/plugins/opPluginsChannelPlugin/trunk/apps/feeds/modules/pluginChannel_r/actions/actions.class.php

    r9244 r9440  
    66 * @package    OpenPNE
    77 * @subpackage pluginChannel_r
    8  * @author     Your name here
    9  * @version    SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
     8 * @author     Kousuke Ebihara <ebihara@tejimaya.com>
    109 */
    1110class pluginChannel_rActions extends sfActions
    1211{
    1312 /**
    14   * Executes index action
     13  * Executes allreleases action
    1514  *
    1615  * @param sfRequest $request A request object
    1716  */
    18   public function executeIndex($request)
     17  public function executeAllreleases($request)
    1918  {
    20     $this->forward('default', 'module');
     19    $packageName = $request->getParameter('package');
     20    $this->package = opPluginChannelPackagePeer::retrieveByName($packageName);
     21
     22    $this->forward404Unless($this->package);
     23
     24    return sfView::SUCCESS;
     25  }
     26
     27 /**
     28  * Executes stability action
     29  *
     30  * @param sfRequest $request A request object
     31  */
     32  public function executeStability($request)
     33  {
     34    $packageName = $request->getParameter('package');
     35    $stability = $request->getParameter('stability');
     36    $this->package = opPluginChannelPackagePeer::retrieveByName($packageName);
     37
     38    $this->forward404Unless($this->package && $this->package->countOpPluginChannelReleases());
     39
     40    $this->version = $this->package->getVersionByStability($stability);
     41
     42    return sfView::SUCCESS;
     43  }
     44
     45 /**
     46  * Executes version action
     47  *
     48  * @param sfRequest $request A request object
     49  */
     50  public function executeVersion($request)
     51  {
     52    // symfony normally outputs Content-Type header like:
     53    //    content-type: text/xml; charset: utf-8
     54    // But PEAR_REST doesn't allow this format. We must omit
     55    // "charset" in the header to converse with PEAR installer.
     56    header('Content-Type: text/xml;');
     57
     58    $packageName = $request->getParameter('package');
     59    $version = $request->getParameter('version');
     60    $this->package = opPluginChannelPackagePeer::retrieveByName($packageName);
     61
     62    $this->forward404Unless($this->package && $this->package->countOpPluginChannelReleases());
     63
     64    $this->release = $this->package->getReleaseByVersion($version);
     65    $this->forward404Unless($this->release);
     66
     67    $fp = $this->release->getFile()->getBin();
     68    $binary = stream_get_contents($fp);
     69
     70    $this->filesize = strlen($binary);
     71
     72    return sfView::SUCCESS;
     73  }
     74
     75 /**
     76  * Executes download action
     77  *
     78  * @param sfRequest $request A request object
     79  */
     80  public function executeDownload($request)
     81  {
     82    $packageName = $request->getParameter('package');
     83    $version = $request->getParameter('version');
     84
     85    $package = opPluginChannelPackagePeer::retrieveByName($packageName);
     86    $this->forward404Unless($package);
     87
     88    $release = $package->getReleaseByVersion($version);
     89    $this->forward404Unless($release);
     90
     91    $fp = $release->getFile()->getBin();
     92    $binary = stream_get_contents($fp);
     93    $filename = $package->getName().'-'.$release->getName().'.tgz';
     94
     95    $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="'.$filename.'"');
     96    $this->getResponse()->setHttpHeader('Content-Length', strlen($binary));
     97    $this->getResponse()->setHttpHeader('Content-Type', 'application/octet-stream');
     98    return $this->renderText($binary);
    2199  }
    22100}
Note: See TracChangeset for help on using the changeset viewer.