--- /dev/null
+[%
+
+WRAPER home;
+
+desired_types = cgi.param('otypes');
+desired_otypes = [];
+desired_otype_ids = [];
+IF desired_types.size > 0;
+ desired_otypes = cstore.search_depository_base_object_type({ hint => desired_types });
+ FOREACH dot IN desired_otypes;
+ desired_otype_ids.push(dot.id());
+ END;
+END;
+
+otypes = cstore.retrieve_all_depository_base_object_type();
+
+otype_by_label = [];
+FOREACH o IN otypes;
+ otype_by_label.push(o.label());
+ otype_by_label.push(o);
+END;
+otype_by_label = otype_by_label.hash;
+
+IF !api %]
+
+<form method="GET">
+
+Packages containing:
+<select name="otypes" multiple="multiple">
+ <option value="*">Any</option>'
+
+[% FOREACH l IN otype_by_label.keys.sort %]
+ <option value="[% otype_by_label.$l.hint() %]" [% 'checked="checked"' IF desired_types.grep(otype_by_label.$l.hint()) %]>[% $l %]</option>
+[% END %]
+
+</select><hr/>
+
+<input type="submit" name="action" value="Search"/>
+
+</form>
+
+[%
+
+END;
+
+items = cstore.search_depository_item({ otype => desired_otype_ids });
+pids = [];
+FOREACH i in items;
+ pids.push(i.package());
+END;
+
+pkgs = cstore.search_depository_packages([{ id => pids.unique },{ flesh => 1, flesh_fields => { dp => ['rating'] }}]);
+pkg_by_rating = [];
+FOREACH p IN pkgs;
+ pkg_by_rating.push( p.rating() _ p.title().lowercase );
+ pkg_by_rating.push( p );
+END;
+pkg_by_rating = pkg_by_rating.hash;
+
+FOREACH p IN pkg_by_rating.keys.sort;
+ INCLUDE package_summary pkg = pkg_by_rating.$p;
+END;
+
+%]