Ejemplo n.º 1
0
 function display()
 {
     $journal = Request::getJournal();
     $countryDao =& DAORegistry::getDAO('CountryDAO');
     $extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
     $institutionDao =& DAORegistry::getDAO('InstitutionDAO');
     $currencyDao =& DAORegistry::getDAO('CurrencyDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $sectionOptions = array('0' => Locale::translate('editor.reports.anyCommittee')) + $sectionDao->getSectionTitles($journal->getId());
     $decisionTypes = array(INITIAL_REVIEW => 'submission.initialReview', PROGRESS_REPORT => 'submission.progressReport', PROTOCOL_AMENDMENT => 'submission.protocolAmendment', SERIOUS_ADVERSE_EVENT => 'submission.seriousAdverseEvents', FINAL_REPORT => 'submission.finalReport');
     $decisionOptions = array(98 => 'editor.reports.aDecisionsIUR', 99 => 'editor.reports.aDecisionsEUR', SUBMISSION_SECTION_DECISION_APPROVED => 'editor.article.decision.approved', SUBMISSION_SECTION_DECISION_RESUBMIT => 'editor.article.decision.resubmit', SUBMISSION_SECTION_DECISION_DECLINED => 'editor.article.decision.declined');
     $budgetOptions = array(">=" => 'editor.reports.budgetSuperiorTo', "<=" => 'editor.reports.budgetInferiorTo');
     $sourceCurrencyId = $journal->getSetting('sourceCurrency');
     $reportTypeOptions = array(0 => 'editor.reports.type.spreadsheet', 1 => 'editor.reports.type.pieChart', 2 => 'editor.reports.type.barChart');
     $measurementOptions = array(0 => 'editor.reports.measurement.proposalNmbre', 1 => 'editor.reports.measurement.cumulatedBudget');
     $chartOptions = array();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('sectionOptions', $sectionOptions);
     $templateMgr->assign('decisionTypes', $decisionTypes);
     $templateMgr->assign('decisionOptions', $decisionOptions);
     $templateMgr->assign('institutionsList', $institutionDao->getInstitutionsList());
     $templateMgr->assign('reportTypeOptions', $reportTypeOptions);
     $templateMgr->assign('measurementOptions', $measurementOptions);
     $templateMgr->assign('chartOptions', $chartOptions);
     parent::display();
 }
 /**
  * Constructor
  * @param subscriptionId int leave as default for new subscription
  */
 function InstitutionalSubscriptionForm($subscriptionId = null, $userId = null)
 {
     parent::Form('subscription/institutionalSubscriptionForm.tpl');
     parent::SubscriptionForm($subscriptionId, $userId);
     $subscriptionId = isset($subscriptionId) ? (int) $subscriptionId : null;
     $userId = isset($userId) ? (int) $userId : null;
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     if (isset($subscriptionId)) {
         $subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
         if ($subscriptionDao->subscriptionExists($subscriptionId)) {
             $this->subscription =& $subscriptionDao->getSubscription($subscriptionId);
         }
     }
     $subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
     $subscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, true);
     $this->subscriptionTypes =& $subscriptionTypes->toArray();
     $subscriptionTypeCount = count($this->subscriptionTypes);
     if ($subscriptionTypeCount == 0) {
         $this->addError('typeId', Locale::translate('manager.subscriptions.form.typeRequired'));
         $this->addErrorField('typeId');
     }
     // Ensure subscription type is valid
     $this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'manager.subscriptions.form.typeIdValid', create_function('$typeId, $journalId', '$subscriptionTypeDao =& DAORegistry::getDAO(\'SubscriptionTypeDAO\'); return ($subscriptionTypeDao->subscriptionTypeExistsByTypeId($typeId, $journalId) && $subscriptionTypeDao->getSubscriptionTypeInstitutional($typeId) == 1);'), array($journal->getId())));
     // Ensure institution name is provided
     $this->addCheck(new FormValidator($this, 'institutionName', 'required', 'manager.subscriptions.form.institutionNameRequired'));
     // If provided, domain is valid
     $this->addCheck(new FormValidatorRegExp($this, 'domain', 'optional', 'manager.subscriptions.form.domainValid', '/^' . '[A-Z0-9]+([\\-_\\.][A-Z0-9]+)*' . '\\.' . '[A-Z]{2,4}' . '$/i'));
 }
 /**
  * Display the form.
  */
 function display()
 {
     $press =& Request::getPress();
     $user =& Request::getUser();
     $submission = $this->reviewerSubmission;
     $reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
     $reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
     $reviewAssignment = $reviewAssignmentDao->getById($submission->getReviewId());
     if ($submission->getDateConfirmed() == null) {
         $confirmedStatus = 0;
     } else {
         $confirmedStatus = 1;
     }
     $templateMgr =& TemplateManager::getManager();
     $reviewerRequestParams = array('reviewer' => $reviewAssignment->getReviewerFullName(), 'personalNote' => 'EDITOR NOTE', 'editor' => $press->getSetting('contactName'));
     $templateMgr->assign('reviewerRequest', Locale::translate('reviewer.step1.requestBoilerplate', $reviewerRequestParams));
     $templateMgr->assign_by_ref('submission', $submission);
     $templateMgr->assign_by_ref('reviewAssignment', $reviewAssignment);
     $templateMgr->assign_by_ref('press', $press);
     $templateMgr->assign_by_ref('reviewGuidelines', $press->getLocalizedSetting('reviewGuidelines'));
     $templateMgr->assign('step', 1);
     $templateMgr->assign('completedSteps', $submission->getStatus());
     $templateMgr->assign('blindReview', true);
     // FIXME: Need to be able to get/set if a review is blind or not
     // FIXME: Need press setting that denotes competing interests are required
     $templateMgr->assign('competingInterestsText', $submission->getCompetingInterests());
     import('classes.submission.reviewAssignment.ReviewAssignment');
     $templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
     $templateMgr->assign('helpTopicId', 'editorial.reviewersRole.review');
     parent::display();
 }
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn(&$row, $column)
 {
     $monographFile =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($monographFile, 'DataObject') && !empty($columnId));
     switch ($columnId) {
         case 'name':
             $fileName = $monographFile->getLocalizedName() != '' ? $monographFile->getLocalizedName() : Locale::translate('common.untitled');
             if ($monographFile->getRevision() > 1) {
                 $fileName .= ' (' . $monographFile->getRevision() . ')';
             }
             // Add revision number to label
             if (empty($title)) {
                 $title = Locale::translate('common.untitled');
             }
             return array('label' => $fileName);
             break;
         case 'fileType':
             return array('label' => $monographFile->getExtension());
             break;
         case 'type':
             $genreDao =& DAORegistry::getDAO('GenreDAO');
             $genre = $genreDao->getById($monographFile->getGenreId());
             return array('label' => $genre->getLocalizedName());
             break;
     }
 }
Ejemplo n.º 5
0
 /**
  * Display the form.
  */
 function display()
 {
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     // Get tracks for this conference
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     // If this user is a track director or a director, they are
     // allowed to submit to tracks flagged as "director-only" for
     // submissions. Otherwise, display only tracks they are allowed
     // to submit to.
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isDirector = $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_TRACK_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_TRACK_DIRECTOR);
     $templateMgr->assign('trackOptions', array('0' => Locale::translate('author.submit.selectTrack')) + $trackDao->getTrackTitles($schedConf->getId(), !$isDirector));
     $paperTypeDao =& DAORegistry::getDAO('PaperTypeDAO');
     $sessionTypes = $paperTypeDao->getPaperTypes($schedConf->getId());
     $templateMgr->assign('sessionTypes', $sessionTypes->toArray());
     // Provide available submission languages. (Convert the array
     // of locale symbolic names xx_XX into an associative array
     // of symbolic names => readable names.)
     $supportedSubmissionLocales = $conference->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($conference->getPrimaryLocale());
     }
     $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
     parent::display();
 }
 /**
  * Display the form.
  */
 function display()
 {
     $press =& Request::getPress();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     // Get series for this press
     $seriesDao =& DAORegistry::getDAO('SeriesDAO');
     // FIXME: If this user is a series editor or an editor, they are
     // allowed to submit to series flagged as "editor-only" for
     // submissions. Otherwise, display only series they are allowed
     // to submit to.
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isEditor = $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_SERIES_EDITOR);
     $seriesOptions = array('0' => Locale::translate('submission.submit.selectSeries')) + $seriesDao->getTitlesByPressId($press->getId());
     $templateMgr->assign('seriesOptions', $seriesOptions);
     // Provide available submission languages. (Convert the array
     // of locale symbolic names xx_XX into an associative array
     // of symbolic names => readable names.)
     $supportedSubmissionLocales = $press->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($press->getPrimaryLocale());
     }
     $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
     parent::display();
 }
Ejemplo n.º 7
0
 /**
  * Display the form.
  */
 function display()
 {
     $templateMgr =& TemplateManager::getManager();
     $institutionDao =& DAORegistry::getDAO('InstitutionDAO');
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $countInstitutions = count($institutionDao->getGeoAreas($this->extraFieldId));
     $countCommittees = count($sectionDao->getGeoAreas($this->extraFieldId));
     if ($this->typeConst == EXTRA_FIELD_GEO_AREA) {
         if ($this->extraFieldId && ($countInstitutions > 0 || $countCommittees > 0)) {
             $warning = 'manager.extraFields.geoAreas.modify.warning';
         } else {
             $warning = null;
         }
     } else {
         if ($this->extraFieldId) {
             $warning = 'manager.extraFields.modify.warning';
         } else {
             $warning = null;
         }
     }
     $templateMgr->assign('warning', $warning);
     $templateMgr->assign('yesNoArray', array(EXTRA_FIELD_ACTIVE => Locale::translate('common.yes'), EXTRA_FIELD_NOT_ACTIVE => Locale::translate('common.no')));
     $templateMgr->assign('pageTitle', 'manager.extraFields.' . $this->type . '.edit');
     $templateMgr->assign('extraFieldId', $this->extraFieldId);
     $templateMgr->assign('type', $this->type);
     $journal = Request::getJournal();
     $templateMgr->assign_by_ref('locales', $journal->getSupportedLocaleNames());
     parent::display();
 }
Ejemplo n.º 8
0
 private function putHeaders(&$columns)
 {
     $columns = array('track' => Locale::translate('track.title'), 'title' => Locale::translate('paper.title'), 'abstract' => Locale::translate('paper.abstract'));
     for ($i = 0; $i <= $this->maxAuthors; $i++) {
         $columns = array_merge($columns, array('fname' . $i => Locale::translate('user.firstName') . " (" . Locale::translate('user.role.author') . " {$i})", 'mname' . $i => Locale::translate('user.middleName') . " (" . Locale::translate('user.role.author') . " {$i})", 'lname' . $i => Locale::translate('user.lastName') . " (" . Locale::translate('user.role.author') . " {$i})", 'affiliation' . $i => Locale::translate('user.affiliation') . " (" . Locale::translate('user.role.author') . " {$i})", 'email' . $i => Locale::translate('user.email') . " (" . Locale::translate('user.role.author') . " {$i})"));
     }
 }
Ejemplo n.º 9
0
 function display(&$args)
 {
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER));
     $this->import('PaperFormSettings');
     $form = new PaperFormSettings($this, $conference->getId());
     if (Request::getUserVar('GenerateReport')) {
         $ReportHandlerDAO =& DAORegistry::getDAO('MultiPaperReportDAO');
         $iterator =& $ReportHandlerDAO->getPaperReport($conference->getId(), $schedConf->getId());
         $form->readInputData();
         if ($form->validate()) {
             $form->execute();
             $custom_Class = $form->getData('reportClass');
             if (class_exists($custom_Class)) {
                 $Report = new $custom_Class($iterator, $this);
                 $Report->makeReport();
                 Request::redirect(null, null, 'manager', 'plugin');
             } else {
                 echo Locale::translate('plugins.reports.MultiGeneratorPaperReport.classNotFound');
                 $form->display();
             }
         } else {
             $this->setBreadCrumbs(true);
             $form->makeOptions();
             $form->display();
         }
     } else {
         $this->setBreadCrumbs(true);
         $form->initData();
         $form->display();
     }
 }
Ejemplo n.º 10
0
 /**
  * This implementation assumes an element that is a
  * Filter. It will display the filter name and information
  * about filter parameters (if any).
  * @see GridCellProvider::getTemplateVarsFromRowColumn()
  * @param $row GridRow
  * @param $column GridColumn
  * @return array
  */
 function getTemplateVarsFromRowColumn(&$row, $column)
 {
     $filter =& $row->getData();
     assert(is_a($filter, 'Filter'));
     switch ($column->getId()) {
         case 'settings':
             $label = '';
             foreach ($filter->getSettings() as $filterSetting) {
                 $settingData = $filter->getData($filterSetting->getName());
                 if (is_a($filterSetting, 'BooleanFilterSetting')) {
                     if ($settingData) {
                         if (!empty($label)) {
                             $label .= ' | ';
                         }
                         $label .= Locale::translate($filterSetting->getDisplayName());
                     }
                 } else {
                     if (!empty($settingData)) {
                         if (!empty($label)) {
                             $label .= ' | ';
                         }
                         $label .= Locale::translate($filterSetting->getDisplayName()) . ': ' . $settingData;
                     }
                 }
             }
             break;
         default:
             $label = $filter->getData($column->getId());
     }
     return array('label' => $label);
 }
Ejemplo n.º 11
0
 /**
  * Read installation parameters from stdin.
  * FIXME: May want to implement an abstract "CLIForm" class handling input/validation.
  * FIXME: Use readline if available?
  */
 function readParams()
 {
     printf("%s\n", Locale::translate('installer.ojsInstallation'));
     parent::readParams();
     $this->readParamBoolean('install', 'installer.installOJS');
     return $this->params['install'];
 }
 function displayPaymentForm($queuedPaymentId, &$queuedPayment)
 {
     if (!$this->isConfigured()) {
         return false;
     }
     $journal =& Request::getJournal();
     $templateMgr =& TemplateManager::getManager();
     $user =& Request::getUser();
     $templateMgr->assign('itemName', $queuedPayment->getName());
     $templateMgr->assign('itemDescription', $queuedPayment->getDescription());
     if ($queuedPayment->getAmount() > 0) {
         $templateMgr->assign('itemAmount', $queuedPayment->getAmount());
         $templateMgr->assign('itemCurrencyCode', $queuedPayment->getCurrencyCode());
     }
     $templateMgr->assign('manualInstructions', $this->getSetting($journal->getJournalId(), 'manualInstructions'));
     $templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
     if ($queuedPayment->getAmount() > 0) {
         import('mail.MailTemplate');
         $contactName = $journal->getSetting('contactName');
         $contactEmail = $journal->getSetting('contactEmail');
         $mail =& new MailTemplate('MANUAL_PAYMENT_NOTIFICATION');
         $mail->setFrom($contactEmail, $contactName);
         $mail->addRecipient($contactEmail, $contactName);
         $mail->assignParams(array('journalName' => $journal->getJournalTitle(), 'userFullName' => $user ? $user->getFullName() : '(' . Locale::translate('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . Locale::translate('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()));
         $mail->send();
     }
 }
Ejemplo n.º 13
0
 /**
  * Return string containing the contents of the HTML file.
  * This function performs any necessary filtering, like image URL replacement.
  * @param $baseImageUrl string base URL for image references
  * @return string
  */
 function getHTMLContents()
 {
     import('file.ArticleFileManager');
     $fileManager =& new ArticleFileManager($this->getArticleId());
     $contents = $fileManager->readFile($this->getFileId());
     $journal =& Request::getJournal();
     // Replace media file references
     $images =& $this->getImageFiles();
     foreach ($images as $image) {
         $imageUrl = Request::url(null, 'article', 'viewFile', array($this->getArticleId(), $this->getBestGalleyId($journal), $image->getFileId()));
         $pattern = preg_quote(rawurlencode($image->getOriginalFileName()));
         $contents = preg_replace('/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\\s*=\\s*"([^"]*' . $pattern . ')"/', '\\1="' . $imageUrl . '"', $contents);
         // Replacement for Flowplayer
         $contents = preg_replace('/[Uu][Rr][Ll]\\s*\\:\\s*\'(' . $pattern . ')\'/', 'url:\'' . $imageUrl . '\'', $contents);
         // Replacement for other players (ested with odeo; yahoo and google player won't work w/ OJS URLs, might work for others)
         $contents = preg_replace('/[Uu][Rr][Ll]=([^"]*' . $pattern . ')/', 'url=' . $imageUrl, $contents);
     }
     // Perform replacement for ojs://... URLs
     $contents = String::regexp_replace_callback('/(<[^<>]*")[Oo][Jj][Ss]:\\/\\/([^"]+)("[^<>]*>)/', array(&$this, '_handleOjsUrl'), $contents);
     // Perform variable replacement for journal, issue, site info
     $issueDao =& DAORegistry::getDAO('IssueDAO');
     $issue =& $issueDao->getIssueByArticleId($this->getArticleId());
     $journal =& Request::getJournal();
     $site =& Request::getSite();
     $paramArray = array('issueTitle' => $issue ? $issue->getIssueIdentification() : Locale::translate('editor.article.scheduleForPublication.toBeAssigned'), 'journalTitle' => $journal->getJournalTitle(), 'siteTitle' => $site->getSiteTitle(), 'currentUrl' => Request::getRequestUrl());
     foreach ($paramArray as $key => $value) {
         $contents = str_replace('{$' . $key . '}', $value, $contents);
     }
     return $contents;
 }
Ejemplo n.º 14
0
 /**
  * Save changes to program settings.
  */
 function saveProgramSettings()
 {
     $this->validate();
     $this->setupTemplate(true);
     $schedConf =& Request::getSchedConf();
     if (!$schedConf) {
         Request::redirect(null, null, 'index');
     }
     import('classes.manager.form.ProgramSettingsForm');
     $settingsForm = new ProgramSettingsForm();
     $settingsForm->readInputData();
     $formLocale = $settingsForm->getFormLocale();
     $programTitle = Request::getUserVar('programFileTitle');
     $editData = false;
     if (Request::getUserVar('uploadProgramFile')) {
         if (!$settingsForm->uploadProgram('programFile', $formLocale)) {
             $settingsForm->addError('programFile', Locale::translate('common.uploadFailed'));
         }
         $editData = true;
     } elseif (Request::getUserVar('deleteProgramFile')) {
         $settingsForm->deleteProgram('programFile', $formLocale);
         $editData = true;
     }
     if (!$editData && $settingsForm->validate()) {
         $settingsForm->execute();
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
         $templateMgr->display('common/message.tpl');
     } else {
         $settingsForm->display();
     }
 }
 function addItem($args, &$request)
 {
     $this->setupTemplate();
     $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
     $press =& $request->getPress();
     $index = 'sourceTitle-' . $this->getId();
     $format = $args[$index];
     if (!isset($format)) {
         $json = new JSON('false');
         return $json->getString();
     } else {
         // Make sure the item doesn't already exist
         $formats = $pressSettingsDao->getSetting($press->getId(), 'cataloguingMetadata');
         foreach ($formats as $item) {
             if ($item['name'] == $format) {
                 $json = new JSON('false', Locale::translate('common.listbuilder.itemExists'));
                 return $json->getString();
                 return false;
             }
         }
         $formats[] = array('name' => $format);
         $pressSettingsDao->updateSetting($press->getId(), 'cataloguingMetadata', $formats, 'object');
         // Return JSON with formatted HTML to insert into list
         $row =& $this->getRowInstance();
         $row->setGridId($this->getId());
         $row->setId($format);
         $rowData = array('item' => $format);
         $row->setData($rowData);
         $row->initialize($request);
         $json = new JSON('true', $this->_renderRowInternally($request, $row));
         return $json->getString();
     }
 }
Ejemplo n.º 16
0
 /**
  * Validate and save changes to user's profile.
  */
 function saveProfile()
 {
     $this->validate();
     $this->setupTemplate();
     $dataModified = false;
     import('user.form.ProfileForm');
     $profileForm = new ProfileForm();
     $profileForm->readInputData();
     if (Request::getUserVar('uploadProfileImage')) {
         if (!$profileForm->uploadProfileImage()) {
             $profileForm->addError('profileImage', Locale::translate('user.profile.form.profileImageInvalid'));
         }
         $dataModified = true;
     } else {
         if (Request::getUserVar('deleteProfileImage')) {
             $profileForm->deleteProfileImage();
             $dataModified = true;
         }
     }
     if (!$dataModified && $profileForm->validate()) {
         $profileForm->execute();
         Request::redirect(null, null, Request::getRequestedPage());
     } else {
         $profileForm->display();
     }
 }
Ejemplo n.º 17
0
 /**
  * @see PKPCitationGridHandler::exportCitations()
  */
 function exportCitations($args, &$request)
 {
     $dispatcher =& $this->getDispatcher();
     $articleMetadataUrl = $dispatcher->url($request, ROUTE_PAGE, null, 'editor', 'viewMetadata', $this->getAssocId());
     $noCitationsFoundMessage = Locale::translate("submission.citations.editor.pleaseImportCitationsFirst", array('articleMetadataUrl' => $articleMetadataUrl));
     return parent::exportCitations($args, $request, $noCitationsFoundMessage);
 }
 /**
  * Constructor
  * @param typeId int leave as default for new subscription type
  */
 function SubscriptionTypeForm($typeId = null)
 {
     $this->validFormats = array(SUBSCRIPTION_TYPE_FORMAT_ONLINE => Locale::translate('subscriptionTypes.format.online'), SUBSCRIPTION_TYPE_FORMAT_PRINT => Locale::translate('subscriptionTypes.format.print'), SUBSCRIPTION_TYPE_FORMAT_PRINT_ONLINE => Locale::translate('subscriptionTypes.format.printOnline'));
     $currencyDao =& DAORegistry::getDAO('CurrencyDAO');
     $currencies =& $currencyDao->getCurrencies();
     $this->validCurrencies = array();
     while (list(, $currency) = each($currencies)) {
         $this->validCurrencies[$currency->getCodeAlpha()] = $currency->getName() . ' (' . $currency->getCodeAlpha() . ')';
     }
     $this->typeId = isset($typeId) ? (int) $typeId : null;
     $journal =& Request::getJournal();
     parent::Form('subscription/subscriptionTypeForm.tpl');
     // Type name is provided
     $this->addCheck(new FormValidatorLocale($this, 'name', 'required', 'manager.subscriptionTypes.form.typeNameRequired'));
     // Cost	is provided and is numeric and positive
     $this->addCheck(new FormValidator($this, 'cost', 'required', 'manager.subscriptionTypes.form.costRequired'));
     $this->addCheck(new FormValidatorCustom($this, 'cost', 'required', 'manager.subscriptionTypes.form.costNumeric', create_function('$cost', 'return (is_numeric($cost) && $cost >= 0);')));
     // Currency is provided and is valid value
     $this->addCheck(new FormValidator($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyRequired'));
     $this->addCheck(new FormValidatorInSet($this, 'currency', 'required', 'manager.subscriptionTypes.form.currencyValid', array_keys($this->validCurrencies)));
     // Non-expiring flag is valid value
     $this->addCheck(new FormValidatorInSet($this, 'nonExpiring', 'optional', 'manager.subscriptionTypes.form.nonExpiringValid', array('0', '1')));
     // Format is provided and is valid value
     $this->addCheck(new FormValidator($this, 'format', 'required', 'manager.subscriptionTypes.form.formatRequired'));
     $this->addCheck(new FormValidatorInSet($this, 'format', 'required', 'manager.subscriptionTypes.form.formatValid', array_keys($this->validFormats)));
     // Institutional flag is valid value
     $this->addCheck(new FormValidatorInSet($this, 'institutional', 'optional', 'manager.subscriptionTypes.form.institutionalValid', array('0', '1')));
     // Membership flag is valid value
     $this->addCheck(new FormValidatorInSet($this, 'membership', 'optional', 'manager.subscriptionTypes.form.membershipValid', array('1')));
     // Public flag is valid value
     $this->addCheck(new FormValidatorInSet($this, 'disable_public_display', 'optional', 'manager.subscriptionTypes.form.publicValid', array('1')));
     $this->addCheck(new FormValidatorPost($this));
 }
Ejemplo n.º 19
0
 /**
  * Fetch
  * @param $request PKPRequest
  * @see Form::fetch()
  */
 function fetch(&$request)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('monographFileCategories', array(GENRE_CATEGORY_DOCUMENT => Locale::translate('submission.document'), GENRE_CATEGORY_ARTWORK => Locale::translate('submission.art')));
     Locale::requireComponents(array(LOCALE_COMPONENT_OMP_MANAGER));
     return parent::fetch($request);
 }
 /**
  * @see Filter::process()
  * @param $citationString string
  * @return MetadataDescription
  */
 function &process($citationString)
 {
     $nullVar = null;
     $queryParams = array('demo' => '3', 'textlines' => $citationString);
     // Parscit web form - the result is (mal-formed) HTML
     if (is_null($result = $this->callWebService(PARSCIT_WEBSERVICE, $queryParams, XSL_TRANSFORMER_DOCTYPE_STRING, 'POST'))) {
         return $nullVar;
     }
     $result = html_entity_decode($result);
     // Detect errors.
     if (!String::regexp_match('/.*<algorithm[^>]+>.*<\\/algorithm>.*/s', $result)) {
         $translationParams = array('filterName' => $this->getDisplayName());
         $this->addError(Locale::translate('submission.citations.filter.webserviceResultTransformationError', $translationParams));
         return $nullVar;
     }
     // Screen-scrape the tagged portion and turn it into XML.
     $xmlResult = String::regexp_replace('/.*<algorithm[^>]+>(.*)<\\/algorithm>.*/s', '\\1', $result);
     $xmlResult = String::regexp_replace('/&/', '&amp;', $xmlResult);
     // Transform the result into an array of meta-data.
     if (is_null($metadata = $this->transformWebServiceResults($xmlResult, dirname(__FILE__) . DIRECTORY_SEPARATOR . 'parscit.xsl'))) {
         return $nullVar;
     }
     // Extract a publisher from the place string if possible.
     $metadata =& $this->fixPublisherNameAndLocation($metadata);
     return $this->getNlm30CitationDescriptionFromMetadataArray($metadata);
 }
 /**
  * Extracts variables for a given column from a data element
  * so that they may be assigned to template before rendering.
  * @param $element mixed
  * @param $columnId string
  * @return array
  */
 function getTemplateVarsFromRowColumn(&$row, $column)
 {
     $element =& $row->getData();
     $columnId = $column->getId();
     assert(is_a($element, 'DataObject') && !empty($columnId));
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     /* @var $roleDao RoleDAO */
     switch ($columnId) {
         case 'name':
             $label = $element->getEmailKey();
             return array('label' => str_replace('_', ' ', $label));
         case 'sender':
             $roleId = $element->getFromRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'recipient':
             $roleId = $element->getToRoleId();
             $label = $roleDao->getRoleNames(false, array($roleId));
             return array('label' => Locale::translate(array_shift($label)));
         case 'subject':
             $locale = Locale::getLocale();
             $label = $element->getSubject();
             return array('label' => $label);
         case 'enabled':
             return array('isChecked' => $element->getEnabled());
     }
 }
 /**
  * Constructor
  * @param subscriptionId int leave as default for new subscription
  */
 function IndividualSubscriptionForm($subscriptionId = null, $userId = null)
 {
     parent::Form('subscription/individualSubscriptionForm.tpl');
     parent::SubscriptionForm($subscriptionId, $userId);
     $subscriptionId = isset($subscriptionId) ? (int) $subscriptionId : null;
     $userId = isset($userId) ? (int) $userId : null;
     $journal =& Request::getJournal();
     $journalId = $journal->getId();
     if (isset($subscriptionId)) {
         $subscriptionDao =& DAORegistry::getDAO('IndividualSubscriptionDAO');
         if ($subscriptionDao->subscriptionExists($subscriptionId)) {
             $this->subscription =& $subscriptionDao->getSubscription($subscriptionId);
         }
     }
     $subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
     $subscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, false);
     $this->subscriptionTypes =& $subscriptionTypes->toArray();
     $subscriptionTypeCount = count($this->subscriptionTypes);
     if ($subscriptionTypeCount == 0) {
         $this->addError('typeId', Locale::translate('manager.subscriptions.form.typeRequired'));
         $this->addErrorField('typeId');
     }
     // Ensure subscription type is valid
     $this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'manager.subscriptions.form.typeIdValid', create_function('$typeId, $journalId', '$subscriptionTypeDao =& DAORegistry::getDAO(\'SubscriptionTypeDAO\'); return ($subscriptionTypeDao->subscriptionTypeExistsByTypeId($typeId, $journalId) && $subscriptionTypeDao->getSubscriptionTypeInstitutional($typeId) == 0);'), array($journal->getId())));
     // Ensure that user does not already have a subscription for this journal
     if (!isset($subscriptionId)) {
         $this->addCheck(new FormValidatorCustom($this, 'userId', 'required', 'manager.subscriptions.form.subscriptionExists', array(DAORegistry::getDAO('IndividualSubscriptionDAO'), 'subscriptionExistsByUserForJournal'), array($journalId), true));
     } else {
         $this->addCheck(new FormValidatorCustom($this, 'userId', 'required', 'manager.subscriptions.form.subscriptionExists', create_function('$userId, $journalId, $subscriptionId', '$subscriptionDao =& DAORegistry::getDAO(\'IndividualSubscriptionDAO\'); $checkId = $subscriptionDao->getSubscriptionIdByUser($userId, $journalId); return ($checkId == 0 || $checkId == $subscriptionId) ? true : false;'), array($journalId, $subscriptionId)));
     }
 }
 function addItem($args, &$request)
 {
     $this->setupTemplate();
     $pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
     $divisionDao =& DAORegistry::getDAO('DivisionDAO');
     $press =& $request->getPress();
     $index = 'sourceTitle-' . $this->getId();
     $divisionTitle = $args[$index];
     if (!isset($divisionTitle)) {
         $json = new JSON('false');
         return $json->getString();
     } else {
         // Make sure the item doesn't already exist
         $divisions = $divisionDao->getByTitle($divisionTitle, $press->getId());
         if (isset($divisions)) {
             $json = new JSON('false', Locale::translate('common.listbuilder.itemExists'));
             return $json->getString();
             return false;
         }
         $division =& $divisionDao->newDataObject();
         $division->setTitle($divisionTitle, Locale::getLocale());
         //FIXME: Get locale from form
         $division->setPressId($press->getId());
         $divisionId = $divisionDao->insertObject($division);
         // Return JSON with formatted HTML to insert into list
         $row =& $this->getRowInstance();
         $row->setGridId($this->getId());
         $row->setId($divisionId);
         $rowData = array('item' => $divisionTitle);
         $row->setData($rowData);
         $row->initialize($request);
         $json = new JSON('true', $this->_renderRowInternally($request, $row));
         return $json->getString();
     }
 }
Ejemplo n.º 24
0
 /**
  * Display the form.
  */
 function display()
 {
     $journal =& Request::getJournal();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     // Get sections for this journal
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     // If this user is a section editor or an editor, they are allowed
     // to submit to sections flagged as "editor-only" for submissions.
     // Otherwise, display only sections they are allowed to submit to.
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR);
     // Set up required Payment Related Information
     import('payment.ojs.OJSPaymentManager');
     $paymentManager =& OJSPaymentManager::getManager();
     if ($paymentManager->submissionEnabled() || $paymentManager->fastTrackEnabled() || $paymentManager->publicationEnabled()) {
         $templateMgr->assign('authorFees', true);
         $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO');
         $articleId = $this->articleId;
         if ($paymentManager->submissionEnabled()) {
             $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment($journal->getId(), $articleId));
         }
         if ($paymentManager->fastTrackEnabled()) {
             $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment($journal->getId(), $articleId));
         }
     }
     $templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor));
     parent::display();
 }
Ejemplo n.º 25
0
 function getManagementVerbs()
 {
     $verbs = array();
     if ($this->getEnabled()) {
         $verbs[] = array('index', Locale::translate('plugins.generic.customLocale.customize'));
     }
     return parent::getManagementVerbs($verbs);
 }
Ejemplo n.º 26
0
 /**
  * Read installation parameters from stdin.
  * FIXME: May want to implement an abstract "CLIForm" class handling input/validation.
  * FIXME: Use readline if available?
  */
 function readParams()
 {
     Locale::requireComponents(array(LOCALE_COMPONENT_PKP_INSTALLER, LOCALE_COMPONENT_APPLICATION_COMMON));
     printf("%s\n", Locale::translate('installer.ocsInstallation'));
     parent::readParams();
     $this->readParamBoolean('install', 'installer.installApplication');
     return $this->params['install'];
 }
 /**
  * Return the set of management verbs supported by this plugin for the
  * administration interface.
  * @return array
  */
 function getManagementVerbs()
 {
     if ($this->isEnabled()) {
         return array(array('disable', Locale::translate('common.disable')));
     } else {
         return array(array('enable', Locale::translate('common.enable')));
     }
 }
Ejemplo n.º 28
0
 /**
  * Display verbs for the management interface.
  */
 function getManagementVerbs()
 {
     $verbs = array();
     if ($this->getEnabled() && $this->isTinyMCEInstalled()) {
         $verbs[] = array('settings', Locale::translate('plugins.generic.staticPages.editAddContent'));
     }
     return parent::getManagementVerbs($verbs);
 }
Ejemplo n.º 29
0
 /**
  * Query parsing helper routine.
  * Returned structure is based on that used by the Search::QueryParser Perl module.
  */
 function _parseQuery($signTokens, $tokens, &$pos, $total)
 {
     $return = array('+' => array(), '' => array(), '-' => array());
     $postBool = $preBool = '';
     $notOperator = String::strtolower(Locale::translate('search.operator.not'));
     $andOperator = String::strtolower(Locale::translate('search.operator.and'));
     $orOperator = String::strtolower(Locale::translate('search.operator.or'));
     while ($pos < $total) {
         if (!empty($signTokens[$pos])) {
             $sign = $signTokens[$pos];
         } else {
             if (empty($sign)) {
                 $sign = '+';
             }
         }
         $token = String::strtolower($tokens[$pos++]);
         switch ($token) {
             case $notOperator:
                 $sign = '-';
                 break;
             case ')':
                 return $return;
             case '(':
                 $token = ArticleSearch::_parseQuery($signTokens, $tokens, $pos, $total);
             default:
                 $postBool = '';
                 if ($pos < $total) {
                     $peek = String::strtolower($tokens[$pos]);
                     if ($peek == $orOperator) {
                         $postBool = 'or';
                         $pos++;
                     } else {
                         if ($peek == $andOperator) {
                             $postBool = 'and';
                             $pos++;
                         }
                     }
                 }
                 $bool = empty($postBool) ? $preBool : $postBool;
                 $preBool = $postBool;
                 if ($bool == 'or') {
                     $sign = '';
                 }
                 if (is_array($token)) {
                     $k = $token;
                 } else {
                     $k = ArticleSearchIndex::filterKeywords($token, true);
                 }
                 if (!empty($k)) {
                     $return[$sign][] = $k;
                 }
                 $sign = '';
                 break;
         }
     }
     return $return;
 }
Ejemplo n.º 30
0
 /**
  * Display verbs for the management interface.
  */
 function getManagementVerbs()
 {
     $schedConf =& Request::getSchedConf();
     if ($schedConf) {
         return array(array('reports', Locale::translate('manager.statistics.reports')));
     } else {
         return array();
     }
 }