Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
collectiveaccess committed Mar 26, 2019
2 parents 697dcd8 + 20f8cfd commit 32c10de
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 14 deletions.
13 changes: 13 additions & 0 deletions app/conf/linked_data.conf
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,17 @@ nomisma = {
literal = "skos:altLabel"
}
},

# Extra attributes to make available for get() and in displays
#
extra_info = {
lat = {
uri = <http://www.w3.org/2003/01/geo/wgs84_pos#location>,
literal = <http://www.w3.org/2003/01/geo/wgs84_pos#lat>
},
long = {
uri = <http://www.w3.org/2003/01/geo/wgs84_pos#location>,
literal = <http://www.w3.org/2003/01/geo/wgs84_pos#long>
},
}
}
17 changes: 15 additions & 2 deletions app/lib/GeographicMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function mapFrom($po_data_object, $ps_georeference_field_name, $pa_option

$va_tmp = explode('.', $ps_georeference_field_name);
$vs_field_name = array_pop($va_tmp);
$vs_containter_field_name = array_pop($va_tmp);

//$va_point_buf = array();

Expand All @@ -144,7 +145,13 @@ public function mapFrom($po_data_object, $ps_georeference_field_name, $pa_option
if (is_array($va_coordinates = $po_data_object->get($ps_georeference_field_name, array('coordinates' => true, 'returnWithStructure' => true, 'returnAllLocales' => false)))) {
foreach($va_coordinates as $vn_i => $va_coord_list) {
foreach($va_coord_list as $vn_attribute_id => $va_geoname) {
$va_coordinate = isset($va_geoname[$vs_field_name]) ? $va_geoname[$vs_field_name] : $va_geoname;
if(isset($va_geoname[$vs_field_name])) {
$va_coordinate = $va_geoname[$vs_field_name];
} elseif(isset($va_geoname[$vs_containter_field_name])) {
$va_coordinate = $va_geoname[$vs_containter_field_name];
} else {
$va_coordinate = $va_geoname;
}

if(!$va_coordinate['latitude'] || !$va_coordinate['longitude']) { continue; }
$vs_label = $vs_content = $vs_ajax_content = null;
Expand Down Expand Up @@ -240,7 +247,13 @@ public function mapFrom($po_data_object, $ps_georeference_field_name, $pa_option
$vs_table = $po_data_object->tableName();
foreach($va_coordinates as $vn_element_id => $va_coord_list) {
foreach($va_coord_list as $vn_attribute_id => $va_geoname) {
$va_coordinate = isset($va_geoname[$vs_field_name]) ? $va_geoname[$vs_field_name] : $va_geoname;
if(isset($va_geoname[$vs_field_name])) {
$va_coordinate = $va_geoname[$vs_field_name];
} elseif(isset($va_geoname[$vs_containter_field_name])) {
$va_coordinate = $va_geoname[$vs_containter_field_name];
} else {
$va_coordinate = $va_geoname;
}

$vs_label = $vs_content = $vs_ajax_content = null;

Expand Down
26 changes: 23 additions & 3 deletions app/lib/Plugins/InformationService/Nomisma.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,26 @@ public function lookup($pa_settings, $ps_search, $pa_options=null) {
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX nm: <http://nomisma.org/id/>
PREFIX nmo: <http://nomisma.org/ontology#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX spatial: <http://jena.apache.org/spatial#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT * WHERE {
?data skos:prefLabel ?label .
?data rdf:type ?t.
OPTIONAL { ?data skos:broader ?parent }
?data rdf:type ?t .
OPTIONAL {
?data skos:broader ?parent .
?data geo:location ?l .
?l geo:lat ?lat.
?l geo:long ?long .
}
'.$query_filter.'
'.$ontology_filter.'
}
LIMIT '.$pn_limit);
LIMIT '.(int)$pn_limit);

$va_results = parent::queryNomisma($vs_query);
if(!is_array($va_results)) { return false; }
Expand Down Expand Up @@ -171,6 +178,8 @@ public function lookup($pa_settings, $ps_search, $pa_options=null) {
'label' => htmlentities($vs_label),
'url' => $va_values['data']['value'],
'idno' => $vs_id,
'lat' => isset($va_values['lat']['value']) ? $va_values['lat']['value'] : null,
'long' => isset($va_values['long']['value']) ? $va_values['long']['value'] : null
);
}

Expand All @@ -193,4 +202,15 @@ public function getDisplayValueFromLookupText($ps_text) {
return $ps_text;
}
# ------------------------------------------------
/**
*
*/
public function getExtraInfo($pa_settings, $ps_url) {
$ret = parent::getExtraInfo($pa_settings, $ps_url);
if (isset($ret['lat']) && isset($ret['long']) && $ret['lat'] && $ret['long']) {
$ret['georeference'] = "[".$ret['lat'].",".$ret['long']."]";
}
return $ret;
}
# ------------------------------------------------
}
16 changes: 8 additions & 8 deletions app/lib/Plugins/Media/Video.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ public function read ($filepath) {
break;
case 'video/x-ms-asf':
case 'video/x-ms-wmv':
$this->properties["has_video"] = (sizeof($this->opa_media_metadata["asf"]["video_media"]) ? 1 : 0);
$this->properties["has_audio"] = (sizeof($this->opa_media_metadata["asf"]["audio_media"]) ? 1 : 0);
$this->properties["has_video"] = (($this->opa_media_metadata["asf"]["video_media"]) ? 1 : 0);
$this->properties["has_audio"] = (($this->opa_media_metadata["asf"]["audio_media"]) ? 1 : 0);

$this->properties["type_specific"] = array("asf" => $this->opa_media_metadata["asf"]);

Expand All @@ -416,8 +416,8 @@ public function read ($filepath) {
break;
case 'video/quicktime':
case 'video/mp4':
$this->properties["has_video"] = (isset($this->opa_media_metadata["video"]["bitrate"]) && sizeof($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0);
$this->properties["has_audio"] = (isset($this->opa_media_metadata["audio"]["bitrate"]) && sizeof($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0);
$this->properties["has_video"] = (isset($this->opa_media_metadata["video"]["bitrate"]) && ($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0);
$this->properties["has_audio"] = (isset($this->opa_media_metadata["audio"]["bitrate"]) && ($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0);

$this->properties["type_specific"] = array();

Expand Down Expand Up @@ -455,8 +455,8 @@ public function read ($filepath) {
$this->properties["bandwidth"] = array("min" => $this->opa_media_metadata["filesize"]/$this->opa_media_metadata["playtime_seconds"], "max" => $this->opa_media_metadata["filesize"]/$this->opa_media_metadata["playtime_seconds"]);
break;
case 'video/mpeg':
$this->properties["has_video"] = (isset($this->opa_media_metadata["video"]["bitrate"]) && sizeof($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0);
$this->properties["has_audio"] = (isset($this->opa_media_metadata["audio"]["bitrate"]) && sizeof($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0);
$this->properties["has_video"] = (isset($this->opa_media_metadata["video"]["bitrate"]) && ($this->opa_media_metadata["video"]["bitrate"]) ? 1 : 0);
$this->properties["has_audio"] = (isset($this->opa_media_metadata["audio"]["bitrate"]) && ($this->opa_media_metadata["audio"]["bitrate"]) ? 1 : 0);

$this->properties["type_specific"] = array();

Expand All @@ -468,8 +468,8 @@ public function read ($filepath) {
$this->properties["bandwidth"] = array("min" => $this->opa_media_metadata["bitrate"], "max" => $this->opa_media_metadata["bitrate"]);
break;
case 'video/x-flv':
$this->properties["has_video"] = (sizeof($this->opa_media_metadata["header"]["hasVideo"]) ? 1 : 0);
$this->properties["has_audio"] = (sizeof($this->opa_media_metadata["header"]["hasAudio"]) ? 1 : 0);
$this->properties["has_video"] = (($this->opa_media_metadata["header"]["hasVideo"]) ? 1 : 0);
$this->properties["has_audio"] = (($this->opa_media_metadata["header"]["hasAudio"]) ? 1 : 0);

$this->properties["type_specific"] = array("header" => $this->opa_media_metadata["header"]);

Expand Down
3 changes: 2 additions & 1 deletion app/lib/ResultContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,7 @@ static public function setVar($key, $value, $options=null) {
return self::$storage->setVar($key, $value, $options);
} else {
$s = self::$storage;
if (!($s = self::$storage)) { $s = 'Session'; }
return $s::setVar($key, $value, $options);
}
}
Expand All @@ -1166,7 +1167,7 @@ static public function getVar($key) {
if (is_object(self::$storage)) {
return self::$storage->getVar($key);
} else {
$s = self::$storage;
if (!($s = self::$storage)) { $s = 'Session'; }
return$s::getVar($key, $value, $options);
}
}
Expand Down
13 changes: 13 additions & 0 deletions app/lib/Search/SearchResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,19 @@ private function _getAttributeValue($pa_value_list, $pt_instance, $pa_options) {
$vs_val_proc = $o_value->getExtraInfo($va_path_components['subfield_name']);
break;
}

if(isset($pa_options['coordinates']) && $pa_options['coordinates']) {
if (preg_match("!\[([^\]]+)!", $vs_val_proc, $va_matches)) {
$va_tmp = explode(',', $va_matches[1]);
if ((sizeof($va_tmp) == 2) && (is_numeric($va_tmp[0])) && (is_numeric($va_tmp[1]))) {
$vs_val_proc = array('latitude' => trim($va_tmp[0]), 'longitude' => trim($va_tmp[1]), 'path' => trim($va_matches[1]), 'label' => $this->ops_text_value);
} else {
$vs_val_proc = array('latitude' => null, 'longitude' => null, 'path' => null, 'label' => $this->ops_text_value);
}
} else {
$vs_val_proc = array('latitude' => null, 'longitude' => null, 'path' => null, 'label' => $this->ops_text_value);
}
}
$vb_dont_return_value = false;
break;
}
Expand Down

0 comments on commit 32c10de

Please sign in to comment.