function manage($verb, $args) { if (!parent::manage($verb, $args, $message)) { return false; } $this->import('CustomLocaleHandler'); $customLocaleHandler = new CustomLocaleHandler(); switch ($verb) { case 'edit': $customLocaleHandler->edit($args); return true; case 'saveLocaleChanges': $customLocaleHandler->saveLocaleChanges($args); return true; case 'editLocaleFile': $customLocaleHandler->editLocaleFile($args); return true; case 'saveLocaleFile': $customLocaleHandler->saveLocaleFile($args); return true; default: $customLocaleHandler->index(); return true; } }
function manage($verb, $args, &$message) { if (!parent::manage($verb, $args, $message)) { return false; } switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $journal =& Request::getJournal(); $this->import('ReferralPluginSettingsForm'); $form = new ReferralPluginSettingsForm($this, $journal->getId()); if (Request::getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); Request::redirect(null, 'manager', 'plugin'); return false; } else { $this->setBreadCrumbs(true); $form->display(); } } else { $this->setBreadCrumbs(true); $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); } }
/** * @see GenericPlugin::manage() */ 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(); $message = NOTIFICATION_TYPE_SUCCESS; $messageParams = array('contents' => __('plugins.generic.alm.settings.saved')); return false; } else { $form->display(); } } else { $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } switch ($verb) { case 'translate': Request::redirect('index', 'translate'); return false; default: // Unknown management verb assert(false); return false; } }
/** * @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 'translate': $request->redirect('index', 'translate'); return false; default: // Unknown management verb assert(false); return false; } }
/** * @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; } }
/** * @see Plugin::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()); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); return false; } else { $form->display($request); } } else { $form->initData(); $form->display($request); } return true; default: // Unknown management verb assert(false); return false; } }
/** * @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; } }
function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $journal =& Request::getJournal(); $this->import('OpenAdsSettingsForm'); $this->import('OpenAdsConnection'); $openAdsConnection = new OpenAdsConnection($this, $this->getInstallationPath()); $openAdsConnection->loadConfig(); $form = new OpenAdsSettingsForm($this, $openAdsConnection, $journal->getId()); if (array_shift($args) == 'save') { $form->readInputData(); $form->execute(); Request::redirect(null, 'manager', 'plugins'); return false; } 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; } $request =& $this->getRequest(); $conference =& $request->getConference(); $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $templateMgr->assign('pagesPath', $request->url(null, null, 'pages', 'view', 'REPLACEME')); $pageCrumbs = array(array($request->url(null, null, 'user'), 'navigation.user'), array($request->url(null, null, 'manager'), 'user.role.manager')); switch ($verb) { case 'settings': $this->import('StaticPagesSettingsForm'); $form = new StaticPagesSettingsForm($this, $conference->getId()); $templateMgr->assign('pageHierarchy', $pageCrumbs); $form->initData($request); $form->display(); return true; case 'edit': case 'add': $this->import('StaticPagesEditForm'); $staticPageId = isset($args[0]) ? (int) $args[0] : null; $form = new StaticPagesEditForm($this, $conference->getId(), $staticPageId); if ($form->isLocaleResubmit()) { $form->readInputData(); $form->addTinyMCE($request); } else { $form->initData(); } $pageCrumbs[] = array($request->url(null, null, 'manager', 'plugin', array('generic', $this->getName(), 'settings')), $this->getDisplayName(), true); $templateMgr->assign('pageHierarchy', $pageCrumbs); $form->display(); return true; case 'save': $this->import('StaticPagesEditForm'); $staticPageId = isset($args[0]) ? (int) $args[0] : null; $form = new StaticPagesEditForm($this, $conference->getId(), $staticPageId); if ($request->getUserVar('edit')) { $form->readInputData(); if ($form->validate()) { $form->save(); $templateMgr->assign(array('currentUrl' => $request->url(null, null, null, null, array($this->getCategory(), $this->getName(), 'settings')), 'pageTitle' => 'plugins.generic.staticPages.displayName', 'pageHierarchy' => $pageCrumbs, 'message' => 'plugins.generic.staticPages.pageSaved', 'backLink' => $request->url(null, null, null, null, array($this->getCategory(), $this->getName(), 'settings')), 'backLinkLabel' => 'common.continue')); $templateMgr->display('common/message.tpl'); exit; } else { $form->addTinyMCE($request); $form->display(); exit; } } $request->redirect(null, null, null, 'manager', 'plugins'); return false; case 'delete': $staticPageId = isset($args[0]) ? (int) $args[0] : null; $staticPagesDao = DAORegistry::getDAO('StaticPagesDAO'); $staticPagesDao->deleteStaticPageById($staticPageId); $templateMgr->assign(array('currentUrl' => $request->url(null, null, null, null, array($this->getCategory(), $this->getName(), 'settings')), 'pageTitle' => 'plugins.generic.staticPages.displayName', 'message' => 'plugins.generic.staticPages.pageDeleted', 'backLink' => $request->url(null, null, null, null, array($this->getCategory(), $this->getName(), 'settings')), 'backLinkLabel' => 'common.continue')); $templateMgr->assign('pageHierarchy', $pageCrumbs); $templateMgr->display('common/message.tpl'); return true; default: // Unknown management verb assert(false); return false; } }
/** * @see Plugin::manage() */ function manage($args, $request) { if (!parent::manage($args, $request)) { return false; } switch (array_shift($args)) { case 'settings': $templateMgr = TemplateManager::getManager($request); $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl')); $journal = $request->getJournal(); $this->import('classes.form.BrowseSettingsForm'); $form = new BrowseSettingsForm($this, $journal->getId()); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $request->redirect(null, 'manager', 'plugins'); return false; } else { $form->display(); } } else { $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
/** * @copydoc PKPPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams) { $journal =& Request::getJournal(); switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $this->import('classes.form.PLNSettingsForm'); $form = new PLNSettingsForm($this, $journal->getId()); if (Request::getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $message = NOTIFICATION_TYPE_SUCCESS; $messageParams = array('contents' => __('plugins.generic.pln.settings.saved')); return false; } else { $this->setBreadcrumbs('settings'); $form->display(); } } else { if (Request::getUserVar('refresh')) { $this->getServiceDocument($journal->getId()); } $this->setBreadcrumbs('settings'); $form->initData(); $form->display(); } return true; case 'status': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $this->import('classes.form.PLNStatusForm'); $form = new PLNStatusForm($this, $journal->getId()); if (Request::getUserVar('reset')) { $journal =& Request::getJournal(); $deposit_ids = array_keys(Request::getUserVar('reset')); $depositDao =& DAORegistry::getDAO('DepositDAO'); foreach ($deposit_ids as $deposit_id) { $deposit =& $depositDao->getDepositById($journal->getId(), $deposit_id); $deposit->setStatus(PLN_PLUGIN_DEPOSIT_STATUS_NEW); $depositDao->updateDeposit($deposit); } } $this->setBreadCrumbs('status'); $form->display(); return true; default: return parent::manage($verb, $args, $message, $messageParams); } }
/** * @see PKPPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } $request =& $this->getRequest(); AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_USER); $templateMgr = TemplateManager::getManager($request); $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl')); $journal = $request->getJournal(); $journalId = $journal->getId(); switch ($verb) { case 'delete': if (!empty($args)) { $externalFeedId = !isset($args) || empty($args) ? null : (int) $args[0]; $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); // Ensure externalFeed is for this journal if ($externalFeedDao->getExternalFeedJournalId($externalFeedId) == $journalId) { $externalFeedDao->deleteExternalFeedById($externalFeedId); } } $request->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); return true; case 'move': $externalFeedId = !isset($args) || empty($args) ? null : (int) $args[0]; $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); // Ensure externalFeed is valid and for this journal if ($externalFeedId != null && $externalFeedDao->getExternalFeedJournalId($externalFeedId) == $journalId) { $feed =& $externalFeedDao->getExternalFeed($externalFeedId); $direction = $this->getRequest()->getUserVar('dir'); if ($direction != null) { // moving with up or down arrow $isDown = $direction == 'd'; $feed->setSeq($feed->getSeq() + ($isDown ? 1.5 : -1.5)); $externalFeedDao->updateExternalFeed($feed); $externalFeedDao->resequenceExternalFeeds($feed->getJournalId()); } } $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); return true; case 'create': case 'edit': $externalFeedId = !isset($args) || empty($args) ? null : (int) $args[0]; $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); // Ensure externalFeed is valid and for this journal if ($externalFeedId != null && $externalFeedDao->getExternalFeedJournalId($externalFeedId) == $journalId || $externalFeedId == null) { $this->import('ExternalFeedForm'); if ($externalFeedId == null) { $templateMgr->assign('externalFeedTitle', 'plugins.generic.externalFeed.manager.createTitle'); } else { $templateMgr->assign('externalFeedTitle', 'plugins.generic.externalFeed.manager.editTitle'); } $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO'); $journalSettings =& $journalSettingsDao->getSettings($journalId); $externalFeedForm = new ExternalFeedForm($this, $externalFeedId, $journalId); if ($externalFeedForm->isLocaleResubmit()) { $externalFeedForm->readInputData(); } else { $externalFeedForm->initData(); } $templateMgr->assign('journalSettings', $journalSettings); $externalFeedForm->display(); } else { $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); } return true; case 'update': $externalFeedId = $this->getRequest()->getUserVar('feedId') == null ? null : (int) $this->getRequest()->getUserVar('feedId'); $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); if ($externalFeedId != null && $externalFeedDao->getExternalFeedJournalId($externalFeedId) == $journalId || $externalFeedId == null) { $this->import('ExternalFeedForm'); $externalFeedForm = new ExternalFeedForm($this, $externalFeedId, $journalId); $externalFeedForm->readInputData(); if ($externalFeedForm->validate()) { $externalFeedForm->execute(); if ($this->getRequest()->getUserVar('createAnother')) { $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'create')); } else { $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); } } else { if ($externalFeedId == null) { $templateMgr->assign('externalFeedTitle', 'plugins.generic.externalFeed.manager.createTitle'); } else { $templateMgr->assign('externalFeedTitle', 'plugins.generic.externalFeed.manager.editTitle'); } $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO'); $journalSettings =& $journalSettingsDao->getSettings($journalId); $templateMgr->assign('journalSettings', $journalSettings); $externalFeedForm->display(); } } else { $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); } return true; case 'settings': $this->import('ExternalFeedSettingsForm'); $form = new ExternalFeedSettingsForm($this, $journal->getId()); if ($this->getRequest()->getUserVar('save')) { $this->getRequest()->redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'feeds')); } elseif ($this->getRequest()->getUserVar('uploadStyleSheet')) { $form->uploadStyleSheet(); } elseif ($this->getRequest()->getUserVar('deleteStyleSheet')) { $form->deleteStyleSheet(); } $form->initData(); $form->display(); return true; case 'feeds': default: $this->import('ExternalFeed'); $rangeInfo =& Handler::getRangeInfo($this->getRequest(), 'feeds'); $externalFeedDao = DAORegistry::getDAO('ExternalFeedDAO'); $feeds =& $externalFeedDao->getExternalFeedsByJournalId($journalId, $rangeInfo); $templateMgr->assign('feeds', $feeds); $templateMgr->display($this->getTemplatePath() . 'externalFeeds.tpl'); return true; } }
function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } $request =& $this->getRequest(); switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $conference =& $request->getConference(); $this->import('GoogleAnalyticsSettingsForm'); $form = new GoogleAnalyticsSettingsForm($this, $conference->getId()); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $request->redirect(null, null, 'manager', 'plugin'); return false; } else { $this->setBreadCrumbs(true); $form->display(); } } else { $this->setBreadCrumbs(true); $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
/** * @see PKPPlugin::manage() */ function manage($args, $request) { $this->import('UsageStatsSettingsForm'); switch ($request->getUserVar('verb')) { case 'settings': $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->initData(); return new JSONMessage(true, $settingsForm->fetch($request)); case 'save': $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->readInputData(); if ($settingsForm->validate()) { $settingsForm->execute(); $notificationManager = new NotificationManager(); $notificationManager->createTrivialNotification($request->getUser()->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('plugins.generic.usageStats.settings.saved'))); return new JSONMessage(true); } return new JSONMessage(true, $settingsForm->fetch($request)); } return parent::manage($args, $request); }
/** * @copydoc Plugin::manage() */ function manage($args, $request) { if (!parent::manage($args, $request)) { return false; } $this->import('CustomLocaleHandler'); $customLocaleHandler = new CustomLocaleHandler($this->getName()); switch ($array_shift($args)) { case 'edit': $customLocaleHandler->edit($args, $request); return true; case 'saveLocaleChanges': $customLocaleHandler->saveLocaleChanges($args, $request); return true; case 'editLocaleFile': $customLocaleHandler->editLocaleFile($args, $request); return true; case 'saveLocaleFile': $customLocaleHandler->saveLocaleFile($args, $request); return true; default: $customLocaleHandler->index($args, $request); return true; } }
function manage($verb, $args, &$message) { if (!parent::manage($verb, $args, $message) && $verb != 'enable') { return false; } switch ($verb) { case 'enable': if (!checkPhpVersion('5.0.0')) { if (!$this->isUsingSolr()) { Request::redirect('zendSearchAdmin', 'settings'); } } return false; case 'adminSearchForm': Request::redirect('zendSearchAdmin', 'index'); return false; case 'adminSettings': Request::redirect('zendSearchAdmin', 'settings'); return false; default: // Unknown management verb assert(false); return false; } }
function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } switch ($verb) { case 'migrate': $counterReportDao =& DAORegistry::getDAO('CounterReportDAO'); $counterReportDao->upgradeFromLogFile(); Request::redirect('index', 'counter'); return false; case 'counter': Request::redirect(null, 'counter'); return false; default: // Unknown management verb assert(false); return false; } }
/** * @see PKPPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } $request =& $this->getRequest(); $this->import('UsageStatsSettingsForm'); switch ($verb) { case 'settings': $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->initData(); $pluginModalContent = $settingsForm->fetch($request); return true; case 'save': $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->readInputData(); if ($settingsForm->validate()) { $settingsForm->execute(); $message = NOTIFICATION_TYPE_SUCCESS; $messageParams = array('contents' => __('plugins.generic.usageStats.settings.saved')); return false; } else { $pluginModalContent = $settingsForm->fetch($request); } return true; default: break; } }
/** * @see Plugin::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': $templateMgr = TemplateManager::getManager($request); $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl')); $journal = $request->getJournal(); AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_PKP_MANAGER); $this->import('PhpMyVisitesSettingsForm'); $form = new PhpMyVisitesSettingsForm($this, $journal->getId()); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $request->redirect(null, 'manager', 'plugin'); return false; } else { $form->display(); } } else { $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
/** * @see GenericPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $this->import('classes.form.LuceneSettingsForm'); $form = new LuceneSettingsForm($this); if (Request::getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); Request::redirect(null, 'manager', 'plugins', 'generic'); return false; } else { $this->_setBreadCrumbs(); $form->display(); } } else { $this->_setBreadCrumbs(); $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
function manage($verb, $args, &$message) { if (!parent::manage($verb, $args, $message)) { return false; } Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER, LOCALE_COMPONENT_PKP_USER)); $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $journal =& Request::getJournal(); switch ($verb) { case 'settings': $this->import('ThesisSettingsForm'); $form = new ThesisSettingsForm($this, $journal->getId()); if (Request::getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses')); return false; } else { $this->setBreadCrumbs(true); $form->display(); } } else { $this->setBreadCrumbs(true); $form->initData(); $form->display(); } return true; case 'delete': if (!empty($args)) { $thesisId = (int) $args[0]; $thesisDao =& DAORegistry::getDAO('ThesisDAO'); // Ensure thesis is for this journal if ($thesisDao->getThesisJournalId($thesisId) == $journal->getId()) { $thesisDao->deleteThesisById($thesisId); } } Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses')); return true; case 'create': case 'edit': $thesisId = !isset($args) || empty($args) ? null : (int) $args[0]; $thesisDao =& DAORegistry::getDAO('ThesisDAO'); // Ensure thesis is valid and for this journal if ($thesisId != null && $thesisDao->getThesisJournalId($thesisId) == $journal->getId() || $thesisId == null) { $this->import('ThesisForm'); if ($thesisId == null) { $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.createTitle'); } else { $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.editTitle'); } $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $journalSettings =& $journalSettingsDao->getJournalSettings($journal->getId()); $thesisForm = new ThesisForm($this->getName(), $thesisId); $thesisForm->initData(); $this->setBreadCrumbs(true); $templateMgr->assign('journalSettings', $journalSettings); $thesisForm->display(); } else { Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses')); } return true; case 'update': $this->import('ThesisForm'); $thesisId = Request::getUserVar('thesisId') == null ? null : (int) Request::getUserVar('thesisId'); $thesisDao =& DAORegistry::getDAO('ThesisDAO'); if ($thesisId != null && $thesisDao->getThesisJournalId($thesisId) == $journal->getId() || $thesisId == null) { $thesisForm = new ThesisForm($this->getName(), $thesisId); $thesisForm->readInputData(); if ($thesisForm->validate()) { $thesisForm->execute(); if (Request::getUserVar('createAnother')) { Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'create')); } else { Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses')); } } else { if ($thesisId == null) { $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.createTitle'); } else { $templateMgr->assign('thesisTitle', 'plugins.generic.thesis.manager.editTitle'); } $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $journalSettings =& $journalSettingsDao->getJournalSettings($journal->getId()); $this->setBreadCrumbs(true); $templateMgr->assign('journalSettings', $journalSettings); $thesisForm->display(); } } else { Request::redirect(null, 'manager', 'plugin', array('generic', $this->getName(), 'theses')); } return true; default: $this->import('Thesis'); $searchField = null; $searchMatch = null; $search = Request::getUserVar('search'); $dateFrom = Request::getUserDateVar('dateFrom', 1, 1); if ($dateFrom !== null) { $dateFrom = date('Y-m-d H:i:s', $dateFrom); } $dateTo = Request::getUserDateVar('dateTo', 32, 12, null, 23, 59, 59); if ($dateTo !== null) { $dateTo = date('Y-m-d H:i:s', $dateTo); } if (!empty($search)) { $searchField = Request::getUserVar('searchField'); $searchMatch = Request::getUserVar('searchMatch'); } $rangeInfo =& Handler::getRangeInfo('theses'); $thesisDao =& DAORegistry::getDAO('ThesisDAO'); $theses =& $thesisDao->getThesesByJournalId($journal->getId(), $searchField, $search, $searchMatch, $dateFrom, $dateTo, null, $rangeInfo); $templateMgr->assign('theses', $theses); $this->setBreadCrumbs(); // Set search parameters $duplicateParameters = array('searchField', 'searchMatch', 'search', 'dateFromMonth', 'dateFromDay', 'dateFromYear', 'dateToMonth', 'dateToDay', 'dateToYear'); foreach ($duplicateParameters as $param) { $templateMgr->assign($param, Request::getUserVar($param)); } $templateMgr->assign('dateFrom', $dateFrom); $templateMgr->assign('dateTo', $dateTo); $templateMgr->assign('yearOffsetPast', THESIS_APPROVED_YEAR_OFFSET_PAST); $fieldOptions = array(THESIS_FIELD_FIRSTNAME => 'plugins.generic.thesis.manager.studentFirstName', THESIS_FIELD_LASTNAME => 'plugins.generic.thesis.manager.studentLastName', THESIS_FIELD_EMAIL => 'plugins.generic.thesis.manager.studentEmail', THESIS_FIELD_DEPARTMENT => 'plugins.generic.thesis.manager.department', THESIS_FIELD_UNIVERSITY => 'plugins.generic.thesis.manager.university', THESIS_FIELD_TITLE => 'plugins.generic.thesis.manager.title', THESIS_FIELD_ABSTRACT => 'plugins.generic.thesis.manager.abstract', THESIS_FIELD_SUBJECT => 'plugins.generic.thesis.manager.keyword'); $templateMgr->assign('fieldOptions', $fieldOptions); $templateMgr->display($this->getTemplatePath() . 'theses.tpl'); return true; } }
function manage($verb, $args, &$message, &$messageParams) { if (!parent::manage($verb, $args, $message, $messageParams)) { return false; } switch ($verb) { case 'reload': $this->parseCrontab(); return false; default: // Unknown management verb assert(false); return false; } }
/** * @copydoc PKPPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null) { $request = $this->getRequest(); $press = $request->getPress(); $templateMgr = TemplateManager::getManager($request); switch ($verb) { case 'settings': $templateMgr->assign('statsConfigured', $this->statsConfigured($press)); $pluginModalContent = $templateMgr->fetch($this->getTemplatePath() . 'settingsTabs.tpl'); return true; case 'showTab': if ($request->getUserVar('tab') == 'settings') { $this->import('AddThisSettingsForm'); $form = new AddThisSettingsForm($this, $press); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $message = NOTIFICATION_TYPE_SUCCESS; $messageParams = array('contents' => __('plugins.generic.addThis.form.saved')); return false; } else { $pluginModalContent = $form->fetch($request); } } else { $form->initData(); $pluginModalContent = $form->fetch($request); } } else { $pluginModalContent = $templateMgr->fetch($this->getTemplatePath() . 'statistics.tpl'); } return true; case 'showStatistics': $this->import('AddThisStatisticsGridHandler'); $gridHandler = new AddThisStatisticsGridHandler($this); $gridHandler->initialize($request); $jsonMessage = json_decode($gridHandler->fetchGrid($args, $request)); $pluginModalContent = $jsonMessage->content; return true; default: // let the parent handle it. return parent::manage($verb, $args, $message, $messageParams); } }
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; } }
/** * @see Plugin::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': // Prepare the template manager. $templateMgr = TemplateManager::getManager($request); $templateMgr->register_function('plugin_url', array($this, 'smartyPluginUrl')); // Instantiate an embedded server instance. $this->import('classes.EmbeddedServer'); $embeddedServer = new EmbeddedServer(); // Instantiate the settings form. $this->import('classes.form.LuceneSettingsForm'); $form = new LuceneSettingsForm($this, $embeddedServer); // Handle request to save configuration data. if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); $request->redirect(null, 'manager', 'plugins', 'generic'); return false; } else { $form->display($request); } // Handle administrative request. } else { // Re-init data. It should be visible to users // that whatever data they may have entered into // the form was not saved. $form->initData(); // Index rebuild. if ($request->getUserVar('rebuildIndex')) { // Check whether we got valid index rebuild options. if ($form->validate()) { // Check whether a journal was selected. $journal = null; $journalId = $request->getUserVar('journalToReindex'); if (!empty($journalId)) { $journalDao = DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $journal = $journalDao->getById($journalId); if (!is_a($journal, 'Journal')) { $journal = null; } } if (empty($journalId) || !empty($journalId) && is_a($journal, 'Journal')) { // Rebuild index and dictionaries. $messages = null; $this->_rebuildIndex(false, $journal, true, true, true, $messages); // Transfer indexing output to the form template. $form->setData('rebuildIndexMessages', $messages); } } // Dictionary rebuild. } elseif ($request->getUserVar('rebuildDictionaries')) { // Rebuild dictionaries. $journal = null; $this->_rebuildIndex(false, null, false, true, false, $messages); // Transfer indexing output to the form template. $form->setData('rebuildIndexMessages', $messages); // Boost File Update. } elseif ($request->getUserVar('updateBoostFile')) { $this->_updateBoostFiles(); // Start/Stop solr server. } elseif ($request->getUserVar('stopServer')) { // As this is a system plug-in we follow usual // plug-in policy and allow journal managers to start/ // stop the server although this will affect all journals // of the installation. $embeddedServer->stopAndWait(); } elseif ($request->getUserVar('startServer')) { $embeddedServer->start(); } // Re-display the settings page after executing // an administrative task. $form->display($request); } return true; default: // Unknown management verb assert(false); return false; } }
function manage($verb, $args, &$message) { if (!parent::manage($verb, $args, $message)) { return false; } $journal =& Request::getJournal(); $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $this->import('XMLGalleySettingsForm'); $form = new XMLGalleySettingsForm($this, $journal->getId()); switch ($verb) { case 'test': // test external XSLT renderer $xsltRenderer = $this->getSetting($journal->getId(), 'XSLTrenderer'); if ($xsltRenderer == "external") { // get command for external XSLT tool $xsltCommand = $this->getSetting($journal->getId(), 'externalXSLT'); // get test XML/XSL files $xmlFile = dirname($_SERVER['SCRIPT_FILENAME']) . DIRECTORY_SEPARATOR . $this->getPluginPath() . '/transform/test.xml'; $xslFile = $this->getPluginPath() . '/transform/test.xsl'; // create a testing article galley object (to access the XSLT render method) $this->import('ArticleXMLGalley'); $xmlGalley = new ArticleXMLGalley($this->getName()); // transform the XML using whatever XSLT processor we have available $result = $xmlGalley->transformXSLT($xmlFile, $xslFile, $xsltCommand); // check the result if (trim(preg_replace("/\\s+/", " ", $result)) != "Open Journal Systems Success") { $form->addError('content', Locale::translate('plugins.generic.xmlGalley.settings.externalXSLTFailure')); } else { $templateMgr->assign('testSuccess', true); } } case 'settings': Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_MANAGER)); // if we are updating XSLT settings or switching XSL sheets if (Request::getUserVar('save')) { $form->readInputData(); $form->initData(); if ($form->validate()) { $form->execute(); } $form->display(); // if we are uploading a custom XSL sheet } elseif (Request::getUserVar('uploadCustomXSL')) { $form->readInputData(); import('classes.file.JournalFileManager'); // if the a valid custom XSL is uploaded, process it $fileManager = new JournalFileManager($journal); if ($fileManager->uploadedFileExists('customXSL')) { // check type and extension -- should be text/xml and xsl, respectively $type = $fileManager->getUploadedFileType('customXSL'); $fileName = $fileManager->getUploadedFileName('customXSL'); $extension = strtolower($fileManager->getExtension($fileName)); if (($type == 'text/xml' || $type == 'text/xml' || $type == 'application/xml' || $type == 'application/xslt+xml') && $extension == 'xsl') { // if there is an existing XSL file, delete it from the journal files folder $existingFile = $this->getSetting($journal->getId(), 'customXSL'); if (!empty($existingFile) && $fileManager->fileExists($fileManager->filesDir . $existingFile)) { $fileManager->deleteFile($existingFile); } // upload the file into the journal files folder $fileManager->uploadFile('customXSL', $fileName); // update the plugin and form settings $this->updateSetting($journal->getId(), 'XSLstylesheet', 'custom'); $this->updateSetting($journal->getId(), 'customXSL', $fileName); } else { $form->addError('content', Locale::translate('plugins.generic.xmlGalley.settings.customXSLInvalid')); } } else { $form->addError('content', Locale::translate('plugins.generic.xmlGalley.settings.customXSLRequired')); } // re-populate the form values with the new settings $form->initData(); $form->display(); // if we are deleting an existing custom XSL sheet } elseif (Request::getUserVar('deleteCustomXSL')) { import('classes.file.JournalFileManager'); // if the a valid custom XSL is uploaded, process it $fileManager = new JournalFileManager($journal); // delete the file from the journal files folder $fileName = $this->getSetting($journal->getId(), 'customXSL'); if (!empty($fileName)) { $fileManager->deleteFile($fileName); } // update the plugin and form settings $this->updateSetting($journal->getId(), 'XSLstylesheet', 'NLM'); $this->updateSetting($journal->getId(), 'customXSL', ''); $form->initData(); $form->display(); } else { $form->initData(); $form->display(); } return true; default: // Unknown management verb assert(false); return false; } }
/** * @see PKPPlugin::manage() */ function manage($verb, $args, &$message, &$messageParams) { $returner = parent::manage($verb, $args, $message, $messageParams); if (!$returner) { return false; } $this->import('UsageStatsSettingsForm'); switch ($verb) { case 'settings': $templateMgr =& TemplateManager::getManager(); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->initData(); $settingsForm->display(); break; case 'save': $settingsForm = new UsageStatsSettingsForm($this); $settingsForm->readInputData(); if ($settingsForm->validate()) { $settingsForm->execute(); $message = NOTIFICATION_TYPE_SUCCESS; $messageParams = array('contents' => __('plugins.generic.usageStats.settings.saved')); return false; } else { $settingsForm->display(); } break; default: return $returner; } return true; }
/** * @see Plugin::manage() */ function manage($args, $request) { switch ($request->getUserVar('verb')) { case 'settings': $context = $request->getContext(); 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, $context->getId()); if ($request->getUserVar('save')) { $form->readInputData(); if ($form->validate()) { $form->execute(); return new JSONMessage(true); } } else { $form->initData(); } return new JSONMessage(true, $form->fetch($request)); } return parent::manage($args, $request); }
/** * 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; } }