View | Details | Raw Unified | Return to bug 4803 | Differences between
and this patch

Collapse All | Expand All

(-)crossref/CrossRefExportDom.inc.php (-45 / +82 lines)
 Lines 1-7    Link Here 
1
<?php
1
<?php
2
2
3
/**
3
/**
4
 * @file CrossRefExportDom.inc.php
4
 * @file plugins/importexport/crossref/CrossRefExportDom.inc.php
5
 *
5
 *
6
 * Copyright (c) 2003-2009 John Willinsky
6
 * Copyright (c) 2003-2009 John Willinsky
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 Lines 17-51    Link Here 
17
17
18
import('xml.XMLCustomWriter');
18
import('xml.XMLCustomWriter');
19
19
20
 /* NOTE: these values reflect the specifications for which this plugin were written
21
  *       any changes to these values must be accompanied by a review of the XML output
22
  */
23
24
define('CROSSREF_XMLNS_XSI' , 'http://www.w3.org/2001/XMLSchema-instance');
20
define('CROSSREF_XMLNS_XSI' , 'http://www.w3.org/2001/XMLSchema-instance');
25
define('CROSSREF_XMLNS' , 'http://www.crossref.org/schema/3.0.3'); 
21
define('CROSSREF_XMLNS' , 'http://www.crossref.org/schema/4.3.0');
26
define('CROSSREF_VERSION' , '3.0.3'); 
22
define('CROSSREF_VERSION' , '4.3.0');
27
define('CROSSREF_XSI_SCHEMALOCATION' , 'http://www.crossref.org/schema/3.0.3 http://www.crossref.org/schema/3.0.3/crossref3.0.3.xsd');
23
define('CROSSREF_XSI_SCHEMALOCATION' , 'http://www.crossref.org/schema/4.3.0 http://www.crossref.org/schema/4.3.0/crossref4.3.0.xsd');
28
29
24
30
class CrossRefExportDom {
25
class CrossRefExportDom {
31
26
32
	/**
27
	/**
33
	 * Build article XML using DOM elements
28
	 * Build article XML using DOM elements
34
	 *
29
	 * @return XMLNode
35
	 * The DOM for this XML was developed according
30
	 */
36
	 * http://www.crossref.org/schema/3.0.3
37
	 */ 
38
39
	function &generateCrossRefDom() {
31
	function &generateCrossRefDom() {
40
		// create the output XML document in DOM with a root node
32
		// create the output XML document in DOM with a root node
41
		$doc =& XMLCustomWriter::createDocument();
33
		$doc =& XMLCustomWriter::createDocument();
42
43
		return $doc;
34
		return $doc;
44
	}
35
	}
45
36
37
	/**
38
	 * Generate DOI batch DOM tree.
39
	 * @param $doc object
40
	 * @return XMLNode
41
	 */
46
	function &generateDoiBatchDom(&$doc) {
42
	function &generateDoiBatchDom(&$doc) {
47
43
48
		// Generate the root node for the file first and set its attributes 
44
		// Generate the root node for the file first and set its attributes
49
		$root =& XMLCustomWriter::createElement($doc, 'doi_batch');
45
		$root =& XMLCustomWriter::createElement($doc, 'doi_batch');
50
46
51
		/* Root doi_batch tag attributes
47
		/* Root doi_batch tag attributes
 Lines 61-68    Link Here 
61
		return $root;
57
		return $root;
62
	}
58
	}
63
59
64
	/* Generate the <head> tag that accompanies each submission */	
60
	/**
65
	function &generateHeadDom(&$doc, &$journal ) {
61
	 * Generate the <head> tag that accompanies each submission
62
	 * @param $doc XMLNode
63
	 * @param $journal Journal
64
	 * @return XMLNode
65
	 */
66
	function &generateHeadDom(&$doc, &$journal) {
66
		$head =& XMLCustomWriter::createElement($doc, 'head');
67
		$head =& XMLCustomWriter::createElement($doc, 'head');
67
68
68
		// DOI batch ID is a simple tracking ID: initials + timestamp
69
		// DOI batch ID is a simple tracking ID: initials + timestamp
 Lines 79-90    Link Here 
79
		$publisherInstitution = $journal->getSetting('publisherInstitution');
80
		$publisherInstitution = $journal->getSetting('publisherInstitution');
80
		XMLCustomWriter::createChildWithText($doc, $head, 'registrant', $publisherInstitution);
81
		XMLCustomWriter::createChildWithText($doc, $head, 'registrant', $publisherInstitution);
81
82
82
83
		return $head;
83
		return $head;
84
	}
84
	}
85
85
86
	/* Depositor Node */
86
	/**
87
	function &generateDepositorDom( &$doc, $name, $email ) {
87
	 * Generate depositor node
88
	 * @param $doc XMLNode
89
	 * @param $name string
90
	 * @param $email string
91
	 * @return XMLNode
92
	 */
93
	function &generateDepositorDom(&$doc, $name, $email) {
88
		$depositor =& XMLCustomWriter::createElement($doc, 'depositor');
94
		$depositor =& XMLCustomWriter::createElement($doc, 'depositor');
89
		XMLCustomWriter::createChildWithText($doc, $depositor, 'name', $name);
95
		XMLCustomWriter::createChildWithText($doc, $depositor, 'name', $name);
90
		XMLCustomWriter::createChildWithText($doc, $depositor, 'email_address', $email);
96
		XMLCustomWriter::createChildWithText($doc, $depositor, 'email_address', $email);
 Lines 92-107    Link Here 
92
		return $depositor;
98
		return $depositor;
93
	}
99
	}
94
100
95
	/* Metadata for journal - accompanies every article */
101
	/**
96
	function &generateJournalMetadataDom( &$doc, &$journal ) {
102
	 * Generate metadata for journal - accompanies every article
103
	 * @param $doc XMLNode
104
	 * @param $journal Journal
105
	 * @return XMLNode
106
	 */
107
	function &generateJournalMetadataDom(&$doc, &$journal) {
97
		$journalMetadataNode =& XMLCustomWriter::createElement($doc, 'journal_metadata');
108
		$journalMetadataNode =& XMLCustomWriter::createElement($doc, 'journal_metadata');
98
109
99
100
		/* Full Title of Journal */
110
		/* Full Title of Journal */
101
		XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'full_title', $journal->getLocalizedTitle());
111
		XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'full_title', $journal->getLocalizedTitle());
102
112
103
		/* Abbreviated title - defaulting to initials if no abbreviation found */
113
		/* Abbreviated title - defaulting to initials if no abbreviation found */
104
		if  ($journal->getLocalizedSetting('abbreviation') != '' ) {
114
		if ($journal->getLocalizedSetting('abbreviation') != '' ) {
105
			XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'abbrev_title', $journal->getLocalizedSetting('abbreviation'));
115
			XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'abbrev_title', $journal->getLocalizedSetting('abbreviation'));
106
		}
116
		}
107
117
 Lines 111-129    Link Here 
111
			XMLCustomWriter::setAttribute($onlineISSN, 'media_type', 'electronic');
121
			XMLCustomWriter::setAttribute($onlineISSN, 'media_type', 'electronic');
112
		}
122
		}
113
123
114
115
		/* Both ISSNs are permitted for CrossRef so sending whichever one (or both) */
124
		/* Both ISSNs are permitted for CrossRef so sending whichever one (or both) */
116
		if ( $ISSN = $journal->getSetting('printIssn') ) {
125
		if ( $ISSN = $journal->getSetting('printIssn') ) {
117
			$printISSN =& XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'issn', $ISSN);
126
			$printISSN =& XMLCustomWriter::createChildWithText($doc, $journalMetadataNode, 'issn', $ISSN);
118
			XMLCustomWriter::setAttribute($printISSN, 'media_type', 'print');
127
			XMLCustomWriter::setAttribute($printISSN, 'media_type', 'print');
119
		}
128
		}
120
129
121
122
		return $journalMetadataNode;
130
		return $journalMetadataNode;
123
	}
131
	}
124
132
125
	/* Journal Issue tag to accompany every article */
133
	/**
126
	function &generateJournalIssueDom( &$doc, &$journal, &$issue, &$section, &$article) {
134
	 * Generate journal issue tag to accompany every article
135
	 * @param $doc XMLNode
136
	 * @param $journal Journal
137
	 * @param $issue Issue
138
	 * @param $section Section
139
	 * @param $article Article
140
	 * @return XMLNode
141
	 */
142
	function &generateJournalIssueDom(&$doc, &$journal, &$issue, &$section, &$article) {
127
		$journalIssueNode =& XMLCustomWriter::createElement($doc, 'journal_issue');
143
		$journalIssueNode =& XMLCustomWriter::createElement($doc, 'journal_issue');
128
144
129
		$publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $issue->getDatePublished());
145
		$publicationDateNode =& CrossRefExportDom::generatePublisherDateDom($doc, $issue->getDatePublished());
 Lines 133-146    Link Here 
133
		XMLCustomWriter::appendChild($journalIssueNode, $journalVolumeNode);
149
		XMLCustomWriter::appendChild($journalIssueNode, $journalVolumeNode);
134
		XMLCustomWriter::createChildWithText($doc, $journalVolumeNode, 'volume', $issue->getVolume());
150
		XMLCustomWriter::createChildWithText($doc, $journalVolumeNode, 'volume', $issue->getVolume());
135
151
136
		XMLCustomWriter::createChildWithText($doc, $journalIssueNode, 'issue', $issue->getNumber());		
152
		XMLCustomWriter::createChildWithText($doc, $journalIssueNode, 'issue', $issue->getNumber());
137
153
138
		return $journalIssueNode;
154
		return $journalIssueNode;
139
	}
155
	}
140
156
141
	/* The heart of the file.  The Journal Article itself */
157
	/**
158
	 * Generate the journal_article node (the heart of the file).
159
	 * @param $doc XMLNode
160
	 * @param $journal Journal
161
	 * @param $issue Issue
162
	 * @param $section Section
163
	 * @param $article Article
164
	 * @return XMLNode
165
	 */
142
	function &generateJournalArticleDom(&$doc, &$journal, &$issue, &$section, &$article) {
166
	function &generateJournalArticleDom(&$doc, &$journal, &$issue, &$section, &$article) {
143
144
		// Create the base node
167
		// Create the base node
145
		$journalArticleNode =& XMLCustomWriter::createElement($doc, 'journal_article');
168
		$journalArticleNode =& XMLCustomWriter::createElement($doc, 'journal_article');
146
		XMLCustomWriter::setAttribute($journalArticleNode, 'publication_type', 'full_text');
169
		XMLCustomWriter::setAttribute($journalArticleNode, 'publication_type', 'full_text');
 Lines 149-162    Link Here 
149
		$titlesNode =& XMLCustomWriter::createElement($doc, 'titles');
172
		$titlesNode =& XMLCustomWriter::createElement($doc, 'titles');
150
		XMLCustomWriter::createChildWithText($doc, $titlesNode, 'title', $article->getLocalizedTitle());
173
		XMLCustomWriter::createChildWithText($doc, $titlesNode, 'title', $article->getLocalizedTitle());
151
		XMLCustomWriter::appendChild($journalArticleNode, $titlesNode);
174
		XMLCustomWriter::appendChild($journalArticleNode, $titlesNode);
152
153
		$contributorsNode =& XMLCustomWriter::createElement($doc, 'contributors');
175
		$contributorsNode =& XMLCustomWriter::createElement($doc, 'contributors');
154
176
155
		/* AuthorList */
177
		/* AuthorList */
156
		foreach ($article->getAuthors() as $author) {
178
		foreach ($article->getAuthors() as $author) {
157
			$authorNode =& CrossRefExportDom::generateAuthorDom($doc, $author);
179
			$authorNode =& CrossRefExportDom::generateAuthorDom($doc, $author);
158
			XMLCustomWriter::appendChild($contributorsNode, $authorNode);
180
			XMLCustomWriter::appendChild($contributorsNode, $authorNode);
159
		}		
181
		}
160
		XMLCustomWriter::appendChild($journalArticleNode, $contributorsNode);
182
		XMLCustomWriter::appendChild($journalArticleNode, $contributorsNode);
161
183
162
		/* publication date of issue */
184
		/* publication date of issue */
 Lines 173-195    Link Here 
173
		return $journalArticleNode;
195
		return $journalArticleNode;
174
	}
196
	}
175
197
176
	/* DOI data part - this is what assigns the DOI */
198
	/**
177
	function &generateDOIdataDom( &$doc, $DOI, $url ) {
199
	 * Generate doi_data element - this is what assigns the DOI
178
		$DOIdataNode =&  XMLCustomWriter::createElement($doc, 'doi_data');
200
	 * @param $doc XMLNode
201
	 * @param $DOI string
202
	 * @param $url string
203
	 */
204
	function &generateDOIdataDom(&$doc, $DOI, $url) {
205
		$DOIdataNode =& XMLCustomWriter::createElement($doc, 'doi_data');
179
		XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'doi', $DOI);
206
		XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'doi', $DOI);
180
		XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'resource', $url);
207
		XMLCustomWriter::createChildWithText($doc, $DOIdataNode, 'resource', $url);
181
208
182
		return $DOIdataNode;
209
		return $DOIdataNode;
183
	}
210
	}
184
211
185
	/* author node */
212
	/**
213
	 * Generate author node
214
	 * @param $doc XMLNode
215
	 * @param $author Author
216
	 * @return XMLNode
217
	 */
186
	function &generateAuthorDom(&$doc, &$author) {
218
	function &generateAuthorDom(&$doc, &$author) {
187
		$authorNode =& XMLCustomWriter::createElement($doc, 'person_name');
219
		$authorNode =& XMLCustomWriter::createElement($doc, 'person_name');
188
		XMLCustomWriter::setAttribute($authorNode, 'contributor_role', 'author');
220
		XMLCustomWriter::setAttribute($authorNode, 'contributor_role', 'author');
189
221
190
		/* there should only be 1 primary contact per article */
222
		/* there should only be 1 primary contact per article */
191
		if ($author->getPrimaryContact()) {
223
		if ($author->getPrimaryContact()) {
192
			XMLCustomWriter::setAttribute($authorNode, 'sequence', 'first');			
224
			XMLCustomWriter::setAttribute($authorNode, 'sequence', 'first');
193
		} else {
225
		} else {
194
			XMLCustomWriter::setAttribute($authorNode, 'sequence', 'additional');
226
			XMLCustomWriter::setAttribute($authorNode, 'sequence', 'additional');
195
		}
227
		}
 Lines 200-217    Link Here 
200
		return $authorNode;
232
		return $authorNode;
201
	}
233
	}
202
234
203
	/* publisher date - order matters */
235
	/**
236
	 * Generate publisher date - order matters
237
	 * @param $doc XMLNode
238
	 * @param $pubdate string
239
	 * @return XMLNode
240
	 */
204
	function &generatePublisherDateDom(&$doc, $pubdate) {
241
	function &generatePublisherDateDom(&$doc, $pubdate) {
205
		$publicationDateNode =& XMLCustomWriter::createElement($doc, 'publication_date');
242
		$publicationDateNode =& XMLCustomWriter::createElement($doc, 'publication_date');
206
		XMLCustomWriter::setAttribute($publicationDateNode, 'media_type', 'online');
243
		XMLCustomWriter::setAttribute($publicationDateNode, 'media_type', 'online');
207
244
208
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'month', date('m', strtotime($pubdate)), false );
245
		$parsedPubdate = strtotime($pubdate);
209
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'day', date('d', strtotime($pubdate)), false );
246
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'month', date('m', $parsedPubdate), false);
210
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'year', date('Y', strtotime($pubdate)) );
247
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'day', date('d', $parsedPubdate), false);
211
248
		XMLCustomWriter::createChildWithText($doc, $publicationDateNode, 'year', date('Y', $parsedPubdate));
212
249
213
		return $publicationDateNode;
250
		return $publicationDateNode;
214
	}
251
	}
215
216
}
252
}
253
217
?>
254
?>
(-)crossref/CrossRefExportPlugin.inc.php (-1 / +1 lines)
 Lines 1-7    Link Here 
1
<?php
1
<?php
2
2
3
/**
3
/**
4
 * @file CrossRefExportPlugin.inc.php
4
 * @file plugins/importexport/crossref/CrossRefExportPlugin.inc.php
5
 *
5
 *
6
 * Copyright (c) 2003-2009 John Willinsky
6
 * Copyright (c) 2003-2009 John Willinsky
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
7
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
(-)crossref/README (-4 / +5 lines)
 Lines 1-8    Link Here 
1
================================
1
================================
2
=== OJS CrossRef Export Plugin
2
=== OJS CrossRef Export Plugin
3
=== Version: 1.0
3
=== Version: 1.1
4
=== Release date: June 8, 2006
4
=== Release date: June 8, 2006
5
=== Author: Juan Pablo Alperin < juan@geeky.net >
5
=== Author: Juan Pablo Alperin <juan@geeky.net>
6
================================
6
================================
7
7
8
About
8
About
 Lines 18-24    Link Here 
18
18
19
System Requirements
19
System Requirements
20
-------------------
20
-------------------
21
Same requirements as the OJS 2.1.x core.
21
Same requirements as the OJS 2.x core.
22
22
23
Installation
23
Installation
24
------------
24
------------
 Lines 48-51    Link Here 
48
48
49
Version History
49
Version History
50
---------------
50
---------------
51
1.0    - initial release
51
1.0	- Initial Release
52
1.1	- Updated to support CrossRef 4.3.0 schema (by Alec Smecher)
(-)crossref/index.tpl (-1 lines)
 Lines 26-30    Link Here 
26
	{translate key="manager.setup.doiPrefixDescription"}
26
	{translate key="manager.setup.doiPrefixDescription"}
27
{/if}
27
{/if}
28
28
29
30
{include file="common/footer.tpl"}
29
{include file="common/footer.tpl"}
(-)crossref/issues.tpl (+1 lines)
 Lines 77-80    Link Here 
77
<p><input type="submit" value="{translate key="common.export"}" class="button defaultButton"/>&nbsp;<input type="button" value="{translate key="common.selectAll"}" class="button" onclick="toggleChecked()" /></p>
77
<p><input type="submit" value="{translate key="common.export"}" class="button defaultButton"/>&nbsp;<input type="button" value="{translate key="common.selectAll"}" class="button" onclick="toggleChecked()" /></p>
78
</form>
78
</form>
79
</div>
79
</div>
80
80
{include file="common/footer.tpl"}
81
{include file="common/footer.tpl"}
(-)crossref/version.xml (-3 / +3 lines)
 Lines 14-19    Link Here 
14
<version>
14
<version>
15
	<application>crossref</application>
15
	<application>crossref</application>
16
	<type>plugins.generic</type>
16
	<type>plugins.generic</type>
17
	<release>1.0.0.0</release>
17
	<release>1.1.0.0</release>
18
	<date>2009-07-13</date>
18
	<date>2009-10-27</date>
19
</version>
19
</version>

Return to bug 4803