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

Changeset 9485


Ignore:
Timestamp:
Dec 6, 2008, 8:13:54 PM (11 years ago)
Author:
ebihara
Message:

#3030:added action for activating/deactivating plugins to pc_backend application

Location:
OpenPNE3/trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/modules/plugin/actions/actions.class.php

    r9480 r9485  
    2626  public function executeList(sfWebRequest $request)
    2727  {
    28     $config = $this->getContext()->getConfiguration();
    29 
    3028    try
    3129    {
     
    3634    $this->plugins = $pluginManager->getInstalledPlugins();
    3735
     36    $this->form = new PluginActivationForm(array(), array('plugins' => $this->plugins));
     37
     38    if ($request->isMethod(sfRequest::POST))
     39    {
     40      $this->form->bind($this->request->getParameter('plugin_activation'));
     41      $this->redirectIf($this->form->save(), 'plugin/list');
     42    }
     43
    3844    return sfView::SUCCESS;
    3945  }
  • OpenPNE3/trunk/apps/pc_backend/modules/plugin/templates/listSuccess.php

    r9479 r9485  
     1<h2>プラグイン設定</h2>
     2
    13<?php if ($plugins) : ?>
     4<?php echo $form->renderFormTag(url_for('plugin/list')); ?>
    25<table>
    36<tr>
     
    912<?php foreach ($plugins as $plugin) : ?>
    1013<tr>
    11 <td><?php echo $plugin->getIsActive() ?></td>
    12 <td><?php echo $plugin->getName() ?></td>
     14<td><?php echo $form[$plugin->getName()]->render() ?></td>
     15<td><?php echo $form[$plugin->getName()]->renderLabel() ?></td>
    1316<td><?php echo $plugin->getVersion() ?></td>
    1417<td><?php echo $plugin->getSummary() ?></td>
     
    1619<?php endforeach; ?>
    1720</table>
     21<input type="submit" value="<?php echo __('設定変更') ?>" />
     22</form>
    1823<?php endif; ?>
  • OpenPNE3/trunk/lib/plugin/opPlugin.class.php

    r9479 r9485  
    7575    return simplexml_load_file($xmlPath);
    7676  }
     77
     78  public function setIsActive($isActive)
     79  {
     80    $file = sfConfig::get('sf_data_dir').'/config/plugin.yml';
     81    $config = array('activation' => array());
     82
     83    if (file_exists($file))
     84    {
     85      $config = array_merge($config, sfYaml::load($file));
     86    }
     87
     88    $config['activation'][$this->getName()] = $isActive;
     89
     90    file_put_contents($file, sfYaml::dump($config, 4));
     91    chmod($file, 0777);
     92  }
    7793}
  • OpenPNE3/trunk/lib/task/opPluginActivateTask.class.php

    r9476 r9485  
    3535    }
    3636
    37     $file = sfConfig::get('sf_config_dir').'/plugin.yml';
    38     $config = array('activation' => array());
    39 
    40     if (file_exists($file))
    41     {
    42       $config = array_merge($config, sfYaml::load($file));
    43     }
    44 
    45     $config['activation'][$name] = true;
    46 
    47     file_put_contents($file, sfYaml::dump($config, 4));
     37    opPlugin::getInstance($name)->setIsActive(true);
    4838
    4939    $cc = new sfCacheClearTask($this->dispatcher, $this->formatter);
  • OpenPNE3/trunk/lib/task/opPluginDeactivateTask.class.php

    r9476 r9485  
    3535    }
    3636
    37     $file = sfConfig::get('sf_config_dir').'/plugin.yml';
    38     $config = array('activation' => array());
    39 
    40     if (file_exists($file))
    41     {
    42       $config = array_merge($config, sfYaml::load($file));
    43     }
    44 
    45     $config['activation'][$name] = false;
    46 
    47     file_put_contents($file, sfYaml::dump($config, 4));
     37    opPlugin::getInstance($name)->setIsActive(false);
    4838
    4939    $cc = new sfCacheClearTask($this->dispatcher, $this->formatter);
Note: See TracChangeset for help on using the changeset viewer.