rev 1919 - in trunk/buscador: . lib/Buscador templates/entity

[prev] [thread] [next] [lurker] [Date index for 2005/02/18]

From: simon
Subject: rev 1919 - in trunk/buscador: . lib/Buscador templates/entity
Date: 18:01 on 18 Feb 2005
Author: simon
Date: 2005-02-18 18:01:02 +0000 (Fri, 18 Feb 2005)
New Revision: 1919

Added:
   trunk/buscador/templates/entity/list
Modified:
   trunk/buscador/TODO
   trunk/buscador/lib/Buscador/Addressing.pm
Log:
Make listing of entities possible


Modified: trunk/buscador/TODO
===================================================================
--- trunk/buscador/TODO	2005-02-18 17:10:49 UTC (rev 1918)
+++ trunk/buscador/TODO	2005-02-18 18:01:02 UTC (rev 1919)
@@ -36,7 +36,7 @@
 * Make braindead browsers pick up filename properly           - DONE
 * have a good long think about HTML mails                     -
   (inline images etc etc)
+* Make listing of entities truly alphabetical                 - 
 
 
 
-

Modified: trunk/buscador/lib/Buscador/Addressing.pm
===================================================================
--- trunk/buscador/lib/Buscador/Addressing.pm	2005-02-18 17:10:49 UTC (rev 1918)
+++ trunk/buscador/lib/Buscador/Addressing.pm	2005-02-18 18:01:02 UTC (rev 1919)
@@ -204,6 +204,14 @@
         [$pager->search_entity_sorted($id)];
 }
 
+
+sub list : Exported {
+    my ($class, $r) = @_;
+    my $pager = Email::Store::Entity->do_pager($r);
+    $r->{template_args}{entities} = [ sort { lc($a->most_common_name->name) cmp lc($b->most_common_name->name) } $pager->retrieve_all ];    
+}
+
+
 sub most_common_name { Email::Store::Entity::Name->search_most_common(shift->id)->first }
 sub most_common_address { Email::Store::Entity::Address->search_most_common(shift->id)->first }
 

Added: trunk/buscador/templates/entity/list
===================================================================
--- trunk/buscador/templates/entity/list	2005-02-18 17:10:49 UTC (rev 1918)
+++ trunk/buscador/templates/entity/list	2005-02-18 18:01:02 UTC (rev 1919)
@@ -0,0 +1,27 @@
+[% INCLUDE header title = "List all entities" %]
+[% PROCESS macros %]
+<h1>All entities</h1>
+
+[% INCLUDE searchbox %]
+
+
+[% FOREACH entity = entities %]
+[% SET names = entity.names.unique %]
+[% IF names.length > 1 %]
+    <div class="entity_name"><a href="<a href="[%base|remove('/$')%]/entity/view/[% entity.id %]">[% entity.most_common_name.name | html %]</a>
+        <div class="aka">
+        <p>Also known as:</p>
+        <ul>
+            [% FOR my_name = names %]
+                <li>[% my_name.name | html %]</li>
+            [% END %]
+        </ul>
+        </div>
+    </div>
+[% ELSE %]
+    <div class="entity_name"><a href="[%base|remove('/$')%]/entity/view/[% entity.id %]">[%  names.first.name |html%]</a></div>
+[% END %]
+[% END %]
+
+
+[% INCLUDE footer %]

Generated at 12:00 on 19 Feb 2005 by mariachi 0.52