forums-chunk.tcl
top level list of forums
- Location:
- /packages/forums/lib/forums/forums-chunk.tcl
- Author:
- Ben Adida <ben@openforce.net>
- Created:
- 2002-05-24
- CVS ID:
$Id: forums-chunk.tcl,v 1.24.2.1 2019/03/15 16:39:30 antoniop Exp $
Related Files
- packages/forums/lib/forums/forums-chunk.xql
- packages/forums/lib/forums/forums-chunk.tcl
- packages/forums/lib/forums/forums-chunk.adp
[ hide source ] | [ make this the default ]
File Contents
ad_page_contract { top level list of forums @author Ben Adida (ben@openforce.net) @creation-date 2002-05-24 @cvs-id $Id: forums-chunk.tcl,v 1.24.2.1 2019/03/15 16:39:30 antoniop Exp $ } set package_id [ad_conn package_id] set user_id [ad_conn user_id] set admin_p [permission::permission_p -object_id $package_id -privilege admin] # get the colors from the params set table_border_color [parameter::get -parameter table_border_color] set table_bgcolor [parameter::get -parameter table_bgcolor] set table_other_bgcolor [parameter::get -parameter table_other_bgcolor] set useReadingInfo [forum::use_ReadingInfo_p] if { $useReadingInfo } { set unread_or_new_query_clause [db_map unread_or_new_query] } else { set unread_or_new_query_clause { case when last_post > (current_date - interval '1' day) then 't' else 'f' end as new_p } } set actions [list] if { $admin_p } { lappend actions [_ forums.New_Forum] "admin/forum-new" {} lappend actions [_ forums.Administration] "admin/" {} } template::list::create \ -name forums \ -actions $actions \ -no_data [_ forums.No_Forums] \ -pass_properties useReadingInfo \ -elements { name { label {\#forums.Forum_Name\#} link_url_col forum_view_url display_template { <if @useReadingInfo;literal@ true> <if @forums.count_unread@ gt 0> <strong> </if> @forums.name@ <if @forums.count_unread@ gt 0> </strong> </if> </if> <else> <if @forums.new_p;literal@ true and @forums.n_threads@ gt 0> <strong> </if> @forums.name@ <if @forums.new_p;literal@ true and @forums.n_threads@ gt 0> </strong> </if> </else> } } charter { label {\#forums.Charter\#} display_template {@forums.charter;noquote@} } n_threads { label {\#forums.Threads\#} display_col n_threads_pretty display_template { <if @useReadingInfo;literal@ true> <if @forums.count_unread@ gt 0> <strong>@forums.count_unread@ new</strong> of </if> </if> @forums.n_threads@ } html { align right } } last_post { label {\#forums.Last_Post\#} display_col last_modified_pretty } statistic { label {\#forums.Statistics\#} link_url_col forum_view_statistic display_col statistic } } db_multirow -extend { forum_view_url last_modified_pretty n_threads_pretty forum_view_statistic statistic } forums select_forums [subst { select forums_forums_enabled.*, approved_thread_count as n_threads, to_char(last_post, 'YYYY-MM-DD HH24:MI:SS') as last_post_ansi, $unread_or_new_query_clause from forums_forums_enabled where forums_forums_enabled.package_id = :package_id and acs_permission.permission_p(forums_forums_enabled.forum_id, :user_id,'read') = 't' order by forums_forums_enabled.name }] { set last_modified_pretty [lc_time_fmt $last_post_ansi "%x %X"] set forum_view_url [export_vars -base forum-view { forum_id }] set n_threads_pretty [lc_numeric $n_threads] set forum_view_statistic [export_vars -base forum-view-statistic { forum_id }] set statistic "[_ forums.Statistics]" } if {[info exists alt_template] && $alt_template ne ""} { ad_return_template $alt_template } # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: