Index: openacs-4/packages/acs-subsite/www/admin/site-map/new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/site-map/new.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-subsite/www/admin/site-map/new.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-subsite/www/admin/site-map/new.tcl 21 Jun 2002 19:08:33 -0000 1.2 @@ -1,53 +1,41 @@ ad_page_contract { - @author Rafael Schloming (rhs@mit.edu) - @creation-date 2000-09-09 - @cvs-id $Id$ + @author Rafael Schloming (rhs@mit.edu) + @creation-date 2000-09-09 + @version $Id$ } { - new_node_id:naturalnum - parent_id:integer,notnull - name:notnull - node_type:notnull - {expand:integer,multiple {}} - {root_id:integer {}} + parent_id:integer,notnull + name:notnull + node_type:notnull + {expand:integer,multiple {}} + {root_id:integer {}} } -validate { - name_root_ck -requires name:notnull { - if {[string match "*/*" $name]} { - ad_complain + name_root_ck -requires name:notnull { + if {[string match "*/*" $name]} { + ad_complain + } } - } - - name_duplicate_ck -requires name_root_ck { - if { [db_string site_node_duplicate_name_root_ck { - select decode(count(*), 0, 0, 1) - from site_nodes - where name = :name - and parent_id = :parent_id - and node_id <> :new_node_id - } -default 0]} { - ad_complain - } - } - - node_type_ck -requires node_type:notnull { - switch $node_type { - folder { - set directory_p t - set pattern_p t - } - - file { - set directory_p f - set pattern_p f - } - - default { - ad_complain - } - } - } - + name_duplicate_ck -requires name_root_ck { + if { [db_string site_node_duplicate_name_root_ck {} -default 0]} { + ad_complain + } + } + node_type_ck -requires node_type:notnull { + switch $node_type { + folder { + set directory_p t + set pattern_p t + } + file { + set directory_p f + set pattern_p f + } + default { + ad_complain + } + } + } } -errors { name_root_ck {Folder or file names cannot contain '/'} name_duplicate_ck {The URL mapping you are creating is already in use. Please delete the other one or change your URL.} @@ -58,25 +46,14 @@ set ip_address [ad_conn peeraddr] db_transaction { - set node_id [db_exec_plsql node_new { - begin - :1 := site_node.new ( - node_id => :new_node_id, - parent_id => :parent_id, - name => :name, - directory_p => :directory_p, - pattern_p => :pattern_p, - creation_user => :user_id, - creation_ip => :ip_address - ); - end; - }] + set node_id [site_node::new \ + -name $name \ + -parent_id $parent_id \ + -directory_p $directory_p \ + -pattern_p $pattern_p \ + ] } on_error { - if {![db_string site_node_new_doubleclick_protect { - select decode(count(*), 0, 0, 1) - from site_nodes - where node_id = :new_node_id - } -default 0]} { + if {![db_string site_node_new_doubleclick_protect {} -default 0]} { ad_return_complaint "Error Creating Site Node" "The following error was generated when attempting to create the site node:
@@ -86,7 +63,7 @@
 }
 
 if {[lsearch $expand $parent_id] == -1} {
-  lappend expand $parent_id
+    lappend expand $parent_id
 }
 
-ad_returnredirect .?[export_url_vars expand:multiple root_id]
+ad_returnredirect ".?[export_url_vars expand:multiple root_id]"