Index: openacs-4/packages/news/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/index.adp,v diff -u -r1.16.2.2 -r1.16.2.3 --- openacs-4/packages/news/www/index.adp 29 Jul 2008 21:16:25 -0000 1.16.2.2 +++ openacs-4/packages/news/www/index.adp 31 Jul 2008 09:42:31 -0000 1.16.2.3 @@ -2,57 +2,16 @@ @context;noquote@ @title;noquote@ - -
[#news.Administer#]
-
+ - - -

#news.lt_There_are_no_news_ite#

+ +

@notification_chunk;noquote@

- - -
#news.Search# -
- - -
-
-
- - -

@notification_chunk;noquote@ - - -

@news_items.publish_date@: @news_items.publish_title@ -
@news_items.publish_lead@

- - - -

#rss-support.Syndication_Feed# Subscribe via RSS

-
- -

@pagination_link;noquote@

-
- - + +

+ + Subscribe via RSS + #rss-support.Syndication_Feed# + +

- - - - - - - -
    -
  • @view_switch_link;noquote@
  • -
-
- - - - Index: openacs-4/packages/news/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/index.tcl,v diff -u -r1.15 -r1.15.4.1 --- openacs-4/packages/news/www/index.tcl 15 Dec 2006 22:45:38 -0000 1.15 +++ openacs-4/packages/news/www/index.tcl 31 Jul 2008 09:42:31 -0000 1.15.4.1 @@ -10,8 +10,8 @@ } { - {start:integer "1"} {view:trim "live"} + page:optional } -properties { @@ -21,10 +21,6 @@ news_admin_p:onevalue news_create_p:onevalue news_items:multirow - allow_search_p:onevalue - pagination_link:onevalue - item_create_link:onevalue - view_switch_link:onevalue } @@ -34,92 +30,77 @@ set context {} +set actions_list [list] -# switches for privilege-enabled links: admin for news_admin, submit for registered users -set news_admin_p [ad_permission_p $package_id news_admin] -set news_create_p [ad_permission_p $package_id news_create] - - -# switch for showing interface to site-wide-search for news -set allow_search_p [parameter::get -package_id $package_id -parameter ShowSearchInterfaceP -default 1] -set search_url [site_node_closest_ancestor_package_url -package_key search -default ""] - # view switch in live | archived news if { [string equal "live" $view] } { set title [apm_instance_name_from_id $package_id] set view_clause [db_map view_clause_live] - if { [db_string archived_p " - select decode(count(*),0,0,1) - from news_items_approved - where publish_date < sysdate - and archive_date < sysdate - and package_id = :package_id"]} { - set view_switch_link "[_ news.Show_archived_news]" - } else { - set view_switch_link "" + if { [db_string archived_p {}]} { + lappend actions_list [_ news.Show_archived_news] \ + [export_vars -base [ad_conn url] {{view archive}}] \ + [_ news.Show_archived_news] } } else { set title [apm_instance_name_from_id $package_id] set view_clause [db_map view_clause_archived] - if { [db_string live_p " - select decode(count(*),0,0,1) - from news_items_approved - where publish_date < sysdate - and (archive_date is null - or archive_date > sysdate) - and package_id = :package_id"] } { - set view_switch_link "[_ news.Show_live_news]" - } else { - set view_switch_link "" - } + if { [db_string live_p {}] } { + lappend actions_list [_ news.Show_live_news] \ + [export_vars -base [ad_conn url] {{view live}}] \ + [_ news.Show_live_news] + } } +# switches for privilege-enabled links: admin for news_admin, submit for registered users +set news_admin_p [ad_permission_p $package_id news_admin] +set news_create_p [ad_permission_p $package_id news_create] -set max_dspl [ad_parameter DisplayMax "news" 10] - -# make list of approved news items, paging included -set count 0 - -# use template::query to limit result to allowed number of rows. - -db_multirow -extend { publish_date } news_items item_list {} { - # this code block enables paging counter, no direct data manipulation - # alternatives are: = [expr $start + $max_dspl] } break - - set publish_date [lc_time_fmt $publish_date_ansi "%x"] +if { $news_admin_p } { + lappend actions_list [_ news.Create_a_news_item] \ + "item-create" \ + [_ news.Create_a_news_item] + lappend actions_list [_ news.Administer] \ + "admin/" \ + [_ news.Administer] +} else { + if { $news_create_p } { + lappend actions_list [_ news.Submit_a_news_item] \ + "item-create" \ + [_ news.Submit_a_news_item] + } } -# make paging links -if { $count < [expr $start + $max_dspl] } { - set next_start "" -} else { - set next_start "Next" -} +# build the multirow for the list -if { $start == 1 } { - set prev_start "" -} else { - set prev_start "Previous" +db_multirow -extend { publish_date news_item_url } news_items item_list {} { + set publish_date [lc_time_fmt $publish_date_ansi "%q"] + set news_item_url [export_vars -base "item" {item_id}] } -if { ![empty_string_p $next_start] && ![empty_string_p $prev_start] } { - set divider " | " -} else { - set divider "" +# TODO: pagination +set max_dspl [ad_parameter DisplayMax "news" 10] +template::list::create -name news -multirow news_items -actions $actions_list -no_data [_ news.lt_There_are_no_news_ite] -elements { + publish_date { + label "[_ news.Release_Date]" + } + publish_title { + label "[_ news.Title]" + display_col publish_title + link_url_col news_item_url + link_html {title "#news.show_content_news_items_publish_title#"} + } + publish_lead { + label "[_ news.Lead]" + } } -set pagination_link "$prev_start$divider$next_start" +# Footer links set rss_exists [rss_support::subscription_exists \ -summary_context_id $package_id \ -impl_name news] @@ -132,9 +113,3 @@ -url [ad_return_url] \ ] ad_return_template - - - - - -