function manage($verb, $args)
 {
     if (parent::manage($verb, $args)) {
         return true;
     }
     if (!$this->getEnabled()) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         default:
             return false;
     }
     return true;
 }
示例#2
0
    public function display()
    {
        $settings = new SettingsForm();
        $settings->role = 3;
        $settings->url = UrlRewriting::GetUrlByAlias($_GET['include']);
        if (isset($_GET['areatype'])) {
            $settings->areaType = $_GET['areatype'];
        }
        if (isset($_GET['area'])) {
            $settings->area = $_GET['area'];
        }
        if (isset($_GET['role'])) {
            $settings->role = $_GET['role'];
        }
        $settings->display();
        ?>
        <div style="margin-left:500px;">
        <h2>Skins</h2>
      <?php 
        $skins = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}skins WHERE LOWER(name) IN (SELECT DISTINCT name FROM {'dbprefix'}settings WHERE areaType = 'skins' AND area = {'dbprefix'}skins.name)");
        if ($skins) {
            foreach ($skins as $skin) {
                $url = UrlRewriting::GetUrlByAlias("admin/settings", "areatype=skins&area=" . urlencode($skin->name));
                echo "<a href=\"" . $url . "\">" . $skin->name . "</a><br />";
            }
        }
        ?>
        <h2>Plugins</h2>
      <?php 
        $plugins = new PluginList();
        $plugins->loadAll();
        foreach ($plugins->plugins as $plugin) {
            if ($plugin->configurationFile != '') {
                $url = UrlRewriting::GetUrlByAlias("admin/pluginsettings", "plugin=" . $plugin->path);
                ?>
              <a href="<?php 
                echo $url;
                ?>
"><?php 
                echo $plugin->name;
                ?>
</a><br />
            <?php 
            }
        }
        ?>
        </div>
      <?php 
    }
示例#3
0
 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     $returner = true;
     $request = $this->getRequest();
     $journal = $request->getJournal();
     $this->addLocaleData();
     switch ($verb) {
         case 'settings':
             AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_MANAGER);
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if ($request->getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $request->redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = NOTIFICATION_TYPE_SWORD_ENABLED;
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = NOTIFICATION_TYPE_PLUGIN_DISABLED;
             $messageParams = array('pluginName' => $this->getDisplayName());
             $returner = false;
             break;
         case 'createDepositPoint':
         case 'editDepositPoint':
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $depositPointId = array_shift($args);
             if ($depositPointId == '') {
                 $depositPointId = null;
             } else {
                 $depositPointId = (int) $depositPointId;
             }
             $this->import('DepositPointForm');
             $form = new DepositPointForm($this, $journal->getId(), $depositPointId);
             if ($request->getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $request->redirect(null, null, null, array('generic', $this->getName(), 'settings'));
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'deleteDepositPoint':
             $journalId = $journal->getId();
             $depositPointId = (int) array_shift($args);
             $depositPoints = $this->getSetting($journalId, 'depositPoints');
             unset($depositPoints[$depositPointId]);
             $this->updateSetting($journalId, 'depositPoints', $depositPoints);
             $request->redirect(null, null, null, array('generic', 'SwordPlugin', 'settings'));
             break;
     }
     return $returner;
 }
示例#4
0
 function manage($verb, $args, &$message)
 {
     if (!parent::manage($verb, $args, $message)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
示例#5
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $journal =& Request::getJournal();
     $this->addLocaleData();
     switch ($verb) {
         case 'settings':
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = Locale::translate('plugins.generic.sword.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = Locale::translate('plugins.generic.sword.disabled');
             $returner = false;
             break;
         case 'createDepositPoint':
         case 'editDepositPoint':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $depositPointId = array_shift($args);
             if ($depositPointId == '') {
                 $depositPointId = null;
             } else {
                 $depositPointId = (int) $depositPointId;
             }
             $this->import('DepositPointForm');
             $form = new DepositPointForm($this, $journal->getId(), $depositPointId);
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, null, array('generic', $this->getName(), 'settings'));
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'deleteDepositPoint':
             $journalId = $journal->getId();
             $depositPointId = (int) array_shift($args);
             $depositPoints = $this->getSetting($journalId, 'depositPoints');
             unset($depositPoints[$depositPointId]);
             $this->updateSetting($journalId, 'depositPoints', $depositPoints);
             Request::redirect(null, null, null, array('generic', 'SwordPlugin', 'settings'));
             break;
     }
     return $returner;
 }
 /**
  * Execute a management verb on this plugin
  * @param $verb string
  * @param $args array
  * @param $message string Result status message
  * @param $messageParams array Parameters for the message key
  * @return boolean
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
 /**
  * Perform management functions
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $journal =& Request::getJournal();
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $pageCrumbs = array(array(Request::url(null, 'user'), 'navigation.user'), array(Request::url(null, 'manager'), 'user.role.manager'), array(Request::url(null, 'manager', 'plugins'), __('manager.plugins'), true));
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
示例#8
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $journal =& Request::getJournal();
     switch ($verb) {
         case 'settings':
             Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER));
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, null, 'plugins');
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($journal->getId(), 'enabled', true);
             $message = Locale::translate('plugins.generic.webfeed.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journal->getId(), 'enabled', false);
             $message = Locale::translate('plugins.generic.webfeed.disabled');
             $returner = false;
             break;
     }
     return $returner;
 }
 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $request =& $this->getRequest();
     switch ($verb) {
         case 'settings':
             $journal = $request->getJournal();
             $templateMgr = TemplateManager::getManager($request);
             $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             $form->readInputData();
             if ($request->getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = $request->getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if ($request->getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
示例#10
0
 function manage($verb, $args, &$message)
 {
     $returner = true;
     $conference =& Request::getConference();
     switch ($verb) {
         case 'settings':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $conference->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     $returner = false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             break;
         case 'enable':
             $this->updateSetting($conference->getId(), 0, 'enabled', true);
             $message = __('plugins.generic.announcementfeed.enabled');
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($conference->getId(), 0, 'enabled', false);
             $message = __('plugins.generic.announcementfeed.enabled');
             $returner = false;
             break;
     }
     return $returner;
 }
 /**
  * @see GenericPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $journal =& Request::getJournal();
     switch ($verb) {
         case 'connect':
             $this->import('classes.form.DataverseAuthForm');
             $form = new DataverseAuthForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'select'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         case 'select':
             $this->import('classes.form.DataverseSelectForm');
             $form = new DataverseSelectForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'settings'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         case 'settings':
             $this->import('classes.form.SettingsForm');
             $form = new SettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin', array('generic'));
                     return false;
                 } else {
                     $form->display();
                 }
             } else {
                 $form->initData();
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
 /**
  * Perform management functions
  */
 function manage($verb, $args)
 {
     $returner = true;
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $pageCrumbs = array(array(Request::url(null, null, 'user'), 'navigation.user'), array(Request::url(null, null, 'manager'), 'user.role.manager'));
     $conference =& Request::getConference();
     switch ($verb) {
         case 'enable':
             $this->setEnabled(true);
             break;
         case 'disable':
             $this->setEnabled(false);
             break;
         case 'settings':
             $pageCrumbs[] = array(Request::url(null, null, 'manager', 'plugins'), Locale::translate('manager.plugins'), true);
             $templateMgr->assign('pageHierarchy', $pageCrumbs);
             $this->import('SettingsForm');
             $form = new SettingsForm($this, $conference->getId());
             $form->readInputData();
             if (Request::getUserVar('addBlock')) {
                 // Add a block
                 $editData = true;
                 //$blocks = is_null($form->getData('blocks'))?array():$form->getData('blocks');
                 $blocks = $form->getData('blocks');
                 array_push($blocks, '');
                 $form->_data['blocks'] = $blocks;
             } else {
                 if (($delBlock = Request::getUserVar('delBlock')) && count($delBlock) == 1) {
                     // Delete an block
                     $editData = true;
                     list($delBlock) = array_keys($delBlock);
                     $delBlock = (int) $delBlock;
                     $blocks = $form->getData('blocks');
                     if (isset($blocks[$delBlock]) && !empty($blocks[$delBlock])) {
                         $deletedBlocks = explode(':', $form->getData('deletedBlocks'));
                         array_push($deletedBlocks, $blocks[$delBlock]);
                         $form->setData('deletedBlocks', join(':', $deletedBlocks));
                     }
                     array_splice($blocks, $delBlock, 1);
                     $form->_data['blocks'] = $blocks;
                 } else {
                     if (Request::getUserVar('save')) {
                         $editData = true;
                         $form->execute();
                     } else {
                         $form->initData();
                     }
                 }
             }
             if (!isset($editData) && $form->validate()) {
                 $form->execute();
                 $form->display();
                 exit;
             } else {
                 $form->display();
                 exit;
             }
             $returner = true;
             break;
     }
     $returner = false;
 }