yaz/commit

result layout and get frame time

authorMichiel Hildebrand
Mon Jan 31 16:55:54 2011 +0100
committerMichiel Hildebrand
Mon Jan 31 16:55:54 2011 +0100
commit1743746f848020b0dfb10ea4d4cd180155d32b33
tree7410911148c834786e07a55c42e660177ff0776e
parentcf83581c0a120240f77e268ca0734ecc793d15eb
Diff style: patch stat
diff --git a/applications/yaz_user.pl b/applications/yaz_user.pl
index dd0eddc..5daf223 100644
--- a/applications/yaz_user.pl
+++ b/applications/yaz_user.pl
@@ -153,7 +153,7 @@ html_video_stream(Videos, Options) -->
 		   h2(a(href(Link), \video_stream_header(Options)))),
 	       div(class(body),
 		   ul(class('thumb-list'),
-		      \html_video_list(Videos, Options)))
+		      \html_video_list(Videos, [desc(false)|Options])))
 	     ]).
 
 video_stream_header(Options) -->
diff --git a/applications/yaz_videos.pl b/applications/yaz_videos.pl
index 6b71c72..01cd05a 100644
--- a/applications/yaz_videos.pl
+++ b/applications/yaz_videos.pl
@@ -98,7 +98,7 @@ html_videos_page(Results, NumberOfResults, Offset, Limit, Options) :-
 				    h2(\message(NumberOfResults, Options))),
 				div(class(body),
 				    ul(class('thumb-list'),
-				       \html_video_list(Results, Options))),
+				       \html_video_list(Results, [desc(true)|Options]))),
 				div(class(footer),
 					div(class(paginator),
 					    \html_paginator(NumberOfResults, Offset, Limit)
@@ -136,18 +136,29 @@ html_video_item(URL, Processes, Options) -->
 	{ display_label(URL, Title),
 	  video_source(URL, Video),
 	  truncate_atom(Title, 47, ShortTitle),
-	  http_link_to_id(http_yaz_player, [video(URL)|Options], Link),
-	  http_link_to_id(serve_video_frame, [url(Video),time(5)], Frame)
+	  (   option(desc(true), Options)
+	  ->  video_desc(URL, Description)
+	  ;   Description = ''
+	  ),
+	  option(frame(Frame), Options, 5),
+	  delete(Options, desc(_), Options1),
+	  http_link_to_id(http_yaz_player, [video(URL)|Options1], Link),
+	  http_link_to_id(serve_video_frame, [url(Video),time(Frame)], FrameURL)
  	},
 	html(div(class('item-content'),
-		 [ a(href(Link),
-		     div(class('thumb-container'),
-			 img([width('140px'), alt('no image available'), title(Title), src(Frame)], []))),
-		   a([href(Link), title(Title)],
-		     ShortTitle),
-		   div(class('processes'),
-		       \html_process_list(Processes, Video, Link))
-		 ])).
+		[ a(href(Link),
+		    [ div(class('thumb-container'),
+			  img([width('140px'), alt('no image available'),
+			       title(Title), src(FrameURL)], [])),
+		      div(class('title'),
+			  a([href(Link),title(Title)],
+			    ShortTitle)),
+		      div([class('description'), title(Description)],
+			  Description)
+		   ]),
+		  div(class('processes'),
+		      \html_process_list(Processes, Video, Link))
+		])).
 
 %%	html_process_list(+Processes, +Video, +Link)//
 %
diff --git a/components/yaz_page.pl b/components/yaz_page.pl
index 2e85b13..75f8231 100644
--- a/components/yaz_page.pl
+++ b/components/yaz_page.pl
@@ -60,13 +60,25 @@ cliopatria:search_pattern(Label, Target,
 	rdf(TN, PN, Tag),
 	rdf(Target, P, TN).
 
-cliopatria:format_search_result(R) -->
+cliopatria:format_search_result(R, Graph) -->
+	{ result_frame(R, Graph, Frame)
+	},
 	html(div(class('result-item'),
-		 \html_video_item(R, [], []))).
+		 \html_video_item(R, [], [desc(true), frame(Frame)]))).
 
 cliopatria:facet_weight(P, 0) :-
 	rdf_equal(pprime:hasAnnotation, P).
 
+result_frame(R, Graph, Frame) :-
+	rdf_equal(pprime:hasAnnotation, P),
+	memberchk(rdf(R,P,Entry), Graph),
+	rdf(Entry, pprime:videoPlayhead, literal(F)),
+	(   rdf(Entry, pprime:typingDuration, literal(Duration))
+	->  Frame is (F-Duration)/1000
+	;   Frame is F/1000
+	).
+result_frame(_, _, 5).
+
 
 %%	html_page_header//
 %
diff --git a/lib/yaz_util.pl b/lib/yaz_util.pl
index 1c5a24f..dde4e59 100644
--- a/lib/yaz_util.pl
+++ b/lib/yaz_util.pl
@@ -18,7 +18,8 @@
 	    delete_nonground/2,
 	    video_source/2,
 	    video_source/3,
-	    annotation_to_json/2
+	    annotation_to_json/2,
+	    video_desc/2
 	  ]).
 
 :- use_module(library(semweb/rdf_db)).
@@ -336,3 +337,8 @@ http:convert_parameter(jsonresource, Atom, Term) :-
 
 
 
+video_desc(VideoURL, Desc) :-
+	rdf_has(VideoURL, pprime:description, Lit),
+	literal_text(Lit, Desc),
+	!.
+video_desc(_, '').
diff --git a/web/css/yaz.css b/web/css/yaz.css
index 3449350..e6d8c27 100644
--- a/web/css/yaz.css
+++ b/web/css/yaz.css
@@ -83,10 +83,6 @@ body {
 	text-align: left;
 }
 
-.search #left {
-
-}
-
 .search #results {
 	width: 540px;
 }
@@ -141,16 +137,40 @@ a img {
 	border-color: #CCC;
 }
 
-.thumb-container {
-	margin-bottom:5px;
-	min-height:90px;
+.item-content {
+	padding: 5px;
+	overflow: auto;
+}
+.item-content:hover {
+	cursor: pointer;
+	background-color: #D1E1FA;
 }
-.thumb-container img {
+.item-content .thumb-container {
+	margin-right: 10px;
+	min-height: 3em;
+	width: 140px;
+	float: left;
 	-moz-border-radius: 3px;
 	border-radius: 3px;
 	border: 1px solid #DDD;
 	overflow: hidden;
 	padding: 4px;	
+	font-size: 0.8em;
+	text-align: center;
+}
+.item-content .thumb-container img {
+}
+.item-content .title {
+	font-size: 1.05em;
+	line-height: 1.4em;
+    overflow: hidden;
+}
+.item-content .description {
+	font-size: 0.95em;
+	line-height: 1.05em;
+	max-height: 3.15em;
+    overflow: hidden;
+	color: #666;
 }
 
 h4 {