/** * Test locales. */ function execute() { $plugins = PluginRegistry::loadAllPlugins(); foreach (Locale::getAllLocales() as $locale => $name) { if (!empty($this->locales) && !in_array($locale, $this->locales)) { continue; } if ($locale != MASTER_LOCALE) { echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n"; $errors = Locale::testLocale($locale, MASTER_LOCALE); $this->displayLocaleErrors($locale, $errors); $emailErrors = Locale::testEmails($locale, MASTER_LOCALE); $this->displayEmailErrors($locale, $emailErrors); } } }
/** * Constructor. * @param $descriptor string descriptor path * @param $params array installer parameters */ function Installer($descriptor, $params = array()) { // Load all plugins. If any of them use installer hooks, // they'll need to be loaded here. PluginRegistry::loadAllPlugins(); // Give the HookRegistry the opportunity to override this // method or alter its parameters. if (!HookRegistry::call('Installer::Installer', array(&$this, &$descriptor, &$params))) { $this->descriptor = $descriptor; $this->params = $params; $this->actions = array(); $this->sql = array(); $this->notes = array(); $this->wroteConfig = true; } }
function getLocaleFiles($locale) { if (!Locale::isLocaleValid($locale)) { return null; } $localeFiles = array(Locale::getMainLocaleFilename($locale)); $plugins =& PluginRegistry::loadAllPlugins(); foreach (array_keys($plugins) as $key) { $plugin =& $plugins[$key]; $localeFile = $plugin->getLocaleFilename($locale); if (!empty($localeFile)) { $localeFiles[] = $localeFile; } unset($plugin); } return $localeFiles; }
/** * Get a list of locale files for the given locale code. * @param $locale string Locale code * @return array List of filenames */ function getLocaleFiles($locale) { if (!AppLocale::isLocaleValid($locale)) { return null; } $localeFiles = AppLocale::getFilenameComponentMap($locale); $plugins =& PluginRegistry::loadAllPlugins(); foreach (array_keys($plugins) as $key) { $plugin =& $plugins[$key]; $localeFile = $plugin->getLocaleFilename($locale); if (!empty($localeFile)) { if (is_scalar($localeFile)) { $localeFiles[] = $localeFile; } if (is_array($localeFile)) { $localeFiles = array_merge($localeFiles, $localeFile); } } unset($plugin); } return $localeFiles; }
/** * Save conference settings. */ function execute() { $conferenceDao =& DAORegistry::getDAO('ConferenceDAO'); if (isset($this->conferenceId)) { $conference =& $conferenceDao->getConference($this->conferenceId); } if (!isset($conference)) { $conference = new Conference(); } $conference->setPath($this->getData('conferencePath')); $conference->setEnabled($this->getData('enabled')); if ($conference->getId() != null) { $conferenceDao->updateConference($conference); } else { $site =& Request::getSite(); // Give it a default primary locale. $conference->setPrimaryLocale($site->getPrimaryLocale()); $conferenceId = $conferenceDao->insertConference($conference); $conferenceDao->resequenceConferences(); // Make the site administrator the conference manager $sessionManager =& SessionManager::getManager(); $userSession =& $sessionManager->getUserSession(); if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($conferenceId)) { $roleDao =& DAORegistry::getDAO('RoleDAO'); $role = new Role(); $role->setConferenceId($conferenceId); $role->setSchedConfId(0); $role->setUserId($userSession->getUserId()); $role->setRoleId(ROLE_ID_CONFERENCE_MANAGER); $roleDao->insertRole($role); } // Make the file directories for the conference import('file.FileManager'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId . '/schedConfs'); FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId); FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs'); // Install default conference settings $conferenceSettingsDao =& DAORegistry::getDAO('ConferenceSettingsDAO'); $titles = $this->getData('title'); AppLocale::requireComponents(array(LOCALE_COMPONENT_OCS_DEFAULT)); $conferenceSettingsDao->installSettings($conferenceId, Config::getVar('general', 'registry_dir') . '/conferenceSettings.xml', array('privacyStatementUrl' => Request::url($this->getData('conferencePath'), 'index', 'about', 'submissions', null, null, 'privacyStatement'), 'loginUrl' => Request::url('index', 'index', 'login'), 'conferenceUrl' => Request::url($this->getData('conferencePath'), null), 'conferencePath' => $this->getData('conferencePath'), 'primaryLocale' => $site->getPrimaryLocale(), 'aboutUrl' => Request::url($this->getData('conferencePath'), 'index', 'about', null), 'accountUrl' => Request::url($this->getData('conferencePath'), 'index', 'user', 'register'), 'conferenceName' => $titles[$site->getPrimaryLocale()])); // Install the default RT versions. import('rt.ocs.ConferenceRTAdmin'); $conferenceRtAdmin = new ConferenceRTAdmin($conferenceId); $conferenceRtAdmin->restoreVersions(false); } $conference->updateSetting('title', $this->getData('title'), 'string', true); $conference->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('ConferenceSiteSettingsForm::execute', array(&$this, &$conference)); }
/** * Test all locale files for the supplied locale against the supplied * reference locale, returning an array of errors. * @param $locale string Name of locale to test * @param $referenceLocale string Name of locale to test against * @return array */ function testLocale($locale, $referenceLocale) { $localeFileNames = AppLocale::getFilenameComponentMap($locale); $errors = array(); foreach ($localeFileNames as $localeFileName) { $referenceLocaleFileName = str_replace($locale, $referenceLocale, $localeFileName); $localeFile = new LocaleFile($locale, $localeFileName); $referenceLocaleFile = new LocaleFile($referenceLocale, $referenceLocaleFileName); $errors = array_merge_recursive($errors, $localeFile->testLocale($referenceLocaleFile)); unset($localeFile); unset($referenceLocaleFile); } $plugins =& PluginRegistry::loadAllPlugins(); foreach (array_keys($plugins) as $key) { $plugin =& $plugins[$key]; $referenceLocaleFilenames = $plugin->getLocaleFilename($referenceLocale); if ($referenceLocaleFilenames) { if (is_scalar($referenceLocaleFilenames)) { $referenceLocaleFilenames = array($referenceLocaleFilenames); } $localeFilenames = $plugin->getLocaleFilename($locale); if (is_scalar($localeFilenames)) { $localeFilenames = array($localeFilenames); } assert(count($localeFilenames) == count($referenceLocaleFilenames)); foreach ($referenceLocaleFilenames as $index => $referenceLocaleFilename) { assert(isset($localeFilenames[$index])); $localeFile = new LocaleFile($locale, $localeFilenames[$index]); $referenceLocaleFile = new LocaleFile($referenceLocale, $referenceLocaleFilename); $errors = array_merge_recursive($errors, $localeFile->testLocale($referenceLocaleFile)); unset($localeFile); unset($referenceLocaleFile); } } unset($plugin); } return $errors; }
/** * Save journal settings. */ function execute() { $journalDao =& DAORegistry::getDAO('JournalDAO'); if (isset($this->journalId)) { $journal =& $journalDao->getJournal($this->journalId); } if (!isset($journal)) { $journal = new Journal(); } $journal->setPath($this->getData('journalPath')); $journal->setEnabled($this->getData('enabled')); if ($journal->getId() != null) { $isNewJournal = false; $journalDao->updateJournal($journal); $section = null; } else { $isNewJournal = true; $site =& Request::getSite(); // Give it a default primary locale $journal->setPrimaryLocale($site->getPrimaryLocale()); $journalId = $journalDao->insertJournal($journal); $journalDao->resequenceJournals(); // Make the site administrator the journal manager of newly created journals $sessionManager =& SessionManager::getManager(); $userSession =& $sessionManager->getUserSession(); if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($journalId)) { $role = new Role(); $role->setJournalId($journalId); $role->setUserId($userSession->getUserId()); $role->setRoleId(ROLE_ID_JOURNAL_MANAGER); $roleDao =& DAORegistry::getDAO('RoleDAO'); $roleDao->insertRole($role); } // Make the file directories for the journal import('lib.pkp.classes.file.FileManager'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues'); FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId); // Install default journal settings $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $titles = $this->getData('title'); AppLocale::requireComponents(array(LOCALE_COMPONENT_OJS_DEFAULT, LOCALE_COMPONENT_APPLICATION_COMMON)); $journalSettingsDao->installSettings($journalId, 'registry/journalSettings.xml', array('indexUrl' => Request::getIndexUrl(), 'journalPath' => $this->getData('journalPath'), 'primaryLocale' => $site->getPrimaryLocale(), 'journalName' => $titles[$site->getPrimaryLocale()])); // Install the default RT versions. import('classes.rt.ojs.JournalRTAdmin'); $journalRtAdmin = new JournalRTAdmin($journalId); $journalRtAdmin->restoreVersions(false); // Create a default "Articles" section $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section = new Section(); $section->setJournalId($journal->getId()); $section->setTitle(__('section.default.title'), $journal->getPrimaryLocale()); $section->setAbbrev(__('section.default.abbrev'), $journal->getPrimaryLocale()); $section->setMetaIndexed(true); $section->setMetaReviewed(true); $section->setPolicy(__('section.default.policy'), $journal->getPrimaryLocale()); $section->setEditorRestricted(false); $section->setHideTitle(false); $sectionDao->insertSection($section); } $journal->updateSetting('title', $this->getData('title'), 'string', true); $journal->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('JournalSiteSettingsForm::execute', array(&$this, &$journal, &$section, &$isNewJournal)); }
function createJournal() { $journalConfigXML = $this->getCurrentElementAsDom(); $journalDao =& DAORegistry::getDAO("JournalDAO"); $journal = new Journal(); $journal->setPath((string) $journalConfigXML->path); $journal->setEnabled((int) $journalConfigXML->enabled); $journal->setPrimaryLocale((string) $journalConfigXML->primaryLocale); $this->generateJournalPath($journal); $journalId = $journalDao->insertJournal($journal); $journalDao->resequenceJournals(); // Make the file directories for the journal import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId)) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId); } if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles')) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles'); } if (!file_exists(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues')) { $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues'); } if (!file_exists(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId)) { $fileManager->mkdir(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId); } import('classes.rt.ojs.JournalRTAdmin'); $journalRtAdmin = new JournalRTAdmin($journalId); $journalRtAdmin->restoreVersions(false); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('JournalSiteSettingsForm::execute', array(&$this, &$journal, &$section, &$isNewJournal)); $journalSettingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); $this->restoreDataObjectSettings($journalSettingsDao, $journalConfigXML->settings, "journal_settings", "journal_id", $journal->getId()); $this->journal = $journal; }
/** * Save journal settings. * @param $request PKPRequest */ function execute($request) { $journalDao = DAORegistry::getDAO('JournalDAO'); if (isset($this->contextId)) { $journal = $journalDao->getById($this->contextId); } if (!isset($journal)) { $journal = $journalDao->newDataObject(); } // Check if the journal path has changed. $pathChanged = false; $journalPath = $journal->getPath(); if ($journalPath != $this->getData('path')) { $pathChanged = true; } $journal->setPath($this->getData('path')); $journal->setEnabled($this->getData('enabled')); if ($journal->getId() != null) { $isNewJournal = false; $journalDao->updateObject($journal); $section = null; } else { $isNewJournal = true; $site = $request->getSite(); // Give it a default primary locale $journal->setPrimaryLocale($site->getPrimaryLocale()); $journalId = $journalDao->insertObject($journal); $journalDao->resequence(); $installedLocales = $site->getInstalledLocales(); // Install default genres $genreDao = DAORegistry::getDAO('GenreDAO'); $genreDao->installDefaults($journalId, $installedLocales); /* @var $genreDao GenreDAO */ // load the default user groups and stage assignments. $this->_loadDefaultUserGroups($journalId); // Put this user in the Manager group. $this->_assignManagerGroup($journalId); // Make the file directories for the journal import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId); $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/articles'); $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/journals/' . $journalId . '/issues'); $fileManager->mkdir(Config::getVar('files', 'public_files_dir') . '/journals/' . $journalId); // Install default journal settings $journalSettingsDao = DAORegistry::getDAO('JournalSettingsDAO'); $names = $this->getData('name'); AppLocale::requireComponents(LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_APP_COMMON); $journalSettingsDao->installSettings($journalId, 'registry/journalSettings.xml', array('indexUrl' => $request->getIndexUrl(), 'journalPath' => $this->getData('path'), 'primaryLocale' => $site->getPrimaryLocale(), 'journalName' => $names[$site->getPrimaryLocale()])); // Install the default RT versions. import('classes.rt.ojs.JournalRTAdmin'); $journalRtAdmin = new JournalRTAdmin($journalId); $journalRtAdmin->restoreVersions(false); // Create a default "Articles" section $sectionDao = DAORegistry::getDAO('SectionDAO'); $section = new Section(); $section->setJournalId($journal->getId()); $section->setTitle(__('section.default.title'), $journal->getPrimaryLocale()); $section->setAbbrev(__('section.default.abbrev'), $journal->getPrimaryLocale()); $section->setMetaIndexed(true); $section->setMetaReviewed(true); $section->setPolicy(__('section.default.policy'), $journal->getPrimaryLocale()); $section->setEditorRestricted(false); $section->setHideTitle(false); $sectionDao->insertObject($section); } $journal->updateSetting('supportedLocales', $site->getSupportedLocales()); $journal->updateSetting('name', $this->getData('name'), 'string', true); $journal->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('JournalSiteSettingsForm::execute', array($this, $journal, $section, $isNewJournal)); if ($isNewJournal || $pathChanged) { return $journal->getPath(); } }
/** * Test all locale files for the supplied locale against the supplied * reference locale, returning an array of errors. * @param $locale string Name of locale to test * @param $referenceLocale string Name of locale to test against * @return array */ function testLocale($locale, $referenceLocale) { $localeFile =& new LocaleFile($locale, Locale::getMainLocaleFilename($locale)); $referenceLocaleFile =& new LocaleFile($referenceLocale, Locale::getMainLocaleFilename($referenceLocale)); $errors = $localeFile->testLocale($referenceLocaleFile); unset($localeFile); unset($referenceLocaleFile); $plugins =& PluginRegistry::loadAllPlugins(); foreach (array_keys($plugins) as $key) { $plugin =& $plugins[$key]; $referenceLocaleFilename = $plugin->getLocaleFilename($referenceLocale); if ($referenceLocaleFilename) { $localeFile =& new LocaleFile($locale, $plugin->getLocaleFilename($locale)); $referenceLocaleFile =& new LocaleFile($referenceLocale, $referenceLocaleFilename); $errors = array_merge_recursive($errors, $localeFile->testLocale($referenceLocaleFile)); unset($localeFile); unset($referenceLocaleFile); } unset($plugin); } return $errors; }
/** * Save press settings. */ function execute() { $pressDao =& DAORegistry::getDAO('PressDAO'); if (isset($this->pressId)) { $press =& $pressDao->getPress($this->pressId); } if (!isset($press)) { $press = new Press(); } $press->setPath($this->getData('path')); $press->setEnabled($this->getData('enabled')); if ($press->getId() != null) { $isNewPress = false; $pressDao->updatePress($press); $series = null; } else { $isNewPress = true; $site =& Request::getSite(); // Give it a default primary locale $press->setPrimaryLocale($site->getPrimaryLocale()); $pressId = $pressDao->insertPress($press); $pressDao->resequencePresses(); // Make the file directories for the press import('lib.pkp.classes.file.FileManager'); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/presses/' . $pressId); FileManager::mkdir(Config::getVar('files', 'files_dir') . '/presses/' . $pressId . '/monographs'); FileManager::mkdir(Config::getVar('files', 'public_files_dir') . '/presses/' . $pressId); $installedLocales =& $site->getInstalledLocales(); // Install default genres $genreDao =& DAORegistry::getDAO('GenreDAO'); $genreDao->installDefaults($pressId, $installedLocales); /* @var $genreDao GenreDAO */ // Install default publication formats $publicationFormatDao =& DAORegistry::getDAO('PublicationFormatDAO'); /* @var $publicationFormatDao PublicationFormatDAO */ $publicationFormatDao->installDefaults($pressId, $installedLocales); // Install default user groups $userGroupDao =& DAORegistry::getDAO('UserGroupDAO'); $userGroupDao->installSettings($pressId, 'registry/userGroups.xml'); // Make the site administrator the press manager of newly created presses $sessionManager =& SessionManager::getManager(); $userSession =& $sessionManager->getUserSession(); if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($pressId)) { // get the default site admin user group $managerUserGroup =& $userGroupDao->getDefaultByRoleId($pressId, ROLE_ID_PRESS_MANAGER); $userGroupDao->assignUserToGroup($userSession->getUserId(), $managerUserGroup->getId()); } // Install default press settings $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO'); $titles = $this->getData('title'); Locale::requireComponents(array(LOCALE_COMPONENT_OMP_DEFAULT_SETTINGS)); $pressSettingsDao->installSettings($pressId, 'registry/pressSettings.xml', array('indexUrl' => Request::getIndexUrl(), 'pressPath' => $this->getData('path'), 'primaryLocale' => $site->getPrimaryLocale(), 'pressName' => $titles[$site->getPrimaryLocale()])); } $press->updateSetting('name', $this->getData('name'), 'string', true); $press->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('PressSiteSettingsForm::execute', array(&$this, &$press, &$series, &$isNewPress)); }
/** * Parse all scheduled tasks files and * save the result object in database. */ function _parseCrontab() { $xmlParser = new XMLParser(); $taskFilesPath = array(); // Load all plugins so any plugin can register a crontab. PluginRegistry::loadAllPlugins(); // Let plugins register their scheduled tasks too. HookRegistry::call('AcronPlugin::parseCronTab', array(&$taskFilesPath)); // Reference needed. // Add the default tasks file. $taskFilesPath[] = 'registry/scheduledTasks.xml'; // TODO: make this a plugin setting, rather than assuming. $tasks = array(); foreach ($taskFilesPath as $filePath) { $tree = $xmlParser->parse($filePath); if (!$tree) { $xmlParser->destroy(); // TODO: graceful error handling fatalError('Error parsing scheduled tasks XML file: ' . $filePath); } foreach ($tree->getChildren() as $task) { $frequency = $task->getChildByName('frequency'); $args = ScheduledTaskHelper::getTaskArgs($task); // Tasks without a frequency defined, or defined to zero, will run on every request. // To avoid that happening (may cause performance problems) we // setup a default period of time. $setDefaultFrequency = true; $minHoursRunPeriod = 24; if ($frequency) { $frequencyAttributes = $frequency->getAttributes(); if (is_array($frequencyAttributes)) { foreach ($frequencyAttributes as $key => $value) { if ($value != 0) { $setDefaultFrequency = false; break; } } } } $tasks[] = array('className' => $task->getAttribute('class'), 'frequency' => $setDefaultFrequency ? array('hour' => $minHoursRunPeriod) : $frequencyAttributes, 'args' => $args); } $xmlParser->destroy(); } // Store the object. $this->updateSetting(0, 'crontab', $tasks, 'object'); }
/** * Test all locale files for the supplied locale against the supplied * reference locale, returning an array of errors. * @param $locale string Name of locale to test * @param $referenceLocale string Name of locale to test against * @return array */ function testLocale($locale, $referenceLocale) { $localeFileNames = Locale::getFilenameComponentMap($locale); $errors = array(); foreach ($localeFileNames as $localeFileName) { $referenceLocaleFileName = str_replace($locale, $referenceLocale, $localeFileName); $localeFile = new LocaleFile($locale, $localeFileName); $referenceLocaleFile = new LocaleFile($referenceLocale, $referenceLocaleFileName); $errors = array_merge_recursive($errors, $localeFile->testLocale($referenceLocaleFile)); unset($localeFile); unset($referenceLocaleFile); } $plugins =& PluginRegistry::loadAllPlugins(); foreach (array_keys($plugins) as $key) { $plugin =& $plugins[$key]; $referenceLocaleFilename = $plugin->getLocaleFilename($referenceLocale); if ($referenceLocaleFilename) { $localeFile = new LocaleFile($locale, $plugin->getLocaleFilename($locale)); $referenceLocaleFile = new LocaleFile($referenceLocale, $referenceLocaleFilename); $errors = array_merge_recursive($errors, $localeFile->testLocale($referenceLocaleFile)); unset($localeFile); unset($referenceLocaleFile); } unset($plugin); } return $errors; }
/** * Save press settings. * @param $request PKPRequest */ function execute($request) { $pressDao = DAORegistry::getDAO('PressDAO'); if (isset($this->contextId)) { $press = $pressDao->getById($this->contextId); /* @var $press Press */ import('classes.publicationFormat.PublicationFormatTombstoneManager'); $publicationFormatTombstoneMgr = new PublicationFormatTombstoneManager(); if ($press->getEnabled() && !$this->getData('enabled')) { // Will disable the press. Create tombstones for all // published monographs publication formats. $publicationFormatTombstoneMgr->insertTombstonesByPress($press); } elseif (!$press->getEnabled() && $this->getData('enabled')) { // Will enable the press. Delete all tombstones. $publicationFormatTombstoneMgr->deleteTombstonesByPressId($press->getId()); } } if (!isset($press)) { $press = $pressDao->newDataObject(); } // Check if the press path has changed. $pathChanged = false; $pressPath = $press->getPath(); if ($pressPath != $this->getData('path')) { $pathChanged = true; } $press->setPath($this->getData('path')); $press->setEnabled($this->getData('enabled')); $isNewPress = false; $site = $request->getSite(); if ($press->getId() != null) { $pressDao->updateObject($press); } else { $isNewPress = true; // Give it a default primary locale $press->setPrimaryLocale($site->getPrimaryLocale()); $contextId = $pressDao->insertObject($press); $pressDao->resequence(); // Make the file directories for the press import('lib.pkp.classes.file.ContextFileManager'); $pressFileManager = new ContextFileManager($contextId); $pressFileManager->mkdir($pressFileManager->getBasePath()); $pressFileManager->mkdir($pressFileManager->getBasePath() . '/monographs'); $installedLocales = $site->getInstalledLocales(); // Install default genres $genreDao = DAORegistry::getDAO('GenreDAO'); $genreDao->installDefaults($contextId, $installedLocales); /* @var $genreDao GenreDAO */ // load the default user groups and stage assignments. $this->_loadDefaultUserGroups($press->getId()); $this->_assignManagerGroup($press->getId()); // Install default press settings $pressSettingsDao = DAORegistry::getDAO('PressSettingsDAO'); $titles = $this->getData('title'); AppLocale::requireComponents(LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_PKP_DEFAULT); $pressSettingsDao->installSettings($contextId, 'registry/pressSettings.xml', array('indexUrl' => $request->getIndexUrl(), 'pressPath' => $this->getData('path'), 'primaryLocale' => $site->getPrimaryLocale(), 'contextName' => $titles[$site->getPrimaryLocale()], 'ldelim' => '{', 'rdelim' => '}')); } $press->updateSetting('supportedLocales', $site->getSupportedLocales()); $press->updateSetting('name', $this->getData('name'), 'string', true); $press->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('PressSiteSettingsForm::execute', array(&$this, &$press, &$isNewPress)); if ($isNewPress || $pathChanged) { return $press->getPath(); } }
/** * Save schedConf settings. * @param $request PKPRequest */ function execute($request) { $schedConfDao = DAORegistry::getDAO('SchedConfDAO'); $conference = $request->getConference(); if (isset($this->contextId)) { $schedConf = $schedConfDao->getById($this->contextId); } if (!isset($schedConf)) { $schedConf = $schedConfDao->newDataObject(); $schedConf->setConferenceId($conference->getId()); } $schedConf->setPath($this->getData('path')); $schedConf->setEnabled($this->getData('enabled')); if ($schedConf->getId() != null) { $isNewSchedConf = false; $schedConfDao->updateObject($schedConf); $section = null; } else { $isNewSchedConf = true; $site = $request->getSite(); // Give it a default primary locale $schedConfId = $schedConfDao->insertObject($schedConf); $schedConfDao->resequence(); // Make the file directories for the scheduled conference import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); $conferenceId = $schedConf->getConferenceId(); $privateBasePath = Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId; $publicBasePath = Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs/' . $schedConfId; $fileManager->mkdirtree($privateBasePath); $fileManager->mkdirtree($privateBasePath . '/papers'); $fileManager->mkdirtree($privateBasePath . '/tracks'); $fileManager->mkdirtree($publicBasePath); // Install default scheduled conference settings $schedConfSettingsDao = DAORegistry::getDAO('SchedConfSettingsDAO'); $name = $this->getData('name'); $name = $name[$this->getFormLocale()]; AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON, LOCALE_COMPONENT_APP_DEFAULT); $dispatcher = $request->getDispatcher(); $schedConfSettingsDao->installSettings($schedConfId, Config::getVar('general', 'registry_dir') . '/schedConfSettings.xml', array('authorGuidelinesUrl' => $dispatcher->url($request, ROUTE_PAGE, array($conference->getPath(), $this->getData('schedConfPath')), 'about', 'submissions', null, null, 'authorGuidelines'), 'indexUrl' => $request->getIndexUrl(), 'conferencePath' => $conference->getPath(), 'conferenceName' => $conference->getLocalizedName(), 'schedConfPath' => $this->getData('path'), 'schedConfUrl' => $dispatcher->url($request, ROUTE_PAGE, array($conference->getPath(), $this->getData('schedConfPath')), 'index'), 'schedConfName' => $name)); // Create a default "Papers" track $trackDao = DAORegistry::getDAO('TrackDAO'); $track = new Track(); $track->setSchedConfId($schedConfId); $track->setMetaReviewed(true); $track->setTitle(__('track.default.title'), $conference->getPrimaryLocale()); $track->setAbbrev(__('track.default.abbrev'), $conference->getPrimaryLocale()); $track->setPolicy(__('track.default.policy'), $conference->getPrimaryLocale()); $track->setDirectorRestricted(false); $trackDao->insertTrack($track); } $schedConf->updateSetting('name', $this->getData('name'), 'string', true); $schedConf->updateSetting('acronym', $this->getData('acronym'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('SchedConfSettingsForm::execute', array(&$this, &$schedConf)); }
/** * Save conference settings. * @param $request PKPRequest */ function execute($request) { $conferenceDao = DAORegistry::getDAO('ConferenceDAO'); if (isset($this->contextId)) { $conference =& $conferenceDao->getById($this->contextId); } if (!isset($conference)) { $conference = $conferenceDao->newDataObject(); } $conference->setPath($this->getData('path')); $conference->setEnabled($this->getData('enabled')); if ($conference->getId() != null) { $isNewConference = false; $conferenceDao->updateObject($conference); $section = null; } else { $isNewConference = true; $site = $request->getSite(); // Give it a default primary locale $conference->setPrimaryLocale($site->getPrimaryLocale()); $conferenceId = $conferenceDao->insertObject($conference); $conferenceDao->resequence(); // Make the site administrator the conference manager of newly created conferences $sessionManager =& SessionManager::getManager(); $userSession =& $sessionManager->getUserSession(); if ($userSession->getUserId() != null && $userSession->getUserId() != 0 && !empty($conferenceId)) { $role = new Role(); $role->setConferenceId($conferenceId); $role->setUserId($userSession->getUserId()); $role->setRoleId(ROLE_ID_MANAGER); $roleDao = DAORegistry::getDAO('RoleDAO'); $roleDao->insertRole($role); } // Make the file directories for the conference import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId); $fileManager->mkdir(Config::getVar('files', 'files_dir') . '/conferences/' . $conferenceId . '/schedConfs'); $fileManager->mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId); $fileManager->mkdir(Config::getVar('files', 'public_files_dir') . '/conferences/' . $conferenceId . '/schedConfs'); // Install default conference settings $conferenceSettingsDao = DAORegistry::getDAO('ConferenceSettingsDAO'); $names = $this->getData('name'); AppLocale::requireComponents(LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_APP_COMMON); $dispatcher = $request->getDispatcher(); $conferenceSettingsDao->installSettings($conferenceId, 'registry/conferenceSettings.xml', array('privacyStatementUrl' => $dispatcher->url($request, ROUTE_PAGE, array($this->getData('path'), 'index'), 'about', 'submissions', null, null, 'privacyStatement'), 'loginUrl' => $dispatcher->url($request, ROUTE_PAGE, array('index', 'index'), 'login'), 'conferenceUrl' => $dispatcher->url($request, ROUTE_PAGE, array($this->getData('path'), 'index')), 'conferencePath' => $this->getData('path'), 'primaryLocale' => $site->getPrimaryLocale(), 'aboutUrl' => $dispatcher->url($request, ROUTE_PAGE, array($this->getData('path'), 'index'), 'about'), 'accountUrl' => $dispatcher->url($request, ROUTE_PAGE, array($this->getData('path'), 'index'), 'user', 'register'), 'conferenceName' => $names[$site->getPrimaryLocale()])); // Install the default RT versions. import('classes.rt.ocs.ConferenceRTAdmin'); $conferenceRtAdmin = new ConferenceRTAdmin($conferenceId); $conferenceRtAdmin->restoreVersions(false); } $conference->updateSetting('name', $this->getData('name'), 'string', true); $conference->updateSetting('description', $this->getData('description'), 'string', true); // Make sure all plugins are loaded for settings preload PluginRegistry::loadAllPlugins(); HookRegistry::call('ConferenceSiteSettingsForm::execute', array(&$this, &$conference)); }