Skip to content

Commit

Permalink
adding timeline of concept versions
Browse files Browse the repository at this point in the history
  • Loading branch information
CLARVIE committed Oct 19, 2017
1 parent 0c62bb0 commit c24a834
Show file tree
Hide file tree
Showing 10 changed files with 2,276 additions and 1,763 deletions.
57 changes: 56 additions & 1 deletion controller/RestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,62 @@ public function vocabularies($request)

return $this->returnJson($ret);
}

//gives the history of thesaurus versions
public function history($request){

$vocabMatch=array();
$vocabId= $request->getVocab()->getId();
$uriConcept=$request->getUri();
$vocabVersion=$request->getVocab()->getConfig()->version();
$vocabVersionDate=$request->getVocab()->getConfig()->versionDate();
$lang = $request->getLang();
$graph=array();
$graph['uri']=$uriConcept;
foreach ($this->model->getVocabularies() as $voc) {
if($voc->getConceptInfo($uriConcept, $lang)!=null){
array_push($vocabMatch, $voc);
}
}
foreach ($vocabMatch as $v) {
$iscurrent=false;
if($v->getId()==$vocabId)
{
$iscurrent=true;
}
$graph['hasVersion'][]=array(
'skosmosVocab'=>$v->getId(),
'version'=>$v->getConfig()->version(),
'createdOn'=>$v->getConfig()->versionDate(),
'iscurrent'=>$iscurrent
);
}

$ret = array_merge_recursive($this->context, array(
'@context' => array(
'rdfs' => 'http://www.w3.org/2000/01/rdf-schema#',
'onki' => 'http://schema.onki.fi/onki#',
'dct' => 'http://purl.org/dc/terms/',
'dcterms' =>'http://purl.org/dc/terms/',
'altLabel' => 'skos:altLabel',
'broader' => 'skos:broader',
'dc11' => 'http://purl.org/dc/elements/1.1/',
'dct' => 'http://purl.org/dc/terms/',
'graph' => '@graph',
'pav' => 'http://purl.org/pav/',
'hiddenLabel' => 'skos:hiddenLabel',
'inScheme' => 'skos:inScheme',
'isothes' => 'http://purl.org/iso25964/skos-thes#',
'prefLabel' => 'skos:prefLabel',
'owl'=>'http://www.w3.org/2002/07/owl#',
'lang'=>'@language',
'related'=>'skos:related',
'value'=>'@value'
),
'graph' => array($graph))
);

return $this->returnJson($ret);
}
private function constructSearchParameters($request)
{
$parameters = new ConceptSearchParameters($request, $this->model->getConfig(), true);
Expand Down
7 changes: 7 additions & 0 deletions model/Vocabulary.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ public function getInfo($lang = null)
if (isset($ret['owl:versionInfo'])) { // if version info availible for vocabulary convert it to a more readable format
$ret['owl:versionInfo'][0] = $this->parseVersionInfo($ret['owl:versionInfo'][0]);
}

if (isset($ret['pav:hasVersion'])) { // if version info availible for vocabulary convert it to a more readable format
$ret['pav:hasVersion']['pav:version'] []= $this->parseVersionInfo($ret['pav:hasVersion'][0]);
}

// remove duplicate values
foreach (array_keys($ret) as $prop) {
$ret[$prop] = array_unique($ret[$prop]);
Expand Down Expand Up @@ -609,4 +614,6 @@ public function getShortName() {
public function getId() {
return $this->config->getId();
}


}
8 changes: 8 additions & 0 deletions model/VocabularyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ public function getTitle($lang = null)
{
return $this->getLiteral('dc:title', $lang);
}
public function version($lang = null)
{
return $this->getLiteral('pav:hasVersion');
}
public function versionDate($lang = null)
{
return $this->getLiteral('pav:createdOn');
}

/**
* Returns a boolean value set in the vocabularies.ttl config.
Expand Down
222 changes: 222 additions & 0 deletions resource/css/stylesheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
.headerbar-coloured {
position: absolute;
background-color: #003a80;
width: 100%;
margin: 0 0 0 15px;
height: 50px;
}
.headerbar{
margin-top: 10px;
}
.search-vocab-text {
background-color: #a4c400;
opacity: 0.95;
height: 40px;
float: left;
text-align: right;
line-height: 40px;
}

.header-left > h1 {
background-color: #003a80;
line-height: 50px;
margin: 0 0 0 15px;
opacity: 0.99;
overflow: hidden;
}

.topbar-white {
background-color: #003a80;
height: 70px;

}

#language, #navigation{
background-color: #a4c400;
float: right;
height: 50px;
line-height: 70px;
padding-left: 0;
padding-right: 2%;
text-align: right;
width: auto;
margin-top: 10px;
}
#logo{
min-width: 30px;
width:6%;
display: normal;
position: absolute;
}
/* Timeline */
.timeline,
.timeline-horizontal {
list-style: none;
padding: 20px;
position: relative;
}
.timeline:before {
top: 40px;
bottom: 0;
position: absolute;
content: " ";
width: 3px;
background-color: #eeeeee;
left: 50%;
margin-left: -1.5px;
}
.timeline .timeline-item {
margin-bottom: 20px;
position: relative;
}
.timeline .timeline-item:before,
.timeline .timeline-item:after {
content: "";
display: table;
}
.timeline .timeline-item:after {
clear: both;
}
.timeline .timeline-item .timeline-badge {
color: #fff;
width: 54px;
height: 54px;
line-height: 52px;
font-size: 22px;
text-align: center;
position: absolute;
top: 18px;
left: 50%;
margin-left: -25px;
background-color: #7c7c7c;
border: 3px solid #ffffff;
z-index: 100;
border-top-right-radius: 50%;
border-top-left-radius: 50%;
border-bottom-right-radius: 50%;
border-bottom-left-radius: 50%;
}
.timeline .timeline-item .timeline-badge i,
.timeline .timeline-item .timeline-badge .fa,
.timeline .timeline-item .timeline-badge .glyphicon {
top: 2px;
left: 0px;
}
.timeline .timeline-item .timeline-badge.primary {
background-color: #a4c400;
}
.timeline .timeline-item .timeline-badge.info {
background-color: #003a80;
}
.timeline .timeline-item .timeline-badge.success {
background-color: #59ba1f;
}
.timeline .timeline-item .timeline-badge.warning {
background-color: #d1bd10;
}
.timeline .timeline-item .timeline-badge.danger {
background-color: #ba1f1f;
}
.timeline .timeline-item .timeline-panel {
position: relative;
width: 10%;
float: left;
right: 16px;
border: 1px solid #c0c0c0;
background: #ffffff;
border-radius: 2px;
padding: 20px;
-webkit-box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.175);
}
.timeline .timeline-item .timeline-panel:before {
position: absolute;
top: 5px;
right: -16px;
display: inline-block;
border-top: 16px solid transparent;
border-left: 16px solid #c0c0c0;
border-right: 0 solid #c0c0c0;
border-bottom: 16px solid transparent;
content: " ";
}
.timeline .timeline-item .timeline-panel .timeline-title {
margin-top: 0;
color: inherit;
text-align: center;
}
.timeline .timeline-item .timeline-panel .timeline-body > p,
.timeline .timeline-item .timeline-panel .timeline-body > ul {
margin-bottom: 0;
}
.timeline .timeline-item .timeline-panel .timeline-body > p + p {
margin-top: 2px;
}
.timeline .timeline-item:last-child:nth-child(even) {
float: right;
}
.timeline .timeline-item:nth-child(even) .timeline-panel {
float: right;
left: 16px;
}
.timeline .timeline-item:nth-child(even) .timeline-panel:before {
border-left-width: 0;
border-right-width: 14px;
left: -14px;
right: auto;
}
.timeline-horizontal {
list-style: none;
position: relative;
padding: 20px 0px 20px 0px;
display: inline-block;
}
.timeline-horizontal:before {
height: 3px;
top: auto;
bottom: 26px;
left: 56px;
right: 0;
width: 100%;
margin-bottom: 20px;
}
.timeline-horizontal .timeline-item {
display: table-cell;
height: 170px;
width: 10%;
min-width: 320px;
float: none !important;
padding-left: 0px;
padding-right: 5px;
margin: 0 auto;
vertical-align: bottom;
}
.timeline-horizontal .timeline-item .timeline-panel {
top: auto;
bottom: 64px;
display: inline-block;
float: none !important;
left: 0 !important;
right: 0 !important;
width: 50%;
margin-bottom: 20px;
}
.timeline-horizontal .timeline-item .timeline-panel:before {
top: auto;
bottom: -16px;
left: 28px !important;
right: auto;
border-right: 16px solid transparent !important;
border-top: 16px solid #c0c0c0 !important;
border-bottom: 0 solid #c0c0c0 !important;
border-left: 16px solid transparent !important;
}
.timeline-horizontal .timeline-item:before,
.timeline-horizontal .timeline-item:after {
display: none;
}
.timeline-horizontal .timeline-item .timeline-badge {
top: auto;
bottom: 0px;
left: 43px;
}
14 changes: 11 additions & 3 deletions resource/js/docready.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
$(function() { // DOCUMENT READY

$(function() { // DOCUMENT READY

var spinner = '<div class="loading-spinner"><span class="spinner-text">'+ loading_text + '</span><span class="spinner" /></div>';
var searchString = ''; // stores the search field's value before autocomplete selection changes it
var selectedVocabs = [];
Expand Down Expand Up @@ -280,10 +281,17 @@ $(function() { // DOCUMENT READY
updateTitle(data);
updateTopbarLang(data);
makeCallbacks(data);
var uri = $('.uri-input-box').html();
getConceptVersions(uri,lang);
// take the content language buttons from the response
$('.header-float .dropdown-menu').empty().append($('.header-float .dropdown-menu', data).html());

}

});



return false;
}
);
Expand Down Expand Up @@ -361,9 +369,9 @@ $(function() { // DOCUMENT READY
return false;
}
var uri = $('.uri-input-box').html();
var base_href = $('base').attr('href'); // see #315, #633
var redirectUrl = base_href + vocab + '/' + lang + '/page/?uri=' + uri;
var redirectUrl = vocab + '/' + lang + '/page/?uri=' + uri;
window.location.replace(encodeURI(redirectUrl));

return false;
}
);
Expand Down
2 changes: 2 additions & 0 deletions resource/js/hierarchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ function getTreeConfiguration() {
nodeId = node.uri;
json_url = (rest_base_url + vocab + '/children');
}

$.ajax({
data: params,
url: json_url,
Expand All @@ -521,6 +522,7 @@ function getTreeConfiguration() {
}
}
});

}
}
});
Expand Down
Loading

0 comments on commit c24a834

Please sign in to comment.