Skip to content

Commit

Permalink
Merge branch 'master' into alertschedule3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuomas Hietala committed Jun 4, 2015
2 parents f6bbe50 + f24d9c3 commit 4505f9b
Show file tree
Hide file tree
Showing 36 changed files with 629 additions and 113 deletions.
13 changes: 13 additions & 0 deletions local/languages/finna/en-gb.ini
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,19 @@ no_ils_support_for_getmytransactions = "Library card does not support displaying
no_ils_support_for_storageretrievalrequests = "Library card does not support displaying storage retrieval requests."
No Holdings Available = "No Holdings Available"
Open in a new window = "Open in a new window"
openurl_coverage_prefix = ""
openurl_coverage_from_year = "from year %%year%%"
openurl_coverage_from_volume = "(volume %%volume%%)"
openurl_coverage_from_issue = "issue %%issue%%"
openurl_coverage_until_year = "until year %%year%%"
openurl_coverage_until_volume = "(volume %%volume%%)"
openurl_coverage_until_issue = "issue %%issue%%"
openurl_embargo_available_year = "only newer than %%year%% year(s)"
openurl_embargo_available_month = "only newer than %%month%% month(s)"
openurl_embargo_available_days = "only newer than %%days%% day(s)"
openurl_embargo_not_available_year = "only older than %%year%% year(s)"
openurl_embargo_not_available_month = "only older than %%month%% month(s)"
openurl_embargo_not_available_days = "only older than %%days%% day(s)"
Organisation = "Organisation"
organisation_archives = "Archives (%%cnt%%)"
organisation_libraries = "Libraries (%%cnt%%)"
Expand Down
13 changes: 13 additions & 0 deletions local/languages/finna/fi.ini
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ no_ils_support_for_getmytransactions = "Kirjastokortti ei tue lainojen näyttäm
no_ils_support_for_storageretrievalrequests = "Kirjastokortti ei tue varastotilausten tekoa."
No Holdings Available = "Ei saatavuustietoja"
Open in a new window = "Avaa uuteen ikkunaan"
openurl_coverage_prefix = ""
openurl_coverage_from_year = "vuodesta %%year%%"
openurl_coverage_from_volume = "(vol/vsk %%volume%%)"
openurl_coverage_from_issue = "nrosta %%issue%%"
openurl_coverage_until_year = "vuoteen %%year%%"
openurl_coverage_until_volume = "(vol/vsk %%volume%%)"
openurl_coverage_until_issue = "nroon %%issue%%"
openurl_embargo_available_year = "vain %%year%% vuotta uudemmat"
openurl_embargo_available_month = "vain %%month%% kuukautta uudemmat"
openurl_embargo_available_days = "vain %%days%% päivää uudemmat"
openurl_embargo_not_available_year = "vain %%year%% vuotta vanhemmat"
openurl_embargo_not_available_month = "vain %%month%% kuukautta vanhemmat"
openurl_embargo_not_available_days = "vain %%days%% päivää vanhemmat"
Organisation = "Organisaatio"
organisation_archives = "Arkistot (%%cnt%%)"
organisation_libraries = "Kirjastot (%%cnt%%)"
Expand Down
13 changes: 13 additions & 0 deletions local/languages/finna/sv.ini
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,19 @@ no_ils_support_for_getmytransactions = "Bibliotekskortet stöder inte visning av
no_ils_support_for_storageretrievalrequests = "Bibliotekskortet stöder inte visning av lagerbeställningar."
No Holdings Available = "Tillgänglighetsinformation saknas"
Open in a new window = "Öppna i ny fönster"
openurl_coverage_prefix = ""
openurl_coverage_from_year = "från år %%year%%"
openurl_coverage_from_volume = "(volym %%volume%%)"
openurl_coverage_from_issue = "nummer %%issue%%"
openurl_coverage_until_year = "till år %%year%%"
openurl_coverage_until_volume = "(volym %%volume%%)"
openurl_coverage_until_issue = "nummer %%issue%%"
openurl_embargo_available_year = "endast nyare än %%year%% år"
openurl_embargo_available_month = "endast nyare än %%month%% monad(er)"
openurl_embargo_available_days = "endast nyare än %%days%% dag(ar)"
openurl_embargo_not_available_year = "endast äldre än %%year%% år"
openurl_embargo_not_available_month = "endast äldre än %%month%% monad(er)"
openurl_embargo_not_available_days = "endast äldre än %%days%% dag(ar)"
Organisation = "Organisation"
organisation_archives = "Arkiv (%%cnt%%)"
organisation_libraries = "Bibliotek (%%cnt%%)"
Expand Down
5 changes: 5 additions & 0 deletions module/Finna/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
'voyagerrestful' => 'Finna\ILS\Driver\Factory::getVoyagerRestful',
],
],
'resolver_driver' => [
'factories' => [
'sfx' => 'Finna\Resolver\Driver\Factory::getSfx',
],
],
'search_backend' => array(
'factories' => array(
'Primo' => 'Finna\Search\Factory\PrimoBackendFactory',
Expand Down
79 changes: 76 additions & 3 deletions module/Finna/src/Finna/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,79 @@ public function getMyListsAjax()
return $this->output($html, self::STATUS_OK);
}

/**
* Fetch Links from resolver given an OpenURL and format as HTML
* and output the HTML content in JSON object.
*
* @return \Zend\Http\Response
* @author Graham Seaman <[email protected]>
*/
protected function getResolverLinksAjax()
{
$this->writeSession(); // avoid session write timing bug
$openUrl = $this->params()->fromQuery('openurl', '');

$config = $this->getConfig();
$resolverType = isset($config->OpenURL->resolver)
? $config->OpenURL->resolver : 'other';
$pluginManager = $this->getServiceLocator()
->get('VuFind\ResolverDriverPluginManager');
if (!$pluginManager->has($resolverType)) {
return $this->output(
$this->translate("Could not load driver for $resolverType"),
self::STATUS_ERROR
);
}
$resolver = new \VuFind\Resolver\Connection(
$pluginManager->get($resolverType)
);
if (isset($config->OpenURL->resolver_cache)) {
$resolver->enableCache($config->OpenURL->resolver_cache);
}
$result = $resolver->fetchLinks($openUrl);

// Sort the returned links into categories based on service type:
$electronic = $print = $services = [];
foreach ($result as $link) {
switch (isset($link['service_type']) ? $link['service_type'] : '') {
case 'getHolding':
$print[] = $link;
break;
case 'getWebService':
$services[] = $link;
break;
case 'getDOI':
// Special case -- modify DOI text for special display:
$link['title'] = $this->translate('Get full text');
$link['coverage'] = '';
case 'getFullTxt':
default:
$electronic[] = $link;
break;
}
}

// Get the OpenURL base:
if (isset($config->OpenURL) && isset($config->OpenURL->url)) {
// Trim off any parameters (for legacy compatibility -- default config
// used to include extraneous parameters):
list($base) = explode('?', $config->OpenURL->url);
} else {
$base = false;
}

// Render the links using the view:
$view = [
'openUrlBase' => $base, 'openUrl' => $openUrl, 'print' => $print,
'electronic' => $electronic, 'services' => $services,
'searchClassId' => $this->params()->fromQuery('searchClassId', '')
];
$html = $this->getViewRenderer()->render('ajax/resolverLinks.phtml', $view);

// output HTML encoded in JSON object
return $this->output($html, self::STATUS_OK);
}

/**
* Update or create a list object.
*
Expand Down Expand Up @@ -512,14 +585,14 @@ public function getFeedAjax()

$type = $config->type;
$channel = null;

// Check for cached version
$cacheEnabled = false;
$cacheDir = $this->getServiceLocator()->get('VuFind\CacheManager')
->getCache('feed')->getOptions()->getCacheDir();

$localFile = "$cacheDir/" . md5(var_export($config, true)) . '.xml';

$cacheConfig = $this->getServiceLocator()
->get('VuFind\Config')->get('config');
$maxAge = isset($cacheConfig->Content->feedcachetime)
Expand All @@ -533,7 +606,7 @@ public function getFeedAjax()
$channel = Reader::importFile($localFile);
}
}

if (!$channel) {
// No cache available, read from source.
if (preg_match('/^http(s)?:\/\//', $url)) {
Expand Down
95 changes: 31 additions & 64 deletions module/Finna/src/Finna/RecordDriver/Primo.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @category VuFind2
* @package RecordDrivers
* @author Samuli Sillanpää <[email protected]>
* @author Ere Maijala <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/vufind2:record_drivers Wiki
*/
Expand All @@ -34,6 +35,7 @@
* @category VuFind2
* @package RecordDrivers
* @author Samuli Sillanpää <[email protected]>
* @author Ere Maijala <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link http://vufind.org/wiki/vufind2:record_drivers Wiki
*/
Expand Down Expand Up @@ -177,6 +179,20 @@ public function getBuilding()
return null;
}

/**
* Return information whether fulltext is available
*
* @return bool
*/
public function getFulltextAvailable()
{
$rec = $this->getSimpleXML();
if (isset($rec->delivery->fulltext)) {
return $rec->delivery->fulltext == 'fulltext';
}
return false;
}

/**
* Return image rights.
*
Expand Down Expand Up @@ -210,81 +226,32 @@ public function getRecordImage($size = 'small', $index = 0)
return $params;
}

/**
* Get OpenURL parameters for an article.
*
* @return array
*/
protected function getArticleOpenURLParams()
{
return $this->processOpenURLParams(
parent::getArticleOpenURLParams()
);
}

/**
* Get OpenURL parameters for a book.
*
* @return array
*/
protected function getBookOpenURLParams()
{
return $this->processOpenURLParams(
parent::getBookOpenURLParams()
);
}

/**
* Get OpenURL parameters for a journal.
*
* @return array
*/
protected function getJournalOpenURLParams()
{
return $this->processOpenURLParams(
parent::getJournalOpenURLParams()
);
}

/**
* Get OpenURL parameters for an unknown format.
*
* @param string $format Name of format
*
* @return array
*/
protected function getUnknownFormatOpenURLParams($format)
{
return $this->processOpenURLParams(
parent::getUnknownFormatOpenURLParams($format)
);
}

/**
* Get default OpenURL parameters.
*
* @return array|false
* @return array
*/
protected function getDefaultOpenURLParams()
{
if (!isset($this->mainConfig->OpenURL->rfr_id)
|| empty($this->mainConfig->OpenURL->rfr_id)
) {
return false;
}

$link = $this->fields['url'];
$link = isset($this->fields['url']) ? $this->fields['url'] : '';

$params = [];
// Take params from the OpenURL returned from Primo, if available
if ($link && strpos($link, 'url_ver=Z39.88-2004') !== false) {
parse_str(substr($link, strpos($link, '?') + 1), $params);
$params['rfr_id'] = $this->mainConfig->OpenURL->rfr_id;
if ($dates = $this->getPublicationDates()) {
$params['rft.date'] = implode('', $this->getPublicationDates());
}
return $params;
$params = $this->processOpenURLParams($params);
}
$params['rfr_id'] = !empty($this->mainConfig->OpenURL->rfr_id)
? $this->mainConfig->OpenURL->rfr_id
: '';
if ($dates = $this->getPublicationDates()) {
$params['rft.date'] = implode('', $this->getPublicationDates());
}
if (!isset($params['rft.title'])) {
$params['rft.title'] = $this->getTitle();
}

return false;
return $params;
}

/**
Expand Down
Loading

0 comments on commit 4505f9b

Please sign in to comment.