Default Citation Pliugin

Good evening everybody.

Just a short question: is there any chance to set the Bibtex citation plugin as the default one? Currently, it seems that the first (ABNT) is set as the default one when opening the Reading Tools/Citation export.

Many thanks!
Reto

Hi @retostauffer,

The citation plugins are ordered by name, no way to define this.

If you want to manually change that, you can take a look at pages/rt/RTHandler.inc.php, at line 193, where the citation plugins are retrieved and sorted by name.

Cheers,
Bruno

Hy Bruno

Thanks - again :). Seems that my brain was too woozy to find it on my own.
For all other users interested in a solution:

As written by Bruno, a small modification in pages/rt/RTHandler.inc.php is necessary. My solution can be found below. In line 194 you should find the first line (usort( … )) in the original OJS source code. After this, I added some lines of code:

  uasort($citationPlugins, create_function('$a, $b', 'return strcmp($a->getDisplayName(), $b->getDisplayName());'));
  // Bring Bibtex plugin to the front (set as default citation plugin)
  $defaultPlugin = "BibtexCitationPlugin";
  $match = array_search($defaultPlugin,array_keys($citationPlugins));
  if ( count($match) == 1 ) {
     $tmp = $citationPlugins;
     $citationPlugins = array($defaultPlugin=>$tmp[$defaultPlugin]);
     foreach ( array_keys($tmp) as $key ) {
        if ( strcmp($key,$defaultPlugin) === 0 ) { continue; }
        $citationPlugins[$key] = $tmp[$key];
     }
     unset($tmp);
  }

$defaultPlugin contains the name of the plugin you’ll show by default on your OJS (will also be the first, and selected in the html select element). Check if key exists in $citationPlugins. If found, rebuild the whole array. Setting the $match’ed element first, and append all others afterwards. The order will stay the same for all remaining plugins. If plugin not found - or found twice (should never occur) the hack will do nothing.

Thanks again for the input. We’ll go online these days with our OJS (existing journal migrated) which is only possible because of the awesome support we got here.

All best,
Reto