Index: openacs-4/packages/acs-bootstrap-installer/installer.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/acs-bootstrap-installer/installer.tcl 15 Oct 2003 09:47:44 -0000 1.12 +++ openacs-4/packages/acs-bootstrap-installer/installer.tcl 25 Nov 2003 14:15:13 -0000 1.12.2.1 @@ -12,6 +12,140 @@ # Return a header for an installation page, suitable for ns_writing. # This procedure engages the installer mutex, as every installer page is a critical section. +ad_proc -private install_input_widget { + {-type ""} + {-size 40} + {-extra_attributes ""} + param_name +} { + Return an HTML input widget for a parameter with an + indication of whether the param is mandatory. +} { + set type_attribute [ad_decode $type "" "" "type=\"$type\""] + + set input_widget "" + + if { [install_param_mandatory_p $param_name] } { + append input_widget " \[*\]" + } + + return $input_widget +} + +ad_proc -private install_param_mandatory_p { param_name } { + Return 1 if the given parameter with given name is + mandatory for OpenACS install and 0 otherwise. + + @author Peter Marklund +} { + array set mandatory_params_array [install_mandatory_params] + set mandatory_names [array names mandatory_params_array] + return [expr [lsearch -exact $mandatory_names $param_name] != -1] +} + +ad_proc -private install_mandatory_params {} { + Return information about parameters that are mandatory + for OpenACS installation. + + @return An array list with variable names as values + and pretty names as keys. +} { + return { + email "Email" + first_names "First names" + last_name "Last name" + password "Password" + password_confirmation "Password confirmation" + system_url "System URL" + system_name "System name" + publisher_name "Publisher name" + } +} + +ad_proc -private install_optional_params {} { + Return information about parameters that are optional + for OpenACS installation. + + @return An array list with variable names as values + and default values as keys. +} { + return { + username "" + system_owner "" + admin_owner "" + host_administrator "" + outgoing_sender "" + new_registrations "" + } +} + +ad_proc -private install_page_contract { mandatory_params optional_params } { + Instead of using ad_page_contract that relies on certain acs-subsite libraries + that may not be available at all times during installation we use this + more primitive proc instead. + + @param mandatory_params An array list where keys are param names and values + are pretty names. + @param optional_params An array list with param names as keys and default + values as keys. + + @author Peter Marklund +} { + array set mandatory_params_array $mandatory_params + array set optional_params_array $optional_params + + set form [ns_getform] + set missing_params [list] + + if { [empty_string_p $form] } { + # Form is empty + set missing_params $mandatory_params + } else { + # Form is non-empty + + # Loop over all params + set all_param_names [concat [array names mandatory_params_array] \ + [array names optional_params_array]] + foreach param_name $all_param_names { + set param_value [ns_set iget $form $param_name] + set mandatory_p [expr [lsearch -exact $mandatory_params $param_name] != -1] + + if { ![empty_string_p $param_value] } { + # Param in form - set value in callers scope + uplevel [list set $param_name $param_value] + } else { + # Param not in form + if { $mandatory_p } { + # Mandatory param - complain + lappend missing_params $mandatory_params_array($param_name) + } else { + # Optional param - set default + uplevel [list set $param_name $optional_params_array($param_name)] + } + } + } + } + + # If there are missing mandatory params - return a complaint + # page and exit + if { [llength $missing_params] > 0 } { + ns_write "[install_header 200 "Missing parameters"] + +The following mandatory parameters are missing: + + +

+Please back up your browser and provide those parameters. Thank you. +

+ +[install_footer] +" + return -code return + } +} + proc install_header { status title } { # Prefix the page title Index: openacs-4/packages/acs-bootstrap-installer/installer/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/index.tcl,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 14 Oct 2003 16:19:59 -0000 1.17 +++ openacs-4/packages/acs-bootstrap-installer/installer/index.tcl 25 Nov 2003 14:15:13 -0000 1.17.2.1 @@ -275,6 +275,9 @@ set system_url "http://yourdomain.com" } + set email_input_widget [install_input_widget \ + -extra_attributes "onChange=\"updateSystemEmails()\"" \ + email] append body "

System Configuration

@@ -304,27 +307,27 @@ Email: - +$email_input_widget Username: - \[*\] + [install_input_widget username] First Name: - + [install_input_widget first_names] Last Name: - + [install_input_widget last_name] Password: - + [install_input_widget -size 12 -type password password] Password (again): - + [install_input_widget -size 12 -type password password_confirmation] @@ -333,42 +336,42 @@ System URL: -
+[install_input_widget system_url]
The canonical URL of your system.

System Name: -
+ [install_input_widget system_name]
The name of your system.

Publisher Name: -
+ [install_input_widget publisher_name]
The legal name of the person or corporate entity responsible for the site.

System Owner: -
+ [install_input_widget system_owner]
The email address signed at the bottom of user-visible pages.

Admin Owner: -
+ [install_input_widget admin_owner]
The email address signed on administrative pages.

Host Administrator: -
+ [install_input_widget admin_owner]
A person whom people can contact if they experience technical problems.

Outgoing Email Sender: -
+ [install_input_widget outgoing_sender]
The email address that will sign outgoing alerts. New Registration Email: -
+ [install_input_widget new_registrations]
The email address to send New registration notifications.

Index: openacs-4/packages/acs-bootstrap-installer/installer/install.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-bootstrap-installer/installer/install.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/acs-bootstrap-installer/installer/install.tcl 31 Oct 2003 11:07:42 -0000 1.6 +++ openacs-4/packages/acs-bootstrap-installer/installer/install.tcl 25 Nov 2003 14:15:13 -0000 1.6.2.1 @@ -1,27 +1,11 @@ -ad_page_contract { - Carries out the full OpenACS install. +############## +# +# Get configuration parameters +# +############# - @author Peter Marklund - @cvs-id $Id$ +install_page_contract [install_mandatory_params] [install_optional_params] -} { - email:notnull - {username ""} - first_names:notnull - last_name:notnull - password:notnull - password_confirmation:notnull - - system_url:notnull - system_name:notnull - publisher_name:notnull - {system_owner ""} - {admin_owner ""} - {host_administrator ""} - {outgoing_sender ""} - {new_registrations ""} -} - # Default all system emails to the administrators email foreach var_name {system_owner admin_owner host_administrator outgoing_sender new_registrations} { if { [empty_string_p [set $var_name]] } {