Index: openacs-4/packages/general-comments/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/index.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/general-comments/www/index.tcl 1 Mar 2005 00:01:37 -0000 1.7 +++ openacs-4/packages/general-comments/www/index.tcl 27 Oct 2014 16:41:43 -0000 1.8 @@ -7,8 +7,10 @@ @author Pascal Scheffers (pascal@scheffers.net) @creation-date 2000-10-12 @cvs-id $Id$ -} { - {orderby {pretty_date*} } +} -query { + {orderby:optional} + {approval "any"} + {modified "any"} } -properties { page_title:onevalue context:onevalue @@ -21,7 +23,7 @@ # check for admin privileges set package_id [ad_conn package_id] -set admin_p [ad_permission_p $package_id admin] +set admin_p [permission::permission_p -object_id $package_id -privilege admin] # return_url to be passed to various helper pages so that we return to # this page with the proper parameters @@ -43,25 +45,46 @@ ] set dimensional_bar [ad_dimensional $dimensional] -# ad_table definition -set table_def [list \ - [list num "[_ general-comments.Num]" {} {$Tcount}] \ - [list comment_id "[_ general-comments.ID]" {} \ - {$comment_id}] \ - [list title "[_ general-comments.Title_1]" {} {}] \ - [list approved_p "[_ general-comments.Approved]" {} 01] \ - [list live_version_p "[_ general-comments.Has_live_version]" {} 01] \ - [list pretty_date "[_ general-comments.Last_Modified]" {creation_date $order} {[lc_time_fmt $creation_date "%x %X"]}] \ -] +template::list::create -name comments_list \ + -multirow comments \ + -no_data "#general-comments.lt_No_comments_available#" \ + -html {align center} \ + -elements { + counter { + label "#general-comments.Num#" + } + comment_id { + label "#general-comments.ID#" + display_template {@comments.comment_id@} + orderby {comment_id} + } + title { + label "#general-comments.Title_1#" + orderby {title} + } + approved_p { + label "#general-comments.Approved#" + html {align center} + orderby {approved_p} + } + live_version_p { + label "#general-comments.Has_live_version#" + html {align center} + orderby {approved_p} + } + pretty_date { + label "#general-comments.Last_Modified#" + orderby {creation_date} + } + } -filters {approval {} modified {}} -# create the table to display the comments -set bind_ns_set [ad_tcl_vars_to_ns_set user_id] -set extra_var_list [list return_url $return_url] -set comments_table [ad_table -Torderby $orderby \ - -Tmissing_text "[_ general-comments.lt_No_comments_available]" \ - -Textra_vars $extra_var_list \ - -bind $bind_ns_set \ - comments_select {} $table_def] +set count 0 +db_multirow -extend {user_id return_url counter pretty_date} comments comments_select {} { + set counter [incr count] + set pretty_date [lc_time_fmt $creation_date "%x %X"] + set approved_p [util_PrettyTclBoolean $approved_p] + set live_version_p [util_PrettyTclBoolean $live_version_p] +} set page_title "[_ general-comments.General_Comments]" set context {}