Index: openacs-4/packages/acs-tcl/tcl/html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/html-procs.tcl,v
diff -u -r1.5.2.4 -r1.5.2.5
--- openacs-4/packages/acs-tcl/tcl/html-procs.tcl 4 Jun 2024 13:18:10 -0000 1.5.2.4
+++ openacs-4/packages/acs-tcl/tcl/html-procs.tcl 4 Jun 2024 13:18:26 -0000 1.5.2.5
@@ -1,6 +1,6 @@
ad_library {
Procs to read and manipulate HTML structures
-
+
@author Antonio Pisano
@creation-date 2015-09-26
}
@@ -11,9 +11,9 @@
-node:required
} {
Extract attributes names and values from a tDOM node
-
+
@param node tDOM node
-
+
@return List in array get form of attribute names and values for node
} {
foreach attribute [$node attributes] {
@@ -29,9 +29,9 @@
-html:required
} {
Extract every form's specification from HTML supplied
-
+
@param html HTML text
-
+
@return Form specification as a nested list of lists in array get form
} {
# Parse document
@@ -66,28 +66,28 @@
lappend form "fields" $fields
lappend forms $form
}
-
+
return $forms
}
ad_proc -public util::html::get_form {
-forms:required
{-id ""}
} {
- Extract form with the specified id from a structure as that
+ Extract form with the specified id from a structure as that
coming from util::html::get_forms
proc.
-
+
@param forms Form structure
@param id HTML id of the form to be read. If structure contains only
one form, this parameter can be omitted, otherwise
the proc will throw an error.
-
+
@return form structure
-} {
+} {
if {[llength $forms] == 1} {
return [lindex $forms 0]
- }
-
+ }
+
if {$id ne ""} {
# We have more than one form, check for supplied id
foreach form $forms {
@@ -96,7 +96,7 @@
}
}
}
-
+
error "Form was not found in supplied HTML"
}
@@ -105,9 +105,9 @@
} {
Read vars from a form structure as that coming out from
util::html::get_form
.
-
+
@param form Form structure
-
+
@return var specification in a form suitable for the vars
argument of proc export_vars
.
} {
@@ -145,15 +145,15 @@
}
}
}
-
+
# Now varDict must be translated in export_vars form
set vars [list]
foreach {name value} $varDict {
- # Multiple values must be specified
+ # Multiple values must be specified
# with the :multiple modifier
if {[llength $value] > 1} {
set name ${name}:multiple
- # Single values must be extracted
+ # Single values must be extracted
# from the list
} else {
set value [lindex $value 0]
@@ -163,7 +163,7 @@
regsub -all -- {:} $name {\:} name
lappend vars [list $name $value]
}
-
+
return $vars
}