lars
committed
on 18 Dec 03
Added sim_case_role_object_map table
openacs-4/.../lib/add-datasources.tcl (+77)
  1 ad_page_contract {
  2
  3     Generate a list of datasources that have supporting portlets.
  4
  5     The user's returned to the current page after installing the select datasource(s).
  6
  7     @author Don Baccus (dhogaza@pacifier.com)
  8     @creation-date
  9     @cvs-id $Id$
  10
  11 } { }
  12
  13 set package_id [ad_conn package_id]
  14 if { ![info exists pageset_id] } {
  15     set pageset_id [layout::pageset::get_master_template_id -package_id $package_id]
  16 }
  17
  18 if { ![info exists return_url] } {
  19     set return_url [ad_conn url]?[ad_conn query]
  20 }
  21
  22 db_multirow -extend {add_url includelets instances} datasources get_datasources {} {
  23     set add_url [export_vars -base [ad_conn package_url]add-datasources-2 \
  24                     { pageset_id datasource return_url }]
  25     set includelets [join [db_list get_includelets {}] ", "]
  26     db_1row get_instance_count {}
  27 }
  28
  29 set wizard_p [template::wizard::exists]
  30
  31 # If we're in the wizard and have no datasources or includelets just skip to the next step.
  32
  33 if { $wizard_p && ${datasources:rowcount} == 0 && ${includelets:rowcount} == 0 } {
  34     rp_form_put wizard_submit_next wizard_submit_next
  35     template::wizard::forward
  36 }
  37
  38 # Build the list-builder list.
  39
  40 # First, build a list of datasources to add
  41
  42 template::list::create \
  43     -name datasources \
  44     -multirow datasources \
  45     -key datasource \
  46     -elements {
  47         description {
  48             label Datasource
  49         }
  50         instances {
  51             label Instances
  52         }
  53         includelets {
  54             label Includelets
  55         }
  56         add {
  57             label Add
  58             link_url_col add_url
  59             link_html { title "Add datasource" }
  60             display_template {Add}
  61         }
  62     }
  63
  64 # Now, if we're in the template wizard, generate the wizard form and buttons.
  65  
  66 if { $wizard_p } {
  67
  68     ad_form -name add-datasources -form {
  69         foo:text(hidden),optional
  70     } -on_submit {
  71         template::wizard::forward
  72     }
  73
  74     template::wizard::submit add-datasources -buttons {back next}
  75 }
  76
  77 ad_return_template