Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/simulation/lib/portfolio.tcl 18 Mar 2004 14:40:24 -0000 1.7.2.1 +++ openacs-4/packages/simulation/lib/portfolio.tcl 30 Nov 2004 21:47:47 -0000 1.7.2.2 @@ -7,8 +7,10 @@ } { case_id {} role_id {} + portfolio_orderby { required_p 0 } } + simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id set upload_url [export_vars -base document-upload { case_id role_id }] @@ -19,23 +21,59 @@ set user_roles [list] } +if { [exists_and_not_null case_id] } { + set num_enabled_actions [db_string select_num_enabled_actions { + select count(*) + from workflow_case_enabled_actions + where case_id = :case_id + }] + set complete_p [expr $num_enabled_actions == 0] +} else { + set complete_p 0 +} + +if { [string match $complete_p "0"] && [exists_and_not_null role_id] } { + set actions [list [_ simulation.Upload_a_document] $upload_url] +} else { + set actions [list] +} + template::list::create \ -name documents \ -multirow documents \ -no_data [_ simulation.lt_There_are_no_document] \ - -actions [list [_ simulation.Upload_a_document] $upload_url] \ + -actions $actions \ + -filters { case_id {} role_id {} } \ + -orderby_name portfolio_orderby \ -elements { document_title { label {[_ simulation.Document]} link_url_col document_url + orderby upper(cr.title) } + publish_date { + label {[_ simulation.Upload_date]} + orderby cr.publish_date + display_col publish_date_pretty + } + mime_type { + label "[_ simulation.Mime_type]" + orderby cr.mime_type + } + content_length { + label "[_ simulation.File_size]" + orderby cr.content_length + } } -db_multirow -extend { document_url } documents select_documents " +db_multirow -extend { document_url publish_date_pretty } documents select_documents " select scrom.object_id as document_id, ci.name as document_name, cr.title as document_title, - wr.pretty_name as role_name + wr.pretty_name as role_name, + cr.publish_date as publish_date, + cr.mime_type, + cr.content_length from sim_case_role_object_map scrom, workflow_roles wr, cr_items ci, @@ -45,7 +83,9 @@ and scrom.role_id = wr.role_id and scrom.object_id = ci.item_id and ci.live_revision = cr.revision_id - order by scrom.order_n + [template::list::orderby_clause -orderby -name "documents"] " { set document_url [simulation::object::content_url -name $document_name] + + set publish_date_pretty [lc_time_fmt $publish_date "%x %X"] }