Index: openacs-4/contrib/packages/project-manager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/www/Attic/index.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/contrib/packages/project-manager/www/index.tcl 26 Feb 2004 15:15:41 -0000 1.12 +++ openacs-4/contrib/packages/project-manager/www/index.tcl 12 Mar 2004 13:44:44 -0000 1.13 @@ -1,7 +1,7 @@ ad_page_contract { Main view page for projects. - + @author jader@bread.com @author ncarroll@ee.usyd.edu.au (on first version that used CR) @creation-date 2003-05-15 @@ -19,6 +19,7 @@ orderby_project:optional {status_id:integer,optional} category_id:multiple,optional + {format "normal"} } -properties { context:onevalue @@ -61,28 +62,29 @@ # set default values if {![exists_and_not_null status_id]} { - set status_id [project_manager::project::default_status_open] + set status_id [pm::project::default_status_open] } # Categories are arranges into category trees. # Set up an array for each tree. The array contains the category for each tree -db_foreach get_choices " -select -t.name as cat_name, -t.category_id as cat_id, -tm.tree_id -from -category_tree_map tm, -categories c, -category_translations t -where -c.tree_id = tm.tree_id and -c.category_id = t.category_id and -tm.object_id = :package_id and -c.deprecated_p = 'f' -order -by t.name" { +db_foreach get_choices { + select + t.name as cat_name, + t.category_id as cat_id, + tm.tree_id + from + category_tree_map tm, + categories c, + category_translations t + where + c.tree_id = tm.tree_id and + c.category_id = t.category_id and + tm.object_id = :package_id and + c.deprecated_p = 'f' + order + by t.name +} { lappend category_choices($tree_id) [list $cat_name $cat_id] } @@ -92,17 +94,18 @@ set category_select "" -foreach tree_list [db_list_of_lists get_category_trees " -select -tt.name as tree_name, -tt.tree_id -from -category_tree_map tm, -category_tree_translations tt -where -tm.object_id = :package_id and -tm.tree_id = tt.tree_id"] { - +foreach tree_list [db_list_of_lists get_category_trees { + select + tt.name as tree_name, + tt.tree_id + from + category_tree_map tm, + category_tree_translations tt + where + tm.object_id = :package_id and + tm.tree_id = tt.tree_id +}] { + set tree_name [lindex $tree_list 0] set tree_id [lindex $tree_list 1] @@ -139,8 +142,8 @@ customer_name { label "Customer" display_template " - @projects.customer_name@@projects.customer_name@ - " +@projects.customer_name@@projects.customer_name@ +" } project_name { label "Project name" @@ -149,7 +152,7 @@ } earliest_finish_date { label "Earliest finish" - display_template "@projects.earliest_finish_date@@projects.earliest_finish_date@" + display_template "@projects.earliest_finish_date@@projects.earliest_finish_date@" } latest_finish_date { label "Latest Finish" @@ -164,14 +167,8 @@ display_template "
  • @projects.category_name@" } } \ - -actions { - "Tasks" "tasks" "View list of tasks" - "Processes" "processes" "View and use processes" - "Add project" "add-edit" "Add project" - "Customers" "/organization" "View customers" - "Admin" "admin/" "Administration pages" - } \ - -main_class { + -actions [list "Add project" "add-edit" "Add project" "Customers" "[site_node::get_package_url -package_key organizations]" "View customers"] \ + -sub_class { narrow } \ -filters { @@ -186,7 +183,7 @@ } } \ -orderby { - default_value customer_name,asc + default_value project_name,asc project_name { label "Project name" orderby_desc "upper(p.title) desc" @@ -224,6 +221,33 @@ default_direction asc } } \ + -formats { + normal { + label "Table" + layout table + row { + project_name {} + customer_name {} + category_id {} + earliest_finish_date {} + latest_finish_date {} + actual_hours_completed {} + } + } + csv { + label "CSV" + output csv + page_size 0 + row { + project_name {} + customer_name {} + category_id {} + earliest_finish_date {} + latest_finish_date {} + actual_hours_completed {} + } + } + } \ -orderby_name orderby_project \ -html { width 100% @@ -236,4 +260,27 @@ } +# This spits out the CSV if we happen to be in CSV layout + +if {[string equal $format csv]} { + #set csv [list::write_output -name pan] + #set outputheaders [ns_conn outputheaders] + #ns_set cput $outputheaders "Content-Disposition" "attachment; filename=pan.csv" + #doc_return 200 "application/text" "$csv" + + # set csv [list::write_output -name projects] + + set outputheaders [ns_conn outputheaders] + ns_set cput $outputheaders "Content-Disposition" "attachment; filename=projects.xls" + + # ns_log Notice "csv: $csv" + + list::write_output -name projects + + # doc_return 200 application/vnd.ms-excel $csv + # ns_return 200 application/vnd.ms-excel $csv + +} + + # ------------------------- END OF FILE ------------------------- #