image_annotation/commit

allow switching styles for object-based and fragment-based annotation

authorJacco van Ossenbruggen
Wed May 7 10:57:11 2014 +0200
committerJacco van Ossenbruggen
Wed May 7 10:57:27 2014 +0200
commit8ba3139e9818e2da0e54706073dc00b4a10ac908
treee89e89623aaa4cee9370cf58879e1af48c6b2ed6
parent6e4dde78e1321b8621120155e4cd7486b2085c6b
Diff style: patch stat
diff --git a/applications/annotation.pl b/applications/annotation.pl
index 9f3a149..d128a34 100644
--- a/applications/annotation.pl
+++ b/applications/annotation.pl
@@ -80,11 +80,21 @@
 :- html_resource('http://localhost:9810/compile?id=annotorious',
 		 [ mime_type(text/javascript) ]).
 
-:- html_resource(annotorious,
+
+:- html_resource(object_annotation,
+		 [ virtual(true),
+		   ordered(true),
+		   requires(
+		       [ css('object-annotation.css')
+		       ])
+		 ]).
+
+:- html_resource(fragment_annotation,
 	      [ virtual(true),
 		ordered(true),
 		requires([
 		    'http://annotorious.github.com/latest/annotorious.css',
+		    css('fragment-annotation.css'),
 		    % 'http://localhost:9810/compile?id=annotorious',
 		    'http://annotorious.github.com/latest/annotorious.min.js',
 		    js('deniche-plugin.js')
@@ -212,9 +222,9 @@ annotation_page(Options) :-
 	reply_html_page(
 	    [ \annotation_page_header(Options) ],
 	    [ \html_requires(yui3('cssgrids/grids-min.css')),
-	      \html_requires(css('annotation.css')),
+	      \html_requires(css('common-annotation.css')),
 	      \conditional_html_requires(style, Options),
-	      \conditional_html_requires(annotorious, Options),
+	      \conditional_html_requires(fragment_annotation, Options),
 	      div(class('yui3-skin-sam yui-skin-sam'),
 		  [ div(id(hd), []),
 		    div(id(bd),
@@ -380,6 +390,13 @@ get_label(UI, Field, LabelProp, LabelOption) :-
 	rdf_global_id(_NS:LabelName, LabelProp),
 	LabelOption =.. [LabelName, LabelText].
 
+fragments_enabled(Options) :-
+	setting(enableFragments, Default),
+	option(ui(UI), Options),
+	(   rdf(UI, ann_ui:enableFragments, literal(type(xsd:boolean, Enable)))
+	->  Enable = true
+	;   Default = true
+	).
 
 conditional_html_requires(style, Options) -->
 	{ option(stylesheet(Stylesheet), Options),
@@ -388,19 +405,17 @@ conditional_html_requires(style, Options) -->
 	},
 	html_requires(Stylesheet).
 
-conditional_html_requires(annotorious, Options) -->
-	{ setting(enableFragments, Default),
-	  option(ui(UI), Options),
-	  (   rdf(UI, ann_ui:enableFragments, literal(type(xsd:boolean, Enable)))
-	  ->  Enable = true
-	  ;   Default = true
-	  )
+conditional_html_requires(fragment_annotation, Options) -->
+	{ fragments_enabled(Options), !
+	},
+	html_requires(fragment_annotation).
+conditional_html_requires(fragment_annotation, Options) -->
+	{ \+ fragments_enabled(Options), !
 	},
-	html_requires(annotorious).
+	html_requires(object_annotation).
 
 conditional_html_requires(_,_) --> !.
 
-
 %%	js_annotation_fields(+FieldURIs, +AnnotationTarget)
 %
 %	Write JavaScript to init chain of annotation fields
diff --git a/web/css/common-annotation.css b/web/css/common-annotation.css
new file mode 100644
index 0000000..310edc0
--- /dev/null
+++ b/web/css/common-annotation.css
@@ -0,0 +1,25 @@
+/*
+Style rules we need in both object and fragment modes.
+*/
+
+.yui3-overlay {
+	padding: 10px;
+	background-color: white;
+	border: solid gray 1pt;
+	position: absolute;
+	width: 400px;
+	z-index: 1;
+}
+
+.yui3-overlay .altLabel {
+	color: gray;
+	font-size: 0.8em;
+	padding-right: 0.5em;
+}
+.yui3-overlay .altLabel:after {
+	content: ";"
+}
+
+.yui3-overlay img.depiction {
+    max-width: 100%;
+}
\ No newline at end of file
diff --git a/web/css/annotation.css b/web/css/fragment-annotation.css
similarity index 63%
rename from web/css/annotation.css
rename to web/css/fragment-annotation.css
index 7cc5426..9205c66 100644
--- a/web/css/annotation.css
+++ b/web/css/fragment-annotation.css
@@ -1,13 +1,5 @@
 @import "deniche-tags.css";
 
-.yui3-overlay {
-  padding: 10px;
-  background-color: white;
-  border: solid gray 1pt;
-  position: absolute;
-  width: 200px;
-}
-
 #media img {
   max-width: 100%;
 }
diff --git a/web/css/annotation-old.css b/web/css/object-annotation.css
similarity index 95%
rename from web/css/annotation-old.css
rename to web/css/object-annotation.css
index 90e4015..de2b2aa 100644
--- a/web/css/annotation-old.css
+++ b/web/css/object-annotation.css
@@ -315,22 +315,4 @@ body {
 /* resource */
 .resource h3 {
 	margin: 0 0 6px;
-}
-
-.yui3-overlay {
-	padding: 10px;
-	background-color: white;
-	border: solid gray 1pt;
-	position: absolute;
-	width: 200px;
-	z-index: 1;
-}
-
-.yui3-overlay .altLabel {
-	color: gray;
-	font-size: 0.8em;
-	padding-right: 0.5em;
-}
-.yui3-overlay .altLabel:after {
-	content: ";"
-}
+}
\ No newline at end of file
diff --git a/web/css/x b/web/css/x
deleted file mode 100644
index be36c72..0000000
--- a/web/css/x
+++ /dev/null
@@ -1 +0,0 @@
-http://localhost:3020/annotate?target=http://purl.org/collections/nl/rma/collection/r-161695&ui=http://semanticweb.cs.vu.nl/annotate/nicheAccuratorCastleDemoUi