Index: openacs-4/packages/acs-templating/acs-templating.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/acs-templating.info,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/acs-templating/acs-templating.info 19 Jan 2002 03:55:16 -0000 1.5
+++ openacs-4/packages/acs-templating/acs-templating.info 20 Feb 2002 21:07:13 -0000 1.6
@@ -137,6 +137,7 @@
+
@@ -190,6 +191,7 @@
+
@@ -322,9 +324,9 @@
-
-
+
+
Index: openacs-4/packages/acs-templating/sql/postgresql/demo-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/sql/postgresql/demo-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/acs-templating/sql/postgresql/demo-create.sql 27 Apr 2001 02:27:09 -0000 1.1
+++ openacs-4/packages/acs-templating/sql/postgresql/demo-create.sql 20 Feb 2002 21:07:13 -0000 1.2
@@ -1,4 +1,5 @@
create sequence ad_template_sample_users_seq start 5 increment 1;
+create view ad_template_sample_users_sequence as select nextval('ad_template_sample_users_seq') as nextval;
create table ad_template_sample_users (
user_id integer primary key,
Index: openacs-4/packages/acs-templating/www/doc/demo/form.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/form.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/doc/demo/form.tcl 27 Apr 2001 02:27:09 -0000 1.2
+++ openacs-4/packages/acs-templating/www/doc/demo/form.tcl 20 Feb 2002 21:07:13 -0000 1.3
@@ -1,36 +1,35 @@
form create add_user -elements {
- user_id -label "User ID" -datatype integer -widget hidden
- first_name -html { size 30 } -label "First Name" -datatype text
- last_name -html { size 30 } -label "Last Name" -datatype text
- address1 -html { size 40 } -label "Address 1" -optional -datatype text
- address2 -html { size 40 } -label "Address 2" -optional -datatype text
- city -html { size 25 } -label "City" -optional -datatype text
- state -html { size 3 maxlength 2 } \
- -label "State" -datatype keyword \
- -validate { {expr [string length $value] == 2 } \
- { State must be 2 characters in length } }
- } \
--html { onSubmit "return confirm('Are you sure you want to submit?');" }
+ user_id -label "User ID" -datatype integer -widget hidden
+ first_name -html { size 30 } -label "First Name" -datatype text
+ last_name -html { size 30 } -label "Last Name" -datatype text
+ address1 -html { size 40 } -label "Address 1" -optional -datatype text
+ address2 -html { size 40 } -label "Address 2" -optional -datatype text
+ city -html { size 25 } -label "City" -optional -datatype text
+ state -html { size 3 maxlength 2 } \
+ -label "State" -datatype keyword \
+ -validate { {expr [string length $value] == 2 } \
+ { State must be 2 characters in length } }
+} \
+ -html { onSubmit "return confirm('Are you sure you want to submit?');" }
# set values
if { [form is_request add_user] } {
- set query "select ad_template_sample_users_seq.nextval from dual"
- template::query get_user_id user_id onevalue $query
+ set query "select ad_template_sample_users_seq.nextval from dual"
+ template::query get_user_id user_id onevalue $query
- element set_properties add_user user_id -value $user_id
+ element set_properties add_user user_id -value $user_id
}
if { [form is_valid add_user] } {
-
- db_dml insert_sample -bind [ns_getform] "
+ db_dml insert_sample "
insert into
ad_template_sample_users
values (
:user_id, :first_name, :last_name, :address1, :address2, :city, :state
- )"
+ )" -bind [ns_getform]
- template::forward index.html
+ template::forward index.html
}
Index: openacs-4/packages/acs-templating/www/doc/demo/user-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/user-edit.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/acs-templating/www/doc/demo/user-edit.tcl 27 Apr 2001 02:27:09 -0000 1.2
+++ openacs-4/packages/acs-templating/www/doc/demo/user-edit.tcl 20 Feb 2002 21:07:13 -0000 1.3
@@ -45,12 +45,11 @@
# query for users (obviously not a very scalable query)
set user_search [string tolower $user_search]
- set query "select user_id, first_name, last_name
- from ad_template_sample_users where
- lower(first_name) like '%$user_search%'
- or lower(last_name) like '%$user_search%'"
-
- query users multirow $query
+ query get_users users multirow "
+ select user_id, first_name, last_name
+ from ad_template_sample_users
+ where lower(first_name) like '%' || :user_search || '%'
+ or lower(last_name) like '%' || :user_search || '%'"
set user_count [multirow size users]
if { $user_count == 1 } {
@@ -103,14 +102,10 @@
if { [form is_request user_edit] } {
- set query "select
- user_id, first_name, last_name, address1, address2, city, state
- from
- ad_template_sample_users
- where
- user_id = :user_id"
-
- if { ! [query info onerow $query] } {
+ if { ! [query get_info info onerow "
+ select user_id, first_name, last_name, address1, address2, city, state
+ from ad_template_sample_users
+ where user_id = :user_id"] } {
request error invalid_user_id "Invalid User ID"
}