yaz/commit
use search for display of tag results
author | Michiel Hildebrand |
---|---|
Mon Jan 31 15:45:30 2011 +0100 | |
committer | Michiel Hildebrand |
Mon Jan 31 15:45:30 2011 +0100 | |
commit | cf83581c0a120240f77e268ca0734ecc793d15eb |
tree | 945df1c30a98cb2432d8149b8a1e83d380c60e93 |
parent | 681b7a7cd6b219e6b590cc36a2df4fbaa42eb131 |
Diff style: patch stat
diff --git a/applications/yaz_tags.pl b/applications/yaz_tags.pl index fc15243..9351a83 100644 --- a/applications/yaz_tags.pl +++ b/applications/yaz_tags.pl @@ -85,8 +85,8 @@ tag_count(N) --> html_tag_list([], _) --> !. html_tag_list([Count-Tag|T], Options) --> - { tag_term_label(Tag, Term, Label), - http_link_to_id(http_yaz_videos, [tag(Term)|Options], Link) + { tag_term_label(Tag, _Term, Label), + http_link_to_id(isearch_page, [q(Label)|Options], Link) }, html(li([a(href(Link), Label), ' (', Count, ')'])), html_tag_list(T, Options). diff --git a/applications/yaz_user.pl b/applications/yaz_user.pl index 5e1723a..dd0eddc 100644 --- a/applications/yaz_user.pl +++ b/applications/yaz_user.pl @@ -196,8 +196,8 @@ html_tag_cloud(Tags, Options) --> html_tag_cloud(TagTerms, Min, Max, Options). html_tag_cloud([], _, _, _) --> !. -html_tag_cloud([tag(Term, Label, Count)|T], Min, Max, Options) --> - { http_link_to_id(http_yaz_videos, [tag(Term)|Options], Link), +html_tag_cloud([tag(_Term, Label, Count)|T], Min, Max, Options) --> + { http_link_to_id(isearch_page, [q(Label)|Options], Link), Size0 is (log((20*max((Count-Min),1)) / max((Max-Min),5))) * 10, Size is max(10, Size0) }, diff --git a/applications/yaz_videos.pl b/applications/yaz_videos.pl index 3a82034..6b71c72 100644 --- a/applications/yaz_videos.pl +++ b/applications/yaz_videos.pl @@ -38,12 +38,9 @@ http_yaz_videos(Request) :- limit(Limit, [default(20), integer, description('Limit on the number of results')]) ]), - user_video_processes(User, Tag, Pairs0), - keysort(Pairs0, Pairs), - group_pairs_by_key(Pairs, Groups), - length(Groups, NumberOfResults), - SortedVideos = Groups, - list_offset(SortedVideos, Offset, OffsetResults), + user_video_processes(User, Tag, Processes), + length(Processes, NumberOfResults), + list_offset(Processes, Offset, OffsetResults), list_limit(OffsetResults, Limit, LimitResults, _), delete_nonground([user(User), tag(Tag)], Options), html_videos_page(LimitResults, NumberOfResults, Offset, Limit, Options). @@ -61,16 +58,22 @@ http_yaz_videos(Request) :- % When defined Videos are limit to those annotated with Value. -user_video_processes(User, Value, Pairs) :- +user_video_processes(User, Value, Processes) :- nonvar(Value), !, - findall(Video-process(Process, Time, Annotations), + findall(Time-(Video-[process(Process, Time, Annotations)]), annotation_value_process(User, Video, Value, Process, Time, Annotations), - Pairs). -user_video_processes(User, _Value, Pairs) :- - findall(Video-process(Process, Time, []), + Pairs0), + keysort(Pairs0, Pairs1), + reverse(Pairs1, Pairs), + pairs_values(Pairs, Processes). +user_video_processes(User, _Value, Processes) :- + findall(Time-(Video-[process(Process, Time, [])]), annotation_process(User, Video, Process, Time), - Pairs). + Pairs0), + keysort(Pairs0, Pairs1), + reverse(Pairs1, Pairs), + pairs_values(Pairs, Processes). annotation_value_process(User, Video, Value, Process, StartTime, [annotation(Value, Times)]) :- annotation_process(User, Video, Process, StartTime), @@ -87,7 +90,7 @@ annotation_value_process(User, Video, Value, Process, StartTime, [annotation(Val html_videos_page(Results, NumberOfResults, Offset, Limit, Options) :- reply_html_page(yaz, - [ title(['YAZ - tagged videos']) + [ title(['YAZ - sessions']) ], [ \html_requires(css('videos.css')), div(class(topic), @@ -102,24 +105,15 @@ html_videos_page(Results, NumberOfResults, Offset, Limit, Options) :- )) ])]). -message(N, Options) --> - { option(user(_User), Options) - }, - !, - html(['You tagged ', - \video_count(N), - \tag_message(Options) - ]). message(N, Options) --> html([\video_count(N), - ' tagged ', - \tag_message(Options) + \tag_message(Options) ]). video_count(1) --> - html('1 video'). + html('1 session'). video_count(N) --> - html([N, ' videos']). + html([N, ' sessions']). tag_message(Options) --> { option(tag(Tag), Options) @@ -160,9 +154,13 @@ html_video_item(URL, Processes, Options) --> % Emit html with a list of annotation processes. html_process_list([], _, _) --> !. -html_process_list([process(_Process, Time, Annotations)|T], Video, Link) --> +html_process_list([process(Process, Time, Annotations)|T], Video, Link) --> + { rdf(Process, rdf:type, Session0), + rdf_display_label(Session0, Session) + }, html(div(class('process'), - [ div(class('process-time'), Time), + [ div(class('process-time'), + [Session, ' at ', Time]), div(class('annotations'), \html_annotations(Annotations, Video, Link)) ])),