We are moving to Git Issues for bug tracking in future releases. During transition, content will be in both tools. If you'd like to file a new bug, please create an issue.

Bug 4645 - ABNT citation has location hardcoded
ABNT citation has location hardcoded
Product: OJS
Classification: Unclassified
Component: Plug-ins
PC Mac OS X 10.3
: P5 normal
Assigned To: PKP Support
Depends on:
  Show dependency treegraph
Reported: 2009-08-19 13:44 PDT by James MacGregor
Modified: 2012-06-28 09:43 PDT (History)
6 users (show)

See Also:
Version Reported In:
Also Affects:

ABNT plugin improvements (33.48 KB, patch)
2012-06-25 07:07 PDT, Giovani Pieri
Details | Diff
ABNT plugin improvements (33.72 KB, patch)
2012-06-26 06:08 PDT, Giovani Pieri
Details | Diff
ABNT plugin improvements (33.52 KB, patch)
2012-06-26 06:35 PDT, Giovani Pieri
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James MacGregor 2009-08-19 13:44:25 PDT
I thought this came up before and was already fixed, but all I can find is bug 3837; and this is still an issue in CVS. The ABNT citation format has the location "North America" hardcoded to appear regardless; a citation will always look like 

Jaik T.. Stetistical approaches for Development. International Stetistical Journal, North America, 14, mar. 2009. Available at: http:myserver.com/journal/J2. Date accessed: 17 Aug. 2009.

Should the location be either removed; changed to be dynamically set; or hand-set in the locale file by the JM? The latter is really a workaround only, and would have to be done for each supported locale file (and a hassle to maintain. 

I've CC'd Ramon as he's provided assistance for this citation type in the past. Ramon, any comments?

(Courtesy of http://pkp.sfu.ca/support/forum/viewtopic.php?f=8&t=4861&p=18942#p18942)
Comment 1 Alec Smecher 2009-08-19 13:55:27 PDT
Maybe a locale key in the ABNT citation format plugin's locale file would be the best place -- it would be nice to have a setup field for this, but that's hard to justify just for ABNT. We could also add a plugin settings form specifically for ABNT. In any case, I think it's too late for 2.3.
Comment 2 James MacGregor 2009-08-19 14:19:41 PDT
(In reply to comment #1)
> Maybe a locale key in the ABNT citation format plugin's locale file would be
> the best place -- it would be nice to have a setup field for this, but that's
> hard to justify just for ABNT. We could also add a plugin settings form
> specifically for ABNT. In any case, I think it's too late for 2.3.

Sounds good, deferring.
Comment 3 James MacGregor 2010-01-04 14:14:12 PST
Assigning this to 2.3.1 as we've had another request (http://pkp.sfu.ca/support/forum/viewtopic.php?f=3&t=5598&p=21237#p21237). Any thoughts, perhaps especially from Florian wrt upcoming citation/metadata updates?
Comment 4 jerico 2010-01-06 11:36:03 PST
I commented directly in the forum, see http://pkp.sfu.ca/support/forum/viewtopic.php?f=3&t=5598&p=21237#p21339
Comment 5 jerico 2010-03-11 13:57:49 PST
Got a request about this bug on #pkp today. Same problem.
Comment 6 Alec Smecher 2010-07-07 09:58:27 PDT
Rescheduling -- this depends on the internal metadata work.
Comment 7 jerico 2010-08-24 18:38:02 PDT
I think that now that I'm on OMP it makes sense to fix that one with a simple translation string. Otherwise we'd have to wait for implementation of #5156. It's such a small change. Needs a translation string so it can only be fixed in 2.3.4. I missed that one for 2.3.3 because it appeared in 2.x. Sorry for that. :-( I've scheduled this to the 2.3.x line now.
Comment 8 Giovani Pieri 2012-06-25 07:07:26 PDT
Created attachment 3806 [details]
ABNT plugin improvements


We at Lepidus Tecnologia have updated the ABNT citation format plugin in order to make it more standard compliant, and we're giving the changes back to PKP. We're open to any comments/suggestions to improve this patch and have it included in the next OJS release.

Note: this patch was created on top of ojs-stable-2_3 branch.

The changes we've made are:
* Removed the location translation string.
* Settings page to change the journal's location.
* Per journal location setting.
* Internationalized location. In case a journal's location is not defined in some language, the journal's location in the default language is used.
* If no location is defined, it is used "[S.l.]" (ABNT standard says so).
* Issue volume and number are shown only if enabled in "Issue identification" setting.
* English and Portuguese translations to the ABNT plugin settings page.

ABNT related changes:
* Issue volume prefixed with "v."
* Issue number prefixed with "n."
* Included page number, prefixed with "p." (eg. "p. 10-12")
* Journal ISSN after date.
* Journal DOI at the end of the citation, if exists.
* Author names separated by ";"
* Author names are not abbreviated
* When there are more than three authors, only the first author's name is included followed by "et al."
* Fixed a bug with accented chars in surname. Using mb_strtoupper() instead of strtoupper() to convert surnames to uppercase.
Comment 9 Alec Smecher 2012-06-25 07:22:45 PDT
Giovani, thanks for your contribution. I'm scheduling it against the next release of OJS for consideration.

A few points for consideration:

- The modification appears to depend on mb_... string-manipulation functions; those aren't always available. It would be better to use String::strtoupper.

- There appear to be some missing |escape modifiers e.g. for author name parts: {$author->getFirstName()} should be {$author->getFirstName()|escape} to avoid XSS risks. (This looks like it was already a flaw but worth fixing at the same time.)

- Some of the existing code headers have their copyrights reassigned; those should stay (c) 2003-2012 John Willinsky.

- The newly added code is (c) 2012 Lepidus Tecnologia. We are in the process of forming a legal PKP entity, and when that is finished, we would like to transfer all copyrights to that. (It will remain GPL-licensed FOSS and non-commercial in the same senses that it is today.) To avoid complicating the transfer we would like to keep the copyrights consistent. Would it be OK to (c) 2003-2012 John Willinsky for the new code? We would be happy to add a "contributed by" line to the code header just below the copyright to credit your group.
Comment 10 Giovani Pieri 2012-06-26 06:08:11 PDT
Created attachment 3807 [details]
ABNT plugin improvements

Thanks for the feedback, Alec. Here is a patch with changes based on the comments.

Some comments:

- We depended on mb_... string-manipulation function because it is commonplace in Brazil to people have accented chars in their surname. Thus, strtoupper does not suffice. Look at this examples:
	php5 -r 'echo mb_strtoupper("Luís Vaz de Camões\n");'

	php5 -r 'echo strtoupper("Luís Vaz de Camões\n");'
Note how the "í" and "õ" are not converted to uppercase. As a workaround, I've added a fall back to strtoupper() if mb_strtoupper() is not available. Does this solve the problem?

- We included the |escape modifier in all places that didn't have it. At the author first name (which was already missing), and in some code that we included (regarding DOI, location, pages).

- No problem regarding the copyright. We replaced our copyright by a "Contributed by" entry as suggested. Feel free to adjust these "Contributed by" entries to your needs. We reassigned the copyright of all files that were changed to "(c) 2003-2012 John Willinsky", hope we didn't miss any.
Comment 11 Jason Nugent 2012-06-26 06:12:28 PDT
Hi Giovani,

Alec will probably have more to say here, but I just wanted to clarify what he meant when he suggested that you use the strtoupper() function.  He's referring to the core String class that is included with OJS, not the standard PHP function.   So, use String::strtoupper() instead of strtoupper().  The OJS class includes mb_ functionality automatically if it is enabled on the server.  The class is located in lib/pkp/classes/core/String.inc.php

Comment 12 Giovani Pieri 2012-06-26 06:35:30 PDT
Created attachment 3808 [details]
ABNT plugin improvements

I see, Jason. Thanks. I didn't know about this String class in OJS.

I changed the patch to register this function in smarty instead of mb_strtoupper.
Comment 13 Alec Smecher 2012-06-27 08:47:24 PDT
Giovani, thanks for contributing and also for being so accommodating! I've committed these to our master branch with just a few tweaks (almost all in code documentation). For the two modified files, I changed "Contributed By" to "With Contributions From"; otherwise the contribution line is as you provided.

This will be released with OJS 2.4.0 late in the summer.
Comment 14 Alec Smecher 2012-06-27 08:50:02 PDT
ABNT location contributions by Lepidus Tecnologia
Comment 15 Giovani Pieri 2012-06-28 09:43:36 PDT
You're welcome, Alec. We, here at Lepidus, are happy to have contributed. We're going to tell the news to OJS users here in Brazil.