Index: openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/ui-procs.tcl,v diff -u -N --- openacs-4/contrib/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 11:23:25 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,105 +0,0 @@ -ad_library { - UI related procs. - - @author Peter Marklund - @creation-date 2004-01-20 - @cvs-id $Id: ui-procs.tcl,v 1.5 2004/01/30 11:23:25 lars Exp $ -} - -namespace eval simulation::ui {} -namespace eval simulation::ui::simplay {} -namespace eval simulation::ui::forms::document_upload {} - -ad_proc -public simulation::ui::forms::document_upload::form_block {} { - Return the form block for the document upload form. - - @author Peter Marklund -} { - return { - {item_id:key} - {document_file:file(file) - {label "Document file"} - } - {title:text(text) - {label "Title"} - {html {size 50}} - } - } -} - -ad_proc -public simulation::ui::forms::document_upload::documents_element_value { action_id } { - Get a piece of HTML with links to documents for the documents form element. -} { - set documents "" - - return $documents -} - - -ad_proc -public simulation::ui::forms::document_upload::insert_document { - case_id - role_id - item_id - document_file - title - {entry_id {}} -} { - Does the document insertion in the DB. - - @author Peter Marklund -} { - db_transaction { - - set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] - - set existing_items [db_list select_items { select name from cr_items where parent_id = :parent_id }] - set name [util_text_to_url -existing_urls $existing_items -text $title] - - set content_type sim_prop - set storage_type file - - set item_id [bcms::item::create_item \ - -item_id $item_id \ - -item_name $name \ - -parent_id $parent_id \ - -content_type $content_type \ - -storage_type $storage_type] - - set revision_id [bcms::revision::upload_file_revision \ - -item_id $item_id \ - -title $title \ - -content_type $content_type \ - -upload_file $document_file] - - bcms::revision::set_revision_status \ - -revision_id $revision_id \ - -status "live" - - set relation_tag "portfolio" - db_dml add_document_to_portfolio { - insert into sim_case_role_object_map - (case_id, object_id, role_id, relation_tag, entry_id) - values - (:case_id, :item_id, :role_id, :relation_tag, :entry_id) - } - } -}