Index: openacs-4/packages/bookmarks/www/search.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/search.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/bookmarks/www/search.adp	3 Oct 2003 10:52:32 -0000	1.6
+++ openacs-4/packages/bookmarks/www/search.adp	21 Jun 2004 22:29:00 -0000	1.7
@@ -1,43 +1,17 @@
 <master>
-<property name="title">@page_title;noquote@</property>
+<property name="title">@page_title@</property>
 <property name="context">@context;noquote@</property>
 
 <if @viewed_user_id@ eq @browsing_user_id@>
-<if @my_list:rowcount@ gt "0">
-Here are your bookmarks that match your search:
-<p>
-<multiple name="my_list">
-
-<img border=0 src="pics/ftv2doc.gif" align="top"> 
-<a href="@my_list.complete_url@">@my_list.title@</a>
-&nbsp; &nbsp;<a href="bookmark-edit?bookmark_id=@my_list.bookmark_id@&viewed_user_id=@viewed_user_id@" title="Edit this bookmark"><img src="/resources/acs-subsite/Edit16.gif" height="16" width="16" alt="Edit" border="0"></a><br>
-
-</multiple>
+	<listtemplate name="my_list"></listtemplate>
 </if>
-<else>
-We couldn't find any matches among your bookmarks.
-</else>
-</if>
 
-<p>
+<p><listtemplate name="others_list"></listtemplate>
 
-<if @others_list:rowcount@ gt "0">
-Here are other people's bookmarks that match your search:
-<p>
-<multiple name="others_list">
+<form action="search" method="post">
+	<input type="hidden" name="return_url" value="index">
+	<input type="hidden" name="viewed_user_id" value="@viewed_user_id@">
 
-@img_html;noquote@ <a target=target_frame href="@others_list.complete_url@">@others_list.title@</a> <if @admin_p@ eq "t"> &nbsp; &nbsp; <a href=bookmark-edit?bookmark_id=@others_list.bookmark_id@&viewed_user_id=@viewed_user_id@&return_url=index>@edit_tag@</a></if> <br>
-
-</multiple>
-</if>
-<else>
-Your search returned zero matches in other bookmark lists.
-</else>
-
-<form action="search" method=post>
-<input type="hidden" name="return_url" value="index">
-<input type="hidden" name="viewed_user_id" value="@viewed_user_id@">
-
-Search bookmarks for: <input name=search_text type=text size=20 value="@search_text@">
-	<input type=submit value=Search>
+	Search bookmarks for: <input name="search_text" type="text" size="20" value="@search_text@">
+	<input type="submit" value="Search">
 </form>
Index: openacs-4/packages/bookmarks/www/search.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/bookmarks/www/search.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/bookmarks/www/search.tcl	22 Sep 2003 12:06:27 -0000	1.4
+++ openacs-4/packages/bookmarks/www/search.tcl	21 Jun 2004 22:29:00 -0000	1.5
@@ -56,74 +56,52 @@
 
 set search_pattern "%[string toupper $search_text]%"
 
-multirow create my_list bookmark_id complete_url title
-multirow create others_list bookmark_id complete_url title admin_p
 
-
 # this select gets all of the users bookmarks that match the user's request
-set bookmark_count 0
-set bookmark_html ""
+template::list::create \
+	-name my_list -multirow my_list \
+	-elements {
+		title {
+			label "Matches from your bookmark list"
+			link_url_eval {$complete_url}
+		}
+		invoke {
+			label "Edit"
+			link_url_eval {[export_vars -base "bookmark_edit" {{bookmark_id $bookmark_id}} ]}
+			link_html { title "Edit bookmark" }
+			display_template {
+				<img src="/resources/acs-subsite/Edit16.gif" width="16" height="16" border="0">
+			}
+		}
+	} -no_data {
+		Your search returned no matches in your bookmark list.
+	}
 
-db_foreach bookmark_search_user {
-    select   bookmark_id, 
-             complete_url,
-             nvl(local_title, url_title) as title, 
-             meta_keywords, 
-             meta_description
-    from     (select bookmark_id, url_id, local_title, folder_p, owner_id 
-              from bm_bookmarks start with bookmark_id = :root_folder_id 
-              connect by prior bookmark_id = parent_id) b, 
-             bm_urls
-    where    owner_id = :browsing_user_id 
-    and      folder_p = 'f'
-    and      b.url_id = bm_urls.url_id 
-    and      b.bookmark_id <> :root_folder_id
-    and     (    upper(local_title)      like :search_pattern
-              or upper(url_title)        like :search_pattern
-              or upper(complete_url)     like :search_pattern
-              or upper(meta_keywords)    like :search_pattern
-              or upper(meta_description) like :search_pattern)
-    order by title
-} {
-    incr bookmark_count
+db_multirow my_list bookmark_search_user {*SQL*}
 
-    multirow append my_list $bookmark_id $complete_url $title
 
-}
-
-
 # thie query searches across other peoples bookmarks that the browsing user
 # has read permission on
+template::list::create \
+	-name others_list -multirow others_list \
+	-elements {
+		title {
+			label "Matches from other bookmark lists"
+			link_url_eval {$complete_url}
+		}
+		invoke {
+			label "Edit"
+			link_url_eval {[export_vars -base "bookmark_edit" {bookmark_id viewed_user_id return_url} ]}
+			link_html { title "Edit bookmark" }
+			display_template {
+				<if @others_list.admin_p@ eq "t">
+				<img src="/resources/acs-subsite/Edit16.gif" width="16" height="16" border="0">
+				</if>
+			}
+		}
+	} -no_data {
+		Your search returned no matches in other bookmark lists.
+	}
 
-set bookmark_count 0
-set bookmark_html ""
+db_multirow others_list bookmark_search_other {*SQL*}
 
-db_foreach bookmark_search_other {
-    select   distinct complete_url,
-             bookmark_id,
-             nvl(local_title, url_title) as title, 
-             meta_keywords, 
-             meta_description, 
-             folder_p,
-             acs_permission.permission_p(bookmark_id, :browsing_user_id, 'admin') as admin_p
-    from     (select bookmark_id, url_id, local_title, folder_p, owner_id 
-              from bm_bookmarks start with bookmark_id in (select bookmark_id
-                           from bm_bookmarks where parent_id = :package_id)
-              connect by prior bookmark_id = parent_id) b, 
-             bm_urls
-    where    owner_id <> :browsing_user_id
-    and      acs_permission.permission_p(bookmark_id, :browsing_user_id, 'read') = 't'
-    and      folder_p  = 'f' 
-    and      b.url_id = bm_urls.url_id 
-    and     (   upper(local_title)      like :search_pattern
-             or upper(url_title)        like :search_pattern
-             or upper(complete_url)     like :search_pattern
-             or upper(meta_keywords)    like :search_pattern
-             or upper(meta_description) like :search_pattern)
-    order by title
-} {
-    multirow append others_list $bookmark_id $complete_url $title $admin_p
-}
-
-
-