Index: openacs-4/packages/simulation/lib/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/messages.tcl,v diff -u -r1.21.2.2 -r1.21.2.3 --- openacs-4/packages/simulation/lib/messages.tcl 31 Oct 2006 21:10:13 -0000 1.21.2.2 +++ openacs-4/packages/simulation/lib/messages.tcl 2 Nov 2006 07:17:10 -0000 1.21.2.3 @@ -176,7 +176,7 @@ "sm.to_role_id = :role_id or sm.from_role_id = :role_id"] )"] and [ad_decode $deleted_p 1 "" "not"] exists ( - select 1 from sim_trash st where st.message_id = sm.message_id) + select 1 from sim_messages_trash st where st.message_id = sm.message_id) and wc.case_id = sm.case_id and sc.sim_case_id = wc.object_id and w.workflow_id = wc.workflow_id Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -r1.10.2.1 -r1.10.2.2 --- openacs-4/packages/simulation/lib/portfolio.tcl 31 Oct 2006 10:13:02 -0000 1.10.2.1 +++ openacs-4/packages/simulation/lib/portfolio.tcl 2 Nov 2006 07:17:10 -0000 1.10.2.2 @@ -7,12 +7,15 @@ } { case_id {} role_id {} + deleted_p { default_value 0 } + show_actions_p { default_value 1 } portfolio_orderby { required_p 0 } } simulation::case::assert_user_may_play_role -case_id $case_id -role_id $role_id +set package_id [ad_conn package_id] set upload_url [export_vars -base document-upload { case_id role_id }] if { [exists_and_not_null case_id] } { @@ -32,25 +35,18 @@ set complete_p 0 } -if { [string match $complete_p "0"] && [exists_and_not_null role_id] } { +if { [string match $complete_p "0"] && [exists_and_not_null role_id] && $show_actions_p } { 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 $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) - } +set 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 @@ -64,11 +60,45 @@ label "[_ simulation.File_size]" orderby cr.content_length } - } +} -db_multirow -extend { document_url publish_date_pretty } documents select_documents " +set extend { document_url publish_date_pretty delete delete_url rename rename_url } + +if { $deleted_p } { + lappend elements delete + lappend elements { + link_url_col delete_url + label {[_ simulation.Undelete]} + } + +} else { + lappend elements delete + lappend elements { + link_url_col delete_url + label {[_ simulation.Delete]} + } + +} + +lappend elements rename +lappend elements { + link_url_col rename_url + label {[_ simulation.Rename]} +} + +template::list::create \ + -name documents \ + -multirow documents \ + -no_data [_ simulation.lt_There_are_no_document] \ + -actions $actions \ + -filters { case_id {} role_id {} } \ + -orderby_name portfolio_orderby \ + -elements $elements + +db_multirow -extend $extend documents select_documents " select scrom.object_id as document_id, ci.name as document_name, + scrom.title as scrom_title, cr.title as document_title, wr.pretty_name as role_name, cr.publish_date as publish_date, @@ -83,9 +113,31 @@ and scrom.role_id = wr.role_id and scrom.object_id = ci.item_id and ci.live_revision = cr.revision_id + and [ad_decode $deleted_p 1 "" "not"] exists + (select 1 from sim_portfolio_trash spt + where spt.object_id = scrom.object_id and + spt.case_id = :case_id and + spt.role_id = :role_id) [template::list::orderby_clause -orderby -name "documents"] " { set document_url [simulation::object::content_url -name $document_name] + + if { $deleted_p } { + set delete [_ simulation.Undelete] + } else { + set delete [_ simulation.Delete] + } + + if { ![empty_string_p $scrom_title] } { + set document_title $scrom_title + } + + set undelete_p $deleted_p + + set delete_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/portfolio-delete" { case_id role_id document_id undelete_p}] + + set rename [_ simulation.Rename] + set rename_url [export_vars -base "[apm_package_url_from_id $package_id]simplay/portfolio-rename" { case_id role_id document_id}] set publish_date_pretty [lc_time_fmt $publish_date "%x %X"] } Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql,v diff -u -r1.29.2.2 -r1.29.2.3 --- openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 31 Oct 2006 21:10:13 -0000 1.29.2.2 +++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-create.sql 2 Nov 2006 07:17:11 -0000 1.29.2.3 @@ -162,6 +162,7 @@ references workflow_cases on delete cascade, order_n integer, + title varchar(200) relation_tag varchar(100), entry_id integer constraint scrom_case_log_fk references workflow_case_log, @@ -204,7 +205,7 @@ comment on table sim_cases is 'The object behind a simulation case.'; -create table sim_trash ( +create table sim_messages_trash ( message_id integer constraint sim_trash_id_nn not null constraint sim_trash_id_fk @@ -216,4 +217,22 @@ PRIMARY KEY (message_id, role_id, case_id) ); -comment on table sim_trash is 'For storing trashed messages per role per case.'; \ No newline at end of file +comment on table sim_messages_trash is 'For storing trashed messages per role per case.'; + +create table sim_portfolio_trash ( + object_id integer constraint sim_trash_id_nn + not null + constraint sim_pt_object_id_fk + references acs_objects ON DELETE CASCADE, + role_id integer constraint sim_pt_role_nn + not null + constraint sim_pt_role_fk + REFERENCES workflow_roles ON DELETE CASCADE, + case_id integer constraint sim_pt_case_nn + not null + constraint sim_pt_case_fk + REFERENCES workflow_cases ON DELETE CASCADE, + PRIMARY KEY (object_id, role_id, case_id) +); + +comment on table sim_portfolio_trash is 'For storing trashed portfolio documents per role per case.'; \ No newline at end of file Index: openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql 31 Oct 2006 10:13:02 -0000 1.5.2.1 +++ openacs-4/packages/simulation/sql/postgresql/simulation-tables-drop.sql 2 Nov 2006 07:17:11 -0000 1.5.2.2 @@ -3,6 +3,8 @@ -- @cvs-id $Id$ --drop independent tables +drop table sim_messages_trash; +drop table sim_portfolio_trash; drop table sim_party_sim_map; drop table sim_task_recipients; drop table sim_tasks; Index: openacs-4/packages/simulation/sql/postgresql/upgrade/upgrade-1.0.0b5-1.1.0b1.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/sql/postgresql/upgrade/Attic/upgrade-1.0.0b5-1.1.0b1.sql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/simulation/sql/postgresql/upgrade/upgrade-1.0.0b5-1.1.0b1.sql 31 Oct 2006 21:10:13 -0000 1.1.2.1 +++ openacs-4/packages/simulation/sql/postgresql/upgrade/upgrade-1.0.0b5-1.1.0b1.sql 2 Nov 2006 07:17:11 -0000 1.1.2.2 @@ -1,4 +1,4 @@ -create table sim_trash ( +create table sim_messages_trash ( message_id integer constraint sim_trash_id_nn not null constraint sim_trash_id_fk @@ -10,4 +10,25 @@ PRIMARY KEY (message_id, role_id, case_id) ); -comment on table sim_trash is 'For storing trashed messages per role per case.'; +comment on table sim_messages_trash is 'For storing trashed messages per role per case.'; + +create table sim_portfolio_trash ( + object_id integer constraint sim_trash_id_nn + not null + constraint sim_pt_object_id_fk + references acs_objects ON DELETE CASCADE, + role_id integer constraint sim_pt_role_nn + not null + constraint sim_pt_role_fk + REFERENCES workflow_roles ON DELETE CASCADE, + case_id integer constraint sim_pt_case_nn + not null + constraint sim_pt_case_fk + REFERENCES workflow_cases ON DELETE CASCADE, + PRIMARY KEY (object_id, role_id, case_id) +); + +comment on table sim_portfolio_trash is 'For storing trashed portfolio documents per role per case.'; + +alter table sim_case_role_object_map + add column title varchar(200); \ No newline at end of file Index: openacs-4/packages/simulation/tcl/message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/message-procs.tcl,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/simulation/tcl/message-procs.tcl 31 Oct 2006 21:10:13 -0000 1.6.2.1 +++ openacs-4/packages/simulation/tcl/message-procs.tcl 2 Nov 2006 07:17:11 -0000 1.6.2.2 @@ -181,7 +181,7 @@ } { db_transaction { if {[string equal $action "delete"]} { - db_dml delete "insert into sim_trash values (:message_id, :role_id, :case_id)" + db_dml delete "insert into sim_messages_trash values (:message_id, :role_id, :case_id)" } else { db_dml undelete " delete from sim_trash Index: openacs-4/packages/simulation/www/simplay/control-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.tcl,v diff -u -r1.19.2.1 -r1.19.2.2 --- openacs-4/packages/simulation/www/simplay/control-bar.tcl 31 Oct 2006 10:13:04 -0000 1.19.2.1 +++ openacs-4/packages/simulation/www/simplay/control-bar.tcl 2 Nov 2006 07:17:11 -0000 1.19.2.2 @@ -33,6 +33,10 @@ from sim_messagesx sm where (sm.to_role_id = :role_id or sm.from_role_id = :role_id) and sm.case_id = :case_id + and not exists (select 1 from sim_messages_trash st + where st.message_id = sm.message_id and + st.role_id = :role_id and + st.case_id = :case_id) "] set messages_url [export_vars -base ${section_uri}messages { case_id role_id }] Index: openacs-4/packages/simulation/www/simplay/document-upload.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/document-upload.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/simulation/www/simplay/document-upload.tcl 30 Nov 2004 21:09:17 -0000 1.11 +++ openacs-4/packages/simulation/www/simplay/document-upload.tcl 2 Nov 2006 07:17:11 -0000 1.11.2.1 @@ -13,7 +13,8 @@ set page_title [_ simulation.lt_Upload_new_document_t] set context [list [list . [_ simulation.SimPlay]] \ - [list [export_vars -base case { case_id role_id }] [_ simulation.Case]] \ + [list [export_vars -base case { case_id role_id }] \ + [_ simulation.Case]] \ $page_title] set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/simplay/portfolio-delete.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/simplay/portfolio-rename.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/simulation/www/simplay/portfolio-rename.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/simulation/www/simplay/portfolio.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/portfolio.adp,v diff -u -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/simulation/www/simplay/portfolio.adp 31 Oct 2006 10:13:04 -0000 1.6.2.1 +++ openacs-4/packages/simulation/www/simplay/portfolio.adp 2 Nov 2006 07:17:11 -0000 1.6.2.2 @@ -4,9 +4,10 @@
- + - + +

@bin_title@

\ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/portfolio.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/simulation/www/simplay/portfolio.tcl 30 Nov 2004 21:09:17 -0000 1.8 +++ openacs-4/packages/simulation/www/simplay/portfolio.tcl 2 Nov 2006 07:17:11 -0000 1.8.2.1 @@ -4,18 +4,25 @@ case_id:integer role_id:integer portfolio_orderby:optional + {bin_p:integer 0} } +set deleted_p $bin_p +set show_actions_p [ad_decode $deleted_p 1 0 1] set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] set simulation_name [simulation::template::get_element -workflow_id $workflow_id -element pretty_name] -set title [_ simulation.Portfolio] +set title [ad_decode $deleted_p 1 [_ simulation.Recycle_Bin] [_ simulation.Portfolio]] set context [list [list . [_ simulation.SimPlay]] [list [export_vars -base case { case_id role_id }] "$simulation_name"] $title] set user_id [ad_conn user_id] set package_id [ad_conn package_id] set section_uri [apm_package_url_from_id $package_id]simplay/ +set bin_p [ad_decode $bin_p 1 "0" "1"] +set recycle_bin_url [export_vars -base ${section_uri}portfolio { case_id role_id bin_p }] if { ![exists_and_not_null portfolio_orderby] } { set portfolio_orderby 0 -} \ No newline at end of file +} + +set bin_title [ad_decode $deleted_p 1 [_ simulation.back_to_portfolio] [_ simulation.Recycle_Bin]] \ No newline at end of file