get_source_params($source_id);
if ($params["PARAMETERS"]) {
$vars=unserialize($params["PARAMETERS"]);
$params["PARAMETERS"]=$vars;
}
return $params;
}
function get_libelle($message) {
if (substr($message,0,4)=="msg:") return $this->msg[substr($message,4)]; else return $message;
}
function source_get_property_form($source_id) {
global $charset,$base_path;
$params=$this->get_source_params($source_id);
if($params["PARAMETERS"]!=""){
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}else{
$file_params = file_get_contents($base_path."/admin/connecteurs/in/openurl/conf.xml");
$params = _parser_text_no_function_($file_params, "CONFIGURATION");
foreach($params as $section => $parameters){
switch($section){
case "TRANSPORT" :
$protocole = $parameters[0]['PROTOCOLE'][0]['value'];
$method=$parameters[0]['METHOD'][0]['value'];
$tparameters=$parameters[0]['PARAMETERS'][0]['value'];
break;
case "SERIALIZATION" :
$serialization= $parameters[0]['value'];
break;
case "ENTITIES" :
foreach($parameters[0]['ENTITY'] as $entity){
switch($entity['TYPE']){
case "referent":
foreach($entity['IDENTIFIERS'][0]['IDENTIFIER'] as $identifier){
switch($identifier['NAME']){
case "issn" :
$rft_issn=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "isbn" :
$rft_isbn=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "pmid" :
$rft_pmid=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "doi" :
$rft_doi=$identifier['ALLOW'] == "yes" ? 1:0;
break;
}
}
$rft_byval=$entity['BYVALUE'][0]['ALLOW'] == "yes" ? 1:0;
$rft_byref=$entity['BYREFERENCE'][0]['ALLOW'] == "yes" ? 1:0;
$rft_private=$entity['PRIVATE'][0]['ALLOW'] == "yes" ? 1:0;
break;
case "referring_entity":
$rfe_allow=$entity['ALLOW'] == "yes" ? 1:0;
foreach($entity['IDENTIFIERS'][0]['IDENTIFIER'] as $identifier){
switch($identifier['NAME']){
case "issn" :
$rfe_issn=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "isbn" :
$rfe_isbn=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "pmid" :
$rfe_pmid=$identifier['ALLOW'] == "yes" ? 1:0;
break;
case "doi" :
$rfe_doi=$identifier['ALLOW'] == "yes" ? 1:0;
break;
}
}
$rfe_byval=$entity['BYVALUE'][0]['ALLOW'] == "yes" ? 1:0;
$rfe_byref=$entity['BYREFERENCE'][0]['ALLOW'] == "yes" ? 1:0;
$rfe_private=$entity['PRIVATE'][0]['ALLOW'] == "yes" ? 1:0;
break;
case "requester":
$req_allow=$entity['ALLOW'] == "yes" ? 1:0;
$req_parameter=$entity['PARAMETER'][0]['value'];
break;
case "service_type":
$svc_allow=$entity['ALLOW'] == "yes" ? 1:0;
$svc_services = array();
foreach($entity['SERVICE'] as $service){
$svc_services[] =array(
'name' => $service['NAME'],
'value'=> $service['DEFAULT_VALUE']
);
}
break;
case "resolver":
$res_allow=$entity['ALLOW'] == "yes" ? 1:0;
$res_parameter=$entity['PARAMETER'][0]['value'];
break;
case "referrer":
$rfr_allow=$entity['ALLOW'] == "yes" ? 1:0;
$rfr_parameter=$entity['PARAMETER'][0]['value'];
break;
}
}
break;
}
}
}
if (!isset($libelle))
$libelle = "OpenURL";
if (!isset($source_name))
$source_name = "OpenURL";
if (!isset($iwidth))
$iwidth = "640";
if (!isset($iheight))
$iheight = "350";
if (!isset($infobulle))
$infobulle = "";
// $result ="
//
";
//REFERENT
$referent="
";
$form_entities.= gen_plus("referent",$this->msg['openurl_entities_referent'],$referent,1);
//REFERRING ENTITY
$referring_entity="
".$this->msg["openurl_entity_allow"]."
".$this->msg['openurl_yes']."
".$this->msg['openurl_no']."
";
$form_entities.= gen_plus("referring_entity",$this->msg['openurl_entities_referring_entity'],$referring_entity,1);
//REQUESTER
$requester = "
".$this->msg["openurl_entity_allow"]."
".$this->msg['openurl_yes']."
".$this->msg['openurl_no']."
".$this->msg['openurl_requester_param']."
";
$form_entities.= gen_plus("requester",$this->msg['openurl_entities_requester'],$requester,1);
//SERVICE TYPE
$service_type = "
".$this->msg["openurl_entity_allow"]."
".$this->msg['openurl_yes']."
".$this->msg['openurl_no']."
";
$form_entities.= gen_plus("service_type",$this->msg['openurl_entities_service_type'],$service_type,1);
//RESOLVER
$resolver = "
".$this->msg['openurl_entity_allow']."
".$this->msg['openurl_yes']."
".$this->msg['openurl_no']."
".$this->msg['openurl_resolver_param']."
";
$form_entities.= gen_plus("resolver",$this->msg['openurl_entities_resolver'],$resolver,1);
//REFERRER
$referrer = "
".$this->msg["openurl_entity_allow"]."
".$this->msg['openurl_yes']."
".$this->msg['openurl_no']."
".$this->msg['openurl_referrer_param']."
";
$form_entities.= gen_plus("referrer",$this->msg['openurl_entities_referrer'],$referrer,1);
$result.= gen_plus("form_entities",$this->msg['openurl_form_param_entities'],$form_entities,1);
$result.="
";
return $result;
}
function make_serialized_source_properties($source_id) {
global $iwidth,$iheight,$libelle,$source_name,$infobulle;
global $protocole,$method,$tparameters,$byref_url;
global $serialization;
global $rft_isbn,$rft_issn,$rft_doi,$rft_pmid,$rft_byval,$rft_byref,$rft_private;
global $rfe_allow,$rfe_isbn,$rfe_issn,$rfe_doi,$rfe_pmid,$rfe_byval,$rfe_byref,$rfe_private;
global $req_allow,$req_parameter;
global $svc_allow,$svc_services;
global $res_allow,$res_parameter;
global $rfr_allow,$rfr_parameter;
$t['libelle'] = $libelle ? stripslashes($libelle) : "OpenURL";
$t['source_name'] = $source_name ? stripslashes($source_name) : "OpenURL";
$t['iwidth']=$iwidth+0;
$t['iheight']=$iheight+0;
$t['infobulle'] = $infobulle ? stripslashes($infobulle) : "";
// if (($_FILES["conf_file"])&&(!$_FILES["conf_file"]["error"])) {
// $file_params = file_get_contents($_FILES["conf_file"]["tmp_name"]);
// $params = _parser_text_no_function_($file_params, "CONFIGURATION");
// foreach($params as $section => $parameters){
// switch($section){
// case "TRANSPORT" :
// $t['protocole'] = $parameters[0]['PROTOCOLE'][0]['value'];
// $t['method']=$parameters[0]['METHOD'][0]['value'];
// $t['tparameters']=$parameters[0]['PARAMETERS'][0]['value'];
// break;
// case "SERIALIZATION" :
// $t['serialization']= $parameters[0]['value'];
// break;
// case "ENTITIES" :
// foreach($parameters[0]['ENTITY'] as $entity){
// switch($entity['TYPE']){
// case "referent":
// foreach($entity['IDENTIFIERS'][0]['IDENTIFIER'] as $identifier){
// switch($identifier['NAME']){
// case "issn" :
// $t['rft_issn']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "isbn" :
// $t['rft_isbn']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "pmid" :
// $t['rft_pmid']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "doi" :
// $t['rft_doi']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// }
// }
// $t['rft_byval']=$entity['BYVALUE'][0]['ALLOW'] == "yes" ? 1:0;
// $t['rft_byref']=$entity['BYREFERENCE'][0]['ALLOW'] == "yes" ? 1:0;
// $t['rft_private']=$entity['PRIVATE'][0]['ALLOW'] == "yes" ? 1:0;
// break;
// case "referring_entity":
// $t['rfe_allow']=$entity['ALLOW'] == "yes" ? 1:0;
// foreach($entity['IDENTIFIERS'][0]['IDENTIFIER'] as $identifier){
// switch($identifier['NAME']){
// case "issn" :
// $t['rfe_issn']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "isbn" :
// $t['rfe_isbn']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "pmid" :
// $t['rfe_pmid']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// case "doi" :
// $t['rfe_doi']=$identifier['ALLOW'] == "yes" ? 1:0;
// break;
// }
// }
// $t['rfe_byval']=$entity['BYVALUE'][0]['ALLOW'] == "yes" ? 1:0;
// $t['rfe_byref']=$entity['BYREFERENCE'][0]['ALLOW'] == "yes" ? 1:0;
// $t['rfe_private']=$entity['PRIVATE'][0]['ALLOW'] == "yes" ? 1:0;
// break;
// case "requester":
// $t['req_allow']=$entity['ALLOW'] == "yes" ? 1:0;
// $t['req_parameter']=$entity['PARAMETER'][0]['value'];
// break;
// case "service_type":
// $t['svc_allow']=$entity['ALLOW'] == "yes" ? 1:0;
// $t['svc_services'] = array();
// foreach($entity['SERVICE'] as $service){
// $t['svc_services'][] =array(
// 'name' => $service['NAME'],
// 'value'=> $service['DEFAULT_VALUE']
// );
// }
// break;
// case "resolver":
// $t['res_allow']=$entity['ALLOW'] == "yes" ? 1:0;
// $t['res_parameter']=$entity['PARAMETER'][0]['value'];
// break;
// case "referrer":
// $t['rfr_allow']=$entity['ALLOW'] == "yes" ? 1:0;
// $t['rfr_parameter']=$entity['PARAMETER'][0]['value'];
// break;
// }
// }
// break;
// }
// }
// }else{
$t['protocole']=$protocole;
$t['method']=$method;
$t['tparameters']=$tparameters;
$t['byref_url']=$byref_url;
$t['serialization']=$serialization;
$t['rft_isbn']=$rft_isbn;
$t['rft_issn']=$rft_issn;
$t['rft_pmid']=$rft_pmid;
$t['rft_doi']=$rft_doi;
$t['rft_byval']=$rft_byval;
$t['rft_byref']=$rft_byref;
$t['rft_private']=$rft_private;
$t['rfe_allow']=$rfe_allow;
$t['rfe_isbn']=$rfe_isbn;
$t['rfe_issn']=$rfe_issn;
$t['rfe_pmid']=$rfe_pmid;
$t['rfe_doi']=$rfe_doi;
$t['rfe_byval']=$rfe_byval;
$t['rfe_byref']=$rfe_byref;
$t['rfe_private']=$rfe_private;
$t['req_allow']=$req_allow;
$t['req_parameter']=$req_parameter;
$t['svc_allow']=$svc_allow;
$t['svc_services']=$svc_services;
$t['res_allow']=$res_allow;
$t['res_parameter']=$res_parameter;
$t['rfr_allow']=$rfr_allow;
$t['rfr_parameter']=$rfr_parameter;
// }
$this->sources[$source_id]["PARAMETERS"]=serialize($t);
}
//Récupération des proriétés globales par défaut du connecteur (timeout, retry, repository, parameters)
function fetch_default_global_values() {
$this->timeout=5;
$this->repository=2;
$this->retry=3;
$this->ttl=1800;
$this->parameters="";
}
//Formulaire des propriétés générales
function get_property_form() {
return "";
}
function make_serialized_properties() {
$keys = array();
$this->parameters = serialize($keys);
}
function enrichment_is_allow(){
return true;
}
function getEnrichmentHeader(){
$header= array();
$header[]= "";
return $header;
}
function getTypeOfEnrichment($source_id){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$type['type'] = array(
array(
'code' => str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle))),
'label' => $libelle,
'infobulle' => $infobulle
)
);
$type['source_id'] = $source_id;
return $type;
}
function getEnrichment($notice_id,$source_id,$type="",$enrich_params=array(),$page=1){
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
$enrichment= array();
//on renvoi ce qui est demandé... si on demande rien, on renvoi tout..
switch ($type){
case str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle))) :
default :
$openurl_param = new openurl_parameters();
$openurl_param->setParameters($vars);
$openurl_instance = new openurl_instance($notice_id,0,$openurl_param->getParameters(),$source_id);
global $debug;
if($debug == 1 ){
print $openurl_instance->getInFrame(1980,980);
}else $enrichment[str_replace(array(" ","%","-","?","!",";",",",":"),"",strip_empty_chars(strtolower($libelle)))]['content'] = $openurl_instance->getInFrame($iwidth,$iheight);
break;
}
$enrichment['source_label']=sprintf($this->msg['openurl_enrichment_source'],$source_name);
return $enrichment;
}
function getByRefContent($source_id,$notice_id,$uri,$entity){
global $include_path;
global $openurl_map;
$openurl_map = array();
$params=$this->get_source_params($source_id);
if ($params["PARAMETERS"]) {
//Affichage du formulaire avec $params["PARAMETERS"]
$vars=unserialize($params["PARAMETERS"]);
foreach ($vars as $key=>$val) {
global $$key;
$$key=$val;
}
}
require_once ($include_path."/parser.inc.php") ;
_parser_($include_path."/openurl/openurl_mapping.xml", array("ITEM" => "_getMapItem_"), "MAP");
if($entity){
//récupère les param d'exports
$export_param = new export_param();
$param = $export_param->get_parametres($export_param->context);
//petit nettoyage pour un bon fonctionnement...
foreach($param as $key => $value){
$param["exp_".$key] = $param[$key];
}
//maintenant que c'est en ordre, on peut y aller!
$export = new export(array($notice_id),array(),array());
$export->get_next_notice("",array(),array(),false,$param);
$elem = new $openurl_map[$uri]['class']($export->xml_array,true);
$elem->setEntityType($entity);
print $elem->serialize();
}else{
//si on demande pas une entité, c'est un contextObject
$openurl_param = new openurl_parameters();
$openurl_param->setParameters($vars);
$openurl_instance = new openurl_instance($notice_id,0,$openurl_param->getParameters(),$source_id);
$openurl_instance->generateContextObject();
print $openurl_instance->contextObject->serialize();
}
}
}
?>