Permalink
Browse files

*4645* ABNT location contributions by Lepidus Tecnologia

  • Loading branch information...
asmecher committed Jun 27, 2012
1 parent 5b03047 commit 09078ebb40bd94e5da5a57a30eddd2174bcae943
Showing with 320 additions and 32 deletions.
  1. +140 −0 plugins/citationFormats/abnt/AbntCitationPlugin.inc.php
  2. +80 −0 plugins/citationFormats/abnt/AbntSettingsForm.inc.php
  3. +19 −5 plugins/citationFormats/abnt/citation.tpl
  4. +0 −1 plugins/citationFormats/abnt/locale/ca_ES/locale.xml
  5. +0 −1 plugins/citationFormats/abnt/locale/cs_CZ/locale.xml
  6. +0 −1 plugins/citationFormats/abnt/locale/da_DK/locale.xml
  7. +0 −1 plugins/citationFormats/abnt/locale/de_DE/locale.xml
  8. +0 −1 plugins/citationFormats/abnt/locale/el_GR/locale.xml
  9. +7 −2 plugins/citationFormats/abnt/locale/en_US/locale.xml
  10. +0 −1 plugins/citationFormats/abnt/locale/es_ES/locale.xml
  11. +0 −1 plugins/citationFormats/abnt/locale/eu_ES/locale.xml
  12. +0 −1 plugins/citationFormats/abnt/locale/fa_IR/locale.xml
  13. +0 −1 plugins/citationFormats/abnt/locale/fr_CA/locale.xml
  14. +0 −1 plugins/citationFormats/abnt/locale/hr_HR/locale.xml
  15. +0 −1 plugins/citationFormats/abnt/locale/it_IT/locale.xml
  16. +0 −1 plugins/citationFormats/abnt/locale/ja_JP/locale.xml
  17. +0 −1 plugins/citationFormats/abnt/locale/nl_NL/locale.xml
  18. +0 −1 plugins/citationFormats/abnt/locale/no_NO/locale.xml
  19. +6 −1 plugins/citationFormats/abnt/locale/pt_BR/locale.xml
  20. +8 −2 plugins/citationFormats/abnt/locale/pt_PT/locale.xml
  21. +0 −2 plugins/citationFormats/abnt/locale/ro_RO/locale.xml
  22. +0 −1 plugins/citationFormats/abnt/locale/ru_RU/locale.xml
  23. +0 −1 plugins/citationFormats/abnt/locale/sv_SE/locale.xml
  24. +0 −1 plugins/citationFormats/abnt/locale/uk_UA/locale.xml
  25. +0 −1 plugins/citationFormats/abnt/locale/vi_VN/locale.xml
  26. +0 −1 plugins/citationFormats/abnt/locale/zh_CN/locale.xml
  27. +59 −0 plugins/citationFormats/abnt/settingsForm.tpl
  28. +1 −1 plugins/citationFormats/abnt/version.xml
@@ -4,6 +4,8 @@
* @file plugins/citationFormats/abnt/AbntCitationPlugin.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* With contributions from by Lepidus Tecnologia
*
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class AbntCitationPlugin
@@ -15,6 +17,9 @@
import('classes.plugins.CitationPlugin');
class AbntCitationPlugin extends CitationPlugin {
/**
* @see Plugin::register
*/
function register($category, $path) {
$success = parent::register($category, $path);
$this->addLocaleData();
@@ -30,18 +35,153 @@ function getName() {
return 'AbntCitationPlugin';
}
/**
* @see Plugin::getDisplayName
*/
function getDisplayName() {
return __('plugins.citationFormats.abnt.displayName');
}
/**
* @see CitationFormatPlugin::getCitationFormatName
*/
function getCitationFormatName() {
return __('plugins.citationFormats.abnt.citationFormatName');
}
/**
* @see Plugin::getDescription
*/
function getDescription() {
return __('plugins.citationFormats.abnt.description');
}
/**
* Get the localized location for citations in this journal
* @param $journal Journal
* @return string
*/
function getLocalizedLocation($journal) {
$settings = $this->getSetting($journal->getId(), 'location');
if ($settings === null) {
return null;
}
$location = $settings[AppLocale::getLocale()];
if (empty($location)) {
$location = $settings[AppLocale::getPrimaryLocale()];
}
return $location;
}
/**
* Display verbs for the management interface.
* @return array
*/
function getManagementVerbs() {
return array(
array(
'settings',
Locale::translate('plugins.citationFormats.abnt.manager.settings')
)
);
}
/**
* Display an HTML-formatted citation. We register String::strtoupper modifier
* in order to convert author names to uppercase.
* @param $article Article
* @param $issue Issue
* @param $journal Journal
*/
function displayCitation(&$article, &$issue, &$journal) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->register_modifier('mb_upper', array(String, 'strtoupper'));
return parent::displayCitation($article, $issue, $journal);
}
/**
* Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string If a message is returned from this by-ref
* argument then it will be displayed as a notification if (and only
* if) the method returns false.
* @return boolean will redirect to the plugin category page if false,
* otherwise will remain on the same page
*/
function manage($verb, $args, &$message) {
switch ($verb) {
case 'settings':
$templateMgr =& TemplateManager::getManager();
$templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
$journal =& Request::getJournal();
$this->import('AbntSettingsForm');
$form = new AbntSettingsForm($this, $journal->getId());
if (Request::getUserVar('save')) {
$form->readInputData();
if ($form->validate()) {
$form->execute();
Request::redirect(null, 'manager', 'plugin');
return false;
} else {
$this->setBreadCrumbs(true);
$form->display();
}
} else {
$this->setBreadCrumbs(true);
if ($form->isLocaleResubmit()) {
$form->readInputData();
} else {
$form->initData();
}
$form->display();
}
return true;
default:
// Unknown management verb, delegate to parent
return parent::manage($verb, $args, $message);
}
}
/**
* Set the page's breadcrumbs, given the plugin's tree of items
* to append.
* @param $subclass boolean
*/
function setBreadcrumbs($isSubclass = false) {
$templateMgr =& TemplateManager::getManager();
$pageCrumbs = array(
array(
Request::url(null, 'manager'),
'user.role.manager'
)
);
if ($isSubclass) {
$pageCrumbs[] = array(
Request::url(null, 'manager', 'plugins'),
'manager.plugins'
);
}
$templateMgr->assign('pageHierarchy', $pageCrumbs);
}
/**
* Extend the {url ...} smarty to support this plugin.
*/
function smartyPluginUrl($params, &$smarty) {
$path = array($this->getCategory(), $this->getName());
if (is_array($params['path'])) {
$params['path'] = array_merge($path, $params['path']);
} elseif (!empty($params['path'])) {
$params['path'] = array_merge($path, array($params['path']));
} else {
$params['path'] = $path;
}
return $smarty->smartyUrl($params, $smarty);
}
}
?>
@@ -0,0 +1,80 @@
<?php
/**
* @file AbntSettingsForm.inc.php
*
* Copyright (c) 2003-2012 John Willinsky
* Contributed by Lepidus Tecnologia
*
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* @class AbntSettingsForm
* @ingroup plugins_citationFormats_abnt
*
* @brief Form for journal managers to modify ABNT Citation plugin settings
*/
import('lib.pkp.classes.form.Form');
class AbntSettingsForm extends Form {
/** @var $journalId int */
var $journalId;
/** @var $plugin object */
var $plugin;
/**
* Constructor
* @param $plugin object
* @param $journalId int
*/
function AbntSettingsForm(&$plugin, $journalId) {
$this->journalId = $journalId;
$this->plugin =& $plugin;
parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
}
/**
* Initialize form data.
*/
function initData() {
$journalId = $this->journalId;
$plugin =& $this->plugin;
$this->_data = array(
'location' => $plugin->getSetting($journalId, 'location')
);
}
/**
* Get the list of field names for which localized settings are used.
* @return array
*/
function getLocaleFieldNames() {
return array('location');
}
/**
* Assign form data to user-submitted data.
*/
function readInputData() {
$this->readUserVars(array('location'));
}
/**
* Save settings.
*/
function execute() {
$journalId =& Request::getJournal()->getId();
$plugin =& $this->plugin;
$value = $this->getData('location');
if (is_array($value)) {
$plugin->updateSetting($journalId, 'location', $value, 'object');
}
}
}
?>
@@ -2,6 +2,8 @@
* plugins/citationFormats/abnt/citation.tpl
*
* Copyright (c) 2003-2012 John Willinsky
* With contributions from by Lepidus Tecnologia
*
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Article reading tools -- Capture Citation for ABNT
@@ -11,10 +13,22 @@
<div id="citation">
{assign var=authors value=$article->getAuthors()}
{assign var=authorCount value=$authors|@count}
{foreach from=$authors item=author name=authors key=i}
{assign var=firstName value=$author->getFirstName()}
{$author->getLastName()|escape|upper}, {$firstName|escape|truncate:1:"":true}.{if $i<$authorCount-1}, {/if}{/foreach}.
{assign var=location value=$citationPlugin->getLocalizedLocation($journal)}
{if $authorCount <= 3}
{foreach from=$authors item=author name=authors key=i}
{assign var=firstName value=$author->getFirstName()}
{assign var=middleName value=$author->getMiddleName()}
{$author->getLastName()|escape|mb_upper}, {$firstName|escape}{if $middleName} {$middleName|escape}{/if}{if $i<$authorCount-1}; {/if}{/foreach}.
{else}
{assign var=firstName value=$authors[0]->getFirstName()}
{assign var=middleName value=$authors[0]->getMiddleName()}
{$authors[0]->getLastName()|escape|mb_upper}, {$firstName|escape}{if $middleName} {$middleName|escape}{/if} et al.
{/if}
{$article->getLocalizedTitle()|strip_unsafe_html}.
<strong>{$journal->getLocalizedTitle()|escape}</strong>, {translate key="plugins.citationFormat.abnt.location"}{if $issue}, {$issue->getVolume()|escape}{/if},
{if $article->getDatePublished()}{$article->getDatePublished()|date_format:'%b. %Y'|lower}{elseif $issue->getDatePublished()}{$issue->getDatePublished()|date_format:'%b. %Y'}{else}{$issue->getYear()|escape}{/if}. {translate key="plugins.citationFormats.abnt.retrieved" retrievedDate=$smarty.now|date_format:'%d %b. %Y' url=$articleUrl}.
<strong>{$journal->getLocalizedTitle()|escape}</strong>, {$location|default:"[S.l.]"|escape}{if $issue}{if $issue->getShowVolume()}, v. {$issue->getVolume()|escape}{/if}{if $issue->getShowNumber()}, n. {$issue->getNumber()|escape}{/if}{/if}
{if $article->getPages()}, p. {$article->getPages()|escape}{/if}, {if $article->getDatePublished()}{$article->getDatePublished()|date_format:'%b. %Y'|lower}{elseif $issue->getDatePublished()}{$issue->getDatePublished()|date_format:'%b. %Y'}{else}{$issue->getYear()|escape}{/if}.
{if $currentJournal->getSetting('onlineIssn')}ISSN {$currentJournal->getSetting('onlineIssn')|escape}.
{elseif $currentJournal->getSetting('printIssn')}ISSN {$currentJournal->getSetting('printIssn')|escape}. {/if}
{translate key="plugins.citationFormats.abnt.retrieved" retrievedDate=$smarty.now|date_format:'%d %b. %Y' url=$articleUrl}
{if $article->getDOI()}doi:{$article->getDOI()|escape}. {/if}
</div>
@@ -16,5 +16,4 @@
<message key="plugins.citationFormats.abnt.displayName">Connector per al format de citació ABNT</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Aquest connector implementa el format de citació ABNT.</message>
<message key="plugins.citationFormat.acao.location">Amèrica del Nord</message>
</locale>
@@ -18,6 +18,5 @@
<message key="plugins.citationFormats.abnt.displayName">Plugin pro citační formát ABNT</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Tento plugin zavádí citační formát ABNT.</message>
<message key="plugins.citationFormat.abnt.location">Severní Amerika</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Available at: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Date accessed: {$retrievedDate}]]></message>
</locale>
@@ -16,5 +16,4 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT citeringsformat plugin</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Dette plugin implementerer ABNT citeringsformatet.</message>
<message key="plugins.citationFormat.acao.location">Nordamerika</message>
</locale>
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT-Zitationsformat-Plug-In</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Dieses Plug-In implementiert das ABNT-Zitationsformat.</message>
<message key="plugins.citationFormat.abnt.location">Nordamerika</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Verfügbar unter: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Zugriffsdatum: {$retrievedDate}]]></message>
</locale>
@@ -23,6 +23,5 @@
<message key="plugins.citationFormats.abnt.displayName">Plugin σχήματος παραπομπής ABNT </message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Το plugin αυτό υλοποιεί το σχήμα παραπομπής ABNT.</message>
<message key="plugins.citationFormat.abnt.location">Βόρεια Αμερική</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Διαθέσιμο από: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Ημερομηνία πρόσβασης: {$retrievedDate}]]></message>
</locale>
@@ -16,6 +16,11 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT citation format plugin</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">This plugin implements the ABNT citation format.</message>
<message key="plugins.citationFormat.abnt.location">North America</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Available at: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Date accessed: {$retrievedDate}]]></message>

<message key="plugins.citationFormats.abnt.manager.settings">Settings</message>
<message key="plugins.citationFormats.abnt.manager.AbntCitationSettings">ABNT citation format plugin settings</message>
<message key="plugins.citationFormats.abnt.manager.settings.description">Settings used to create citations according to ABNT.</message>
<message key="plugins.citationFormats.abnt.manager.settings.location">Location</message>

<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Available at: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Date accessed: {$retrievedDate}.]]></message>
</locale>
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">Complemento de Formato de Citas ABNT</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Este complemento implementa el formato de citas ABNT.</message>
<message key="plugins.citationFormat.abnt.location">Norteamérica</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Disponible en: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Fecha de acceso: {$retrievedDate}]]></message>
</locale>
@@ -16,7 +16,6 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT aipamen-formatuaren plugina</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Plugin honek ABNT aipamenen formatua inplementatzen du.</message>
<message key="plugins.citationFormat.abnt.location">Ipar Amerika</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Hemen dago erabilgarri: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Atzitze-data: {$retrievedDate}]]></message>
</locale>

@@ -14,7 +14,6 @@
<message key="plugins.citationFormats.abnt.displayName" >پلاگین الگوی مرجع نویسی آ بی ان تی</message>
<message key="plugins.citationFormats.abnt.citationFormatName" >آ بی ان تی</message>
<message key="plugins.citationFormats.abnt.description" >این پلاگین الگوی مرجع نویسی آ بی ان تی را اعمال میکند.</message>
<message key="plugins.citationFormat.abnt.location" >آمریکای شمالی</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[قابل دسترسی در:
&lt;<a href="{$url}" target="_new">{$url}</a>&gt;.
تاریخ دسترسی:
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">Plugiciel de format de référence bibliographique ABNT</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Ce plugiciel implante le format de référence bibliographique ABNT.</message>
<message key="plugins.citationFormat.abnt.location">Amérique du Nord</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Disponible à l'adresse&nbsp;: &gt;<a href="{$url}" target="_new">{$url}</a>&gt;. Date de consultation&nbsp;: {$retrievedDate}]]></message>
</locale>
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">Dodatak za ABNT bibliografski standard</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Ovaj dodatak implementira ABNT bibliografski standard.</message>
<message key="plugins.citationFormat.abnt.location">Sjeverna amerika</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Dostupno na: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Posjećeno: {$retrievedDate}]]></message>
</locale>
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT (NBR 6023:2000)</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description"><![CDATA[Questo plugin implementa il formato di citazioni ABNT, <a href="http://www.habitus.ifcs.ufrj.br/pdf/abntnbr6023.pdf">http://www.habitus.ifcs.ufrj.br/pdf/abntnbr6023.pdf</a>]]></message>
<message key="plugins.citationFormat.abnt.location">Italia</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Disponibile all'indirizzo: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Data di accesso: {$retrievedDate}]]></message>
</locale>
@@ -16,6 +16,5 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT引用形式プラグイン</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">ABNT引用形式を実装します。</message>
<message key="plugins.citationFormat.abnt.location">北米</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[入手先: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. 参照: {$retrievedDate}]]></message>
</locale>
@@ -18,6 +18,5 @@
<message key="plugins.citationFormats.abnt.displayName">ABNT citatieformaat plugin</message>
<message key="plugins.citationFormats.abnt.citationFormatName">ABNT</message>
<message key="plugins.citationFormats.abnt.description">Dize plugin implementeert het ABNT citatieformaat.</message>
<message key="plugins.citationFormat.abnt.location">Noord-Amerika</message>
<message key="plugins.citationFormats.abnt.retrieved"><![CDATA[Beschikbaar op: &lt;<a href="{$url}" target="_new">{$url}</a>&gt;. Datum gebruik: {$retrievedDate}]]></message>
</locale>
Oops, something went wrong.

0 comments on commit 09078eb

Please sign in to comment.