registration.wf
Delivered as */*
[ hide source ] | [ make this the default ]
File Contents
# -*- Tcl -*- ######################################################################## # Workflow for registration for the OpenACS conference 2022 # ========================================================= # # # {entry -name New.Registration -form en:registration.wf} # #set :policy ::xowf::test_item::test-item-policy-edit set :autoname 1 ;# to avoid editable name field # set :policy ::xowf::test_item::test-item-policy-answer set :policy ::xowf::conf2022policy set :debug 0 set :fc_repository { {postalAddress:textarea,rows=4,label=Postal address,help_text=Address to be used when preparing and issuing your invoice. Pls. indicate: street/ city/ state/ postal code/ country plus any additional billing information to be included into the invoice.} {diet:textarea,rows=2,label=Dietary requirements,help_text=Pls. indicate any dietary requirements!} {showMe:boolean,label=Show my name on the participant list at the conference's Web site} {affiliation:text,label=Affiliation (Your Organisation)} {comments:textarea,label=Comments or suggestions} {username:text,readonly=false,label=Participant (Full Name)} {email:text,readonly=true,label=Email} {contribTitle:text,label=Title of your contribution,help_text=Pls. indicate the title of your planned contribution} {contribDesc:richtext,label=Description,help_text=Pls. describe the planned presentation according to the Call for Presentations. In case you consider multiple contributions__COMMA__ simply add these as "Comments and suggestions" below.} {contribComments:textarea,label=Comments or suggestions,help_text=Do you have any time restrictions regarding time slots for your presentation? Do you have additional or alternative presentation proposals?} {registerConfirm:boolean,horizontal=yes,label=Terms of Registration,default=f} } # {contribType:select,required,options={{Presentation} presentation} {{Birds of a Feather} bof} {{Demonstration} demo} {{Participation only} ponly},label=Planned contribution} Action allocate -proc activate {obj} { # Called, when we try to create or use a workflow instance # via a workflow definition ($obj is a workflow definition) set parent_id [$obj parent_id] #set parent_id [$obj item_id] set name [ns_md5 $parent_id-[::xo::cc set untrusted_user_id]] set parent_obj [::xo::db::CrClass get_instance_from_db -item_id $parent_id] set title "Conference Registration for [::xo::get_user_name [ad_conn user_id]]" :payload [list title $title name $name parent_id [$parent_obj item_id]] } Action save \ -extra_css_class "btn btn-primary btn-lg" \ -label "Update Registration Data" Action register \ -proc activate {obj} { ns_log notice [$obj serialize] set ia [$obj instance_attributes] set cb_value [dict get $ia registerConfirm] if {$cb_value eq "f"} { ad_returnredirect -html \ -message "<b>Please accept the <u>terms for registration</u>!</b>" \ [$obj pretty_link] ad_script_abort } }\ -next_state registered \ -extra_css_class "btn btn-primary btn-lg" \ -label "Register" Action submit_abstract \ -next_state submitted \ -extra_css_class "btn btn-primary btn-lg" \ -label "Submit or Update Abstract" Action back_to_registered \ -proc activate {obj} { $obj save ad_returnredirect [$obj pretty_link] ad_script_abort } \ -next_state registered \ -extra_css_class "btn btn-primary btn-lg" \ -label "Save" Action back_to_registration \ -next_state registered \ -extra_css_class "btn btn-primary btn-lg" \ -label "Return to Registration" Action deregister \ -proc activate {obj} { set delete_link [$obj pretty_link -query m=delete] ad_returnredirect $delete_link ad_script_abort }\ -extra_css_class "btn btn-danger btn-lg" \ -label "Cancel Registration" State parameter { {extra_css {}} } State initial \ -actions {register} \ -view_method edit \ -form en:register1.form State registered \ -actions {save submit_abstract deregister} \ -view_method edit \ -form en:register2a.form State submitted \ -actions {back_to_registered back_to_registration} \ -view_method edit \ -form en:register2b.form :wf-specific { #ns_log notice "REGISTRATION.wf wf-specific" ######################################################################## # web-callable method "registrations" for the workflow object # # Print a friendly report # :proc www-registrations {} { set HTML "" #set withAnswerColumns [${:package_id} query_parameter with_answers:boolean 0] set items [::xowiki::FormPage get_form_entries \ -base_item_ids ${:item_id} \ -form_fields "" \ -always_queried_attributes "*" \ -initialize false \ -orderby "item_id" \ -extra_where_clause "" \ -publish_status all \ -package_id ${:package_id} \ ] foreach item [$items children] { set ia [$item instance_attributes] $item set famnam [lindex [dict get $ia username] end] } $items orderby -order "increasing" famnam #ns_log notice "ITEMS [$items children]" append HTML "<p>[llength [$items children]] registrations</p>" foreach item [$items children] { set ia [$item instance_attributes] #append HTML "[$item instance_attributes] <br>" append HTML "<p><strong>[dict get $ia username]</strong> ([dict get $ia email])" if {[dict exists $ia contribTitle]} { append HTML ": <i>[dict get $ia contribTitle]</i>" } append HTML "<br>" foreach att {contribDesc contribComments} { if {[dict exists $ia $att] && [dict get $ia $att] ne ""} { append HTML "<blockquote style='margin-left: 2em;'>[dict get $ia $att]</blockquote>" } #append HTML "<br>" } append HTML "</p>" } :www-view $HTML } } :object-specific { #ns_log notice "REGISTRATION.wf object-specific" if {[:property email] eq ""} { :set_property -new 1 email [::party::email -party_id [ad_conn user_id]] :set_property -new 1 username [::xo::get_user_name [ad_conn user_id]] } # # grant admin permissions to creation_user # #if {![permission::permission_p -party_id [:creation_user] -object_id [[self] item_id] -privilege "admin"]} { # ns_log notice "[:creation_user] does not have admin permissions on [[self] item_id], granting..." # permission::grant -party_id [:creation_user] -object_id [[self] item_id] -privilege "admin" #} # # set confirm popup before deregister # template::add_confirm_handler \ -selector {'[name="__action_deregister"]'} \ -message "Do you really want to deregister from the conference?\ Your registration will be deleted. To request a refund of your\ registration fee, contact conf2024@openacs.org.\nPlease\ note that a full refund is only guarantueed until June, 30th." #:proc www-delete-registration {} { # next # ad_returnredirect /conf2024/info/ # # ns_log notice "revoking [:creation_user] - [:package_id] - admin" # # permission::revoke -party_id [:creation_user] -object_id [:package_id] -privilege admin # ad_script_abort #} :proc render_icon {} { # We can use a different icon when the participant paid return {text "<adp:icon name='cart'>" is_richtext true} } #ns_log notice "REGISTRATION.wf loaded [:info procs]" } # # Local variables: # mode: tcl # tcl-indent-level: 2 # indent-tabs-mode: nil # End: