yaz/commit
improve facet generation and layout
author | Michiel Hildebrand |
---|---|
Wed Feb 23 18:03:53 2011 +0100 | |
committer | Michiel Hildebrand |
Wed Feb 23 18:03:53 2011 +0100 | |
commit | 455759156d6ac8dd41088cbf21b3d826ba35997e |
tree | f514e5fb1e382dff2966fed001e0249eabcf02b1 |
parent | 4b9819eb05b6c32b11b4bda90af6e4b134f70808 |
Diff style: patch stat
diff --git a/applications/yaz_player.pl b/applications/yaz_player.pl index ea52718..6f02cea 100644 --- a/applications/yaz_player.pl +++ b/applications/yaz_player.pl @@ -60,39 +60,24 @@ http_yaz_player(Request) :- confirmed(Confirmed) ], delete_nonground(Options0, Options), - % processes - video_usage(Video, Process, User, Processes, Users), + findall(P, video_process(Video, P, User), Processes0), + findall(U, video_process(Video, Process, U), Users0), + sort(Processes0, Processes), + sort(Users0, Users), % annotations video_annotations(Video, Annotations0, Options), sort_by_arg(Annotations0, 2, Annotations1), list_limit(Annotations1, Limit, Annotations, _), html_page(Video, Processes, Users, Annotations, StartTime, Options). -%% video_processes(+Video, ?Process, ?User, -Processes) +%% video_process(+Video, -Process, -User) % -% Processes are all processes that used Video. - -video_usage(_Video, Process, User, [Process], [User]) :- - nonvar(Process), - nonvar(User), - !. -video_usage(Video, Process, User, Processes, Users) :- - findall(Process-User, - video_process(Video, Process, User), - Pairs), - pairs_keys(Pairs, Ps), - pairs_values(Pairs, Us), - sort(Ps, Processes), - sort(Us, Users). +% Process has used Video. video_process(Video, Process, User) :- rdf(Process, opmv:used, Video), rdf(Process, rdf:type, pprime:'Game'), - ( rdf_has(Process, opmv:wasControlledBy, _) - -> rdf_has(Process, opmv:wasControlledBy, User) - ; User = '' %hack - ). - + rdf_has(Process, opmv:wasControlledBy, User). %% html_page(+Video, +Processes, +Users, +Annotations, +StartTime, %% +Options) @@ -100,41 +85,65 @@ video_process(Video, Process, User) :- % Emit an HTML page with a video player and a tag carousel. html_page(Video, Processes, Users, Annotations, StartTime, Options) :- - http_link_to_id(http_yaz_player, [video(Video)|Options], Link), + option(process(Process), Options, -), + option(user(User), Options, -), + delete(Options, process(_), POptions), + delete(Options, user(_), UOptions), + http_link_to_id(http_yaz_player, [video(Video)|POptions], PLink), + http_link_to_id(http_yaz_player, [video(Video)|UOptions], ULink), reply_html_page(yaz, [ title(['YAZ - ', Video]) ], [ \html_requires(css('player.css')), \yaz_video_header(Video), + div(id(tagplayer), []), + div(id(videoplayer), []), div(class(facets), - [ div(class(processes), - \html_process_list(Processes, Link)), - div(class(users), - \html_user_list(Users, Link)) + [ \html_facet(games, \html_process_list(Processes, Process, PLink)), + \html_facet(users, \html_user_list(Users, User, ULink)) ]), - div(id(tagplayer), []), - div(id(videoplayer), []), script(type('text/javascript'), \html_video_page_yui(Video, Annotations, StartTime, Options)) ]). -html_process_list([], _) --> !. -html_process_list([Process|T], VideoPlayer) --> +html_facet(Title, Content) --> + html(div(class(facet), + [ h3(class('facet-title'), Title), + div(class('facet-content'), + Content) + ])). + +html_process_list([], _, _) --> !. +html_process_list([Process|T], Selected, VideoPlayer) --> { rdf(Process, opmv:wasStartedAt, L), literal_text(L, Time0), - display_time(Time0, Time) + display_time(Time0, Time), + ( Process == Selected + -> Class = selected, + Link = VideoPlayer + ; Class = item, + Link = VideoPlayer+'&process='+Process + ) }, - html(li(a(href(VideoPlayer+'&process='+Process), + html(li(class(Class), + a(href(Link), [Time]))), - html_process_list(T, VideoPlayer). - -html_user_list([], _) --> !. -html_user_list([User|T], VideoPlayer) --> - { rdf_display_label(User, Label) + html_process_list(T, Selected, VideoPlayer). + +html_user_list([], _, _) --> !. +html_user_list([User|T], Selected, VideoPlayer) --> + { rdf_display_label(User, Label), + ( User == Selected + -> Class = selected, + Link = VideoPlayer + ; Class = item, + Link = VideoPlayer+'&user='+User + ) }, - html(li(a(href(VideoPlayer+'&user='+User), + html(li(class(Class), + a(href(Link), [Label]))), - html_user_list(T, VideoPlayer). + html_user_list(T, Selected, VideoPlayer). diff --git a/components/yaz_page.pl b/components/yaz_page.pl index e0dae9f..df97b26 100644 --- a/components/yaz_page.pl +++ b/components/yaz_page.pl @@ -49,6 +49,11 @@ yaz_search_page(Body) --> :- set_setting_default(search:pattern_literal, false). :- set_setting_default(search:pattern_resource, false). +cliopatria:facet_weight(P, 0) :- rdf_equal(pprime:description,P), !. +cliopatria:facet_weight(P, 0) :- rdf_equal(pprime:duration,P), !. +cliopatria:facet_weight(P, 0) :- rdf_equal(pprime:source,P), !. + + cliopatria:search_pattern(Label, Target, [ rdf(Tag, PL, literal(Value)), rdf(TN, PN, Tag), @@ -114,7 +119,8 @@ html_search --> \isearch_field(Query, Class))). html_navigation --> - html([li(a(href(location_by_id(http_yaz_game)), game)) + html([li(a(href(location_by_id(http_yaz_video_stats)), statistics)), + li(a(href(location_by_id(http_yaz_game)), game)) %li(a(href(location_by_id(http_yaz_annotate)), annotate)) ]). diff --git a/lib/import_waisda.pl b/lib/import_waisda.pl index 9fb6212..2608a64 100644 --- a/lib/import_waisda.pl +++ b/lib/import_waisda.pl @@ -87,6 +87,7 @@ assert_videos([T|Ts]) :- rdf_assert(URL, pprime:provider, literal(Provider), waisda), rdf_assert(URL, pprime:description, literal(lang(nl, Desc)), waisda), rdf_assert(URL, pprime:category, CatURL, waisda), + rdf_assert(CatURL, rdfs:label, Cat, waisda), assert_videos(Ts). diff --git a/web/css/player.css b/web/css/player.css index 8700cff..acde85c 100644 --- a/web/css/player.css +++ b/web/css/player.css @@ -33,7 +33,7 @@ /* tag player */ #videoplayer { float: left; - margin-left: 20px; + margin: 0 10px; } #tagplayer { float: left; @@ -233,17 +233,33 @@ ul.game-players { /* facets */ .facets { overflow: hidden; - border: 1px solid #CCC; margin-bottom: 10px; } -.processes, -.users { - float: left; - margin-right: 15px; - height: 100px; - overflow-y: scroll; - width: 200px; +.facet { + font-size: 0.9em; + margin-bottom: 10px; + width: 100%; +} +.facet h3 { + border-bottom: 1px solid #CCCCCC; + font-size: 1em; + margin: 0; + padding: 1px 0 1px 4px; } -.facets li { +.facet-content { + max-height: 100px; + overflow-y: auto; +} +.facet li { list-style: none; + padding: 2px 4px; +} +.facet li a { + color: #222; +} +.facet li.selected { + background-color: #0033CC; +} +.facet li.selected a { + color: white; } \ No newline at end of file diff --git a/web/css/yaz.css b/web/css/yaz.css index 5c1cbe0..05f39f1 100644 --- a/web/css/yaz.css +++ b/web/css/yaz.css @@ -197,6 +197,7 @@ a img { max-height: 3.15em; overflow: hidden; color: #666; + margin-bottom: 10px; } /* tags */