From 5257413bcbb3adf165d78eb9e4b2a497ab8bb087 Mon Sep 17 00:00:00 2001
From: root <root@hindustan.uib.no>
Date: Tue, 19 Nov 2013 17:55:22 +0100
Subject: [PATCH] Better prev-next links on Collection. Some changes to static
 pages. Better handling of searches on index.'

---
 classes/modules/typeModule.php                |  8 +++--
 components/includes/footer.inc                | 19 +++++++++--
 components/includes/header.inc                |  6 ++--
 .../instance%2Fcollection/html.template       | 29 ++++++++++------
 components/services/search/html.template      | 24 +++++++++++--
 components/static/index.html                  | 34 +++++++++----------
 components/static/technology.html             | 14 +++++---
 components/types/bibo__Document/html.template | 24 +++++++------
 .../bibo__Document/queries/collections.query  |  3 +-
 .../types/bibo__Document/queries/main.query   |  9 +++--
 10 files changed, 114 insertions(+), 56 deletions(-)

diff --git a/classes/modules/typeModule.php b/classes/modules/typeModule.php
index eff9d4fb..7acc5997 100755
--- a/classes/modules/typeModule.php
+++ b/classes/modules/typeModule.php
@@ -121,9 +121,11 @@ class TypeModule extends abstractModule{
   	//Defining default views and models
   	$curieType="";
  	//Get the firstResults type available
-  	$typesAndValues = array('rdfs:Resource' => -1);
-  	$typesAndValues = array('rdfs__Resource' => -1);
-  	if(!isset($conf['disableComponents']) || $conf['disableComponents'] != true){
+  	//$typesAndValues = array('rdfs:Resource' => -1);
+  	//$typesAndValues = array('rdfs__Resource' => -1);
+  	$typesAndValues = array('bibo:Document' => -1);
+	$typesAndValues = array('bibo__Document' => -1);
+	if(!isset($conf['disableComponents']) || $conf['disableComponents'] != true){
   	  foreach($t as $v){
   	  	$curie = Utils::uri2curie($v);
   	  	$typesAndValues[$curie] = 0;
diff --git a/components/includes/footer.inc b/components/includes/footer.inc
index 64826f9f..a050fb3c 100755
--- a/components/includes/footer.inc
+++ b/components/includes/footer.inc
@@ -18,7 +18,7 @@
 				<h3>Om Marcus</h3>
 				<ul class="nav">
 					<!-- <li><a href="#">Om nettsiden</a></li> -->
-					<li><a href="http://marcus.uib.no/rights.html"><span class="glyphicon glyphicon-copyright-mark"></span> Rettigheter</a></li> 
+					<!-- <li><a href="http://marcus.uib.no/rights.html"><span class="glyphicon glyphicon-copyright-mark"></span> Rettigheter</a></li>  -->
 					<li><a href="http://marcus.uib.no/technology.html"><span class="glyphicon glyphicon-cog"></span> Teknologi</a></li>
 				</ul>
 				
@@ -128,4 +128,19 @@ cartColumns: [
 });
     </script>
     <script src="{{lodspk.home}}js/holder.js"></script>
-    
\ No newline at end of file
+    
+    <!-- Piwik -->
+	<script type="text/javascript">
+	  var _paq = _paq || [];
+	  _paq.push(["trackPageView"]);
+	  _paq.push(["enableLinkTracking"]);
+	
+	  (function() {
+	    var u=(("https:" == document.location.protocol) ? "https" : "http") + "://stats.uib.no/";
+	    _paq.push(["setTrackerUrl", u+"piwik.php"]);
+	    _paq.push(["setSiteId", "23"]);
+	    var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
+	    g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
+	  })();
+	</script>
+	<!-- End Piwik Code -->
\ No newline at end of file
diff --git a/components/includes/header.inc b/components/includes/header.inc
index 226832fc..3fbec40a 100755
--- a/components/includes/header.inc
+++ b/components/includes/header.inc
@@ -118,12 +118,12 @@
             </form>
 			
 			<div id="popover-beta-head" style="display: none;">
-				<strong>Beta?</strong>
+				<strong>Marcus - Beta</strong>
 			</div>
 			<div id="popover-beta-content" style="display: none;">
-				<p>Beta beta beta beta... Ja, det må mye testing til før man har noe som virkelig er bra. 
+				<p>Marcus har fått en grundig overhaling og nettsidene kan ha noen feil. Vi jobber daglig med å gjøre sidene bedre.</p> 
 			</div>
-			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta"><span class="glyphicon glyphicon-warning-sign"></span> Beta</p> 
+			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta">Beta</p> 
 			<script>
 				$('.beta').popover({ 
 					placement : 'bottom',
diff --git a/components/services/instance%2Fcollection/html.template b/components/services/instance%2Fcollection/html.template
index 2c583421..dd8f1ef7 100755
--- a/components/services/instance%2Fcollection/html.template
+++ b/components/services/instance%2Fcollection/html.template
@@ -57,17 +57,26 @@
 	    var offset = 100;
 	    var nextPage = page+offset;
 		var prevPage = page - offset;
-		var next_uri = '{{lodskp.home}}'+'{{lodspk.args.arg0}}'+'/' + nextPage;
-	    var prev_uri = '{{lodskp.home}}'+'{{lodspk.args.arg0}}'+'/' + prevPage;
+		var next_uri = 'http://marcus.uib.no/instance/collection/'+'{{lodspk.args.arg0}}'+'/' + nextPage;
+	    var prev_uri = 'http://marcus.uib.no/instance/collection/'+'{{lodspk.args.arg0}}'+'/' + prevPage;
+		
+		document.write('<ul class="pager">');
+			if (prevPage == 0){
+				document.write('<li><a href="http://marcus.uib.no/instance/collection/{{lodspk.args.arg0}}" id="prev">Forrige 100</a></li>');
+			}		
+			else if ("{{lodspk.args.arg1}}".length > 1 && !("{{lodspk.args.arg1}}".length === 0)){
+				document.write('<li><a href="" id="prev">Forrige 100</a></li>');
+				$("#prev").attr("href",prev_uri);
+			};
+	
+			if ({{first.count.total.value}} > nextPage){
+				document.write('<li><a href="" id="next">Neste 100</a></li>');
+				$("#next").attr("href",next_uri);
+			};
+		document.write('</ul>');
+		
 		</script>
-	    <ul class="pager">
-	    	<li><a href="" id="prev">Forrige 100</a></li>
-			<li><a href="" id="next">Neste 100</a></li>
-	    </ul>
-		<script>
-		$("#next").attr("href",next_uri);
-		$("#prev").attr("href",prev_uri);
-	</script>
+
 	{% endif %}
         
         </div></div></div>
diff --git a/components/services/search/html.template b/components/services/search/html.template
index 51e9a1d8..88eb1bc1 100755
--- a/components/services/search/html.template
+++ b/components/services/search/html.template
@@ -1,13 +1,33 @@
 {%include "../../includes/header.inc"%}
-    <div class="container">
+    <div class="container main-body">
+    	
+    	<div class="row">
+    	
+    	</div>
+    	
+    	<div class="row">
+			<div class="col-md-3">
+			<div class="bs-sidebar hidden-xs hidden-sm affix">
+				
+				<div class="browse-sidebar">
+					<h4>Bla i:</h4>
+					<ul class="nav">
+						{% include "../../includes/nav.inc" %}
+					</ul>
+				</div>	
+				</div> <!-- End Sidebar -->
+			</div>
+			
+	<div class="col-md-9">
       <h1>Treff på  "{{lodspk.args.arg0}}"</h1>
-        <ul>
+        <ul class="nav">
     {% for row in models.main %}
         <li><a href="{{ row.resource.value }}">{{row.label.curie}}</a></li>
     {% endfor %}
     </ul>
    </div>
    
+   </div></div>
    {%include "../../includes/footer.inc"%}
 
   </body>
diff --git a/components/static/index.html b/components/static/index.html
index 521250fe..d0d108e0 100755
--- a/components/static/index.html
+++ b/components/static/index.html
@@ -65,20 +65,20 @@
     <script type="text/javascript" src="{{lodspk.home}}js/bootstrap-typeahead.js"></script>
     <script type="text/javascript">
     $(document).ready(function(){
-        $('.typeahead').typeahead({
-            minLength: 4,
-            source: function (typeahead, query) {
-              $('.typeahead').addClass('wait');[]
-              return $.get('http://marcus.uib.no/search/'+encodeURIComponent(query), { }, function (data) {
-                  $('.typeahead').removeClass('wait');[]
-                  return typeahead.process(data);
-              }, 'json');
-            },
-            onselect: function (obj) {
-              $('.typeahead').attr('disabled', true);
-              window.location = obj.uri;
-            }
-        });
+    //    $('.typeahead').typeahead({
+    //        minLength: 4,
+    //        source: function (typeahead, query) {
+    //          $('.typeahead').addClass('wait');[]
+    //          return $.get('http://marcus.uib.no/search/'+encodeURIComponent(query), { }, function (data) {
+    //              $('.typeahead').removeClass('wait');[]
+    //              return typeahead.process(data);
+    //          }, 'json');
+    //        },
+    //        onselect: function (obj) {
+    //          $('.typeahead').attr('disabled', false);
+    //          window.location = obj.uri;
+    //        }
+    //    });
         $("input").on('keyup', function(){$("form").attr("action", 'search/'+$(this).val())});
     });
     </script>
@@ -130,12 +130,12 @@
             </script>
 
             <div id="popover-beta-head" style="display: none;">
-				<strong>Beta?</strong>
+				<strong>Marcus - Beta</strong>
 			</div>
 			<div id="popover-beta-content" style="display: none;">
-				<p>Beta beta beta beta... Ja, det må mye testing til før man har noe som virkelig er bra. 
+				<p>Marcus har fått en grundig overhaling og nettsidene kan ha noen feil. Vi jobber daglig med å gjøre sidene bedre.</p> 
 			</div>
-			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta"><span class="glyphicon glyphicon-warning-sign"></span> Beta</p> 
+			<p rel="popover" class="navbar-text pull-right hidden-xs hidden-sm beta">Beta</p> 
 			<script>
 				$('.beta').popover({ 
 					placement : 'bottom',
diff --git a/components/static/technology.html b/components/static/technology.html
index bb910ba2..fb0be1a1 100755
--- a/components/static/technology.html
+++ b/components/static/technology.html
@@ -204,12 +204,15 @@
         		<ul>
         			<li><a href="http://protege.stanford.edu/">Protégé</a></li>
         		</ul>
-        		<p>Google Spreadsheet bruker vi til å registrere enkelt dokument i ulike samlinger og sammenhenger. Disse regnearkene konverteres til Linked Data med OpenRefine eller med XSLT-stilark. For bruk 
-        		<p>Andre aktuelle løsninger</p>
+        		<p>Google Spreadsheet bruker vi til å registrere enkelt dokument i ulike samlinger og sammenhenger. Disse regnearkene konverteres til Linked Data med OpenRefine eller med XSLT-stilark.
+        		<!--
+<p>Andre aktuelle løsninger</p>
         		<ul>
         			<li>Topbraid Composer</li>
         		</ul>
+-->
         		
+<!--
         		<h3>Lagring av data og filer</h3>
         		<h4>Fuseki</h4>
         		<ul>
@@ -217,6 +220,7 @@
         		</ul>
         		
         		<h4>Filer</h4>
+-->
         		
         		<h3>Visualisering</h3>
         		<p>Vi har testet ulike system for å lage nettsider på vår Linked Data. <a href="https://drupal.org/">Drupal</a> var tidlig en kandidat, men det føltes tungvint og lite fleksibelt. <a href="https://github.com/csarven/linked-data-pages">Linked Data Pages</a> var en tidlig utfordrer sammen med <a href="http://graphite.ecs.soton.ac.uk/">Graphite</a>. Etter litt testing gikk vi videre med LODSpeakr. LODSpeakr har vist seg å være et enkelt system å lage tilpassede visninger på våre materialtyper.</p>
@@ -224,16 +228,18 @@
         			<li><a href="http://lodspeakr.org/">LODspeakr</a></li>
         		</ul>
             	
-            	<h2>Ontologi</h2>
+            	<!--
+<h2>Ontologi</h2>
             	<p><a href="http://marcus.uib.no/files/ontology/ubbont.owl">ubbont</a></p>
             	<ul>
             		<li><strong>55</strong>: klasser</li>
             		<li><strong>86</strong>: datatype-egenskaper</li>
             		<li><strong>71</strong>: objekt-egenskaper</li>
             	</ul>
+-->
             	
             	<h2>Takk til</h2>
-            	<p>En stor takk til alle som har hjulpet oss med prosjektene!</p>
+            	<p>En stor takk til NTNU, Bergen offentlige bibliotek, Robert Engels og alle som har hjulpet oss med prosjektene! Prosjektene er støttet av Nasjonalbiblioteket.</p>
             </div>
 			
 			<div class="col-lg-3 pull-right well">
diff --git a/components/types/bibo__Document/html.template b/components/types/bibo__Document/html.template
index 1f1db1b4..9ef9830e 100755
--- a/components/types/bibo__Document/html.template
+++ b/components/types/bibo__Document/html.template
@@ -1,5 +1,10 @@
 {% include "../../includes/header.inc" %}
     <div class="container main-body">
+    	
+    	<div class="row">
+    	
+    	</div>
+    	
     	<div class="row">
 			<div class="col-md-3">
 			<div class="bs-sidebar hidden-xs hidden-sm affix">
@@ -15,7 +20,7 @@
 					{% if first.depicted.depicts.value != null %}
 						<li><a href="#places"><span class="glyphicon glyphicon-user"></span> Personer</a></li>
 					{% endif %} 
-					{% if first.places.long.value != null %}
+					{% if models.places|length != 0 %}
 						<li><a href="#places"><span class="glyphicon glyphicon-map-marker"></span> Steder</a></li>
 					{% endif %} 
 					<li><a href="#disqus_thread"><span class="glyphicon glyphicon-bullhorn"></span> Kommentarer</a></li>
@@ -34,9 +39,9 @@
 				</div> <!-- End Sidebar -->
 			</div>
 			
-	<div class="col-md-9" typeof="bibo:Document">
+	<div class="col-md-9">
     {% for row in models.main %}
-	    <h1 property="rdfs:label">{{ row.title.value }}</h1>
+	    <h1>{{ row.title.value }} - {{ row.classLabel.value }}</h1>
     {% endfor %}
         
 	{% if models.dzi|length != 0 %}
@@ -56,8 +61,6 @@
 			</div> -->
 		</div>
 	</div> 
-
-
 	 
     <script type="text/javascript" src="{{lodspk.home}}files/js/openseadragon/openseadragon.js"></script>
 	<script type="text/javascript" src="{{lodspk.home}}files/js/ubbdstjfl/ubbdst.js"></script>
@@ -103,11 +106,12 @@
         });
     </script>	
     {% endif %}
-{% if models.pdf|length != 0 %}
-{% for row in models.pdf %}
-<p><a href="{{row.uri.value }}">Last ned PDF</a></p>
-{% endfor %}
-{% endif %}
+
+	{% if models.pdf|length != 0 %}
+	{% for row in models.pdf %}
+	<p><a href="{{row.uri.value }}">Last ned PDF</a></p>
+	{% endfor %}
+	{% endif %}
 <!--     <p>Signatur: <a href="{{lodspk.this.value}}">{{ first.main.identifier.value }}</a></p> -->
     
     {% if first.maker.maker.value != null %}
diff --git a/components/types/bibo__Document/queries/collections.query b/components/types/bibo__Document/queries/collections.query
index 75da29cc..66d0bdce 100755
--- a/components/types/bibo__Document/queries/collections.query
+++ b/components/types/bibo__Document/queries/collections.query
@@ -1,6 +1,5 @@
 SELECT DISTINCT ?collection ?collectionName WHERE {
-
-	OPTIONAL { <{{ uri }}> dct:isPartOf ?collection . }
+	<{{ uri }}> dct:isPartOf ?collection . 
 	OPTIONAL { ?collection dct:title ?collectionName . }
 	OPTIONAL { ?collection rdfs:label ?collectionName .}
 	
diff --git a/components/types/bibo__Document/queries/main.query b/components/types/bibo__Document/queries/main.query
index f799c8a2..834211aa 100755
--- a/components/types/bibo__Document/queries/main.query
+++ b/components/types/bibo__Document/queries/main.query
@@ -1,6 +1,9 @@
-SELECT DISTINCT ?title ?created ?date ?available ?identifier WHERE {
-
-    <{{ uri }}> rdfs:label|dct:title ?title .
+SELECT DISTINCT ?title ?created ?date ?available ?identifier ?classLabel WHERE {
+    <{{ uri }}> rdf:type ?class .
+	?class rdfs:label ?classLabel .
+	FILTER(langMatches(lang(?classLabel), ""))
+    OPTIONAL { <{{ uri }}> rdfs:label ?title . }
+    OPTIONAL { <{{ uri }}> dct:title ?title . }
     OPTIONAL { <{{ uri }}> dct:identifier ?identifier . }
     OPTIONAL { <{{ uri }}> dct:created ?created .}
     OPTIONAL { <{{ uri }}> dct:date ?date .}
-- 
GitLab