I was able to implement "Sets" via the oai interface via the following changes to the functions.inc.php file in the ocs/oai/include directory. Standard disclaimer.. Use at your own risk. This was only tested in a multiple conference configuration. It should work in a single conference setup as well.
BTW this is for version OCS 1.1.5.
This was the output of 'diff -c functions.inc.php functions.inc.php.orig'.
- Code: Select all
*** functions.inc.php Tue Oct 26 09:07:44 2004
--- functions.inc.php.orig Mon Oct 25 13:48:25 2004
***************
*** 53,59 ****
function getIdentifiers($metadataPrefix, $from, $until, $set, &$offset, &$tota
l) {
global $oai_config, $db, $dbtable;
! $sql = "SELECT cf, id, timestamp FROM $dbtable[papers] WHERE accepted='t
rue' ";
// determine parameters for selective harvesting
$where = array();
--- 53,59 ----
function getIdentifiers($metadataPrefix, $from, $until, $set, &$offset, &$tota
l) {
global $oai_config, $db, $dbtable;
! $sql = "SELECT id, timestamp FROM $dbtable[papers] WHERE accepted='true'
";
// determine parameters for selective harvesting
$where = array();
***************
*** 60,69 ****
if(isset($from)) { array_push($where, "timestamp>='" . date("Y-m-d", $fr
om) . "'"); }
if(isset($until)) { array_push($where, "timestamp<='" . date("Y-m-d", $u
ntil) . "'"); }
if(!empty($where)) { $sql .= "AND " . join(" AND ", $where) . " "; }
! if(isset($set)) { $sql .= "AND cf='" . $set . "'"; } else {
$sql .= "ORDER BY id";
! }
!
$result = $db->query($sql);
$total = $db->num_rows($result);
--- 60,68 ----
if(isset($from)) { array_push($where, "timestamp>='" . date("Y-m-d", $fr
om) . "'"); }
if(isset($until)) { array_push($where, "timestamp<='" . date("Y-m-d", $u
ntil) . "'"); }
if(!empty($where)) { $sql .= "AND " . join(" AND ", $where) . " "; }
!
$sql .= "ORDER BY id";
!
$result = $db->query($sql);
$total = $db->num_rows($result);
***************
*** 76,87 ****
$identifiers = array();
for($offset, $max=$offset + $oai_config[max_identifiers]; $offse
t<$max && $offset<$total; $offset++) {
! list($cf, $id, $datestamp) = $db->assoc_array($result, $
offset);
! array_push($identifiers, array("identifier" => getIdenti
fierFromID($id),
! "datestamp" => UTCDate(t
imestamp2php($datestamp)),
! //"set" => "conference-p
apers")
! "set" => "$cf")
! );
}
return $identifiers;
--- 75,82 ----
$identifiers = array();
for($offset, $max=$offset + $oai_config[max_identifiers]; $offse
t<$max && $offset<$total; $offset++) {
! list($id, $datestamp) = $db->assoc_array($result, $offse
t);
! array_push($identifiers, array("identifier" => getIdenti
fierFromID($id), "datestamp" => UTCDate(timestamp2php($datestamp)), "set" => "co
nference-papers"));
}
return $identifiers;
***************
*** 148,172 ****
function getSets(&$offset, &$total) {
global $oai_config, $db, $dbtable;
! #return array("conference-papers");
!
! $result = $db->query("select id,name,intro from $dbtable[conference]");
! $total = $db->num_rows($result);
!
! if($total == 0) {
! return array();
! } else {
! $records = array();
! for($offset, $max=$offset + $oai_config[max_records]; $offset<$max
&& $offset<$total; $offset++) {
! $items = $db->assoc_array($result,$offset);
! array_push($records,array(
! "spec" => $items[id],
! "name" => $items[name],
! "description" => $items[intro])
! );
! }
! return $records;
! }
}
--- 143,149 ----
function getSets(&$offset, &$total) {
global $oai_config, $db, $dbtable;
! return array("conference-papers");
}
***************
*** 277,284 ****
return array(
"identifier" => $baseurl . "viewabstract.php?id=$items[id]&cf=$i
tems[cf]",
"datestamp" => UTCDate(timestamp2php($items[timestamp])),
! //"set" => "conference-papers",
! "set" => $items[cf],
"title" => $items[title],
"creator" => $creator,
"subject" => array($items[discipline], $items[topic]),
--- 254,260 ----
return array(
"identifier" => $baseurl . "viewabstract.php?id=$items[id]&cf=$i
tems[cf]",
"datestamp" => UTCDate(timestamp2php($items[timestamp])),
! "set" => "conference-papers",
"title" => $items[title],
"creator" => $creator,
"subject" => array($items[discipline], $items[topic]),
