Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
afi
opacce
Commits
5d8da2fb
Commit
5d8da2fb
authored
Jul 12, 2019
by
Patrick Barroca
😁
Browse files
hotline #89462 : add new oai_dc_bokeh metadataPrefix
parent
954ac9c1
Pipeline
#7956
failed with stage
in 33 minutes and 44 seconds
Changes
15
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
544 additions
and
111 deletions
+544
-111
VERSIONS_HOTLINE/89462
VERSIONS_HOTLINE/89462
+1
-0
application/modules/opac/controllers/OaiController.php
application/modules/opac/controllers/OaiController.php
+23
-24
application/modules/opac/views/scripts/oai/list-metadata-formats.xml.phtml
...es/opac/views/scripts/oai/list-metadata-formats.xml.phtml
+3
-14
library/Class/FRBR/Link.php
library/Class/FRBR/Link.php
+5
-0
library/Class/Notice/DublinCoreBokehVisitor.php
library/Class/Notice/DublinCoreBokehVisitor.php
+70
-0
library/Class/WebService/OAI/MetadataFormat.php
library/Class/WebService/OAI/MetadataFormat.php
+85
-0
library/Class/WebService/OAI/Request/GetRecord.php
library/Class/WebService/OAI/Request/GetRecord.php
+18
-12
library/Class/WebService/OAI/Request/ListIdentifiers.php
library/Class/WebService/OAI/Request/ListIdentifiers.php
+7
-3
library/Class/WebService/OAI/Request/ListMetadataFormats.php
library/Class/WebService/OAI/Request/ListMetadataFormats.php
+18
-6
library/Class/WebService/OAI/Request/ListRecords.php
library/Class/WebService/OAI/Request/ListRecords.php
+8
-2
library/Class/WebService/OAI/Response/RecordBuilder.php
library/Class/WebService/OAI/Response/RecordBuilder.php
+1
-2
library/ZendAfi/Form/Album.php
library/ZendAfi/Form/Album.php
+3
-3
tests/application/modules/opac/controllers/OAIControllerGetRecordTest.php
...n/modules/opac/controllers/OAIControllerGetRecordTest.php
+133
-21
tests/application/modules/opac/controllers/OAIControllerListMetadataFormatsTest.php
...opac/controllers/OAIControllerListMetadataFormatsTest.php
+37
-23
tests/application/modules/opac/controllers/OAIControllerListRecordsTest.php
...modules/opac/controllers/OAIControllerListRecordsTest.php
+132
-1
No files found.
VERSIONS_HOTLINE/89462
0 → 100644
View file @
5d8da2fb
- ticket #89462 : Serveur OAI : Ajout d'un metadataPrefix oai_dc_bokeh plus riche que l'oai_dc pour les notices d'albums de la bibliothèque numérique Bokeh
\ No newline at end of file
application/modules/opac/controllers/OaiController.php
View file @
5d8da2fb
...
...
@@ -18,17 +18,24 @@
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
OaiController
extends
Zend_Controller_Action
{
public
function
init
()
{
$this
->
_helper
->
getHelper
(
'contextSwitch'
)
->
addActionContext
(
'list-identifiers'
,
'xml'
)
->
addActionContext
(
'identify'
,
'xml'
)
->
addActionContext
(
'list-metadata-formats'
,
'xml'
)
->
addActionContext
(
'list-records'
,
'xml'
)
->
addActionContext
(
'list-sets'
,
'xml'
)
->
addActionContext
(
'get-record'
,
'xml'
)
->
addActionContext
(
'bad-verb'
,
'xml'
)
->
initContext
();
->
addActionContext
(
'list-identifiers'
,
'xml'
)
->
addActionContext
(
'identify'
,
'xml'
)
->
addActionContext
(
'list-metadata-formats'
,
'xml'
)
->
addActionContext
(
'list-records'
,
'xml'
)
->
addActionContext
(
'list-sets'
,
'xml'
)
->
addActionContext
(
'get-record'
,
'xml'
)
->
addActionContext
(
'bad-verb'
,
'xml'
)
->
initContext
();
}
public
function
preDispatch
()
{
parent
::
preDispatch
();
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
}
...
...
@@ -62,7 +69,6 @@ class OaiController extends Zend_Controller_Action {
public
function
listIdentifiersAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$request
=
new
Class_WebService_OAI_Request_ListIdentifiers
(
$this
->
_request
->
getParams
(),
$this
->
buildBaseUrl
());
$builder
=
new
Class_Xml_Builder
();
...
...
@@ -70,7 +76,7 @@ class OaiController extends Zend_Controller_Action {
$this
->
view
->
error
=
$request
->
getErrorOn
(
$builder
);
if
(
$notices
=
$request
->
getNotices
())
{
$visitor
=
new
Class_Notice_DublinC
or
e
Visitor
();
$visitor
=
$request
->
getRec
or
d
Visitor
();
$visitor
->
setGlobalSetSpec
(
$request
->
getSet
());
$recordBuilder
=
new
Class_WebService_OAI_Response_RecordHeadersBuilder
();
$headers
=
''
;
...
...
@@ -80,13 +86,13 @@ class OaiController extends Zend_Controller_Action {
}
$this
->
view
->
headers
=
$headers
;
}
$this
->
view
->
builder
=
$builder
;
$this
->
view
->
token
=
$request
->
getToken
();
}
public
function
listRecordsAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$request
=
new
Class_WebService_OAI_Request_ListRecords
(
$this
->
_request
->
getParams
(),
$this
->
buildBaseUrl
());
$builder
=
new
Class_Xml_Builder
();
...
...
@@ -94,7 +100,7 @@ class OaiController extends Zend_Controller_Action {
$this
->
view
->
error
=
$request
->
getErrorOn
(
$builder
);
if
(
$notices
=
$request
->
getNotices
())
{
$visitor
=
new
Class_Notice_DublinC
or
e
Visitor
();
$visitor
=
$request
->
getRec
or
d
Visitor
();
$visitor
->
setGlobalSetSpec
(
$request
->
getSet
());
$recordBuilder
=
new
Class_WebService_OAI_Response_RecordBuilder
();
$records
=
''
;
...
...
@@ -104,13 +110,13 @@ class OaiController extends Zend_Controller_Action {
}
$this
->
view
->
records
=
$records
;
}
$this
->
view
->
builder
=
$builder
;
$this
->
view
->
token
=
$request
->
getToken
();
}
public
function
identifyAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$this
->
view
->
baseUrl
=
$baseUrl
=
$this
->
buildBaseUrl
();
$request
=
new
Class_WebService_OAI_Request_Identify
(
$this
->
_request
->
getParams
(),
...
...
@@ -134,19 +140,16 @@ class OaiController extends Zend_Controller_Action {
public
function
listMetadataFormatsAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$baseUrl
=
$this
->
buildBaseUrl
();
$request
=
new
Class_WebService_OAI_Request_ListMetadataFormats
(
$this
->
_request
->
getParams
(),
$baseUrl
);
$this
->
view
->
request
=
$request
;
$this
->
view
->
builder
=
$builder
=
new
Class_Xml_Builder
();
$this
->
view
->
error
=
$request
->
getErrorOn
(
$builder
);
$builder
=
new
Class_Xml_Builder
();
$this
->
view
->
request
=
$request
->
renderOn
(
$builder
);
$this
->
view
->
response
=
$request
->
getResponseOn
(
$builder
);
}
public
function
listSetsAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$baseUrl
=
$this
->
buildBaseUrl
();
$request
=
new
Class_WebService_OAI_Request_ListSets
(
$this
->
_request
->
getParams
(),
$baseUrl
);
...
...
@@ -167,7 +170,6 @@ class OaiController extends Zend_Controller_Action {
public
function
getRecordAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$baseUrl
=
$this
->
buildBaseUrl
();
$request
=
new
Class_WebService_OAI_Request_GetRecord
(
$this
->
_request
->
getParams
(),
$baseUrl
);
...
...
@@ -177,7 +179,7 @@ class OaiController extends Zend_Controller_Action {
$this
->
view
->
error
=
$request
->
getErrorOn
(
$builder
);
if
(
$notice
=
$request
->
getNotice
())
{
$visitor
=
new
Class_Notice_DublinC
or
e
Visitor
();
$visitor
=
$request
->
getRec
or
d
Visitor
();
$visitor
->
visit
(
$notice
);
$recordBuilder
=
new
Class_WebService_OAI_Response_RecordBuilder
();
$this
->
view
->
record
=
$recordBuilder
->
xml
(
$builder
,
$visitor
);
...
...
@@ -187,9 +189,6 @@ class OaiController extends Zend_Controller_Action {
public
function
badVerbAction
()
{
$this
->
getHelper
(
'ViewRenderer'
)
->
setLayoutScript
(
'empty.phtml'
);
$this
->
view
->
baseUrl
=
$this
->
buildBaseUrl
();
}
}
?>
\ No newline at end of file
application/modules/opac/views/scripts/oai/list-metadata-formats.xml.phtml
View file @
5d8da2fb
...
...
@@ -3,17 +3,6 @@
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"
>
<responseDate>
<?php
echo
date
(
'c'
);
?>
</responseDate>
<?php
echo
$this
->
request
->
renderOn
(
$this
->
builder
);
?>
<?php
if
(
$this
->
error
)
echo
$this
->
error
;
else
{
?>
<ListMetadataFormats>
<metadataFormat>
<metadataPrefix>
oai_dc
</metadataPrefix>
<schema>
http://www.openarchives.org/OAI/2.0/oai_dc.xsd
</schema>
<metadataNamespace>
http://www.openarchives.org/OAI/2.0/oai_dc/
</metadataNamespace>
</metadataFormat>
</ListMetadataFormats>
<?php
}
?>
</OAI-PMH>
\ No newline at end of file
<?php
echo
$this
->
request
;
?>
<?php
echo
$this
->
response
;
?>
</OAI-PMH>
library/Class/FRBR/Link.php
View file @
5d8da2fb
...
...
@@ -348,4 +348,9 @@ class Class_FRBR_Link extends Storm_Model_Abstract {
public
function
forJson
()
{
return
$this
->
getRawAttributes
();
}
public
function
isSourceRecord
()
{
return
static
::
TYPE_NOTICE
==
$this
->
getSourceType
();
}
}
library/Class/Notice/DublinCoreBokehVisitor.php
0 → 100644
View file @
5d8da2fb
<?php
/**
* Copyright (c) 2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_Notice_DublinCoreBokehVisitor
extends
Class_Notice_DublinCoreVisitor
{
/**
* @param $album Class_Album
*/
public
function
visitAlbum
(
$album
)
{
if
(
!
$album
)
return
;
parent
::
visitAlbum
(
$album
);
foreach
(
$album
->
getRessources
()
as
$resource
)
$this
->
_addResourceRelationTo
(
$resource
);
$this
->
_addRecordsRelationTo
(
$album
);
$this
->
_xml
.
=
$this
->
_builder
->
relation
(
$this
->
cdata
(
'categorie : '
.
implode
(
' > '
,
$album
->
getCategorie
()
->
getPathParts
())));
}
protected
function
_addResourceRelationTo
(
$resource
)
{
$this
->
_xml
.
=
$this
->
_builder
->
relation
(
$this
->
cdata
(
'ressource : '
.
Class_Url
::
absolute
(
$resource
->
getOriginalUrl
())));
}
protected
function
_addRecordsRelationTo
(
$album
)
{
foreach
(
Class_FRBR_Link
::
findAllRecordLinksForAlbum
(
$album
)
as
$link
)
$this
->
_addRecordRelationThrough
(
$link
);
}
protected
function
_addRecordRelationThrough
(
$link
)
{
$record
=
$link
->
isSourceRecord
()
?
$link
->
getSourceEntity
()
:
$link
->
getTargetEntity
();
if
(
!
$record
||
(
!
$item
=
$record
->
getFirstExemplaire
()))
return
;
$label
=
$link
->
isSourceRecord
()
?
$link
->
getTypeLabelFromTarget
()
:
$link
->
getTypeLabelFromSource
();
$this
->
_xml
.
=
$this
->
_builder
->
relation
(
$this
->
cdata
(
$label
.
' : '
.
$item
->
getIdOrigine
()));
}
}
library/Class/WebService/OAI/MetadataFormat.php
0 → 100644
View file @
5d8da2fb
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_OAI_MetadataFormat
{
const
SCHEMA_OAI_DC
=
'http://www.openarchives.org/OAI/2.0/oai_dc.xsd'
;
const
NAMESPACE_OAI_DC
=
'http://www.openarchives.org/OAI/2.0/oai_dc/'
;
protected
$_prefix
;
public
static
function
getAll
()
{
return
[
new
Class_WebService_OAI_MetadataFormat_OaiDc
(),
new
Class_WebService_OAI_MetadataFormat_OaiDcBokeh
()];
}
public
static
function
isKnownPrefix
(
$prefix
)
{
foreach
(
static
::
getAll
()
as
$format
)
if
(
$format
->
isPrefix
(
$prefix
))
return
true
;
return
false
;
}
public
static
function
forPrefix
(
$prefix
)
{
foreach
(
static
::
getAll
()
as
$format
)
if
(
$format
->
isPrefix
(
$prefix
))
return
$format
;
}
public
function
isPrefix
(
$prefix
)
{
return
$this
->
_prefix
===
$prefix
;
}
public
function
renderOn
(
$builder
)
{
$parts
=
[
$builder
->
metadataPrefix
(
$this
->
_prefix
),
$builder
->
schema
(
static
::
SCHEMA_OAI_DC
),
$builder
->
metadataNamespace
(
static
::
NAMESPACE_OAI_DC
)];
return
$builder
->
metadataFormat
(
implode
(
$parts
));
}
public
function
getRecordVisitor
()
{
return
new
Class_Notice_DublinCoreVisitor
();
}
}
class
Class_WebService_OAI_MetadataFormat_OaiDc
extends
Class_WebService_OAI_MetadataFormat
{
protected
$_prefix
=
'oai_dc'
;
}
class
Class_WebService_OAI_MetadataFormat_OaiDcBokeh
extends
Class_WebService_OAI_MetadataFormat
{
protected
$_prefix
=
'oai_dc_bokeh'
;
public
function
getRecordVisitor
()
{
return
new
Class_Notice_DublinCoreBokehVisitor
();
}
}
library/Class/WebService/OAI/Request/GetRecord.php
View file @
5d8da2fb
...
...
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_OAI_Request_GetRecord
{
protected
$_baseUrl
;
...
...
@@ -27,8 +27,8 @@ class Class_WebService_OAI_Request_GetRecord {
public
function
__construct
(
$params
,
$baseUrl
)
{
$this
->
_baseUrl
=
$baseUrl
;
$this
->
_params
=
array_merge
(
array
(
'metadataPrefix'
=>
null
,
'identifier'
=>
null
)
,
$this
->
_params
=
array_merge
(
[
'metadataPrefix'
=>
null
,
'identifier'
=>
null
]
,
$params
);
$this
->
_metadataPrefix
=
$this
->
_params
[
'metadataPrefix'
];
...
...
@@ -37,24 +37,24 @@ class Class_WebService_OAI_Request_GetRecord {
public
function
getErrorOn
(
$builder
)
{
if
(
!
$this
->
_metadataPrefix
)
return
$builder
->
error
(
array
(
'code'
=>
'badArgument'
)
,
'Missing metadataPrefix'
);
if
(
!
$this
->
_metadataPrefix
)
return
$builder
->
error
(
[
'code'
=>
'badArgument'
]
,
'Missing metadataPrefix'
);
if
(
'oai_dc'
!=
$this
->
_metadataPrefix
)
return
$builder
->
error
(
array
(
'code'
=>
'cannotDisseminateFormat'
)
);
if
(
!
Class_WebService_OAI_MetadataFormat
::
isKnownPrefix
(
$this
->
_metadataPrefix
)
)
return
$builder
->
error
(
[
'code'
=>
'cannotDisseminateFormat'
]
);
if
(
!
$this
->
_identifier
)
return
$builder
->
error
(
array
(
'code'
=>
'badArgument'
)
,
'Missing identifier'
);
return
$builder
->
error
(
[
'code'
=>
'badArgument'
]
,
'Missing identifier'
);
$this
->
_notice
=
Class_Notice
::
getNoticeByOAIIdentifier
(
$this
->
_identifier
);
if
(
!
$this
->
_notice
)
return
$builder
->
error
(
array
(
'code'
=>
'idDoesNotExist'
)
);
if
(
!
$this
->
_notice
)
return
$builder
->
error
(
[
'code'
=>
'idDoesNotExist'
]
);
}
public
function
renderOn
(
$builder
)
{
$attributes
=
array
(
'verb'
=>
'GetRecord'
)
;
$attributes
=
[
'verb'
=>
'GetRecord'
]
;
if
(
$this
->
_metadataPrefix
)
$attributes
[
'metadataPrefix'
]
=
$this
->
_metadataPrefix
;
...
...
@@ -68,5 +68,11 @@ class Class_WebService_OAI_Request_GetRecord {
public
function
getNotice
()
{
return
$this
->
_notice
;
}
public
function
getRecordVisitor
()
{
return
(
$format
=
Class_WebService_OAI_MetadataFormat
::
forPrefix
(
$this
->
_metadataPrefix
))
?
$format
->
getRecordVisitor
()
:
new
Class_Notice_DublinCoreVisitor
();
}
}
?>
\ No newline at end of file
library/Class/WebService/OAI/Request/ListIdentifiers.php
View file @
5d8da2fb
...
...
@@ -83,7 +83,7 @@ class Class_WebService_OAI_Request_ListIdentifiers {
$answer
.
=
$builder
->
error
([
'code'
=>
'badArgument'
],
'Metadata prefix is not found'
);
if
(
'oai_dc'
!=
$this
->
_metadataPrefix
)
if
(
!
Class_WebService_OAI_MetadataFormat
::
isKnownPrefix
(
$this
->
_metadataPrefix
)
)
$answer
.
=
$builder
->
error
([
'code'
=>
'cannotDisseminateFormat'
]);
if
(
!
$this
->
_set
)
...
...
@@ -172,5 +172,9 @@ class Class_WebService_OAI_Request_ListIdentifiers {
public
function
getSet
()
{
return
$this
->
_set
;
}
}
?>
\ No newline at end of file
public
function
getRecordVisitor
()
{
return
new
Class_Notice_DublinCoreVisitor
();
}
}
\ No newline at end of file
library/Class/WebService/OAI/Request/ListMetadataFormats.php
View file @
5d8da2fb
...
...
@@ -16,12 +16,11 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_OAI_Request_ListMetadataFormats
{
protected
$_baseUrl
;
protected
$_identifier
;
protected
$_baseUrl
,
$_identifier
;
public
function
__construct
(
$params
,
$baseUrl
)
{
if
(
isset
(
$params
[
'identifier'
]))
$this
->
_identifier
=
$params
[
'identifier'
];
...
...
@@ -29,6 +28,20 @@ class Class_WebService_OAI_Request_ListMetadataFormats {
}
public
function
getResponseOn
(
$builder
)
{
if
(
$error
=
$this
->
getErrorOn
(
$builder
))
return
$error
;
$formats
=
array_map
(
function
(
$format
)
use
(
$builder
)
{
return
$format
->
renderOn
(
$builder
);
},
Class_WebService_OAI_MetadataFormat
::
getAll
());
return
$builder
->
ListMetadataFormats
(
implode
(
$formats
));
}
public
function
getErrorOn
(
$builder
)
{
if
(
$this
->
_identifier
&&
!
Class_Notice
::
getNoticeByOAIIdentifier
(
$this
->
_identifier
))
return
$builder
->
error
([
'code'
=>
'idDoesNotExist'
]);
...
...
@@ -36,11 +49,10 @@ class Class_WebService_OAI_Request_ListMetadataFormats {
public
function
renderOn
(
$builder
)
{
$attributes
=
array
(
'verb'
=>
'ListMetadataFormats'
)
;
$attributes
=
[
'verb'
=>
'ListMetadataFormats'
]
;
if
(
$this
->
_identifier
)
$attributes
[
'identifier'
]
=
$this
->
_identifier
;
return
$builder
->
request
(
$attributes
,
$this
->
_baseUrl
);
}
}
?>
\ No newline at end of file
library/Class/WebService/OAI/Request/ListRecords.php
View file @
5d8da2fb
...
...
@@ -16,9 +16,15 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_OAI_Request_ListRecords
extends
Class_WebService_OAI_Request_ListIdentifiers
{
protected
$_verb
=
'ListRecords'
;
public
function
getRecordVisitor
()
{
return
(
$format
=
Class_WebService_OAI_MetadataFormat
::
forPrefix
(
$this
->
_metadataPrefix
))
?
$format
->
getRecordVisitor
()
:
parent
::
getRecordVisitor
();
}
}
?>
\ No newline at end of file
library/Class/WebService/OAI/Response/RecordBuilder.php
View file @
5d8da2fb
...
...
@@ -16,7 +16,7 @@
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class
Class_WebService_OAI_Response_RecordBuilder
{
public
function
xml
(
$builder
,
$visitor
)
{
...
...
@@ -39,4 +39,3 @@ class Class_WebService_OAI_Response_RecordBuilder {
return
$builder
->
metadata
(
$visitor
->
xml
());
}
}
?>
\ No newline at end of file
library/ZendAfi/Form/Album.php
View file @
5d8da2fb
...
...
@@ -339,10 +339,10 @@ class ZendAfi_Form_Album extends ZendAfi_Form {
public
function
addFrbrLinkFor
(
$album
)
{
$descs
=
$values
=
[
'frbr_type'
=>
[],
'frbr_url'
=>
[]];
foreach
(
Class_FRBR_Link
::
findAllRecordLinksForAlbum
(
$album
)
as
$link
)
{
$record_type
=
(
Class_FRBR_Link
::
TYPE_NOTICE
==
$link
->
get
Source
Type
()
)
?
'
S
ource'
:
'
T
arget'
;
$album_type
=
'
S
ource'
==
$record_type
?
'target'
:
'source'
;
$record_type
=
$link
->
is
Source
Record
(
)
?
'
s
ource'
:
'
t
arget'
;
$album_type
=
'
s
ource'
==
$record_type
?
'target'
:
'source'
;
$values
[
'frbr_url'
][]
=
$link
->
{
'get'
.
$record_type
}();
$values
[
'frbr_url'
][]
=
$link
->
{
'get'
.
ucfirst
(
$record_type
)
}();
$values
[
'frbr_type'
][]
=
$link
->
getType
()
->
getId
()
.
':'
.
$album_type
;
$descs
[
'frbr_type'
][]
=
''
;
$descs
[
'frbr_url'
][]
=
$this
->
getView
()
->
frbrLabel
(
$link
,
$record_type
);
...
...
tests/application/modules/opac/controllers/OAIControllerGetRecordTest.php
View file @
5d8da2fb
...
...
@@ -26,11 +26,20 @@ abstract class OAIControllerGetRecordTestCase extends AbstractControllerTestCase
protected
$_xpath
;
protected
$_xml
;
protected
$_storm_default_to_volatile
=
true
;
public
function
setUp
()
{
parent
::
setUp
();
$this
->
_xpath
=
TestXPathFactory
::
newOaiDc
();
}
protected
function
assertMetadataContains
(
$path
,
$content
)
{
$this
->
_xpath
->
assertXPathContentContains
(
$this
->
_xml
,
'//oai:GetRecord/oai:record/oai:metadata'
.
$path
,
$content
);
}
}
...
...
@@ -90,11 +99,6 @@ class OAIControllerGetRecordNotFoundParamsTest extends OAIControllerGetRecordTes
public
function
setUp
()
{
parent
::
setUp
();
Storm_Test_ObjectWrapper
::
onLoaderOfModel
(
'Class_Notice'
)
->
whenCalled
(
'getNoticeByClefAlpha'
)
->
with
(
'harrypotter-sorciers'
)
->
answers
(
null
);
$this
->
dispatch
(
'/opac/oai/request?verb=GetRecord&metadataPrefix=oai_dc&identifier=harrypotter-sorciers\"id'
,
true
);
$this
->
_xml
=
$this
->
_response
->
getBody
();
}
...
...
@@ -121,14 +125,11 @@ class OAIControllerGetRecordNotSupportedPrefixTest extends OAIControllerGetRecor
public
function
setUp
()
{
parent
::
setUp
();
Storm_Test_ObjectWrapper
::
onLoaderOfModel
(
'Class_Notice'
)
->
whenCalled
(
'getNoticeByClefAlpha'
)
->
with
(
'harrypotter-sorciers'
)
->
answers
(
Class_Notice
::
getLoader
()
->
newInstanceWithId
(
4
)
->
setClefAlpha
(
'harrypotter-sorciers'
)
->
setTitrePrincipal
(
'Harry Potter a l\'ecole des sorciers'
)
->
setDateMaj
(
'2001-12-14 11:39:44'
));
$this
->
fixture
(
'Class_Notice'
,
[
'id'
=>
4
,
'clef_alpha'
=>
'harrypotter-sorciers'
,
'titre_principal'
=>
'Harry Potter a l\'ecole des sorciers'
,
'date_maj'
=>
'2001-12-14 11:39:44'
]);
$this
->
dispatch
(
'/opac/oai/request?verb=GetRecord&metadataPrefix=not_supported&identifier=harrypotter-sorciers'
);
$this
->
_xml
=
$this
->
_response
->
getBody
();
...
...
@@ -156,14 +157,12 @@ class OAIControllerGetRecordValidParamsTest extends OAIControllerGetRecordTestCa
public
function
setUp
()
{
parent
::
setUp
();
$this
->
onLoaderOfModel
(
'Class_Notice'
)
->
whenCalled
(
'getNoticeByClefAlpha'
)
->
with
(
'harrypotter-sorciers'
)
->
answers
(
Class_Notice
::
newInstanceWithId
(
4
)
->
setClefAlpha
(
'harrypotter-sorciers'
)
->
setTitrePrincipal
(
'Harry Potter a l\'ecole des sorciers'
)
->
setCreatedAt
(
'2001-12-14'
)
->
setDateMaj
(
'2017-10-09 11:39:44'
));
$this
->
fixture
(
'Class_Notice'
,
[
'id'
=>
4
,
'clef_alpha'
=>
'harrypotter-sorciers'
,
'titre_principal'
=>
'Harry Potter a l\'ecole des sorciers'
,
'created_at'
=>
'2001-12-14'
,
'date_maj'
=>
'2001-12-14 11:39:44'
]);
$this
->
dispatch
(
'/opac/oai/request?verb=GetRecord&metadataPrefix=oai_dc&identifier=harrypotter-sorciers'
,
true
);
$this
->
_xml
=
$this
->
_response
->
getBody
();
...
...
@@ -221,4 +220,117 @@ class OAIControllerGetRecordValidParamsTest extends OAIControllerGetRecordTestCa
self
::
OAI_RECORD_PATH
.
'oai:metadata'
,
1
);
}
}