Skip to content

Commit

Permalink
*4865* Add public ID info to native import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Jan 8, 2013
1 parent 21c26e1 commit b778abd
Show file tree
Hide file tree
Showing 30 changed files with 64 additions and 28 deletions.
1 change: 1 addition & 0 deletions plugins/importexport/native/NativeExportDom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ function &generateSectionDom(&$doc, &$journal, &$issue, &$section) {

function &generateArticleDom(&$doc, &$journal, &$issue, &$section, &$article) {
$root =& XMLCustomWriter::createElement($doc, 'article');
XMLCustomWriter::setAttribute($root, 'locale', $article->getLocale());
XMLCustomWriter::setAttribute($root, 'public_id', $article->getPubId('publisher-id'), false);
XMLCustomWriter::setAttribute($root, 'language', $article->getLanguage(), false);

Expand Down
33 changes: 31 additions & 2 deletions plugins/importexport/native/NativeImportDom.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function importIssue(&$journal, &$issueNode, &$issue, &$errors, &$user, $isComma
if (($value = $issueNode->getAttribute('public_id')) != '') {
$anotherIssue = $issueDao->getIssueByPubId('publisher-id', $value, $journal->getId());
if ($anotherIssue) {
$errors[] = array('plugins.importexport.native.import.error.duplicatePublicId', array('issueTitle' => $issue->getIssueIdentification(), 'otherIssueTitle' => $anotherIssue->getIssueIdentification()));
$errors[] = array('plugins.importexport.native.import.error.duplicatePublicIssueId', array('issueTitle' => $issue->getIssueIdentification(), 'otherIssueTitle' => $anotherIssue->getIssueIdentification()));
$hasErrors = true;
} else {
$issue->setStoredPubId('publisher-id', $value);
Expand Down Expand Up @@ -643,6 +643,16 @@ function handleArticleNode(&$journal, &$articleNode, &$issue, &$section, &$artic
} else {
$article->setLocale($journal->getPrimaryLocale());
}
if (($value = $articleNode->getAttribute('public_id')) != '') {
$anotherArticle = $publishedArticleDao->getPublishedArticleByPubId('publisher-id', $value, $journal->getId());
if ($anotherArticle) {
$errors[] = array('plugins.importexport.native.import.error.duplicatePublicArticleId', array('articleTitle' => $article->getLocalizedTitle(), 'otherArticleTitle' => $anotherArticle->getLocalizedTitle()));
$hasErrors = true;
} else {
$issue->setStoredPubId('publisher-id', $value);
}
}

$article->setJournalId($journal->getId());
$article->setUserId($user->getId());
$article->setSectionId($section->getId());
Expand Down Expand Up @@ -969,6 +979,16 @@ function handleGalleyNode(&$journal, &$galleyNode, &$issue, &$section, &$article
if ($isHtml) $galley = new ArticleHtmlGalley();
else $galley = new ArticleGalley();

if (($value = $galleyNode->getAttribute('public_id')) != '') {
$anotherGalley = $galleyDao->getGalleyByPubId('publisher-id', $value, $article->getId());
if ($anotherGalley) {
$errors[] = array('plugins.importexport.native.import.error.duplicatePublicGalleyId', array('publicId' => $value, 'articleTitle' => $article->getLocalizedTitle()));
$hasErrors = true;
} else {
$galley->setStoredPubId('publisher-id', $value);
}
}

$galley->setArticleId($article->getId());
$galley->setSequence($galleyCount);

Expand Down Expand Up @@ -1251,7 +1271,16 @@ function handleSuppFileNode(&$journal, &$suppNode, &$issue, &$section, &$article

$suppFile->setShowReviewers($suppNode->getAttribute('show_reviewers')=='true');
$suppFile->setLanguage($suppNode->getAttribute('language'));
$suppFile->setStoredPubId('publisher-id', $suppNode->getAttribute('public_id'));

if (($value = $suppNode->getAttribute('public_id')) != '') {
$anotherSuppFile = $suppFileDao->getSuppFileByPubId('publisher-id', $value, $article->getId());
if ($anotherSuppFile) {
$errors[] = array('plugins.importexport.native.import.error.duplicatePublicSuppFileId', array('suppFileTitle' => $suppFile->getLocalizedTitle(), 'otherSuppFileTitle' => $anotherSuppFile->getLocalizedTitle()));
$hasErrors = true;
} else {
$suppFile->setStoredPubId('publisher-id', $value);
}
}

if (!($fileNode = $suppNode->getChildByName('file'))) {
$errors[] = array('plugins.importexport.native.import.error.suppFileMissing', array('articleTitle' => $article->getLocalizedTitle(), 'sectionTitle' => $section->getLocalizedTitle(), 'issueTitle' => $issue->getIssueIdentification()));
Expand Down
2 changes: 2 additions & 0 deletions plugins/importexport/native/NativeImportExportPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ function executeCLI($scriptName, &$args) {
$xmlFile = array_shift($args);
$journalPath = array_shift($args);

AppLocale::requireComponents(LOCALE_COMPONENT_APPLICATION_COMMON);

$journalDao =& DAORegistry::getDAO('JournalDAO');
$issueDao =& DAORegistry::getDAO('IssueDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/ca_ES/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ S'accepten els formats següents:
<message key="plugins.importexport.native.import.error.illegalUrl">L'URL indicat per al número "{$issueTitle}", "{$url}", no és vàlid. Les importacions trameses per web només admeten els mètodes http, https, ftp o ftps.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">S'ha indicat un tipus de fitxer addicional desconegut, "{$suppFileType}".</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">No s'ha pogut copiar l'URL "{$url}" a un fitxer local.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">L'id. públic proporcionat per al número importat "{$issueTitle}" ja és utilitzat per un altre número, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">L'id. públic proporcionat per al número importat "{$issueTitle}" ja és utilitzat per un altre número, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">Falta un títol de secció per al número "{$issueTitle}". Comproveu que el document XML s'adeqüi a les especificacions de la DTD corresponent.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">La secció "{$sectionTitle}" del número "{$issueTitle}" coincideix amb una secció existent de la revista, però l'abreviació indicada ("{$sectionAbbrev}") coincideix amb una altra secció.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">Falta un títol d'article per al número "{$issueTitle}" a la secció "{$sectionTitle}". Comproveu que el document XML s'adeqüi a les especificacions de la DTD corresponent i que s'hagi indicat un títol per a la configuració regional de la revista.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/cs_CZ/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Jsou akceptovány následující formáty:
<message key="plugins.importexport.native.import.error.illegalUrl">Uvedená adresa URL "{$url}" pro číslo "{$issueTitle}" nebyla povolená. Imprt pře web podporuje pouze metody http, https, ftp nebo ftps.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">Byl uveden neznámý typ doplňkového souboru "{$suppFileType}".</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">Uvedená adresa URL "{$url}" nemohla být skopírována do místního souboru.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">Veřejné ID přidělené importovanému číslu "{$issueTitle}" je již používáno jiným číslem "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">Veřejné ID přidělené importovanému číslu "{$issueTitle}" je již používáno jiným číslem "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">Název sekce chyběl u čísla "{$issueTitle}". Prosím ujistěte se, že XML dokument je v souladu s odpovídajícím DTD.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">Sekce "{$sectionTitle}" čísla "{$issueTitle}" odpovídá existující sekci časopisu, ale uvedená zkratka ("{$sectionAbbrev}") odpovídá jiné sekci.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">Chyběl název článku v čísle "{$issueTitle}" v sekci "{$sectionTitle}". Ujistěte se prosím, že XML document je v souladu s odpovídajícím DTD, a že byl uveden název lokalizace časopisu.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/da_DK/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ De følgende formater accepteres:
<message key="plugins.importexport.native.import.error.illegalUrl">Den angivne URL "{$url}" for nummeret "{$issueTitle}" var ugyldig. Web-indsendte importer understøtter kun http, https, ftp, eller ftps metoder.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">En ukendt supplerende filtype "{$suppFileType}" blev angivet.</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">En angivet URL "{$url}" kunne ikke kopieres til en lokal fil.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">Det offentlige ID givet til imporeringen af nummeret "{$issueTitle}" bruges allerede af et andet nummer, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">Det offentlige ID givet til imporeringen af nummeret "{$issueTitle}" bruges allerede af et andet nummer, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">En sektionstitel mangler i nummeret "{$issueTitle}". Sørg for at XML dokumentet er konformt med den pågældende DTD.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">Sektionen "{$sectionTitle}" i "{$issueTitle}" nummer matchede en eksisterende tidsskriftsektion, men den angivne forkortelse ("{$sectionAbbrev}") matchede en anden section.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">En artikel-titel manglede for nummeret "{$issueTitle}" i sektionen "{$sectionTitle}". Sørg for at XML dokumentet svarer til den tilsvarende DTD, og at en titel er blevet angivet i tidsskriftets lokalisering.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/de_DE/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Folgende Formate sind gültig:
<message key="plugins.importexport.native.import.error.illegalUrl">Die angegebene URL "{$url}" für die Ausgabe "{$issueTitle}" war ungültig. Web-Importe unterstützen nur http, https, ftp oder ftps.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">Ein unbekannter Dateityp "{$suppFileType}" wurde für eine zusätzliche Datei angegeben.</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">Angegebene URL "{$url}" konnte nicht in lokaler Datei gespeichert werden.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">Die öffentliche Kennung für die zu importierende Ausgabe "{$issueTitle}" wird bereits von einer anderen Ausgabe "{$otherIssueTitle}" verwendet.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">Die öffentliche Kennung für die zu importierende Ausgabe "{$issueTitle}" wird bereits von einer anderen Ausgabe "{$otherIssueTitle}" verwendet.</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">Ein Rubriktitel fehlte für Ausgabe "{$issueTitle}". Bitte stellen Sie sicher, dass das XML-Dokument der passenden DTD entspricht.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">Die Rubrik "{$sectionTitle}" der Ausgabe "{$issueTitle}" existiert in der Zeitschrift, aber die angegebene Abkürzung ("{$sectionAbbrev}") gehört zu einer anderen Rubrik.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">Ein Beitragtitel fehlte in Ausgabe "{$issueTitle}", Rubrik "{$sectionTitle}". Bitte stellen Sie sicher, dass das XML-Dokument der passenden DTD entspricht und dass ein Titel in der Regionaleinstellung der Zeitschrift eingegeben wurde.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/el_GR/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Commands:
<message key="plugins.importexport.native.import.error.illegalUrl">Το ορισμένο URL "{$url}" για το τεύχος "{$issueTitle}" είναι παράτυπο. Εισαγωγές μέσω του Web υποστηρίζουν μόνο τις http, https, ftp, ή ftps μεθόδους.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">Καθορίστηκε ένας άγνωστος τύπος συμπληρωματικού αρχείου "{$suppFileType}" .</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">Ένα καθορισμένο URL "{$url}" δεν μπόρεσε να αντιγραφεί σε ένα τοπικό αρχείο.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">Το δημόσιο ID που δόθηκε για την εισαγωγή του τεύχους "{$issueTitle}" χρησιμοποιείται ήδη από ένα άλλο τεύχος, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">Το δημόσιο ID που δόθηκε για την εισαγωγή του τεύχους "{$issueTitle}" χρησιμοποιείται ήδη από ένα άλλο τεύχος, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">Ένας τίτλος ενότητας λείπει από το τεύχος "{$issueTitle}". Σιγουρευτείτε ότι το XML αρχείο συμμορφώνεται με το κατάλληλο DTD.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">Η ενότητα "{$sectionTitle}" του τεύχους "{$issueTitle}" ταίριαξε με μια υπάρχουσα ενότητα περιοδικού, αλλά η καθορισμένη συντομογραφία ("{$sectionAbbrev}") ταίριαξε με μια διαφορετική ενότητα.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">Ένας τίτλος άρθρου λείπει στο τεύχος "{$issueTitle}" στην ενότητα "{$sectionTitle}". Σιγουρευτείτε ότι το XML αρχείο συμμορφώνεται με το κατάλληλο DTD, και ότι ένας τίτλος έχει δοθεί για το αρχείο τοπικών ρυθμίσεων του περιοδικού.</message>
Expand Down
5 changes: 4 additions & 1 deletion plugins/importexport/native/locale/en_US/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ The following formats are accepted:
<message key="plugins.importexport.native.import.error.illegalUrl">The specified URL "{$url}" for the issue "{$issueTitle}" was illegal. Web-submitted imports support only http, https, ftp, or ftps methods.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">An unknown supplemental file type "{$suppFileType}" was specified.</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">A specified URL "{$url}" could not be copied to a local file.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">The public ID given for the import issue "{$issueTitle}" is already in use by another issue, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicGalleyId">The public ID given for the import galley "{$publicId}" is already in use by another galley for the same article, "{$articleTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicSuppFileId">The public ID given for the import supplementary file "{$suppFileTitle}" is already in use by another supplementary file for the same article, "{$otherSuppFileTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicArticleId">The public ID given for the import article "{$articleTitle}" is already in use by another article, "{$otherArticleTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">The public ID given for the import issue "{$issueTitle}" is already in use by another issue, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">A section title was missing for the issue "{$issueTitle}". Please ensure that the XML document conforms to the appropriate DTD.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">The "{$sectionTitle}" section of the "{$issueTitle}" issue matched an existing journal section, but the specified abbreviation ("{$sectionAbbrev}") matched a different section.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">An article title was missing for the issue "{$issueTitle}" in the section "{$sectionTitle}". Please ensure that the XML document conforms to the appropriate DTD, and that a title has been supplied for the journal's locale.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/es_ES/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Se aceptan los siguientes formatos:
<message key="plugins.importexport.native.import.error.illegalUrl">La URL indicada "{$url}" para el número "{$issueTitle}" no era correcta. Las importaciones enviadas via web sólo soportan métodos http, https, ftp, o ftps.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">Se ha especificado un tipo de fichero suplementario desconocido "{$suppFileType}".</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">No se ha podido copiar una URL especificada "{$url}" a un fichero local".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">La ID pública indicada para el número importado "{$issueTitle}" ya está en uso por otro número, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">La ID pública indicada para el número importado "{$issueTitle}" ya está en uso por otro número, "{$otherIssueTitle}".</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">Falta un título de sección para el número "{$issueTitle}". Por favor, asegúrese de que el documento XML es conforme con la DTD apropiada.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch">La sección "{$sectionTitle}" del número "{$issueTitle}" no coindice con una sección de la revista, pero la abreviatura especificada ("{$sectionAbbrev}") coincide con una sección diferente.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">Falta un título de artículo para el número "{$issueTitle}" en la sección "{$sectionTitle}". Por favor, asegúrese de que el documento XML es conforme con la DTD apropiada, y que se ha proporcionado un título apropiado para el locale de la revista.</message>
Expand Down
2 changes: 1 addition & 1 deletion plugins/importexport/native/locale/eu_ES/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Formatu hauek onartzen dira:
<message key="plugins.importexport.native.import.error.illegalUrl">"{$issueTitle}" zenbakiarentzat adierazitako "{$url}" URLa ez da baliozkoa. Web bidezko inportazioak http, https, ftp, edo ftps metodoak bakarrik onartzen ditu.</message>
<message key="plugins.importexport.native.import.error.unknownSuppFileType">"{$suppFileType}" fitxategi osagarriaren mota ezezaguna zehaztu da.</message>
<message key="plugins.importexport.native.import.error.couldNotCopy">"{$url}" URLa ezin izan da kopiatu fitxategi lokalera.</message>
<message key="plugins.importexport.native.import.error.duplicatePublicId">"{$issueTitle}" zenbakia inportatzeko emandako ID publikoa beste zenbaki honena da: "{$otherIssueTitle}"</message>
<message key="plugins.importexport.native.import.error.duplicatePublicIssueId">"{$issueTitle}" zenbakia inportatzeko emandako ID publikoa beste zenbaki honena da: "{$otherIssueTitle}"</message>
<message key="plugins.importexport.native.import.error.sectionTitleMissing">"{$issueTitle}" zenbakian atal baten titulua falta zen. Ziurtatu XML dokumentua DTD egokiaren arabera eginda dagoela.</message>
<message key="plugins.importexport.native.import.error.sectionMismatch"> "{$issueTitle}" zenbakiko "{$sectionTitle}" titulua aldizkariaren atal baten izena da, baina laburdura ("{$sectionAbbrev}") beste atal batena da.</message>
<message key="plugins.importexport.native.import.error.articleTitleMissing">"{$issueTitle}" zenbakiko "{$sectionTitle}" ataleko artikulu baten titulua falta zen. Ziurtatu XML dokumentua DTD egokiaren arabera eginda dagoela, eta titulu bat eman dela aldizkariaren hizkuntzan.</message>
Expand Down
Loading

0 comments on commit b778abd

Please sign in to comment.