Index: openacs-4/packages/simulation/simulation.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/simulation.info,v diff -u -N -r1.12.2.3 -r1.12.2.4 --- openacs-4/packages/simulation/simulation.info 24 Mar 2004 16:33:13 -0000 1.12.2.3 +++ openacs-4/packages/simulation/simulation.info 30 Nov 2004 21:47:39 -0000 1.12.2.4 @@ -8,29 +8,41 @@ f simulation - + Collaboraid ApS - Workflow-based task simulator. Build scenario - templates in which various roles must complete tasks such as - sending messages and uploading documents. Then enroll groups - of students into cases, cast the students into roles, and - monitor progress. Developed as a legal education tool for + O'Design + Workflow-based task simulator. Build scenario + templates in which various roles must complete tasks such as + sending messages and uploading documents. Then enroll groups + of students into cases, cast the students into roles, and + monitor progress. Developed as a legal education tool for www.rechtenonline.nl. - 2004-01-30 + 2004-11-30 - + + - + + - - + + + + + + + + + + + Index: openacs-4/packages/simulation/catalog/simulation.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/catalog/simulation.en_US.ISO-8859-1.xml,v diff -u -N -r1.1.2.8 -r1.1.2.9 --- openacs-4/packages/simulation/catalog/simulation.en_US.ISO-8859-1.xml 1 Jun 2004 14:45:05 -0000 1.1.2.8 +++ openacs-4/packages/simulation/catalog/simulation.en_US.ISO-8859-1.xml 30 Nov 2004 21:47:46 -0000 1.1.2.9 @@ -1,11 +1,15 @@ - add new characters + Abort the session + Add a template + Add an Object + Add an object Administration All All Messages All messages... + and %rest_length% more Assigned action Attachments Body @@ -15,10 +19,20 @@ Case History Case home CityBuild + CityBuild Help + Clear filter + Clone this template + Colophon + Contact Info Contacts You are <a href="%role.character_url%">%role.character_title%</a> (%role.role_pretty%) + Copy + Count Create props + Created by + Current State + Delete Delete this case Delete this template Description @@ -27,20 +41,25 @@ Document Portfolio Documents Edit + Edit this template Dear %user_name%, This is to notify you that you have been enrolled in simulation %sim_template.pretty_name%. You may visit the casting page at %casting_page_url% to choose case or role. You have been enrolled in simulation %sim_template.pretty_name% + File size From + Home <strong>Note:</strong> Ignoring %ignored_actions_count% tasks that don't have the task name "%action.pretty_name%". Please back up your browser if you want to change the selection of tasks. + Import a template Dear %user_name%, You have been invited to join simulation %sim_template.pretty_name%. Please visit the enrollment page at %enrollment_page_url% to accept the invitation. Thank you! You have been invited to join simulation %sim_template.pretty_name% <b>Invitations</b> are sent, when this wizard is completed and casting begins. + Join Join a Simulation join case join role @@ -58,10 +77,9 @@ all messages you receive All tasks in the simulation all tasks you're assigned to - and refresh - this page. Are you sure you want to delete this object? Are you sure you want to delete this case? + Are you sure you want to delete template Attachments in received message: Back to template %sim_template_array.pretty_name% Be the first user in a new case @@ -84,43 +102,60 @@ Case "%case.label%" has been deleted. Choose new roles for user %user.name% Choose new users for role %role.pretty_name% + Create new simulation templates or edit existing ones. Delete case "%case.label%" Delete %name% and tasks Did not generate an XML file. + Do not delete it if you're not 100% sure about what you're doing. Document %document% uploaded + Duration in hours, decimals are allowed; example: 0.25 = 15 minutes. Each role may be played by one or by many users. Each role can only be played by users in the groups specified below. If a group is not selected for any role, users in that group will not be cast in the simulation Either of the HTTP parameters workflow_id and case_id must be provided. Please contact the system administrator about this error. Expects a sim id. Shows all cases for that sim. This is an admin page. - Export full case history + Show full case history Export this template as a text file Full History for %case.label% Generate Map XML file and send notifications Generated map XML file and sent any notifications. + has dependent tasks (some task is either enabled in this state or this state is defined as the next state of some task). If you delete this state, all the dependent tasks will also be deleted. If you are using the respond button to respond to multiple tasks then all checked tasks must share the same task name. + if you think you're uploading a proper file. in CityBuild before you can finish setting up these tasks. + In CityBuild you can create new Sieberdam objects. Join a Case in Simulation "%workflow.pretty_name%" Join a Case in Simulation "%simulation.pretty_name%" + Join a simulation or continue a simulation session. Make a copy of the selected template, including all tasks and roles, but not any objects. Mark this template ready for use Messages for %role_array.pretty_name% - %name% has dependent tasks. Do you want to delete this role -and all related tasks? + %name% has dependent tasks (either as an assignee or as a recipient of a message). Do you want to delete this role and all related tasks? + New Simulation From Template + No attachments. No empty slots in role "%role.pretty_name%" + No simulations available to join. Not allowed to cast in role "%role.pretty_name%" Not enrolled in simulation "%simulation.pretty_name%" Notify me of changes to map XML Placeholder for flash map + Please contact + the system administrator Portfolio for %role_array.pretty_name% in %case_array.label% Portfolio for %role_array.pretty_name% + Restrict to items matching word or phrase Restrict to previous task matching word or phrase + Return to SimBuild Home + Return to Simulation root + Return to Simulation Home Return to template list page + Right-click document name and select "Save as" (or equiv.) to download a document to your computer. Roles with actions only - Select from existing characters in the Yellow Pages, or + "search_terms" must be a string containing three or more characters + Select a character to play each role in simulation. Select which case and role to join, or create a new case for yourself. If you do not select a case and role to join, you will be automatically assigned to a case and role when the simulation @@ -129,6 +164,8 @@ yourself. If you do not select a case to join, you will be automatically assigned to a case when the simulation begins. + Sieberdam/ROCS Availability + SimInst is used to start new simulations. Simulation Case List Simulation "%simulation.pretty_name%" is in state %simulation.sim_type% and you cannot enroll in it now. Contact your @@ -138,20 +175,24 @@ Some of the tasks of this simulation require attachments. However, there are no CityBuild props to select from. Start a simulation with this template Stop notifying me of changes to map XML + Subscribe to %pretty_name% Take action on selected tasks Templates must be marked ready for use by template authors in order to appear on this list. The enrollment period for simulation "%simulation.pretty_name%" is between %simulation.enroll_start% and %simulation.enroll_end% and you cannot enroll at this time. Contact your administrator if you believe this is an error. Thank you! The following errors were encountered: + The mime type of your file was not recognised. The template "%simulation.pretty_name%" is not ready for casting. There are no cases in this simulation yet There are no documents. There are no participants selected, so casting is not yet possible. On the previous tab, please select participants, or allow open enrollment on the first tab. There are no roles or users in this simulation case There are no users playing the role This case has been completed. + This item is related to one or more items + This item is used in one or more simulations to see your active cases. Unsubscribe from %pretty_name% Up to %parent_task_array.pretty_name% @@ -160,6 +201,7 @@ Users playing role %role.pretty_name% in case %case.label% Warning: this simulation is already in casting. Clicking the finish button may have unwanted consequences such as sending notifications twice to users. We couldn't find any roles that you could join in case "%case.label%" of simulation "%simulation.pretty_name%". You would need to join a new case. Select your administrator about this. Thank you! + Yellow Pages is the directory of Sieberdam locations and cahacters. Yes, delete the object You administer these cases You are already cast in the following roles: @@ -174,11 +216,13 @@ You have been enrolled in simulation "%simulation.pretty_name%" You have deleted template "%template_name%". + You have no Simulations in Development or Casting You must supply both case_id and role_id You will be automatically cast in "%simulation.pretty_name%" Your Current Simulations Your Tasks in Simulation %simulation.pretty_name% Manage groups + Map help Map XML Max # users Message @@ -199,19 +243,27 @@ Thank you. Messages messages + Mime type + + + mime type Move user My Notifications + Name New Users + No attachments. No available roles No, cancel No documents No messages. Notifications Notifications for + Number Number of tasks Parent Task Portfolio Re: + Ready Received Recent Messages Related Tasks @@ -223,17 +275,31 @@ Simulation %simulation_name% starts on %simulation_start_date% Remove user Respond + Return to SimPlay Role Roles + Send a message to Send new message + Session + Session + Session Home + Sieberdam History + Sieberdam Map + Sieberdam/ROCS Info SimBuild + SimBuild Help SimInst + SimInst Help SimPlay + SimPlay Help + Simplay Help Simulation + Simulation Home %simulation_name% Dear %user_name%, Simulation %simulation.pretty_name% has now started. Please visit %simplay_url% to participate. Thank you! Simulation %simulation.pretty_name% has started + Simulation Templates States Status Sub-States @@ -247,6 +313,7 @@ tasks Template Template Description + Template Name Thank you! Time Timeout @@ -257,14 +324,18 @@ <font color="red"><em>NOTE</em></font>: To attach a document to your message you need to <a href="%document_upload_url%">upload a document</a> to your portfolio before writing the message. + Type Unknown type Unsubscribe Upload a document + Upload date User # Users View Map XML + Warning Yellow Pages Yes, delete the case + You are Your Options Your Tasks Index: openacs-4/packages/simulation/catalog/simulation.nl_NL.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/catalog/simulation.nl_NL.ISO-8859-1.xml,v diff -u -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/simulation/catalog/simulation.nl_NL.ISO-8859-1.xml 11 Apr 2004 10:30:14 -0000 1.1.2.1 +++ openacs-4/packages/simulation/catalog/simulation.nl_NL.ISO-8859-1.xml 30 Nov 2004 21:47:46 -0000 1.1.2.2 @@ -1,5 +1,5 @@ - + Annuleren Verwijder dit sjabloon Index: openacs-4/packages/simulation/lib/cases-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/cases-admin.tcl,v diff -u -N -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/simulation/lib/cases-admin.tcl 18 Mar 2004 14:40:24 -0000 1.5.2.1 +++ openacs-4/packages/simulation/lib/cases-admin.tcl 30 Nov 2004 21:47:47 -0000 1.5.2.2 @@ -8,33 +8,54 @@ party_id { default_value "" } + case_admin_order { + required_p 0 + } } + set package_id [ad_conn package_id] set user_id [auth::get_user_id] set elements { + pretty_name { + label {[_ simulation.Simulation]} + orderby upper(w.pretty_name) + } label { label {[_ simulation.Case]} - orderby upper(w.pretty_name) + orderby label link_url_eval {[export_vars -base [ad_conn package_url]simplay/case-admin { case_id }]} } - pretty_name { - label {[_ simulation.Simulation]} - orderby upper(w.pretty_name) + num_roles { + label {[_ simulation.Roles]} + orderby num_roles } + status { + label {[_ simulation.Status]} + orderby status + } } template::list::create \ -name cases \ -multirow cases \ -no_data [_ simulation.lt_You_are_not_administe] \ + -orderby_name case_admin_order \ -elements $elements db_multirow cases select_cases " select wc.case_id, sc.label, - w.pretty_name + w.pretty_name, + case when (select count(*) + from workflow_case_enabled_actions wcea + where wcea.case_id = wc.case_id) = 0 then 'Completed' + else 'Active' + end as status, + (select count(*) + from workflow_roles wr + where wr.workflow_id = w.workflow_id) as num_roles from workflow_cases wc, sim_cases sc, workflows w, @@ -43,5 +64,5 @@ and sc.sim_case_id = wc.object_id and w.workflow_id = ao.object_id and ao.creation_user = :user_id - order by w.workflow_id, wc.case_id + [template::list::orderby_clause -orderby -name "cases"] " Index: openacs-4/packages/simulation/lib/cases.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/cases.tcl,v diff -u -N -r1.16.2.1 -r1.16.2.2 --- openacs-4/packages/simulation/lib/cases.tcl 18 Mar 2004 14:40:24 -0000 1.16.2.1 +++ openacs-4/packages/simulation/lib/cases.tcl 30 Nov 2004 21:47:47 -0000 1.16.2.2 @@ -13,13 +13,13 @@ set package_id [ad_conn package_id] set elements { + pretty_name { + label {[_ simulation.Simulation]} + } label { label {[_ simulation.Case]} link_url_eval {[export_vars -base "[ad_conn package_url]simplay/case" { case_id role_id }]} } - pretty_name { - label {[_ simulation.Simulation]} - } role_pretty { label {[_ simulation.Role]} } Index: openacs-4/packages/simulation/lib/messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/messages.tcl,v diff -u -N -r1.16.2.6 -r1.16.2.7 --- openacs-4/packages/simulation/lib/messages.tcl 1 Jun 2004 14:51:45 -0000 1.16.2.6 +++ openacs-4/packages/simulation/lib/messages.tcl 30 Nov 2004 21:47:47 -0000 1.16.2.7 @@ -36,6 +36,14 @@ } set elements { + sim_name { + label {[_ simulation.Simulation]} + hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + } + case_label { + label {[_ simulation.Case]} + hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} + } from { label {[_ simulation.From]} } @@ -54,14 +62,6 @@ label {[_ simulation.Attachments]} html { align center } } - case_label { - label {[_ simulation.Case]} - hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} - } - sim_name { - label {[_ simulation.Simulation]} - hide_p {[ad_decode [exists_and_not_null case_id] 1 1 0]} - } } set extend { message_url creation_date_pretty } @@ -75,7 +75,18 @@ lappend extend body } -if { [exists_and_not_null case_id] && [exists_and_not_null role_id] } { +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.Send_new_message] [export_vars -base message { case_id role_id }] {}] } else { set actions [list] @@ -96,19 +107,23 @@ w.pretty_name as sim_name, sm.creation_date, to_char(sm.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date_ansi, - (select scx.title + (select wr.pretty_name || ' (' || scx.title || ')' as from from sim_roles fr, sim_charactersx scx, - cr_items ci + cr_items ci, + workflow_roles wr where fr.role_id = sm.from_role_id + and fr.role_id = wr.role_id and scx.item_id = fr.character_id and ci.item_id = scx.item_id and ci.live_revision = scx.object_id) as from, - (select scx.title + (select wr.pretty_name || ' (' || scx.title || ')' as to from sim_roles tr, sim_charactersx scx, - cr_items ci + cr_items ci, + workflow_roles wr where tr.role_id = sm.to_role_id + and tr.role_id = wr.role_id and scx.item_id = tr.character_id and ci.item_id = scx.item_id and ci.live_revision = scx.object_id) as to, @@ -145,4 +160,4 @@ if { $show_body_p } { set body [ad_html_text_convert -from $mime_type -to "text/plain" $content] } -} +} \ No newline at end of file Index: openacs-4/packages/simulation/lib/object-display.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/object-display.adp,v diff -u -N -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/simulation/lib/object-display.adp 18 Mar 2004 09:47:59 -0000 1.7.2.1 +++ openacs-4/packages/simulation/lib/object-display.adp 30 Nov 2004 21:47:47 -0000 1.7.2.2 @@ -1,15 +1,26 @@ - + + + + + + @page_title;noquote@ @context;noquote@ - - - @content_html;noquote@ - -

- #simulation.Edit# -

+ + +

+ #simulation.Edit# +

+
+ + +

+ #simulation.Send_a_message_to# @page_title@ +

+
+
\ No newline at end of file Index: openacs-4/packages/simulation/lib/object-display.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/object-display.tcl,v diff -u -N -r1.14 -r1.14.2.1 --- openacs-4/packages/simulation/lib/object-display.tcl 5 Mar 2004 10:47:45 -0000 1.14 +++ openacs-4/packages/simulation/lib/object-display.tcl 30 Nov 2004 21:47:47 -0000 1.14.2.1 @@ -7,19 +7,33 @@ } { revision_id:optional,naturalnum {printer_friendly_p:optional 0} + case_id:optional + role_id:optional + recipient_role_id:optional } set package_id [ad_conn package_id] +set package_url [ad_conn package_url] + set root_id [bcms::folder::get_id_by_package_id -parent_id 0] +set base_url [ad_conn urlv] + +set simplay 1 +if { [lsearch -exact $base_url "simplay"] == -1 } { + set simplay 0 +} + # This little exercise removes the object/ part from the extra_url -set extra_url [eval file join [lrange [file split [ad_conn extra_url]] 1 end]] +# Let's just use path_info +# set extra_url [eval file join [lrange [file split [ad_conn extra_url]] 1 end]] +set extra_url [ad_conn path_info] if { [empty_string_p $extra_url] } { set extra_url "index" } -# get the item by url if now revision id is given +# get the item by url if no revision id is given if { ![info exists revision_id] } { array set item [bcms::item::get_item_by_url -root_id $root_id -url $extra_url -revision live] } else { @@ -79,6 +93,28 @@ set page_title $item(title) set context [list $page_title] +set recipient_p 0 + +# We are in simplay/object, so we need stuff for the control and context bars +if { $simplay } { + # We do have case_id, it's required by simplay/object/index.vuh + simulation::case::get -case_id $case_id -array case + set section_uri [apm_package_url_from_id $package_id]simplay/ + set case_url [export_vars -base ${section_uri}case { case_id role_id }] + + if { [exists_and_not_null recipient_role_id] } { + set role_name [simulation::role::get_element -role_id $recipient_role_id -element pretty_name] + set recipient_p 1 + set message_url [export_vars -base ../message { role_id case_id recipient_role_id }] + set page_title "${item(title)} (${role_name})" + } + + set context [list [list $section_uri [_ simulation.SimPlay]] [list $case_url $case(label)] $page_title] + +} + + + foreach name [lsort [array names content]] { multirow append attributes $name $content($name) } Index: openacs-4/packages/simulation/lib/portfolio.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.adp,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/lib/portfolio.adp 19 Dec 2003 13:39:33 -0000 1.1 +++ openacs-4/packages/simulation/lib/portfolio.adp 30 Nov 2004 21:47:47 -0000 1.1.2.1 @@ -1 +1,2 @@ -

+ +

#simulation.lt_Right-click_document_#

Index: openacs-4/packages/simulation/lib/portfolio.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/portfolio.tcl,v diff -u -N -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"] } Index: openacs-4/packages/simulation/lib/sim-insts-grouped.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-insts-grouped.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/lib/sim-insts-grouped.tcl 12 Jan 2004 13:24:57 -0000 1.3 +++ openacs-4/packages/simulation/lib/sim-insts-grouped.tcl 30 Nov 2004 21:47:47 -0000 1.3.2.1 @@ -23,14 +23,14 @@ template::list::create \ -name sims \ -multirow sims \ - -actions "{New Simulation From Template} $add_url" \ - -no_data "You have no Simulations in Development or Casting" \ + -actions "{[_ simulation.lt_New_Simulation_From_T]} $add_url" \ + -no_data "[_ simulation.lt_You_have_no_Simulatio]" \ -elements { status { - label "Status" + label "[_ simulation.Status]" } count { - label "Count" + label "[_ simulation.Count]" } } Index: openacs-4/packages/simulation/lib/sim-objects-grouped.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-objects-grouped.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/simulation/lib/sim-objects-grouped.tcl 12 Jan 2004 11:35:33 -0000 1.2 +++ openacs-4/packages/simulation/lib/sim-objects-grouped.tcl 30 Nov 2004 21:47:47 -0000 1.2.2.1 @@ -5,6 +5,7 @@ @creation-date 2003-11-12 @cvs-id $Id$ } { + sog_orderby { required_p 0 } } ###################################################################### @@ -32,7 +33,7 @@ set add_url [export_vars -base "[ad_conn package_url]citybuild/object-edit" { parent_id }] if { $create_p } { - set actions "{Add an object} $add_url" + set actions "{[_ simulation.Add_an_object]} $add_url" } else { set actions "" } @@ -41,11 +42,11 @@ # Set basic elements list set elements { pretty_name { - label "Type" + label "[_ simulation.Type]" orderby upper(ot.pretty_name) } count { - label "Number" + label "[_ simulation.Number]" orderby count } } @@ -55,6 +56,7 @@ -name objects \ -multirow objects \ -actions $actions \ + -orderby_name sog_orderby \ -elements $elements #--------------------------------------------------------------------- Index: openacs-4/packages/simulation/lib/sim-objects.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-objects.tcl,v diff -u -N -r1.13 -r1.13.2.1 --- openacs-4/packages/simulation/lib/sim-objects.tcl 29 Jan 2004 15:12:48 -0000 1.13 +++ openacs-4/packages/simulation/lib/sim-objects.tcl 30 Nov 2004 21:47:47 -0000 1.13.2.1 @@ -74,6 +74,11 @@ orderby r.title link_url_col view_url } + name { + label "URI" + orderby lower(i.name) + } + } #--------------------------------------------------------------------- @@ -120,7 +125,7 @@ Edit + width="16" border="0" alt="Delete"> } } @@ -167,6 +172,9 @@ set edit_p [expr $write_p || [permission::write_permission_p -object_id $item_id]] switch -glob $mime_type { + text/calendar - text/rtf { + set view_url [simulation::object::content_url -name $name] + } text/* - {} { set view_url [simulation::object::url -name $name] } Index: openacs-4/packages/simulation/lib/sim-template-states.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-states.tcl,v diff -u -N -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/simulation/lib/sim-template-states.tcl 1 Jun 2004 14:18:08 -0000 1.4.2.1 +++ openacs-4/packages/simulation/lib/sim-template-states.tcl 30 Nov 2004 21:47:47 -0000 1.4.2.2 @@ -79,9 +79,9 @@ set edit_url [export_vars -base "[ad_conn package_url]simbuild/state-edit" { state_id { return_url [ad_return_url] } }] set delete_url [export_vars -base "[ad_conn package_url]simbuild/state-delete" { state_id { return_url [ad_return_url] } }] if { $counter > 1 } { - set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction up } { return_url [ad_return_url] } }] + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction up } { return_url [ad_return_url] } { parent_action_id $parent_action_id } }] } - set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction down } { return_url [ad_return_url] } }] + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type state } state_id { direction down } { return_url [ad_return_url] } { parent_action_id $parent_action_id } }] } # Get rid of the last down_url Index: openacs-4/packages/simulation/lib/sim-template-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-template-tasks.tcl,v diff -u -N -r1.39.2.3 -r1.39.2.4 --- openacs-4/packages/simulation/lib/sim-template-tasks.tcl 1 Jun 2004 14:18:08 -0000 1.39.2.3 +++ openacs-4/packages/simulation/lib/sim-template-tasks.tcl 30 Nov 2004 21:47:47 -0000 1.39.2.4 @@ -30,7 +30,7 @@ #------------------------------------------------------------- if { $display_mode == "edit"} { - set list_actions [list "Add a Task" [export_vars -base task-edit { workflow_id parent_action_id {return_url "[ad_return_url]\#tasks" } }] {}] + set list_actions [list "Add a Task" [export_vars -base task-edit { workflow_id parent_action_id {return_url "[ad_return_url]" } }] {}] } else { set list_actions [list] } @@ -221,11 +221,11 @@ order by wa.sort_order " { incr counter - set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" -anchor tasks { action_id {return_url "[ad_return_url]\#tasks"} }] - set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" -anchor tasks { action_id {return_url "[ad_return_url]\#tasks"}}] + set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" -anchor tasks { action_id {return_url "[ad_return_url]"} }] + set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-edit" -anchor tasks { action_id {return_url "[ad_return_url]"}}] set delete_url \ - [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id {return_url "[ad_return_url]\#tasks"} }] - set copy_url [export_vars -base task-copy { action_id {return_url "[ad_return_url]\#tasks"} }] + [export_vars -base "[apm_package_url_from_id $package_id]simbuild/task-delete" { action_id workflow_id {return_url "[ad_return_url]"} }] + set copy_url [export_vars -base task-copy { action_id workflow_id {return_url "[ad_return_url]"} }] set assigned_role_edit_url \ [export_vars -base "[apm_package_url_from_id $package_id]simbuild/role-edit" { { role_id $assigned_role } }] @@ -239,9 +239,9 @@ } else { set state_$state_id enabled } - set state_${state_id}_url [export_vars -base task-enabled-in-state-update { action_id state_id { enabled_p f } { return_url {[ad_return_url]\#tasks} } }] + set state_${state_id}_url [export_vars -base task-enabled-in-state-update { action_id state_id { enabled_p f } { return_url {[ad_return_url]} } }] } else { - set state_${state_id}_url [export_vars -base task-enabled-in-state-update { action_id state_id { return_url {[ad_return_url]\#tasks} } }] + set state_${state_id}_url [export_vars -base task-enabled-in-state-update { action_id state_id { return_url {[ad_return_url]} } }] } if { $new_state == $state_id } { @@ -250,9 +250,9 @@ } if { $counter > 1 } { - set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url "[ad_return_url]\#tasks" } }] + set up_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction up } { return_url "[ad_return_url]" } { parent_action_id $parent_action_id } }] } - set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url "[ad_return_url]\#tasks" } }] + set down_url [export_vars -base "[ad_conn package_url]simbuild/template-object-reorder" { { type action } action_id { direction down } { return_url "[ad_return_url]" } { parent_action_id $parent_action_id } }] switch $trigger_type { workflow - parallel - dynamic { Index: openacs-4/packages/simulation/lib/sim-templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/sim-templates.tcl,v diff -u -N -r1.18 -r1.18.2.1 --- openacs-4/packages/simulation/lib/sim-templates.tcl 23 Jan 2004 11:11:28 -0000 1.18 +++ openacs-4/packages/simulation/lib/sim-templates.tcl 30 Nov 2004 21:47:53 -0000 1.18.2.1 @@ -9,6 +9,7 @@ allowed_values {short long} default_value long } + sb_orderby { required_p 0 } } set package_id [ad_conn package_id] @@ -17,22 +18,22 @@ set create_p [permission::permission_p -object_id $package_id -privilege sim_template_create] set package_admin_p [permission::permission_p -object_id $package_id -privilege admin] -set actions [list "Add a template" $add_url {} \ - "Import a template" "[apm_package_url_from_id $package_id]simbuild/template-load" {}] +set actions [list "[_ simulation.Add_a_template]" $add_url {} \ + "[_ simulation.Import_a_template]" "[apm_package_url_from_id $package_id]simbuild/template-load" {}] switch $size { short { set elements { name { - label "Template" + label "[_ simulation.Template]" link_url_col edit_url - orderby upper(ot.pretty_name) + orderby upper(w.pretty_name) } role_count { - label "Roles" + label "[_ simulation.Roles]" } task_count { - label "Tasks" + label "[_ simulation.Tasks]" } } } @@ -42,54 +43,54 @@ sub_class narrow display_template { - - Edit + + [_ simulation.Edit] } } name { - label "Template Name" - orderby upper(ot.pretty_name) + label "[_ simulation.Template_Name]" + orderby upper(w.pretty_name) link_url_col view_url } description { - label "Description" - orderby r.description + label "[_ simulation.Description]" + orderby description display_template {@sim_templates.description;noquote@} } created_by { - label "Created by" - orderby r.createdby + label "[_ simulation.Created_by]" + orderby created_by } role_count { - label "Roles" + label "[_ simulation.Roles]" } task_count { - label "Tasks" + label "[_ simulation.Tasks]" } sim_type { - label "Ready" + label "[_ simulation.Ready]" display_eval {[ad_decode $sim_type "ready_template" "Yes" "No"]} } copy { sub_class narrow display_template { - Copy + [_ simulation.Copy] } link_url_col clone_url - link_html { title "Clone this template" } + link_html { title "[_ simulation.Clone_this_template]" } } delete { sub_class narrow link_url_col delete_url link_html { - title "Delete this template" - onclick "return confirm('Are you sure you want to delete template @sim_templates.name@?');" + title "[_ simulation.Delete_this_template]" + onclick "return confirm('[_ simulation.lt_Are_you_sure_you_want_2] @sim_templates.name@?');" } display_template { - Delete + [_ simulation.Delete] } } @@ -101,6 +102,7 @@ -name sim_templates \ -multirow sim_templates \ -actions $actions \ + -orderby_name sb_orderby \ -elements $elements @@ -119,7 +121,7 @@ db_multirow -extend { edit_url view_url delete_url clone_url edit_p } sim_templates select_sim_templates " select w.workflow_id, w.pretty_name as name, - w.description, + w.description as description, w.description_mime_type, ss.sim_type, (select p.first_names || ' ' || p.last_name @@ -143,9 +145,9 @@ " { set description [ad_html_text_convert -from $description_mime_type -maxlen 200 -- $description] - set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" { workflow_id }] + set edit_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-sim-type-update" { workflow_id { sim_type "dev_template" } }] - set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-edit" { workflow_id }] + set view_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-sim-type-update" { workflow_id { sim_type "dev_template" } }] set clone_url [export_vars -base "[apm_package_url_from_id $package_id]simbuild/template-clone" { workflow_id }] Index: openacs-4/packages/simulation/lib/simulations-available.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/simulations-available.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/simulation/lib/simulations-available.tcl 15 Jan 2004 14:56:26 -0000 1.4 +++ openacs-4/packages/simulation/lib/simulations-available.tcl 30 Nov 2004 21:47:53 -0000 1.4.2.1 @@ -8,35 +8,39 @@ party_id { default_value "" } + as_orderby { + required_p 0 + } } set package_id [ad_conn package_id] set user_id [ad_conn user_id] set elements { pretty_name { - label "Simulation" + label "[_ simulation.Simulation]" orderby upper(w.pretty_name) } description { - label "Description" + label "[_ simulation.Description]" display_template { @avail_sims.description;noquote@ } } enroll { - label "Join" + label "[_ simulation.Join]" display_template { - Join + [_ simulation.Join] } } } template::list::create \ -name avail_sims \ + -orderby_name as_orderby \ -multirow avail_sims \ - -no_data "No simulations available to join." \ + -no_data "[_ simulation.lt_No_simulations_availa]" \ -elements $elements db_multirow -extend { enroll_url } avail_sims select_avail_sims " Index: openacs-4/packages/simulation/lib/template-clone.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/template-clone.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/lib/template-clone.tcl 23 Jan 2004 14:31:36 -0000 1.1 +++ openacs-4/packages/simulation/lib/template-clone.tcl 30 Nov 2004 21:47:53 -0000 1.1.2.1 @@ -1,9 +1,11 @@ simulation::template::get -workflow_id $workflow_id -array simulation -set pretty_name "Clone of $simulation(pretty_name)" +set pretty_name "Copy of $simulation(pretty_name)" -ad_form -name clone -export { workflow_id } -edit_buttons [list [list "Clone" ok]] -form { +ad_form -name clone \ + -cancel_url [util_current_location][util_current_directory] \ + -export { workflow_id } -edit_buttons [list [list "Clone" ok]] -form { {pretty_name:text {label "Name"} {html {size 50}} Index: openacs-4/packages/simulation/lib/yellow-pages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/yellow-pages.adp,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/lib/yellow-pages.adp 9 Mar 2004 17:04:23 -0000 1.3 +++ openacs-4/packages/simulation/lib/yellow-pages.adp 30 Nov 2004 21:47:53 -0000 1.3.2.1 @@ -1,3 +1,8 @@ + + +

Search filter: @search_terms@

+
+

Index: openacs-4/packages/simulation/lib/yellow-pages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/yellow-pages.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/lib/yellow-pages.tcl 10 Mar 2004 10:13:46 -0000 1.6 +++ openacs-4/packages/simulation/lib/yellow-pages.tcl 30 Nov 2004 21:47:53 -0000 1.6.2.1 @@ -6,6 +6,10 @@ @author Joel Aufrecht @creation-date 2003-11-12 @cvs-id $Id$ +} { + yp_orderby { required_p 0 } + case_id { required_p 0 } + role_id { required_p 0 } } ###################################################################### @@ -22,17 +26,30 @@ search_terms:optional } +if { ![exists_and_not_null search_terms] } { + set search_terms "" +} +set base_url [ad_conn urlv] + +set simplay 1 +if { [lsearch -exact $base_url "simplay"] == -1 } { + set simplay 0 +} + +set cancel_url [export_vars -base "./yellow-pages" { case_id role_id }] + ad_form -name search -form { - {search_terms:text,optional {label "Restrict to items matching word or phrase"}} + {search_terms:text,optional {label "[_ simulation.lt_Restrict_to_items_mat]"}} +} -export { case_id role_id } -validate { {search_terms {[string length $search_terms] >= 3} - "\"search_terms\" must be a string containing three or more characters" + {[_ simulation.lt_search_terms_must_be_]} } } -method GET -on_submit { # foobar -} +} -cancel_url $cancel_url -cancel_label "[_ simulation.Clear_filter]" ###################################################################### @@ -45,18 +62,18 @@ # Set basic elements list set elements { object_type { - label "Type" - orderby upper(ot.pretty_name) + label "[_ simulation.Type]" + orderby object_type_pretty display_col object_type_pretty } title { - label "Name" - orderby r.title + label "[_ simulation.Name]" + orderby title link_url_col view_url } description { - label "Description" - orderby r.description + label "[_ simulation.Description]" + orderby description } } @@ -65,6 +82,8 @@ template::list::create \ -name objects \ -multirow objects \ + -orderby_name yp_orderby \ + -filters { role_id {} case_id {} search_terms {} } \ -elements $elements #--------------------------------------------------------------------- @@ -87,11 +106,11 @@ select sl.object_id, sl.object_type, ot.pretty_name as object_type_pretty, - sl.title, + sl.title as title, sl.mime_type, sl.name, sl.item_id, - sl.description + sl.description as description from sim_locationsx sl, cr_items ci, acs_object_types ot, @@ -105,11 +124,11 @@ select sc.object_id, sc.object_type, ot.pretty_name as object_type_pretty, - sc.title, + sc.title as title, sc.mime_type, sc.name, sc.item_id, - sc.description + sc.description as description from sim_charactersx sc, cr_items ci, acs_object_types ot, @@ -125,7 +144,11 @@ set description [string_truncate -len 200 $description] switch -glob $mime_type { text/* - {} { - set view_url [simulation::object::url -name $name] + if { $simplay } { + set view_url [export_vars -base [simulation::object::url -name $name -simplay $simplay] { case_id role_id } ] + } else { + set view_url [simulation::object::url -name $name] + } } default { set view_url [simulation::object::content_url -name $name] Index: openacs-4/packages/simulation/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/apm-callback-procs.tcl,v diff -u -N -r1.14.2.1 -r1.14.2.2 --- openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 17 Mar 2004 12:41:45 -0000 1.14.2.1 +++ openacs-4/packages/simulation/tcl/apm-callback-procs.tcl 30 Nov 2004 21:47:55 -0000 1.14.2.2 @@ -11,6 +11,10 @@ ad_proc -private simulation::apm::after_install {} { simulation::notification::xml_map::register simulation::notification::message::register + + cr_create_mime_type -extension rtf -mime_type {text/rtf} -description "RTF - Rich Text Format" + cr_create_mime_type -extension ics -mime_type {text/calendar} -description "iCal Calendar" + } ad_proc -private simulation::apm::before_uninstall {} { @@ -81,7 +85,6 @@ "Sim Admins" {sim_admin} "Template Authors" {sim_template_creator sim_inst sim_object_create} "Case Authors" {sim_inst sim_object_create sim_adminplayer} - "Service Admins" {} "City Admins" {sim_set_map_p sim_object_writer} "Actors" {} } { @@ -95,10 +98,6 @@ permission::grant -party_id $permission_group_id -object_id $package_id -privilege $privilege } - # Grant subsite admin to the admin groups so that they can admin groups - if { [string equal $group_name "Sim Admins"] || [string equal $group_name "Service Admins"] } { - permission::grant -party_id $permission_group_id -object_id $subsite_package_id -privilege admin - } } Index: openacs-4/packages/simulation/tcl/object-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/object-procs.tcl,v diff -u -N -r1.12 -r1.12.2.1 --- openacs-4/packages/simulation/tcl/object-procs.tcl 9 Mar 2004 17:04:24 -0000 1.12 +++ openacs-4/packages/simulation/tcl/object-procs.tcl 30 Nov 2004 21:47:56 -0000 1.12.2.1 @@ -19,6 +19,7 @@ {-package_id ""} {-name:required} {-mime_type ""} + {-simplay ""} } { The URL for the page displaying contents and name of an item. @@ -29,9 +30,17 @@ set package_id [ad_conn package_id] set package_url "[ad_url][apm_package_url_from_id $package_id]" } + + if { [empty_string_p $simplay] } { + set simplay 0 + } if { [empty_string_p $mime_type] || [string match "text/*" $mime_type] } { - return "${package_url}object/${name}" + if { !$simplay } { + return "${package_url}object/${name}" + } else { + return "${package_url}simplay/object/${name}" + } } else { return "${package_url}object-content/${name}" } Index: openacs-4/packages/simulation/tcl/sim-action-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/sim-action-procs.tcl,v diff -u -N -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/simulation/tcl/sim-action-procs.tcl 16 Mar 2004 16:16:18 -0000 1.7.2.1 +++ openacs-4/packages/simulation/tcl/sim-action-procs.tcl 30 Nov 2004 21:47:56 -0000 1.7.2.2 @@ -87,7 +87,7 @@ # Handle columns in the sim_tasks table foreach attr { - attachment_num + attachment_num default_text default_text_mime_type } { if { [info exists row($attr)] } { set varname attr_$attr @@ -136,6 +136,16 @@ } } + switch $operation { + update { + if { [info exists row(trigger_type)] } { + if { [empty_string_p $row(trigger_type)] } { + unset row(trigger_type) + } + } + } + } + db_transaction { # Base row set action_id [workflow::action::fsm::edit \ @@ -224,7 +234,7 @@ } db_1row select_action { - select attachment_num + select attachment_num, default_text, default_text_mime_type from sim_tasks where task_id = :action_id } -column_array local_row @@ -283,10 +293,22 @@ } array set row [workflow::action::fsm::generate_spec -action_id $action_id -handlers $handlers] + ############ + # DEBUGGING + if { [exists_and_not_null row(parent_action_id)] } { + ns_log notice "simulation::action::generate_spec: row(parent_action_id) is $row(parent_action_id)" + } else { + ns_log notice "simulation::action::generate_spec: no paren_action_id in sight :(" + } + # STOP DEBUGGING + ############### + + # Get local spec, remove unwanted entries get -action_id $action_id -array local_row -local_only array unset local_row recipients + # Copy local stuff in over the parent stuff array set row [array get local_row] @@ -363,6 +385,10 @@ set action_spec(pretty_name) "Copy of $action_spec(pretty_name)" + if { [exists_and_not_null action(parent_action_id)] } { + set action_spec(parent_action_id) $action(parent_action_id) + } + foreach type { child_actions child_states child_roles } { if { [info exists action_spec($type)] } { unset action_spec($type) Index: openacs-4/packages/simulation/tcl/sim-case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/sim-case-procs.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/tcl/sim-case-procs.tcl 19 Jan 2004 17:45:27 -0000 1.6 +++ openacs-4/packages/simulation/tcl/sim-case-procs.tcl 30 Nov 2004 21:47:56 -0000 1.6.2.1 @@ -167,3 +167,23 @@ } return 1 } + +ad_proc -public simulation::case::complete_p { + {-case_id:required} +} { + Checks if the case has been completed. + + @param case_id The ID of the case + + @return 1 if the case has been completed, 0 otherwise + + @author Jarkko Laine (jarkko@jlaine.net) +} { + set num_enabled_actions [db_string select_num_enabled_actions { + select count(*) + from workflow_case_enabled_actions + where case_id = :case_id + }] + + return [expr $num_enabled_actions == 0] +} \ No newline at end of file Index: openacs-4/packages/simulation/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/template-procs.tcl,v diff -u -N -r1.66.2.10 -r1.66.2.11 --- openacs-4/packages/simulation/tcl/template-procs.tcl 14 Apr 2004 10:19:13 -0000 1.66.2.10 +++ openacs-4/packages/simulation/tcl/template-procs.tcl 30 Nov 2004 21:47:56 -0000 1.66.2.11 @@ -1324,17 +1324,12 @@ } # 3. Tasks - set prop_empty_count [db_string prop_empty_count { - select sum((select count(*) from sim_task_object_map where task_id = wa.action_id) - st.attachment_num) - from sim_tasks st, - workflow_actions wa - where st.task_id = wa.action_id - and wa.workflow_id = :workflow_id - }] - if { $prop_empty_count == 0 } { - set tab_complete_p(map-tasks) 1 - } + # Jarkko: I took away the check because the attachments shouldn't + # be obligatory + set tab_complete_p(map-tasks) 1 + + # 4. Participants set num_parties [db_string num_parties { select count(*) from sim_party_sim_map where simulation_id = :workflow_id}] if { [string equal $sim_template(enroll_type) "open"] || $num_parties > 0 } { @@ -1513,3 +1508,46 @@ and pamm.member_id = :user_id }] } + +ad_proc -public simulation::template::check_init_p { + {-workflow_id:required} +} { + Checks that given simulation template and all its subworkflows + and parallel tasks have an initial action. Returns 1 if everything + is ok and 0 if an init action is missing. + + @param workflow_id ID of simulation template. +} { + set ret_val 1 + + if { ![db_string get_init " + select count(*) + from workflow_actions + where workflow_id = :workflow_id and + trigger_type = 'init' and + parent_action_id is null"] } { + return 0 + } + + db_foreach get_subworkflows { + select action_id + from workflow_actions + where workflow_id = :workflow_id and + trigger_type in ('workflow') + } { + if { ![db_string get_sub_init " + select count(*) + from workflow_actions + where workflow_id = :workflow_id and + trigger_type = 'init' and + parent_action_id = :action_id"] } { + set ret_val 0 + break + } + } + + return $ret_val +} + + + Index: openacs-4/packages/simulation/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/ui-procs.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/simulation/tcl/ui-procs.tcl 30 Jan 2004 11:23:25 -0000 1.5 +++ openacs-4/packages/simulation/tcl/ui-procs.tcl 30 Nov 2004 21:48:01 -0000 1.5.2.1 @@ -27,7 +27,10 @@ } } -ad_proc -public simulation::ui::forms::document_upload::documents_element_value { action_id } { +ad_proc -public simulation::ui::forms::document_upload::documents_element_value { + {-content_p:boolean {0}} + action_id +} { Get a piece of HTML with links to documents for the documents form element. } { set documents "
    " @@ -44,8 +47,13 @@ and cr.revision_id = ci.live_revision order by m.order_n } { - set object_url [simulation::object::url \ - -name $object_name] + if { !$content_p } { + set object_url [simulation::object::url \ + -name $object_name] + } else { + set object_url [simulation::object::content_url \ + -name $object_name] + } append documents "
  • $object_title
  • " } @@ -54,7 +62,36 @@ return $documents } +ad_proc -public simulation::ui::forms::document_upload::documents_element_value_content { + action_id +} { + Get a piece of HTML with links to documents' content for the documents form element. +} { + set documents "
      " + + db_foreach documents { + select cr.title as object_title, + ci.name as object_name + from sim_task_object_map m, + cr_items ci, + cr_revisions cr + where m.task_id = :action_id + and m.relation_tag = 'attachment' + and ci.item_id = m.object_id + and cr.revision_id = ci.live_revision + order by m.order_n + } { + set object_url [simulation::object::content_url \ + -name $object_name] + append documents "
    • $object_title
    • " + } + append documents "
    " + + return $documents +} + + ad_proc -public simulation::ui::forms::document_upload::insert_document { case_id role_id @@ -103,3 +140,56 @@ } } } + +ad_proc -public simulation::ui::forms::document_upload::check_mime { + -document_file +} { + Checks that the mime type of the given file can be found in the cr_mime_types + table. Using this avoids bombs later on in the upload process + + @param document_file the file being uploaded + + @author Jarkko Laine (jarkko@jlaine.net) +} { + set upload_filename [template::util::file::get_property filename $document_file] + + if { ![exists_and_not_null mime_type] } { + set mime_type [template::util::file::get_property mime_type $document_file] + } + + ns_log notice "check_mime(1): mime_type is <$mime_type>" + + if { ![exists_and_not_null mime_type] } { + set mime_type [cr_filename_to_mime_type -create $upload_filename] + } + + ns_log notice "check_mime(2): mime_type is <$mime_type>" + + set mime_count [db_string get_mime { + select count(*) from cr_mime_types where mime_type = :mime_type}] + + if { $mime_count > 0 } { + return 1 + } else { + return 0 + } +} + +ad_proc -public simulation::ui::forms::document_upload::add_mime { + -document_file +} { + Tries to add the mime type of a file to cr_mime_types unless + it already exists there. + + @param document_file the file being uploaded + + @author Jarkko Laine (jarkko@jlaine.net) +} { + set upload_filename [template::util::file::get_property filename $document_file] + set extension [string tolower [string trimleft [file extension $upload_filename] "."]] + set orig_mime_type [template::util::file::get_property mime_type $document_file] + + ns_log notice "add_mime: mime_type is <$orig_mime_type>" + + cr_create_mime_type -extension $extension -mime_type $orig_mime_type +} \ No newline at end of file Index: openacs-4/packages/simulation/tcl/test/simulation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/test/simulation-procs.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/simulation/tcl/test/simulation-procs.tcl 18 Nov 2003 13:31:33 -0000 1.4 +++ openacs-4/packages/simulation/tcl/test/simulation-procs.tcl 30 Nov 2004 21:48:04 -0000 1.4.2.1 @@ -12,6 +12,7 @@ procs. } { aa_log [simulation::object::url -name "test_name"] + aa_log [simulation::object::url -name "test_name_2" -simplay 1] aa_log [simulation::object::content_url -name "test_name"] } Index: openacs-4/packages/simulation/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.adp,v diff -u -N -r1.30.2.3 -r1.30.2.4 --- openacs-4/packages/simulation/www/index.adp 4 May 2004 09:19:10 -0000 1.30.2.3 +++ openacs-4/packages/simulation/www/index.adp 30 Nov 2004 21:48:05 -0000 1.30.2.4 @@ -2,41 +2,4 @@ @page_title;noquote@ @context;noquote@ -
    - -

    CityBuild

    - -
    -
    - -
    - -

    SimBuild

    - -
    -
    - -
    - -

    SimInst

    - -
    -
    - -
    -

    SimPlay

    - -

    Your Current Simulations

    - -
    - - Log in to see your active cases. - -

    -

    Join a Simulation

    - -
    - - + \ No newline at end of file Index: openacs-4/packages/simulation/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.tcl,v diff -u -N -r1.14.2.1 -r1.14.2.2 --- openacs-4/packages/simulation/www/index.tcl 17 Mar 2004 08:31:49 -0000 1.14.2.1 +++ openacs-4/packages/simulation/www/index.tcl 30 Nov 2004 21:48:05 -0000 1.14.2.2 @@ -6,158 +6,6 @@ } -properties { } -set package_id [ad_conn package_id] -set page_title "Simulation" +set page_title "[_ simulation.Simulation_Home]" set context "" -set user_id [auth::get_user_id] -set login_url [ad_get_login_url -return] - -set citybuild_p [permission::permission_p -object_id $package_id -privilege sim_object_create] -set simbuild_p [permission::permission_p -object_id $package_id -privilege sim_template_read] -set siminst_p [permission::permission_p -object_id $package_id -privilege sim_inst] - -###################################################################### -# -# active_cases -# -# a list of active cases for logged-in user -# -###################################################################### - -#--------------------------------------------------------------------- -# active_cases list -#--------------------------------------------------------------------- - -template::list::create \ - -name active_cases \ - -multirow active_cases \ - -html {width "100%"}\ - -elements { - case_name { - label "Case" - orderby case_name - } - task_count { - label "Tasks" - orderby task_count - html { align right } - } - } - -#--------------------------------------------------------------------- -# active_cases database query -#--------------------------------------------------------------------- -# this is currently a dummy query. It should get all cases -# for which the logged-in user has a role, and a count of active tasks -# for that role. - -db_multirow active_cases active_cases_select { - select 'case one' as case_name, - 2 as task_count -} - - -###################################################################### -# -# object_count -# -# A count of all objects in the system, by type, for admins -# -###################################################################### - -#--------------------------------------------------------------------- -# object_count list -#--------------------------------------------------------------------- -if { ![exists_and_not_null parent_id] } { - set parent_id [bcms::folder::get_id_by_package_id -parent_id 0] -} - -set action_list [list "Add an Object" [export_vars -base object-edit { parent_id }] ] - -template::list::create \ - -name object_count \ - -multirow object_count \ - -actions $action_list \ - -html {width "100%"} \ - -elements { - type { - label "Type" - } - count { - label "Count" - link_url_col view_url - html { align right } - } - } - -#--------------------------------------------------------------------- -# object_count database query -#--------------------------------------------------------------------- -# this query should be package-sensitive. Not sure how to do that - -# should it return only items in folders associated with the package id? -# if so, how do we also count items in child folders? - -db_multirow -extend { view_url } object_count object_count_select " - select content_type as type, - count(content_type) as count - from cr_items - where content_type like 'sim_%' - or content_type like 'image' - or content_type like 'stylesheet' - group by content_type -" { - set view_url [export_vars -base "citybuild/" { type }] -} - - -###################################################################### -# -# sim_template_count -# -# A count of all templates, for admins -# They should probably be grouped, but I'm not sure what to group -# them by yet -# -###################################################################### - -#--------------------------------------------------------------------- -# sim_template_count list -#--------------------------------------------------------------------- - -template::list::create \ - -name sim_template_count \ - -multirow sim_template_count \ - -html {width "100%"} \ - -elements { - count { - label "Simulation Templates" - link_url_col view_url - } - } - - - -template::list::create \ - -name template_count \ - -multirow template_count \ - -elements { - type { - label "Type" - } - count { - label "Count" - link_url_col view_url - } - } - -#--------------------------------------------------------------------- -# template_count database query -#--------------------------------------------------------------------- - -db_multirow -extend { view_url } sim_template_count sim_template_count_query " - select count(workflow_id) as count - from workflows w -" { - set view_url [export_vars -base "simbuild/"] -} Index: openacs-4/packages/simulation/www/map-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/map-master.adp,v diff -u -N -r1.7.2.2 -r1.7.2.3 --- openacs-4/packages/simulation/www/map-master.adp 4 May 2004 09:19:10 -0000 1.7.2.2 +++ openacs-4/packages/simulation/www/map-master.adp 30 Nov 2004 21:48:05 -0000 1.7.2.3 @@ -7,12 +7,14 @@ -
    + - -
    Placeholder for flash map
    +
    Index: openacs-4/packages/simulation/www/map-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/map-master.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/simulation/www/map-master.tcl 18 Nov 2003 09:44:31 -0000 1.2 +++ openacs-4/packages/simulation/www/map-master.tcl 30 Nov 2004 21:48:05 -0000 1.2.2.1 @@ -1,3 +1,5 @@ set package_id [ad_conn package_id] set return_url [ad_return_url] set parameters_url [export_vars -base "/shared/parameters" {package_id return_url}] + +set map_help_url [ad_conn url]object/[parameter::get -package_id $package_id -parameter MapHelpFile] \ No newline at end of file Index: openacs-4/packages/simulation/www/map.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/map.adp,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/map.adp 17 Dec 2003 08:47:15 -0000 1.1 +++ openacs-4/packages/simulation/www/map.adp 30 Nov 2004 21:48:05 -0000 1.1.2.1 @@ -5,14 +5,13 @@ id="map" ALIGN="" alt="Flash map of the city"> - + - - - \ No newline at end of file + \ No newline at end of file Index: openacs-4/packages/simulation/www/simulation-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simulation-master.adp,v diff -u -N -r1.10 -r1.10.2.1 --- openacs-4/packages/simulation/www/simulation-master.adp 12 Dec 2003 12:23:35 -0000 1.10 +++ openacs-4/packages/simulation/www/simulation-master.adp 30 Nov 2004 21:48:05 -0000 1.10.2.1 @@ -5,11 +5,9 @@ @focus;noquote@ - + @header_stuff;noquote@ - - - + \ No newline at end of file Index: openacs-4/packages/simulation/www/yellow-pages.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/yellow-pages.adp,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/simulation/www/yellow-pages.adp 16 Dec 2003 14:16:28 -0000 1.5 +++ openacs-4/packages/simulation/www/yellow-pages.adp 30 Nov 2004 21:48:05 -0000 1.5.2.1 @@ -1,7 +1,14 @@ - + @page_title;noquote@ @context;noquote@

    + + + + + + +

    Index: openacs-4/packages/simulation/www/yellow-pages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/yellow-pages.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/yellow-pages.tcl 13 Nov 2003 14:55:25 -0000 1.1 +++ openacs-4/packages/simulation/www/yellow-pages.tcl 30 Nov 2004 21:48:05 -0000 1.1.2.1 @@ -6,7 +6,12 @@ parent_id:optional {orderby "title,asc"} {type:optional} + yp_orderby:optional } +if { ![exists_and_not_null yp_orderby] } { + set yp_orderby 0 +} + set page_title "Yellow Pages" set context [list $page_title] Index: openacs-4/packages/simulation/www/citybuild/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/index.adp,v diff -u -N -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/simulation/www/citybuild/index.adp 22 Mar 2004 15:27:25 -0000 1.6.2.2 +++ openacs-4/packages/simulation/www/citybuild/index.adp 30 Nov 2004 21:48:06 -0000 1.6.2.3 @@ -2,6 +2,8 @@ @page_title;noquote@ @context;noquote@ + +

    @@ -20,3 +22,6 @@
+ \ No newline at end of file Index: openacs-4/packages/simulation/www/citybuild/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/index.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/www/citybuild/index.tcl 30 Jan 2004 09:34:05 -0000 1.6 +++ openacs-4/packages/simulation/www/citybuild/index.tcl 30 Nov 2004 21:48:08 -0000 1.6.2.1 @@ -11,7 +11,10 @@ set page_title "CityBuild" set context [list $page_title] set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set help_url "${package_url}object/[parameter::get -package_id $package_id -parameter CityBuildHelpFile]" + permission::require_permission -object_id $package_id -privilege sim_object_create set admin_p [permission::permission_p -object_id $package_id -privilege admin] Index: openacs-4/packages/simulation/www/citybuild/object-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/object-delete.adp,v diff -u -N -r1.3.2.1 -r1.3.2.2 --- openacs-4/packages/simulation/www/citybuild/object-delete.adp 18 Mar 2004 09:48:00 -0000 1.3.2.1 +++ openacs-4/packages/simulation/www/citybuild/object-delete.adp 30 Nov 2004 21:48:08 -0000 1.3.2.2 @@ -2,10 +2,22 @@ @page_title;noquote@ @context;noquote@ + + +
+

#simulation.Warning#

+ +

#simulation.lt_This_item_is_used_in_# (@wf_string@).

+
+ +

#simulation.lt_This_item_is_related_# (@rel_string@).

+
+

#simulation.lt_Do_not_delete_it_if_y#

+
+
+

#simulation.lt_Are_you_sure_you_want#

#simulation.lt_Yes_delete_the_object#      #simulation.No_cancel# - - Index: openacs-4/packages/simulation/www/citybuild/object-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/object-delete.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/www/citybuild/object-delete.tcl 2 Feb 2004 12:57:02 -0000 1.6 +++ openacs-4/packages/simulation/www/citybuild/object-delete.tcl 30 Nov 2004 21:48:08 -0000 1.6.2.1 @@ -16,8 +16,49 @@ ad_script_abort } + set page_title "Delete object \"$item(title)\"" set context [list [list "." "CityBuild"] $page_title] +set use_workflows [db_list char_use { select wf.pretty_name +from sim_roles sr, workflow_roles wr, workflows wf +where sr.role_id = wr.role_id and + wr.workflow_id = wf.workflow_id and + sr.character_id = :item_id +}] + +set deletable 1 +set wfs 0 +set wf_length [llength $use_workflows] + +if { $wf_length > 0 } { + if { $wf_length > 5 } { + set rest [lrange $use_workflows 5 [expr $wf_length-1]] + set use_workflows [lrange $use_workflows 0 4] + set rest_length [llength $rest] + lappend use_workflows "([_ simulation.and_rest_length_more])" + } + set wf_string [join $use_workflows ", "] + set wfs 1 + set deletable 0 +} + +set relations [db_list relations { +select case when cir.related_object_id = :item_id + then content_item__get_title(cir.item_id) + else content_item__get_title(cir.related_object_id) + end as title +from cr_item_rels cir +where item_id = :item_id or + related_object_id = :item_id +}] + +set rels 0 +if { [llength $relations] > 0 } { + set rel_string [join $relations ", "] + set rels 1 + set deletable 0 +} + set delete_url [export_vars -base [ad_conn url] { item_id return_url { confirm_p 1 } }] set cancel_url $return_url Index: openacs-4/packages/simulation/www/citybuild/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/citybuild/object-edit.tcl,v diff -u -N -r1.24 -r1.24.2.1 --- openacs-4/packages/simulation/www/citybuild/object-edit.tcl 1 Mar 2004 11:06:52 -0000 1.24 +++ openacs-4/packages/simulation/www/citybuild/object-edit.tcl 30 Nov 2004 21:48:08 -0000 1.24.2.1 @@ -556,6 +556,10 @@ lappend attributes [list $attribute_name $value] } + if { [exists_and_not_null content_file] && ![simulation::ui::forms::document_upload::check_mime -document_file $content_file] } { + simulation::ui::forms::document_upload::add_mime -document_file $content_file + } + } -new_data { # TODO B: For now, assume we are always using this to create global objects -- LARS: Not sure what to do on this Index: openacs-4/packages/simulation/www/resources/under-construction.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/resources/under-construction.css,v diff -u -N -r1.3 -r1.3.4.1 --- openacs-4/packages/simulation/www/resources/under-construction.css 17 Oct 2003 11:11:25 -0000 1.3 +++ openacs-4/packages/simulation/www/resources/under-construction.css 30 Nov 2004 21:48:09 -0000 1.3.4.1 @@ -4,3 +4,14 @@ .notloggedin { background-color: silver; } + +.help-link { + float: right; + clear: none; + margin-left: -200px; + margin-top: -30px; +} + +#page-body td { + vertical-align: top; +} \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/index.adp,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/www/simbuild/index.adp 11 Dec 2003 13:21:53 -0000 1.3 +++ openacs-4/packages/simulation/www/simbuild/index.adp 30 Nov 2004 21:48:10 -0000 1.3.2.1 @@ -2,4 +2,15 @@ @page_title;noquote@ @context;noquote@ + + + + + + + + + \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/index.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/www/simbuild/index.tcl 2 Dec 2003 17:24:32 -0000 1.3 +++ openacs-4/packages/simulation/www/simbuild/index.tcl 30 Nov 2004 21:48:10 -0000 1.3.2.1 @@ -1,9 +1,17 @@ ad_page_contract { List workflows designated as templates (but not simulations or cases) in this package. +} { + sb_orderby:optional } +if { ![exists_and_not_null sb_orderby] } { + set sb_orderby 0 +} + set page_title "SimBuild" set context [list $page_title] set package_id [ad_conn package_id] +set package_url [ad_conn package_url] +set help_url "${package_url}object/[parameter::get -package_id $package_id -parameter SimBuildHelpFile]" permission::require_permission -object_id $package_id -privilege sim_template_read Index: openacs-4/packages/simulation/www/simbuild/role-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-delete.adp,v diff -u -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/simulation/www/simbuild/role-delete.adp 18 Mar 2004 09:48:01 -0000 1.2.2.1 +++ openacs-4/packages/simulation/www/simbuild/role-delete.adp 30 Nov 2004 21:48:10 -0000 1.2.2.2 @@ -2,7 +2,7 @@ @page_title;noquote@ @context;noquote@ -

#simulation.lt_name_has_dependent_ta# +

#simulation.lt_name_has_dependent_ta#

#simulation.Related_Tasks#

Index: openacs-4/packages/simulation/www/simbuild/role-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-delete.tcl,v diff -u -N -r1.4 -r1.4.2.1 --- openacs-4/packages/simulation/www/simbuild/role-delete.tcl 23 Jan 2004 11:16:15 -0000 1.4 +++ openacs-4/packages/simulation/www/simbuild/role-delete.tcl 30 Nov 2004 21:48:10 -0000 1.4.2.1 @@ -10,12 +10,21 @@ } set package_id [ad_conn package_id] -set num_of_tasks [db_string task_count " -select count(*) + +set tasks [db_list tasks " +select action_id from workflow_actions wa where wa.assigned_role = :role_id +union +select task_id as action_id + from sim_task_recipients + where recipient = :role_id " ] + +set num_of_tasks [llength $tasks] + + workflow::role::get -role_id $role_id -array role_array set name $role_array(pretty_name) set workflow_id $role_array(workflow_id) @@ -26,8 +35,21 @@ if { [template::util::is_true $confirm_p] || $num_of_tasks == 0 } { permission::require_write_permission -object_id $workflow_id + + # confirm_p is true and we have tasks + if { $num_of_tasks > 0 } { + foreach task $tasks { + simulation::action::edit -operation delete -action_id $task + } + } + simulation::role::edit -operation "delete" -role_id $role_id - ad_returnredirect $return_url + + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + } workflow::get -workflow_id $workflow_id -array sim_template_array Index: openacs-4/packages/simulation/www/simbuild/role-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/role-edit.tcl,v diff -u -N -r1.7 -r1.7.2.1 --- openacs-4/packages/simulation/www/simbuild/role-edit.tcl 16 Dec 2003 18:34:00 -0000 1.7 +++ openacs-4/packages/simulation/www/simbuild/role-edit.tcl 30 Nov 2004 21:48:10 -0000 1.7.2.1 @@ -58,7 +58,8 @@ set page_title "Edit Role template $pretty_name" set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] -} -new_request { +} -cancel_url [export_vars -base "template-edit" { workflow_id }] \ +-new_request { permission::require_write_permission -object_id $workflow_id workflow::get -workflow_id $workflow_id -array sim_template_array set page_title "Add Role to $sim_template_array(pretty_name)" @@ -87,7 +88,10 @@ -workflow_id $workflow_id \ -array row] - ad_returnredirect [export_vars -base "template-edit" { workflow_id }] + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type }] ad_script_abort } Index: openacs-4/packages/simulation/www/simbuild/state-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/state-delete.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/simbuild/state-delete.tcl 16 Dec 2003 18:34:00 -0000 1.1 +++ openacs-4/packages/simulation/www/simbuild/state-delete.tcl 30 Nov 2004 21:48:10 -0000 1.1.2.1 @@ -2,15 +2,71 @@ Delete a state } { + {confirm_p:boolean "f"} state_id:integer {return_url ""} } +set package_id [ad_conn package_id] + set workflow_id [workflow::state::fsm::get_element -state_id $state_id -element workflow_id] -permission::require_write_permission -object_id $workflow_id -workflow::state::fsm::edit -operation "delete" -state_id $state_id +workflow::state::fsm::get -state_id $state_id -array state_array + +set name $state_array(pretty_name) +set workflow_id $state_array(workflow_id) + +set tasks [db_list enabled_tasks " +select action_id +from workflow_fsm_action_en_in_st wfa, + workflow_fsm_states wfs +where wfa.state_id = wfs.state_id + and wfs.state_id = :state_id + and wfs.workflow_id = :workflow_id +" + ] + +set tasks [concat $tasks [db_list next_state_tasks " +select wa.action_id +from workflow_fsm_actions wfa, + workflow_actions wa +where wa.action_id = wfa.action_id + and wfa.new_state = :state_id + and wa.workflow_id = :workflow_id +" + ] + ] + +set num_of_tasks [llength $tasks] + if { [empty_string_p $return_url] } { set return_url [export_vars -base template-edit { workflow_id }] } -ad_returnredirect $return_url + +if { [template::util::is_true $confirm_p] || $num_of_tasks == 0 } { + permission::require_write_permission -object_id $workflow_id + + # confirm_p is true and we have tasks + if { $num_of_tasks > 0 } { + foreach task $tasks { + simulation::action::edit -operation delete -action_id $task + } + } + + workflow::state::fsm::edit -operation "delete" -state_id $state_id + + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + +} + + +workflow::get -workflow_id $workflow_id -array sim_template_array + +set page_title "Delete $name" +set context [list [list "." "Sim Templates"] [list "template-edit?workflow_id=$workflow_id" "$sim_template_array(pretty_name)"] $page_title] + +set delete_url [export_vars -base [ad_conn url] { state_id return_url { confirm_p 1 } }] +set cancel_url $return_url \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/state-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/state-edit.tcl,v diff -u -N -r1.5 -r1.5.2.1 --- openacs-4/packages/simulation/www/simbuild/state-edit.tcl 26 Jan 2004 12:34:47 -0000 1.5 +++ openacs-4/packages/simulation/www/simbuild/state-edit.tcl 30 Nov 2004 21:48:10 -0000 1.5.2.1 @@ -34,6 +34,12 @@ workflow::get -workflow_id $workflow_id -array sim_template_array + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "template-edit" { workflow_id }] +} + + if { ![ad_form_new_p -key state_id] } { set page_title "Edit State $state_array(pretty_name)" } else { @@ -63,7 +69,8 @@ ad_form \ -name state \ - -edit_buttons [list [list [ad_decode [ad_form_new_p -key state_id] 1 [_ acs-kernel.common_add] [_ acs-kernel.common_edit]] ok]] \ + -cancel_url $return_url \ + -edit_buttons [list [list [ad_decode [ad_form_new_p -key state_id] 1 [_ acs-kernel.common_OK] [_ acs-kernel.common_OK]] ok]] \ -export { return_url } \ -form { {state_id:key} @@ -74,7 +81,7 @@ {parent_action_id:integer(select) {label "Parent task"} {mode display} - {options {[workflow::action::get_options -workflow_id $workflow_id]}} + {options {[workflow::action::get_options -all=1 -workflow_id $workflow_id]}} } } } else { @@ -133,9 +140,10 @@ -workflow_id $workflow_id \ -array row] - if { ![exists_and_not_null return_url] } { - set return_url [export_vars -base "template-edit" { workflow_id }] - } - ad_returnredirect $return_url + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + ad_script_abort } Index: openacs-4/packages/simulation/www/simbuild/task-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-copy.tcl,v diff -u -N -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/simulation/www/simbuild/task-copy.tcl 16 Mar 2004 16:16:18 -0000 1.1.2.1 +++ openacs-4/packages/simulation/www/simbuild/task-copy.tcl 30 Nov 2004 21:48:10 -0000 1.1.2.2 @@ -4,13 +4,23 @@ @author Peter Marklund } { action_id:integer + {workflow_id ""} {return_url ""} - } +if { ![exists_and_not_null workflow_id] } { + set workflow_id [workflow::action::get_element -action_id $action_id -element workflow_id] +} + +permission::require_write_permission -object_id $workflow_id + simulation::action::clone -action_id $action_id if { [empty_string_p $return_url] } { set return_url [export_vars -base template-edit { workflow_id }] } -ad_returnredirect $return_url + +# Let's mark this template edited +set sim_type "dev_template" + +ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/task-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-delete.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/www/simbuild/task-delete.tcl 16 Dec 2003 18:34:00 -0000 1.3 +++ openacs-4/packages/simulation/www/simbuild/task-delete.tcl 30 Nov 2004 21:48:10 -0000 1.3.2.1 @@ -6,11 +6,20 @@ {return_url ""} } -set workflow_id [workflow::action::get_element -action_id $action_id -element workflow_id] +if { ![exists_and_not_null workflow_id] } { + set workflow_id [workflow::action::get_element \ + -action_id $action_id \ + -element workflow_id] +} + permission::require_write_permission -object_id $workflow_id simulation::action::edit -operation "delete" -action_id $action_id if { [empty_string_p $return_url] } { set return_url [export_vars -base template-edit { workflow_id }] } -ad_returnredirect $return_url + +# Let's mark this template edited +set sim_type "dev_template" + +ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/task-details.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-details.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/simbuild/task-details.tcl 23 Jan 2004 15:01:27 -0000 1.1 +++ openacs-4/packages/simulation/www/simbuild/task-details.tcl 30 Nov 2004 21:48:10 -0000 1.1.2.1 @@ -25,8 +25,11 @@ set page_title "Task $task_array(pretty_name)" -set template_url [export_vars -base "template-edit" { workflow_id }] +# Let's mark this template edited +set sim_type "dev_template" +set template_url [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + set context [list [list "." "SimBuild"] [list $template_url "$sim_template_array(pretty_name)"] $page_title] if { ![empty_string_p $task_array(parent_action_id)] } { Index: openacs-4/packages/simulation/www/simbuild/task-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-edit.tcl,v diff -u -N -r1.36 -r1.36.2.1 --- openacs-4/packages/simulation/www/simbuild/task-edit.tcl 12 Mar 2004 11:02:39 -0000 1.36 +++ openacs-4/packages/simulation/www/simbuild/task-edit.tcl 30 Nov 2004 21:48:10 -0000 1.36.2.1 @@ -5,7 +5,7 @@ @cvs-id $Id$ } { {workflow_id:integer ""} - action_id:integer,optional + action_id:optional parent_action_id:integer,optional return_url:optional } -validate { @@ -60,6 +60,11 @@ set page_title "Add Task to $sim_template_array(pretty_name)" } + +if { ![exists_and_not_null return_url] } { + set return_url [export_vars -base "template-edit" -anchor "tasks" { workflow_id }] +} + set context [list [list "." "SimBuild"] [list [export_vars -base "template-edit" { workflow_id }] "$sim_template_array(pretty_name)"] $page_title] #--------------------------------------------------------------------- @@ -100,9 +105,10 @@ ad_form \ -name task \ -export { workflow_id return_url } \ + -cancel_url $return_url \ -edit_buttons [list \ [list \ - [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_add] [_ acs-kernel.common_finish]] \ + [ad_decode [ad_form_new_p -key action_id] 1 [_ acs-kernel.common_OK] [_ acs-kernel.common_OK]] \ ok]] \ -form { {action_id:key} @@ -114,7 +120,7 @@ {parent_action_id:integer(select) {label "Parent task"} {mode display} - {options {[workflow::action::get_options -workflow_id $workflow_id]}} + {options {[workflow::action::get_options -all=1 -workflow_id $workflow_id]}} } } } else { @@ -181,25 +187,18 @@ switch $trigger_type { - user - message - workflow - parallel - dynamic { + user - message - workflow - parallel - dynamic - time { ad_form -extend -name task -form { - {timeout_hours:integer(text),optional + {timeout_hours:float(text),optional {label "Timeout"} {after_html "hours"} + {help_text "[_ simulation.lt_Duration_in_hours_dec]"} } } } - time { - ad_form -extend -name task -form { - {timeout_hours:integer(text) - {label "Timeout"} - {after_html "hours"} - } - } - } default { ad_form -extend -name task -form { - {timeout_hours:integer(hidden),optional} + {timeout_hours:float(hidden),optional} } } } @@ -218,6 +217,16 @@ } } +if { [string equal $trigger_type "user"] && [string equal $task_type "message"] } { + ad_form -extend -name task -form { + {default_text:richtext,optional + {label "Default Message"} + {html {cols 60 rows 8}} + {help_text "Suggested message; can be edited when template is instantiated."} + } + } +} + if { [string equal $trigger_type "user"] } { ad_form -extend -name task -form { {attachment_num:integer(text) @@ -261,7 +270,9 @@ ad_form -extend -name task -edit_request { set workflow_id $task_array(workflow_id) permission::require_write_permission -object_id $workflow_id + set description [template::util::richtext::create $task_array(description) $task_array(description_mime_type)] + set default_text [template::util::richtext::create $task_array(default_text) $task_array(default_text_mime_type)] foreach elm { pretty_name new_state_id @@ -273,7 +284,7 @@ set timeout_hours "" if { ![empty_string_p $task_array(timeout_seconds)] } { - set timeout_hours [expr $task_array(timeout_seconds) / 3600] + set timeout_hours [expr $task_array(timeout_seconds) / 3600.0] } } -new_request { @@ -308,6 +319,11 @@ set description [template::util::richtext::get_property contents $description] } + if { [info exists default_text] } { + set default_text_mime_type [template::util::richtext::get_property format $default_text] + set default_text [template::util::richtext::get_property contents $default_text] + } + switch $task_type { message { } @@ -320,7 +336,7 @@ foreach elm { pretty_name pretty_past_tense assigned_role description description_mime_type - new_state_id + new_state_id default_text default_text_mime_type recipient_roles attachment_num trigger_type parent_action_id } { if { [info exists $elm] } { @@ -355,9 +371,11 @@ -action_id $action_id \ -array row] - if { ![exists_and_not_null return_url] } { - set return_url [export_vars -base "template-edit" -anchor "tasks" { workflow_id }] - } - ad_returnredirect $return_url + + # Let's mark this template edited + set sim_type "dev_template" + + ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] + ad_script_abort } Index: openacs-4/packages/simulation/www/simbuild/task-enabled-in-state-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/task-enabled-in-state-update.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/simulation/www/simbuild/task-enabled-in-state-update.tcl 27 Jan 2004 14:53:42 -0000 1.2 +++ openacs-4/packages/simulation/www/simbuild/task-enabled-in-state-update.tcl 30 Nov 2004 21:48:11 -0000 1.2.2.1 @@ -8,18 +8,23 @@ {return_url {}} } +set workflow_id [workflow::action::get_element \ + -action_id $action_id \ + -element workflow_id] + +permission::require_write_permission -object_id $workflow_id + workflow::action::fsm::set_enabled_in_state \ -action_id $action_id \ -state_id $state_id \ -enabled=[template::util::is_true $enabled_p] \ -assigned=[template::util::is_true $assigned_p] -if { [empty_string_p $return_url] } { - set workflow_id [workflow::action::get_element \ - -action_id $action_id \ - -element workflow_id] - +if { [empty_string_p $return_url] } { set return_url [export_vars -base template-edit { workflow_id }] } -ad_returnredirect $return_url +# Let's mark this template edited +set sim_type "dev_template" + +ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/template-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-edit.adp,v diff -u -N -r1.24.2.2 -r1.24.2.3 --- openacs-4/packages/simulation/www/simbuild/template-edit.adp 22 Mar 2004 15:27:26 -0000 1.24.2.2 +++ openacs-4/packages/simulation/www/simbuild/template-edit.adp 30 Nov 2004 21:48:11 -0000 1.24.2.3 @@ -20,13 +20,7 @@
  • #simulation.lt_Mark_this_template_re#
  • - - -
  • #simulation.lt_Start_a_simulation_wi#
  • -
    -
  • #simulation.lt_Export_this_template#
  • -
  • #simulation.Delete_this_template#
  • @@ -63,3 +57,7 @@ + \ No newline at end of file Index: openacs-4/packages/simulation/www/simbuild/template-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-edit.tcl,v diff -u -N -r1.22 -r1.22.2.1 --- openacs-4/packages/simulation/www/simbuild/template-edit.tcl 29 Jan 2004 14:36:39 -0000 1.22 +++ openacs-4/packages/simulation/www/simbuild/template-edit.tcl 30 Nov 2004 21:48:11 -0000 1.22.2.1 @@ -9,6 +9,7 @@ set package_key [ad_conn package_key] set package_id [ad_conn package_id] +set package_url [ad_conn package_url] ###################################################################### # @@ -111,6 +112,12 @@ break } + if { [string match $template_ready_p "t"] && ![simulation::template::check_init_p -workflow_id $workflow_id] } { + form set_error sim_template template_ready_p "This template or one of its subworkflows or parallel tasks is missing an initial action. You can't mark a template ready for use until you have added all required initial actions." + break + + } + set description_mime_type [template::util::richtext::get_property format $description] set description [template::util::richtext::get_property contents $description] } -new_data { Index: openacs-4/packages/simulation/www/simbuild/template-load.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-load.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/simulation/www/simbuild/template-load.tcl 7 Jan 2004 13:12:17 -0000 1.3 +++ openacs-4/packages/simulation/www/simbuild/template-load.tcl 30 Nov 2004 21:48:11 -0000 1.3.2.1 @@ -1,24 +1,33 @@ ad_page_contract { Load a simulation from a spec +} { + cancel_url:optional } +if { ![exists_and_not_null cancel_url] } { + set cancel_url [get_referrer] +} + permission::require_permission -object_id [ad_conn package_id] -privilege sim_template_create set page_title "Load Template" set context [list [list "." "SimBuild"] $page_title] -ad_form -name load -edit_buttons [list [list "Load" ok]] -form { - {pretty_name:text - {label "Name"} - {html {size 50}} - } - {spec:text(textarea),nospell - {label "Spec"} - {help_text {Copy and paste the specification here. A specification is a plain-text file which can be generated when editing a template.}} - {html {cols 80 rows 10}} - } +ad_form -name load \ + -cancel_url $cancel_url \ + -edit_buttons [list [list "Load" ok]] -form { + {pretty_name:text + {label "Name"} + {html {size 50}} + } + {spec:text(textarea),nospell + {label "Spec"} + {help_text {Copy and paste the specification here. A specification is a plain-text file which can be generated when editing a template.}} + {html {cols 80 rows 10}} + } + {cancel_url:text(hidden) } } -on_request { } -on_submit { Index: openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl,v diff -u -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl 1 Jun 2004 15:03:31 -0000 1.2.2.1 +++ openacs-4/packages/simulation/www/simbuild/template-object-reorder.tcl 30 Nov 2004 21:48:11 -0000 1.2.2.2 @@ -5,6 +5,7 @@ state_id:optional action_id:optional role_id:optional + parent_action_id:optional {direction down} {return_url "."} } @@ -16,18 +17,36 @@ switch $type { state { set object_id $state_id - set workflow_id [workflow::state::fsm::get_element -state_id $state_id -element workflow_id] - set all_ids [workflow::state::fsm::get_ids -workflow_id $workflow_id] + set workflow_id [workflow::state::fsm::get_element \ + -state_id $state_id -element workflow_id] + # Use parent_action_id if we're not on the top-level + if { [exists_and_not_null parent_action_id] } { + set all_ids [workflow::state::fsm::get_ids \ + -workflow_id $workflow_id \ + -parent_action_id $parent_action_id] + } else { + set all_ids [workflow::state::fsm::get_ids -workflow_id $workflow_id] + } } role { set object_id $role_id set workflow_id [workflow::role::get_element -role_id $role_id -element workflow_id] + + # Roles are only available on a top-level workflow so we don't need the + # parent_action_id here set all_ids [workflow::role::get_ids -workflow_id $workflow_id] } action { set object_id $action_id set workflow_id [workflow::action::get_element -action_id $action_id -element workflow_id] - set all_ids [workflow::action::get_ids -workflow_id $workflow_id] + + # Use parent_action_id if we're not on the top-level + if { [exists_and_not_null parent_action_id] } { + set all_ids [workflow::action::get_ids -workflow_id $workflow_id \ + -parent_action_id $parent_action_id] + } else { + set all_ids [workflow::action::get_ids -workflow_id $workflow_id] + } } default { error "Invalid type, $type, only implemented for 'state', 'role', and 'action'." @@ -89,4 +108,7 @@ } } -ad_returnredirect $return_url +# Let's mark this template edited +set sim_type "dev_template" + +ad_returnredirect [export_vars -base "template-sim-type-update" { workflow_id sim_type return_url }] Index: openacs-4/packages/simulation/www/simbuild/template-sim-type-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simbuild/template-sim-type-update.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/simbuild/template-sim-type-update.tcl 8 Jan 2004 10:50:34 -0000 1.1 +++ openacs-4/packages/simulation/www/simbuild/template-sim-type-update.tcl 30 Nov 2004 21:48:11 -0000 1.1.2.1 @@ -4,6 +4,18 @@ workflow_id:integer {sim_type "ready_template"} {return_url {[export_vars -base "template-edit" { workflow_id }]}} +} -validate { + inits_exist -requires {workflow_id:integer} { + if { [string match $sim_type "ready_template"] } { + if { ![simulation::template::check_init_p -workflow_id $workflow_id] } { + ad_complain "

    Either the simulation template or one of its subworkflows + seems to be missing an initial action. Please correct this + before you try to mark this template ready for use.

    +

    Note that every subworkflow and parallel task must + also have its own initial action.

    " + } + } + } } permission::require_write_permission -object_id $workflow_id @@ -14,4 +26,4 @@ -workflow_id $workflow_id \ -array row -ad_returnredirect $return_url +ad_returnredirect $return_url \ No newline at end of file Index: openacs-4/packages/simulation/www/siminst/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/index.adp,v diff -u -N -r1.19.2.1 -r1.19.2.2 --- openacs-4/packages/simulation/www/siminst/index.adp 18 Mar 2004 09:48:02 -0000 1.19.2.1 +++ openacs-4/packages/simulation/www/siminst/index.adp 30 Nov 2004 21:48:13 -0000 1.19.2.2 @@ -2,16 +2,21 @@ @page_title;noquote@ @context;noquote@ + +

    +#simulation.lt_New_Simulation_From_T# +

    +

    #simulation.lt_Simulations_in_Develo#

    - -

    #simulation.lt_Simulations_in_Castin#

    + \ No newline at end of file Index: openacs-4/packages/simulation/www/siminst/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/index.tcl,v diff -u -N -r1.33 -r1.33.2.1 --- openacs-4/packages/simulation/www/siminst/index.tcl 23 Jan 2004 14:31:36 -0000 1.33 +++ openacs-4/packages/simulation/www/siminst/index.tcl 30 Nov 2004 21:48:13 -0000 1.33.2.1 @@ -1,15 +1,21 @@ ad_page_contract { The index page for SimInst +} { + ds_orderby:optional + cs_orderby:optional } set page_title "SimInst" set context [list $page_title] set package_id [ad_conn package_id] set user_id [ad_conn user_id] +set package_uri [apm_package_url_from_id $package_id] +set help_url "${package_uri}object/[parameter::get -package_id $package_id -parameter SimInstHelpFile]" + permission::require_permission -object_id $package_id -privilege sim_inst set admin_p [permission::permission_p -object_id $package_id -privilege admin] -set base_url [apm_package_url_from_id $package_id] +set base_url $package_uri #--------------------------------------------------------------------- # dev_sims: simulations in development @@ -18,9 +24,9 @@ template::list::create \ -name dev_sims \ -multirow dev_sims \ - -actions "{New Simulation From Template} simulation-new" \ -no_data "No Simulations are in Development" \ -sub_class "narrow" \ + -orderby_name ds_orderby \ -elements { edit { sub_class narrow @@ -42,14 +48,6 @@ display_template {@dev_sims.description;noquote@} } - copy { - sub_class narrow - display_template { - Copy - } - link_url_col clone_url - link_html { title "Clone this template" } - } delete { sub_class narrow link_url_col delete_url @@ -93,6 +91,7 @@ and ao.object_id = w.workflow_id and ss.sim_type = 'dev_sim' $sim_in_dev_filter_sql + [template::list::orderby_clause -orderby -name "dev_sims"] " { set description [ad_html_text_convert -from $description_mime_type -maxlen 200 -- $description] @@ -120,18 +119,11 @@ -name casting_sims \ -multirow casting_sims \ -no_data "No Simulations are in Casting" \ + -orderby_name cs_orderby \ -elements { - edit { - sub_class narrow - link_url_eval {[export_vars -base wizard { workflow_id }]} - display_template { - Edit - } - } pretty_name { label "Simulation" orderby upper(w.pretty_name) - link_url_eval {[export_vars -base wizard { workflow_id }]} } n_users { label "Users enrolled" @@ -143,6 +135,7 @@ } case_start { label "Start date" + orderby case_start } start_now { label "Start" @@ -151,12 +144,6 @@ Start immediately } } - copy { - sub_class narrow - display_template { - Copy - } - } delete { sub_class narrow link_url_col delete_url @@ -197,6 +184,7 @@ and ao.object_id = w.workflow_id and ss.sim_type = 'casting_sim' $sim_in_dev_filter_sql + [template::list::orderby_clause -orderby -name "casting_sims"] " { set delete_url [export_vars -base "${base_url}siminst/simulation-delete" { workflow_id }] set start_url [export_vars -base "simulation-start" { workflow_id }] Index: openacs-4/packages/simulation/www/siminst/map-characters.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-characters.adp,v diff -u -N -r1.13.2.2 -r1.13.2.3 --- openacs-4/packages/simulation/www/siminst/map-characters.adp 22 Mar 2004 15:27:27 -0000 1.13.2.2 +++ openacs-4/packages/simulation/www/siminst/map-characters.adp 30 Nov 2004 21:48:13 -0000 1.13.2.3 @@ -1,6 +1,5 @@

    #simulation.lt_Select_from_existing# - #simulation.add_new_characters# #simulation.lt_and_refresh__this_pag#

    Index: openacs-4/packages/simulation/www/siminst/map-tasks.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/map-tasks.tcl,v diff -u -N -r1.13.2.2 -r1.13.2.3 --- openacs-4/packages/simulation/www/siminst/map-tasks.tcl 1 Jun 2004 13:35:25 -0000 1.13.2.2 +++ openacs-4/packages/simulation/www/siminst/map-tasks.tcl 30 Nov 2004 21:48:13 -0000 1.13.2.3 @@ -28,6 +28,8 @@ a.pretty_name, a.description, a.description_mime_type, + st.default_text, + st.default_text_mime_type, st.attachment_num, (select pretty_name from workflow_roles where role_id = a.assigned_role) as assigned_role_pretty from workflow_actions a, @@ -66,7 +68,18 @@ {html {cols 60 rows 4}} \ {section $section_name} ]] set description_$row(action_id) [template::util::richtext::create $row(description) $row(description_mime_type)] - + + # Show default message text field if this is a message-type task + if { ![empty_string_p $recipient_role_pretty] } { + ad_form -extend -name tasks -form \ + [list [list default_text_$row(action_id):richtext,optional \ + {label "Task Default message"} \ + {help_text "This is the default text that will appear in a message-type task form."} \ + {html {cols 60 rows 4}} \ + {section $section_name} ]] + set default_text_$row(action_id) [template::util::richtext::create $row(default_text) $row(default_text_mime_type)] + } + # Save attachment_num for later ad_form -extend -name tasks -form \ [list [list attachment_num_$row(action_id):integer(hidden),optional \ @@ -79,7 +92,7 @@ } ad_form -extend -name tasks -form \ - [list [list attachment_$row(action_id)_${i}:integer(select) \ + [list [list attachment_$row(action_id)_${i}:integer(select),optional \ {label "Attachment $i"} \ {options $prop_options} \ {help_text "Select from existing attachments or (i.e. Started, Open, Written...)"} {options {{"Show states" t} {"Don't show states" f}}} } - {stylesheet:integer(select),optional - {label "CSS Stylesheet"} - {options $stylesheet_options} - } } -on_request { foreach elm { @@ -60,7 +54,6 @@ enroll_start enroll_end show_states_p - stylesheet } { set $elm $sim_template($elm) } @@ -167,7 +160,7 @@ } foreach elm { send_start_note_date case_start case_end pretty_name description description_mime_type enroll_type enroll_start enroll_end - show_states_p stylesheet } { + show_states_p } { set row($elm) [set $elm] } Index: openacs-4/packages/simulation/www/siminst/simulation-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/siminst/simulation-new.tcl,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/www/siminst/simulation-new.tcl 23 Jan 2004 13:18:43 -0000 1.6 +++ openacs-4/packages/simulation/www/siminst/simulation-new.tcl 30 Nov 2004 21:48:14 -0000 1.6.2.1 @@ -1,5 +1,7 @@ ad_page_contract { A list of available simulation templates +} { + orderby:optional } set page_title "New Simulation From Template" @@ -31,6 +33,7 @@ number_of_tasks { label "Tasks" html { align center } + orderby number_of_tasks } map { label "" @@ -41,7 +44,7 @@ } } -db_multirow -extend {map_url} ready_templates select_ready_templates { +db_multirow -extend {map_url} ready_templates select_ready_templates " select workflow_id, suggested_duration, pretty_name, @@ -57,7 +60,8 @@ where ss.simulation_id = w.workflow_id and w.object_id = :package_id and ss.sim_type = 'ready_template' -} { + [template::list::orderby_clause -orderby -name "ready_templates"] +" { set map_url [export_vars -base "map-create" { workflow_id }] if { [empty_string_p $suggested_duration] } { Index: openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl,v diff -u -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl 19 Mar 2004 10:52:44 -0000 1.2.2.1 +++ openacs-4/packages/simulation/www/simplay/case-admin-user-move.tcl 30 Nov 2004 21:48:15 -0000 1.2.2.2 @@ -12,8 +12,8 @@ set page_title [_ simulation.lt_Choose_new_roles_for] set context [list [list . [_ simulation.SimPlay]] \ - [list [export_vars -base case-admin { case_id }] - [_ simulation.lt_Administer_caselabel]] + [list [export_vars -base case-admin { case_id }] \ + [_ simulation.lt_Administer_caselabel]] \ $page_title] workflow::case::get -case_id $case_id -array case Index: openacs-4/packages/simulation/www/simplay/case-admin.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin.adp,v diff -u -N -r1.12.2.3 -r1.12.2.4 --- openacs-4/packages/simulation/www/simplay/case-admin.adp 1 Jun 2004 14:48:09 -0000 1.12.2.3 +++ openacs-4/packages/simulation/www/simplay/case-admin.adp 30 Nov 2004 21:48:15 -0000 1.12.2.4 @@ -8,7 +8,7 @@ + Index: openacs-4/packages/simulation/www/simplay/case-admin.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case-admin.tcl,v diff -u -N -r1.16.2.3 -r1.16.2.4 --- openacs-4/packages/simulation/www/simplay/case-admin.tcl 22 Mar 2004 15:50:17 -0000 1.16.2.3 +++ openacs-4/packages/simulation/www/simplay/case-admin.tcl 30 Nov 2004 21:48:15 -0000 1.16.2.4 @@ -20,14 +20,16 @@ set user_id [ad_conn user_id] set section_uri [apm_package_url_from_id $package_id]simplay/ +set complete_p [simulation::case::complete_p -case_id $case_id] + set elements { role { label {[_ simulation.Role]} link_url_eval {[export_vars -base case { case_id role_id }]} } role_action { display_template { - Add user to role + [ad_decode $complete_p 1 "" "Add user to role"] } } user_name { @@ -37,8 +39,9 @@ user_actions { label "" display_template { - [_ simulation.Move_user] \ - [_ simulation.Remove_user] + [ad_decode $complete_p 1 "" " \ + [_ simulation.Move_user] \ + [_ simulation.Remove_user] "] } } max_n_users { Index: openacs-4/packages/simulation/www/simplay/case.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case.adp,v diff -u -N -r1.11.2.4 -r1.11.2.5 --- openacs-4/packages/simulation/www/simplay/case.adp 1 Jun 2004 14:51:45 -0000 1.11.2.4 +++ openacs-4/packages/simulation/www/simplay/case.adp 30 Nov 2004 21:48:15 -0000 1.11.2.5 @@ -1,25 +1,31 @@ @title;noquote@ @context;noquote@ + @workflow_id;noquote@
    -

    Recent Messages

    +

    #simulation.Recent_Messages#

    -

    Tasks

    +

    #simulation.Tasks#

    -

    Document Portfolio

    +

    #simulation.Document_Portfolio#

    + + + + +
    Index: openacs-4/packages/simulation/www/simplay/case.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/case.tcl,v diff -u -N -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/simulation/www/simplay/case.tcl 19 Mar 2004 10:52:44 -0000 1.6.2.1 +++ openacs-4/packages/simulation/www/simplay/case.tcl 30 Nov 2004 21:48:15 -0000 1.6.2.2 @@ -3,6 +3,7 @@ } { case_id:integer,notnull role_id:integer,notnull + portfolio_orderby:optional } simulation::case::assert_user_may_play_role \ @@ -14,10 +15,14 @@ set simulation_name [simulation::template::get_element \ -workflow_id $workflow_id -element pretty_name] -set title [_ simulation.simulation_name] +set title [_ simulation.Session_Home] set context [list [list . [_ simulation.SimPlay]] $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 messages_url [export_vars -base messages { case_id role_id }] + +if { ![exists_and_not_null portfolio_orderby] } { + set portfolio_orderby 0 +} \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/control-bar.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/control-bar.adp,v diff -u -N -r1.17.2.3 -r1.17.2.4 --- openacs-4/packages/simulation/www/simplay/control-bar.adp 4 May 2004 09:19:11 -0000 1.17.2.3 +++ openacs-4/packages/simulation/www/simplay/control-bar.adp 30 Nov 2004 21:48:16 -0000 1.17.2.4 @@ -1,6 +1,6 @@
    -You are @role.character_title@ +#simulation.You_are# @role.character_title@ (@role.role_pretty@)
    @@ -10,26 +10,46 @@ -

    + +

    @curr_state@: @state_name@

    + +
    -

    Contacts

    +

    #simulation.Contacts#

    +
    + 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 -N -r1.16.2.5 -r1.16.2.6 --- openacs-4/packages/simulation/www/simplay/control-bar.tcl 19 Apr 2004 15:22:30 -0000 1.16.2.5 +++ openacs-4/packages/simulation/www/simplay/control-bar.tcl 30 Nov 2004 21:48:17 -0000 1.16.2.6 @@ -9,20 +9,24 @@ role_id {} } +set current_url [export_vars -base [ad_conn url] { case_id role_id }] set package_id [ad_conn package_id] set user_id [ad_conn user_id] set section_uri [apm_package_url_from_id $package_id]simplay/ +set page_role_id $role_id simulation::case::get -case_id $case_id -array case set workflow_id $case(workflow_id) +set case_name $case(label) + db_1row getflags { select show_contacts_p, show_states_p from sim_simulations where simulation_id=:workflow_id} -set case_home_url [export_vars -base "case" { case_id role_id }] +set case_home_url [export_vars -base ${section_uri}case { case_id role_id }] set message_count [db_string message_count_sql " select count(*) @@ -60,7 +64,7 @@ and ci.live_revision = scx.object_id } -column_array role -set role(character_url) [simulation::object::url -name $role(character_name)] +set role(character_url) [export_vars -base [simulation::object::url -name $role(character_name) -simplay 1] { case_id role_id }] array set thumbnail [lindex \ [util_list_of_ns_sets_to_list_of_lists -list_of_ns_sets \ @@ -99,18 +103,30 @@ and ci.live_revision = scx.object_id and wr.role_id != :role_id " { - set character_url [simulation::object::url -name $character_name] + set character_url [export_vars -base [simulation::object::url -name $character_name -simplay 1] { case_id {role_id $page_role_id} {recipient_role_id $role_id} }] } -set notifications_url [export_vars -base notifications { case_id role_id }] +set notifications_url [export_vars -base ${section_uri}notifications { case_id role_id }] -db_multirow -unclobber states select_states { - select wfs.pretty_name, - wfs.state_id, - wcf.current_state - from workflow_case_fsm wcf, - workflow_fsm_states wfs - where wfs.workflow_id = :workflow_id - and wcf.case_id = :case_id - order by wfs.sort_order -} +set yp_url [export_vars -base ${section_uri}yellow-pages { case_id role_id }] + +set map_url [export_vars -base ${section_uri}map { case_id role_id }] + +set help_url [export_vars -base "${section_uri}object/[parameter::get -parameter SimPlayHelpFile]" { case_id role_id }] + +set curr_state [_ simulation.curr_state] + +db_1row get_state { + select wfs.pretty_name as state_name, + s.show_states_p + from workflow_fsm_states wfs, + workflow_case_fsm wcf, + workflow_cases wc, + sim_simulations s + where wcf.case_id = wc.case_id and + wcf.current_state = wfs.state_id and + s.simulation_id = wc.workflow_id and + wc.workflow_id = :workflow_id and + wcf.case_id = :case_id and + wcf.parent_enabled_action_id is NULL +} \ No newline at end of file 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 -N -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/simulation/www/simplay/document-upload.tcl 22 Mar 2004 15:50:17 -0000 1.8.2.3 +++ openacs-4/packages/simulation/www/simplay/document-upload.tcl 30 Nov 2004 21:48:19 -0000 1.8.2.4 @@ -25,12 +25,24 @@ set focus "document.document_file" +if { [exists_and_not_null document_file] && ![simulation::ui::forms::document_upload::check_mime -document_file $document_file] } { + simulation::ui::forms::document_upload::add_mime -document_file $document_file +} + ad_form -name document -export { case_id role_id workflow_id return_url } -html {enctype multipart/form-data} \ + -cancel_url $return_url \ -form [simulation::ui::forms::document_upload::form_block] \ - -on_submit { + -validate { + {document_file + {[simulation::ui::forms::document_upload::check_mime -document_file $document_file]} + "[_ simulation.lt_The_mime_type_of_your] [_ simulation.lt_Please_contact_______] + ([ad_host_administrator]) + [_ simulation.lt_if_you_think_youre_up]" + } + } -on_submit { simulation::ui::forms::document_upload::insert_document \ $case_id $role_id $item_id $document_file $title ad_returnredirect $return_url - } + } \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/index.adp,v diff -u -N -r1.23.2.4 -r1.23.2.5 --- openacs-4/packages/simulation/www/simplay/index.adp 1 Jun 2004 14:46:42 -0000 1.23.2.4 +++ openacs-4/packages/simulation/www/simplay/index.adp 30 Nov 2004 21:48:19 -0000 1.23.2.5 @@ -2,6 +2,8 @@ @title;noquote@ @context;noquote@ + +
    @@ -11,18 +13,23 @@

    #simulation.lt_You_administer_these#

    + + + + +

    #simulation.All_Messages#

    -
    -

    #simulation.Your_Tasks#

    - -
    - + \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/index.tcl,v diff -u -N -r1.10.2.1 -r1.10.2.2 --- openacs-4/packages/simulation/www/simplay/index.tcl 19 Mar 2004 10:52:44 -0000 1.10.2.1 +++ openacs-4/packages/simulation/www/simplay/index.tcl 30 Nov 2004 21:48:19 -0000 1.10.2.2 @@ -2,14 +2,22 @@ Simplay index page. } { {case_id:integer ""} + case_admin_order:optional } +if { ![exists_and_not_null case_admin_order] } { + set case_admin_order 0 +} + set title [_ simulation.SimPlay] set context [list $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 package_uri [apm_package_url_from_id $package_id] +set section_uri ${package_uri}simplay/ +set help_url "${package_uri}object/[parameter::get -package_id $package_id -parameter SimPlayHelpFile]" + set adminplayer_p [permission::permission_p -object_id $package_id -privilege sim_adminplayer] set case_list [db_list_of_lists case_count { Index: openacs-4/packages/simulation/www/simplay/map.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/map.adp,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/simplay/map.adp 30 Nov 2004 21:09:17 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/map.adp 30 Nov 2004 21:48:19 -0000 1.1.2.1 @@ -3,4 +3,5 @@ @context;noquote@ \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/map.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/map.tcl,v diff -u -N -r1.1 -r1.1.2.1 --- openacs-4/packages/simulation/www/simplay/map.tcl 30 Nov 2004 21:09:17 -0000 1.1 +++ openacs-4/packages/simulation/www/simplay/map.tcl 30 Nov 2004 21:48:19 -0000 1.1.2.1 @@ -22,4 +22,6 @@ set package_id [ad_conn package_id] set section_uri [apm_package_url_from_id $package_id]simplay/ -set messages_url [export_vars -base messages { case_id role_id }] \ No newline at end of file +set messages_url [export_vars -base messages { case_id role_id }] + +set map_help_url [export_vars -base [ad_conn package_url]simplay/object/[parameter::get -package_id $package_id -parameter MapHelpFile] { case_id role_id }] \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/message.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/message.adp,v diff -u -N -r1.10.2.2 -r1.10.2.3 --- openacs-4/packages/simulation/www/simplay/message.adp 18 Mar 2004 09:48:05 -0000 1.10.2.2 +++ openacs-4/packages/simulation/www/simplay/message.adp 30 Nov 2004 21:48:19 -0000 1.10.2.3 @@ -4,9 +4,11 @@ @focus;noquote@ -

    - #simulation.to_attach_document_to_message# -

    + +

    + #simulation.to_attach_document_to_message# +

    +
    Index: openacs-4/packages/simulation/www/simplay/message.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/message.tcl,v diff -u -N -r1.26.2.4 -r1.26.2.5 --- openacs-4/packages/simulation/www/simplay/message.tcl 1 Jun 2004 14:51:45 -0000 1.26.2.4 +++ openacs-4/packages/simulation/www/simplay/message.tcl 30 Nov 2004 21:48:19 -0000 1.26.2.5 @@ -16,17 +16,22 @@ set context [list [list "." [_ simulation.SimPlay]] [list [export_vars -base case { case_id role_id }] [_ simulation.Case]] $page_title] set package_id [ad_conn package_id] +set return_url [export_vars -base case { case_id role_id }] + set workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id] set all_role_options [list] foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { - set pretty_name [simulation::role::get_element -role_id $one_role_id -element character_title] - lappend all_role_options [list $pretty_name $one_role_id] + set character_title [simulation::role::get_element -role_id $one_role_id -element character_title] + set pretty_name [simulation::role::get_element -role_id $one_role_id -element pretty_name] + lappend all_role_options [list "$pretty_name ($character_title)" $one_role_id] } set to_role_options [list] foreach one_role_id [workflow::role::get_ids -workflow_id $workflow_id] { - lappend to_role_options [list [simulation::role::get_element -role_id $one_role_id -element character_title] $one_role_id] + set character_title [simulation::role::get_element -role_id $one_role_id -element character_title] + set pretty_name [simulation::role::get_element -role_id $one_role_id -element pretty_name] + lappend to_role_options [list "$pretty_name ($character_title)" $one_role_id] } set attachment_options [simulation::case::attachment_options -case_id $case_id -role_id $role_id] @@ -42,15 +47,22 @@ -item_id $item_id \ -array content - set recipient_role_id $content(from_role_id) + set sender_role_id $content(from_role_id) set subject "[_ simulation.Re] $content(title)" + set sender_pretty_name [simulation::role::get_element -role_id $sender_role_id -element pretty_name] + set sender_character_title [simulation::role::get_element -role_id $sender_role_id -element character_title] + set recipient_pretty_name [simulation::role::get_element -role_id $content(to_role_id) \ + -element pretty_name] + set recipient_character_title [simulation::role::get_element -role_id $content(to_role_id) \ + -element character_title] set body_text " + -----Original Message----- -From: [simulation::role::get_element -role_id $content(from_role_id) -element character_title] +From: $sender_pretty_name ($sender_character_title) Sent: [lc_time_fmt $content(creation_date) "%x %X"] -To: [simulation::role::get_element -role_id $content(to_role_id) -element character_title] +To: $recipient_pretty_name ($recipient_character_title) Subject: $content(title) [ad_html_text_convert -from $content(mime_type) -to "text/plain" $content(text)]" @@ -59,8 +71,10 @@ ad_returnredirect [export_vars -base [ad_conn url] { case_id role_id recipient_role_id subject body_text body_mime_type }] } -set form_mode [ad_decode [ad_form_new_p -key item_id] 1 "edit" "display"] +set form_new_p [ad_form_new_p -key item_id] +set form_mode [ad_decode $form_new_p 1 "edit" "display"] + set focus "message.recipient_role_id" set sender_role_id $role_id @@ -70,6 +84,7 @@ -edit_buttons { { Send ok } } \ -export { case_id role_id } \ -mode $form_mode \ + -cancel_url $return_url \ -form { {item_id:key} {sender_role_id:text(select) @@ -79,7 +94,7 @@ } } -if { [ad_form_new_p -key item_id] } { +if { $form_new_p } { if { [llength $to_role_options] == 1 } { ad_form -extend -name message -form { {recipient_role_id_inform:text(inform) @@ -120,8 +135,16 @@ } } -if { [llength $attachment_options] > 0 } { - if { ![string equal $form_mode "display"] } { +if { !$form_new_p } { + set attachments_set_list [bcms::item::list_related_items \ + -revision live \ + -item_id $item_id \ + -relation_tag attachment \ + -return_list] +} + +if { ![string equal $form_mode "display"] } { + if { [llength $attachment_options] > 0 } { # edit/new mode - show checkboxes ad_form -extend -name message -form { {attachments:integer(checkbox),multiple,optional @@ -130,20 +153,26 @@ } } } else { - # display mode - show a list of attached documents - ad_form -extend -name message -form { - {attachments:text(inform),optional - {label {[_ simulation.Attachments]}} - } - } + ad_form -extend -name message -form { + {attachments:integer(hidden),optional} + } } - -} else { +} elseif { [llength $attachments_set_list] > 0 } { + # display mode - show a list of attached documents ad_form -extend -name message -form { - {attachments:integer(hidden),optional} + {attachments:text(inform),optional + {label {[_ simulation.Attachments]}} + } } +} else { + # this is just to avoid ad_form freakin' out because it needs a + # field called attachments + ad_form -extend -name message -form { + {attachments:integer(hidden),optional} + } } + ad_form -extend -name message -new_request { if { [info exists body_text] } { if { ![info exists body_mime_type] } { @@ -172,13 +201,6 @@ form set_properties message -actions { } } - - set attachments_set_list [bcms::item::list_related_items \ - -revision live \ - -item_id $item_id \ - -relation_tag attachment \ - -return_list] - if { ![string equal $form_mode "display"] } { # edit/new mode - set checkbox integer values set attachments [list] @@ -220,7 +242,7 @@ } } - ad_returnredirect [export_vars -base case { case_id role_id }] + ad_returnredirect $return_url ad_script_abort } Index: openacs-4/packages/simulation/www/simplay/notifications.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/notifications.adp,v diff -u -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/simulation/www/simplay/notifications.adp 18 Mar 2004 09:48:05 -0000 1.2.2.1 +++ openacs-4/packages/simulation/www/simplay/notifications.adp 30 Nov 2004 21:48:19 -0000 1.2.2.2 @@ -1,4 +1,4 @@ - + @page_title;noquote@ @context;noquote@ Index: openacs-4/packages/simulation/www/simplay/notifications.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/notifications.tcl,v diff -u -N -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/simulation/www/simplay/notifications.tcl 19 Mar 2004 10:52:44 -0000 1.1.2.2 +++ openacs-4/packages/simulation/www/simplay/notifications.tcl 30 Nov 2004 21:48:19 -0000 1.1.2.3 @@ -9,8 +9,17 @@ set case_url [export_vars -base case { case_id role_id }] set page_title [_ simulation.Notifications] -set context [list [list . [_ simulation.SimPlay]] [list $case_url $case(label)] $page_title] +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 sim_title [_ simulation.simulation_name] + +set context [list [list . [_ simulation.SimPlay]] [list [export_vars -base case {case_id role_id }] $sim_title] $page_title] + set package_id [ad_conn package_id] set user_id [ad_conn user_id] set return_url [ad_return_url] @@ -66,7 +75,7 @@ multirow append notifications \ $url \ [string totitle $pretty_name] \ - [ad_decode $subscribed_p 1 [_ simulation.lt_Unsubscribe_from_pret] "Subscribe to %pretty_name%"] \ + [ad_decode $subscribed_p 1 [_ simulation.lt_Unsubscribe_from_pret] [_ simulation.lt_Subscribe_to_pretty_n]] \ $subscribed_p } } Index: openacs-4/packages/simulation/www/simplay/play-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/play-master.adp,v diff -u -N -r1.6 -r1.6.2.1 --- openacs-4/packages/simulation/www/simplay/play-master.adp 12 Jan 2004 13:43:14 -0000 1.6 +++ openacs-4/packages/simulation/www/simplay/play-master.adp 30 Nov 2004 21:48:19 -0000 1.6.2.1 @@ -1,9 +1,33 @@ @title;noquote@ @context;noquote@ - @header_stuff;noquote@ + +@header_stuff;noquote@ + + + + + + + + + @focus;noquote@ +

    #simulation.Session#: @simulation_title;noquote@

    -
    @@ -13,5 +37,4 @@
    - + \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/play-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/play-master.tcl,v diff -u -N -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/simulation/www/simplay/play-master.tcl 29 Mar 2004 14:58:57 -0000 1.4.2.1 +++ openacs-4/packages/simulation/www/simplay/play-master.tcl 30 Nov 2004 21:48:19 -0000 1.4.2.2 @@ -9,6 +9,17 @@ set role_id [ns_queryget role_id] } +simulation::case::get -case_id $case_id -array case + +if { ![exists_and_not_null workflow_id] } { + set workflow_id $case(workflow_id) +} + +set simulation_name [simulation::template::get_element \ + -workflow_id $workflow_id -element pretty_name] + +set simulation_title "${simulation_name} — $case(label)" + # Get any simulation specific Stylesheet # set stylesheet_link "" 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 -N -r1.5 -r1.5.2.1 --- openacs-4/packages/simulation/www/simplay/portfolio.adp 12 Jan 2004 15:37:28 -0000 1.5 +++ openacs-4/packages/simulation/www/simplay/portfolio.adp 30 Nov 2004 21:48:19 -0000 1.5.2.1 @@ -2,5 +2,11 @@ @title;noquote@ @context;noquote@ + + + + + + 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 -N -r1.6.2.1 -r1.6.2.2 --- openacs-4/packages/simulation/www/simplay/portfolio.tcl 19 Mar 2004 10:52:44 -0000 1.6.2.1 +++ openacs-4/packages/simulation/www/simplay/portfolio.tcl 30 Nov 2004 21:48:19 -0000 1.6.2.2 @@ -3,6 +3,7 @@ } { case_id:integer role_id:integer + portfolio_orderby:optional } set workflow_id [simulation::case::get_element -case_id $case_id -element workflow_id] @@ -14,3 +15,7 @@ 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/ + +if { ![exists_and_not_null portfolio_orderby] } { + set portfolio_orderby 0 +} \ No newline at end of file Index: openacs-4/packages/simulation/www/simplay/task-detail.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.adp,v diff -u -N -r1.10.2.4 -r1.10.2.5 --- openacs-4/packages/simulation/www/simplay/task-detail.adp 22 Mar 2004 15:27:27 -0000 1.10.2.4 +++ openacs-4/packages/simulation/www/simplay/task-detail.adp 30 Nov 2004 21:48:19 -0000 1.10.2.5 @@ -25,20 +25,33 @@ @action.description@

    -

    -@documents_pre_form;noquote@ -

    - - + +

    - #simulation.to_attach_a_document# + #simulation.no_attachments#

    + +

    +

    #simulation.Documents#

    + @documents_pre_form;noquote@ +

    +
    +
    + + +

    + #simulation.to_attach_a_document# +

    +
    +
    +

    #simulation.lt_Attachments_in_receiv# @received_attachments;noquote@

    + Index: openacs-4/packages/simulation/www/simplay/task-detail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/simplay/task-detail.tcl,v diff -u -N -r1.22.2.6 -r1.22.2.7 --- openacs-4/packages/simulation/www/simplay/task-detail.tcl 1 Jun 2004 14:51:45 -0000 1.22.2.6 +++ openacs-4/packages/simulation/www/simplay/task-detail.tcl 30 Nov 2004 21:48:19 -0000 1.22.2.7 @@ -38,74 +38,6 @@ set return_url [export_vars -base case { case_id role_id }] } - if { [info exists body] && [info exists received_message_item_id] } { - # We have a prepopulated body. This means we are responding to a message (see else clause below) - # Display a listing of any attachments in the message being responded to - set attachments_set_list [bcms::item::list_related_items \ - -revision live \ - -item_id $received_message_item_id \ - -relation_tag attachment \ - -return_list] - - set received_attachments "" - foreach attachment_set $attachments_set_list { - set object_url [simulation::object::content_url -name [ns_set get $attachment_set name]] - set object_title [ns_set get $attachment_set title] - set mime_type [ns_set get $attachment_set mime_type] - append received_attachments "$object_title ($mime_type)
    " - } - - } else { - # If this is a message task (with recipients) and its recipients have previously executed a message task - # that put us in the current state then we consider this a response and we prepopulate the message - # subject and body with text from the message being responded to. - if {[db_0or1row select_received_message { - select sm.item_id as received_message_item_id, - sm.from_role_id, - sm.to_role_id, - sm.creation_date, - cr.title as subject, - cr.content as triggering_body, - cr.mime_type as mime_type - from sim_messagesx sm, - cr_revisions cr - where sm.message_id = cr.revision_id - and sm.entry_id = (select max(wcl.entry_id) - from workflow_case_log wcl, - workflow_fsm_actions wfa, - workflow_case_fsm wcf, - sim_messagesx sm2 - where wcl.case_id = sm.case_id - and wcl.action_id = wfa.action_id - and wcf.case_id = wcl.case_id - and wfa.new_state = wcf.current_state - and sm2.entry_id = wcl.entry_id - and sm2.to_role_id = :role_id - and sm2.from_role_id in (select recipient - from sim_task_recipients - where task_id = :action_id - ) - ) - and sm.case_id = :case_id - }] } { - # Only refresh form with prepopulated subject and body if this is not a submit - if { ![string equal action [ns_set iget [rp_getform] form:id]] } { - set subject "Re: $subject" - set body " - ------Original Message----- -From: [workflow::role::get_element -role_id $from_role_id -element character_title] -Sent: [lc_time_fmt $creation_date "%x %X"] -To: [workflow::role::get_element -role_id $to_role_id -element character_title] -Subject: $subject - -[ad_html_text_convert -from $mime_type -to "text/plain" $triggering_body]" - - ad_returnredirect [export_vars -base [ad_conn url] { enabled_action_id role_id subject body bulk_p received_message_item_id}] - } - } - } - set common_actions_count 1 set ignored_actions_count 0 @@ -163,7 +95,13 @@ set document_upload_url [export_vars -base document-upload {case_id role_id {return_url {[ad_return_url]}}}] -if { ![empty_string_p $action(recipients)] } { +if { [empty_string_p $action(recipients)] } { + set message_p false +} else { + set message_p true +} + +if { $message_p } { # We have recipient roles - use message form if { !$bulk_p } { @@ -176,7 +114,7 @@ set form_id action - ad_form -name $form_id -edit_buttons { { Send ok } } -export { case_id role_id {enabled_action_ids $enabled_action_id} bulk_p} \ + ad_form -name $form_id -edit_buttons { { Send ok } } -cancel_url $return_url -export { case_id role_id {enabled_action_ids $enabled_action_id} bulk_p} \ -form { {pretty_name:text(inform) {label {[_ simulation.Task]}} @@ -214,23 +152,37 @@ } set body [template::util::richtext::create $body $body_mime_type] set focus "action.body" - } + } else { + if { ![empty_string_p $action(default_text)] } { + set body [template::util::richtext::create $action(default_text) $action(default_text_mime_type)] + set body_mime_type $action(default_text_mime_type) + } + } set pretty_name $action(pretty_name) set description [template::util::richtext::create $action(description) $action(description_mime_type)] - set documents [simulation::ui::forms::document_upload::documents_element_value $action_id] + set documents [simulation::ui::forms::document_upload::documents_element_value_content \ + $action_id] + + # Let's tell users if there's no attachments instead of giving + # them an empty
      pair. + if { [string match "
        " $documents] } { + set documents "[_ simulation.no_attachments]" + } + set documents_pre_form "" set recipient_list [list] foreach recipient_id $action(recipients) { - lappend recipient_list [simulation::role::get_element -role_id $recipient_id -element character_title] + simulation::role::get -role_id $recipient_id -array recipient_role + lappend recipient_list "$recipient_role(pretty_name) ($recipient_role(character_title))" } set recipient_names [join $recipient_list ", "] if { ![empty_string_p $action(assigned_role_id)] } { simulation::role::get -role_id $action(assigned_role_id) -array sender_role - set sender_name $sender_role(character_title) + set sender_name "$sender_role(pretty_name) ($sender_role(character_title))" } } -on_submit { @@ -273,21 +225,30 @@ set form_id document + set documents_pre_form [simulation::ui::forms::document_upload::documents_element_value_content $action_id] + set documents_pre_form_empty_p [string match "
          " $documents_pre_form] + ad_form -name $form_id \ -export { case_id role_id workflow_id {enabled_action_ids $enabled_action_id} bulk_p} \ + -cancel_url $return_url \ -html {enctype multipart/form-data} \ -form [concat {{pretty_name:text(inform) {label {[_ simulation.Task]}}}} \ [simulation::ui::forms::document_upload::form_block]] \ -on_request { set pretty_name $action(pretty_name) - set documents_pre_form [simulation::ui::forms::document_upload::documents_element_value $action_id] - - } -on_submit { - + } -validate { + {document_file + {[simulation::ui::forms::document_upload::check_mime -document_file $document_file]} + "[_ simulation.lt_The_mime_type_of_your] [_ simulation.lt_Please_contact_______] + ([ad_host_administrator]) + [_ simulation.lt_if_you_think_youre_up]" + } + } -on_submit { + db_transaction { foreach one_action $common_enabled_action_ids { set case_id [lindex $one_action 1] - + set document [lindex $document_file 0] set entry_id [workflow::case::action::execute \ -case_id $case_id \