Index: openacs-4/packages/acs-admin/www/apm/package-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/package-add-2.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 12 Feb 2019 17:12:18 -0000 1.19 +++ openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 12 Feb 2019 17:28:59 -0000 1.20 @@ -1,6 +1,6 @@ ad_page_contract { Adds a package to the package manager. - + @author Bryan Quinn (bquinn@arsdigita.com) @creation-date 17 April 2000 @cvs-id $Id$ @@ -24,64 +24,64 @@ version_id:naturalnum { owner_name:multiple } { owner_uri:multiple} - { vendor ""} + { vendor ""} { vendor_uri ""} { install_p:boolean 0 } {implements_subsite_p:boolean "f"} {inherit_templates_p:boolean "f"} } -validate { package_key_format -requires {package_key} { - if { [regexp {[^a-z0-9-]} $package_key] } { - ad_complain - } + if { [regexp {[^a-z0-9-]} $package_key] } { + ad_complain + } } package_key_unique -requires {package_key} { - if {[apm_package_registered_p $package_key] } { - ad_complain "The package key, $package_key, you have requested -is already registered to another package." - } + if {[apm_package_registered_p $package_key] } { + ad_complain "The package key, $package_key, you have requested + is already registered to another package." + } } pretty_plural_unique -requires {pretty_plural} { - if {[db_string apm_pretty_plural_unique_ck { - select decode(count(*), 0, 0, 1) from apm_package_types - where pretty_plural = :pretty_plural - } -default 0]} { - ad_complain "A package with the pretty plural of $pretty_plural already exists." - } + if {[db_string apm_pretty_plural_unique_ck { + select decode(count(*), 0, 0, 1) from apm_package_types + where pretty_plural = :pretty_plural + } -default 0]} { + ad_complain "A package with the pretty plural of $pretty_plural already exists." + } } package_name_unique -requires {pretty_name} { - if { [db_string apm_name_unique_ck { - select decode(count(*), 0, 0, 1) from apm_package_types - where pretty_name = :pretty_name - } -default 0] } { - ad_complain "A package with the name $pretty_name already exists." - } + if { [db_string apm_name_unique_ck { + select decode(count(*), 0, 0, 1) from apm_package_types + where pretty_name = :pretty_name + } -default 0] } { + ad_complain "A package with the name $pretty_name already exists." + } } package_uri_unique -requires {package_uri} { - if { [db_string apm_uri_unique_ck { - select decode(count(*), 0, 0, 1) from apm_package_types - where package_uri = :package_uri - } -default 0] } { - ad_complain "A package with the URL $package_uri already exists." - } + if { [db_string apm_uri_unique_ck { + select decode(count(*), 0, 0, 1) from apm_package_types + where package_uri = :package_uri + } -default 0] } { + ad_complain "A package with the URL $package_uri already exists." + } } version_uri_unique -requires {version_uri} { - if { [db_string apm_version_uri_unique_ck { - select decode(count(*), 0, 0, 1) from apm_package_versions - where version_uri = :version_uri - } -default 0] } { - ad_complain "A version with the URL $version_uri already exists." - } + if { [db_string apm_version_uri_unique_ck { + select decode(count(*), 0, 0, 1) from apm_package_versions + where version_uri = :version_uri + } -default 0] } { + ad_complain "A version with the URL $version_uri already exists." + } } - version_name_ck -requires {version_uri} { - if {![regexp {^[0-9]+((\.[0-9]+)+((d|a|b|)[0-9]?)?)$} $version_name match]} { - ad_complain - } + version_name_ck -requires {version_uri} { + if {![regexp {^[0-9]+((\.[0-9]+)+((d|a|b|)[0-9]?)?)$} $version_name match]} { + ad_complain + } } } -errors { @@ -105,42 +105,42 @@ db_transaction { # Register the package. apm_package_register $package_key $pretty_name $pretty_plural $package_uri \ - $package_type $initial_install_p $singleton_p $implements_subsite_p \ - $inherit_templates_p - # Insert the version + $package_type $initial_install_p $singleton_p $implements_subsite_p \ + $inherit_templates_p + # Insert the version set version_id [apm_package_install_version \ - -callback apm_dummy_callback \ - -version_id $version_id \ - -array attributes \ - $package_key $version_name $version_uri $summary $description \ - $description_format $vendor $vendor_uri $auto_mount] + -callback apm_dummy_callback \ + -version_id $version_id \ + -array attributes \ + $package_key $version_name $version_uri $summary $description \ + $description_format $vendor $vendor_uri $auto_mount] apm_version_enable -callback apm_dummy_callback $version_id apm_build_one_package_relationships $package_key apm_build_subsite_packages_list apm_package_install_owners -callback apm_dummy_callback \ - [apm_package_install_owners_prepare $owner_name $owner_uri] $version_id + [apm_package_install_owners_prepare $owner_name $owner_uri] $version_id if { $install_p } { - if {[catch { - apm_package_install_spec $version_id - } errmsg]} { - ad_return_error "Filesystem Error" \ + if {[catch { + apm_package_install_spec $version_id + } errmsg]} { + ad_return_error "Filesystem Error" \ "I was unable to create your package for the following reason: -
[ns_quotehtml $errmsg]
" +
[ns_quotehtml $errmsg]
" ad_script_abort - } + } } } on_error { if {[db_string apm_package_add_doubleclick { - select decode(count(*), 0, 0, 1) from apm_package_versions - where version_id = :version_id + select decode(count(*), 0, 0, 1) from apm_package_versions + where version_id = :version_id } -default 0]} { - ad_returnredirect "version-view?version_id=$version_id" - ad_script_abort + ad_returnredirect "version-view?version_id=$version_id" + ad_script_abort } ad_return_error "Database Error" \ "I was unable to create your package for the following reason: -
[ns_quotehtml $errmsg]
" +
[ns_quotehtml $errmsg]
" ad_script_abort } Index: openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl 12 Feb 2019 17:12:18 -0000 1.15 +++ openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl 12 Feb 2019 17:28:59 -0000 1.16 @@ -18,35 +18,35 @@ {max_n_values:integer 1} } -validate { datatype_type_ck { - if {$datatype ne "number" && $datatype ne "string" && $datatype ne "text"} { - ad_complain - } + if {$datatype ne "number" && $datatype ne "string" && $datatype ne "text"} { + ad_complain + } } param_name_unique_ck { - if {[db_string param_name_unique_ck { - select decode(count(*), 0, 0, 1) - from apm_parameters - where parameter_name = :parameter_name + if {[db_string param_name_unique_ck { + select decode(count(*), 0, 0, 1) + from apm_parameters + where parameter_name = :parameter_name and package_key= :package_key - }]} { - ad_complain "The parameter name $parameter_name already exists for this package" - } + }]} { + ad_complain "The parameter name $parameter_name already exists for this package" + } } } -errors { datatype_type_ck {The datatype must be either a number or a string or text.} } db_transaction { apm_parameter_register -parameter_id $parameter_id -scope $scope $parameter_name $description $package_key \ - $default_value $datatype $section_name $min_n_values $max_n_values + $default_value $datatype $section_name $min_n_values $max_n_values apm_package_install_spec $version_id } on_error { if {![db_string apm_parameter_register_doubleclick_p { - select 1 from apm_parameters where parameter_id = :parameter_id + select 1 from apm_parameters where parameter_id = :parameter_id } -default 0]} { - ad_return_error "Database Error" "The database is complaining about the parameter you entered:

-

[ns_quotehtml $errmsg]
" - ad_script_abort + ad_return_error "Database Error" "The database is complaining about the parameter you entered:

+

[ns_quotehtml $errmsg]
" + ad_script_abort } } Index: openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl 12 Feb 2019 17:12:18 -0000 1.13 +++ openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl 12 Feb 2019 17:28:59 -0000 1.14 @@ -17,29 +17,28 @@ {max_n_values:integer 1} } -validate { datatype_type_ck { - if {$datatype ne "number" && $datatype ne "string" && $datatype ne "text"} { - ad_complain - } + if {$datatype ne "number" && $datatype ne "string" && $datatype ne "text"} { + ad_complain + } } } -errors { datatype_type_ck {The datatype must be either a number or a string or text.} } -db_transaction { +db_transaction { ns_log Debug "APM: Updating Parameter: $parameter_id, $parameter_name $description, $package_key, $default_value, $datatype, $section_name, $min_n_values, $max_n_values" apm_parameter_update $parameter_id $package_key $parameter_name $description \ - $default_value $datatype $section_name $min_n_values $max_n_values + $default_value $datatype $section_name $min_n_values $max_n_values apm_package_install_spec $version_id } on_error { - ad_return_error "Database Error" "The parameter could not be updated. + ad_return_error "Database Error" "The parameter could not be updated. The database returned the following error:

[ns_quotehtml $errmsg]
" ad_script_abort -} +} - ad_returnredirect [export_vars -base "version-parameters" { version_id section_name }] ad_script_abort Index: openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl,v diff -u -r1.69 -r1.70 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 12 Feb 2019 17:12:18 -0000 1.69 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 12 Feb 2019 17:28:59 -0000 1.70 @@ -879,7 +879,7 @@ set i 0 db_foreach select_locale_keys { - select locale, package_key, message_key, message + select locale, package_key, message_key, message from lang_messages where deleted_p = 'f' } { Index: openacs-4/packages/acs-mail/tcl/acs-mail-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-mail/tcl/acs-mail-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-mail/tcl/acs-mail-procs.tcl 12 Feb 2019 17:12:18 -0000 1.13 +++ openacs-4/packages/acs-mail/tcl/acs-mail-procs.tcl 12 Feb 2019 17:28:59 -0000 1.14 @@ -761,3 +761,8 @@ return 1 } +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/acs-tcl/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/install-procs.tcl,v diff -u -r1.36 -r1.37 --- openacs-4/packages/acs-tcl/tcl/install-procs.tcl 12 Feb 2019 17:12:18 -0000 1.36 +++ openacs-4/packages/acs-tcl/tcl/install-procs.tcl 12 Feb 2019 17:28:59 -0000 1.37 @@ -16,19 +16,19 @@ ad_proc -public install::xml::action::text { node } { A documentation element which ignores its contents and does no processing. -} { +} { return {} } ad_proc -private ::install::xml::action::source { node } { - Source an install.xml file, sql file or Tcl script during execution of + Source an install.xml file, sql file or Tcl script during execution of the current install.xml. - If no type attribute is specified then this tag will attempt to guess - type of the sourced script from the file extension, otherwise it defaults + If no type attribute is specified then this tag will attempt to guess + type of the sourced script from the file extension, otherwise it defaults to install.xml. - The type of the sourced script may be explicitly declared as 'tcl', + The type of the sourced script may be explicitly declared as 'tcl', 'sql' or 'install.xml' using the type attribute. @author Lee Denison lee@xarg.co.uk @@ -82,7 +82,7 @@ } } - return $out + return $out } ad_proc -public install::xml::action::install { node } { @@ -101,7 +101,7 @@ Mounts a package on a specified node.

<mount package="package-key instance-name="name" mount-point="url" />

-} { +} { set package_key [apm_required_attribute_value $node package] set instance_name [apm_required_attribute_value $node instance-name] @@ -138,11 +138,11 @@ set parent_id [site_node::get_node_id -url "/$parent_url"] # technically this isn't safe - between us checking that the node exists - # and using it, the node may have been deleted. + # and using it, the node may have been deleted. # We could "select for update" but since it's in a memory cache anyway, # it won't help us very much! # Instead we just press on and if there's an error handle it at the top level. - + # create the node and reget iff it doesn't exist if { [catch { array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } error] } { set node_id [site_node::new -name $leaf_url -parent_id $parent_id] @@ -189,7 +189,7 @@ Mounts an existing package on a specified node.

<mount-existing package-id="package-id mount-point="url" />

-} { +} { set package_id [apm_attribute_value -default "" $node package-id] set package_key [apm_attribute_value -default "" $node package-key] set mount_point [apm_attribute_value -default "" $node mount-point] @@ -216,17 +216,17 @@ set parent_id [site_node::get_node_id -url "/$parent_url"] # technically this isn't safe - between us checking that the node exists - # and using it, the node may have been deleted. + # and using it, the node may have been deleted. # We could "select for update" but since it's in a memory cache anyway, # it won't help us very much! # Instead we just press on and if there's an error handle it at the top level. - + # create the node and reget iff it doesn't exist if { [catch { array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } error] } { set node_id [site_node::new -name $leaf_url -parent_id $parent_id] array set site_node [site_node::get_from_url -exact -url "/$mount_point"] } - + # There now definitely a node with that path if {$site_node(object_id) eq ""} { # no package mounted - good! @@ -245,7 +245,7 @@ set package_id [install::xml::util::get_id $package_id] } elseif {$package_key ne ""} { set package_id [apm_package_id_from_key $package_key] - } + } set package_id [site_node::mount \ -node_id $node_id \ @@ -261,7 +261,7 @@

<rename-instance package-id="package-id" url="url" instance-name="new instance name" />

-} { +} { set package_id [apm_attribute_value -default "" $node package-id] set url [apm_attribute_value -default "" $node url] set instance_name [apm_required_attribute_value $node instance-name] @@ -315,7 +315,7 @@ Registers a package parameter.

<register-parameter name="parameter" description="description" package-key="package-key" scope="instance or global" default-value="default-value" datatype="datatype" [ [ [ section="section" ] min-n-values="min-n-values" ] max-n-values="max-n-values" ] [ callback="callback" ] [ parameter-id="parameter-id" ]

-} { +} { set name [apm_required_attribute_value $node name] set desc [apm_required_attribute_value $node description] set package_key [apm_required_attribute_value $node package-key] @@ -360,7 +360,7 @@ Sets a package parameter.

<set-parameter name="parameter" [ package="package-key | url="package-url" ] type="[id|literal]" value="value" />

-} { +} { variable ::install::xml::ids set name [apm_required_attribute_value $node name] @@ -370,19 +370,19 @@ set package_ids [install::xml::object_id::package $node] foreach package_id $package_ids { - switch -- $type { - literal { - parameter::set_value -package_id $package_id \ - -parameter $name \ - -value $value - } + switch -- $type { + literal { + parameter::set_value -package_id $package_id \ + -parameter $name \ + -value $value + } - id { - parameter::set_value -package_id $package_id \ - -parameter $name \ - -value $ids($value) - } - } + id { + parameter::set_value -package_id $package_id \ + -parameter $name \ + -value $ids($value) + } + } } return } @@ -407,7 +407,7 @@ Sets permissions on an object.

<set-permissions grantee="party" privilege="package-key />

-} { +} { set privileges [apm_required_attribute_value $node privilege] set privilege_list [split $privileges ","] @@ -417,7 +417,7 @@ foreach grantee $grantees { set party_id [apm_invoke_install_proc -type object_id -node $grantee] - + set objects_node [xml_node_get_children_by_name [lindex $node 0] object] set objects [xml_node_get_children [lindex $objects_node 0]] @@ -436,11 +436,11 @@ } ad_proc -public install::xml::action::unset-permission { node } { - Revokes a permissions on an object - has no effect if the permission is not granted directly + Revokes a permissions on an object - has no effect if the permission is not granted directly (ie does not act as negative permissions).

<unset-permissions grantee="party" privilege="package-key />

-} { +} { set privileges [apm_required_attribute_value $node privilege] set privilege_list [split $privileges ","] @@ -450,7 +450,7 @@ foreach grantee $grantees { set party_id [apm_invoke_install_proc -type object_id -node $grantee] - + set objects_node [xml_node_get_children_by_name [lindex $node 0] object] set objects [xml_node_get_children [lindex $objects_node 0]] @@ -489,7 +489,7 @@ Create a new user. local-p should be set to true when this action is used in - the bootstrap install.xml - this ensures we call the + the bootstrap install.xml - this ensures we call the auth::local api directly while the service contract has not been setup. } { @@ -576,7 +576,7 @@ WHERE user_id = :user_id } } - + if {$id ne ""} { set ::install::xml::ids($id) $result(user_id) } @@ -706,7 +706,7 @@ -extension $extension \ -package_id $package \ -context_id $context] - } + } if {$id ne ""} { set ::install::xml::ids($id) $result @@ -772,7 +772,7 @@ set value [apm_attribute_value -default "" $child value] set type [apm_attribute_value -default literal $child type] set subtree_p [apm_attribute_value -default f $child subtree-p] - + set subtree_p [template::util::is_true $subtree_p] if {$type eq "id"} { @@ -789,7 +789,7 @@ set url [apm_required_attribute_value $child url] set exports [apm_attribute_value -default "" $child exports] set subtree_p [apm_attribute_value -default f $child subtree-p] - + set subtree_p [template::util::is_true $subtree_p] location::parameter::create -location_id $location_id \ @@ -811,12 +811,12 @@ xml_node_set_attribute $child path-arg $child_arg } - if {$package ne "" + if {$package ne "" && ![xml_node_has_attribute $child package-id]} { xml_node_set_attribute $child package-id $package } - if {$context ne "" + if {$context ne "" && ![xml_node_has_attribute $child context-id]} { xml_node_set_attribute $child context-id $parent_id } @@ -846,7 +846,7 @@ set title [apm_attribute_value -default "" $node title] set child_arg [apm_attribute_value -default "" $node child-arg] set process [apm_attribute_value -default "" $node process] - + if {$context ne ""} { set context [install::xml::util::get_id $context] } @@ -864,14 +864,14 @@ -path_arg "" \ -package_id $package \ -context_id $context] - + if {$process ne ""} { location::parameter::create -location_id $parent_id \ -name "wizard::process" \ -subtree_p t \ -value $process } - + set steps [xml_node_get_children [lindex $node 0]] foreach step $steps { @@ -888,12 +888,12 @@ xml_node_set_attribute $step path-arg $child_arg } - if {$package ne "" + if {$package ne "" && ![xml_node_has_attribute $step package-id]} { xml_node_set_attribute $step package-id $package } - if {$context ne "" + if {$context ne "" && ![xml_node_has_attribute $step context-id]} { xml_node_set_attribute $step context-id $parent_id } @@ -991,7 +991,7 @@ Instantiate an object using package_instantiate_object. This will work for both PostgreSQL and Oracle if the proper object package and new() function have been defined. - + @author Don Baccus donb@pacifier.com @creation-date 2008-12-04 @@ -1028,7 +1028,7 @@ ad_proc -public install::xml::object_id::package { node } { Returns an object_id for a package specified in node. - The node name is ignored so any node which provides the correct + The node name is ignored so any node which provides the correct attributes may be used.

<package [ id="id" | key="package-key" | url="package-url" ] />

@@ -1065,14 +1065,14 @@ ad_proc -public install::xml::object_id::group { node } { Returns an object_id for a group or relational segment. - The node name is ignored so any node which provides the correct + The node name is ignored so any node which provides the correct attributes may be used.

<group id="group_id" [ type="group type" relation="relation-type" ] />

} { set group_type [apm_attribute_value -default "group" $node type] set relation_type [apm_attribute_value -default "membership_rel" $node relation] - + if {$group_type eq "group"} { set id [apm_required_attribute_value $node group-id] } elseif {$group_type eq "rel_segment"} { @@ -1125,7 +1125,7 @@ ad_proc -public install::xml::object_id::object { node } { Returns a literal object_id for an object. - + use <object id="-100"> to return the literal id -100. } { set id [apm_required_attribute_value $node id] @@ -1146,7 +1146,7 @@ variable ::install::xml::ids set ids($name) $value } - + ad_proc -public install::xml::util::get_id { id } { Returns an id from the global ids variable if it exists and attempts to find an acs_magic_object if not. @@ -1164,7 +1164,7 @@ } err]} { error "$id is not an integer, is not defined in this install.xml, and is not an acs_magic_object" } - + return $result } Index: openacs-4/packages/assessment/tcl/as-qti-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-qti-procs.tcl,v diff -u -r1.51 -r1.52 --- openacs-4/packages/assessment/tcl/as-qti-procs.tcl 12 Feb 2019 17:12:18 -0000 1.51 +++ openacs-4/packages/assessment/tcl/as-qti-procs.tcl 12 Feb 2019 17:28:59 -0000 1.52 @@ -11,26 +11,26 @@ {-tmp_dir:required} {-community_id:required} } { - Relation with assessment + Relation with assessment } { - + if {[regexp -nocase -- {\.zip$} $tmp_dir]} { - # Generate a random directory name - set tmpdirectory [ad_tmpnam] - # Create a temporary directory - file mkdir $tmpdirectory - # UNZIP the zip file in the temporary directory - catch { exec unzip ${tmp_dir} -d $tmpdirectory } outMsg + # Generate a random directory name + set tmpdirectory [ad_tmpnam] + # Create a temporary directory + file mkdir $tmpdirectory + # UNZIP the zip file in the temporary directory + catch { exec unzip ${tmp_dir} -d $tmpdirectory } outMsg - set url_assessment {} - # Read the content of the temporary directory - foreach file_i [ glob -directory $tmpdirectory *{.xml} ] { - set url_assessment [as::qti::register_xml -xml_file $file_i -community_id $community_id] - } + set url_assessment {} + # Read the content of the temporary directory + foreach file_i [ glob -directory $tmpdirectory *{.xml} ] { + set url_assessment [as::qti::register_xml -xml_file $file_i -community_id $community_id] + } - # Delete the temporary directory - file delete -force -- $tmpdirectory + # Delete the temporary directory + file delete -force -- $tmpdirectory } else { set url_assessment [as::qti::register_xml -xml_file $tmp_dir -community_id $community_id] } @@ -84,7 +84,7 @@ set assessment_id [as::qti::register_xml_object_id -xml_file $xml_file -community_id $community_id -prop $prop] set url_assessment "../../assessment/assessment?assessment_id=$assessment_id" - + return $url_assessment } @@ -104,23 +104,23 @@ # FIXME this is a hack until I figure out how to get the # package_id of the assessment of the current community ad_conn -set package_id [db_string get_assessment_package_id {select dotlrn_community_applets.package_id from dotlrn_community_applets join apm_packages on (dotlrn_community_applets.package_id=apm_packages.package_id) where community_id = :community_id and package_key='assessment'}] - + set assessment_revision_id [as::qti::parse_qti_xml -prop $prop $xml_file] content::item::set_live_revision -revision_id $assessment_revision_id set assessment_id [db_string items_items_as_item_id "SELECT item_id FROM cr_revisions WHERE revision_id = :assessment_revision_id"] # Restore the package_id ad_conn -set package_id $current_package_id - + return $assessment_id } ad_proc -private as::qti::mattext_gethtml { mattextNode } { Get the HTML of a mattext } { set texttype [$mattextNode getAttribute {texttype} {text/plain}] if { $texttype eq "text/html" } { - return [$mattextNode text] + return [$mattextNode text] } else { - return [ad_html_text_convert -from text/plain -to text/html -- [$mattextNode text]] + return [ad_html_text_convert -from text/plain -to text/html -- [$mattextNode text]] } } @@ -136,318 +136,318 @@ # get all elements of a XML instance file set questestinteropNodes [$root selectNodes {/questestinterop}] foreach questestinterop $questestinteropNodes { - # Looks for assessments - set assessmentNodes [$questestinterop selectNodes {assessment}] - if { [llength $assessmentNodes] > 0 } { - # There are assessments - foreach assessment $assessmentNodes { - set as_assessments__title [$assessment getAttribute {title} {Assessment}] - #get assessment's children: section, (qticomment, duration, qtimetadata, objectives, assessmentcontrol, - #rubric, presentation_material, outcomes_processing, assessproc_extension, assessfeedback, - #selection_ordering, reference, sectionref) - set nodesList [$assessment childNodes] - set as_assessments__definition "" - set as_assessments__instructions "" - set as_assessments__duration "" - #for each assessment's child - foreach node $nodesList { - set nodeName [$node nodeName] - #as_assessmentsx.description = or - if {$nodeName eq "qticomment"} { - set definitionNodes [$assessment selectNodes {qticomment}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_assessments__definition [as::qti::mattext_gethtml $definition] - } - } elseif {$nodeName eq "objectives"} { - set definitionNodes [$assessment selectNodes {objectives/material/mattext}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_assessments__definition [as::qti::mattext_gethtml $definition] - } - #as_assessments.instructions = - } elseif {$nodeName eq "rubric"} { - set instructionNodes [$assessment selectNodes {rubric/material/mattext}] - if {[llength $instructionNodes] != 0} { - set instruction [lindex $instructionNodes 0] - set as_assessments__instructions [as::qti::mattext_gethtml $instruction] - } - #as_assessments.time_for_response = - } elseif {$nodeName eq "duration"} { - set durationNodes [$assessment selectNodes {duration/text()}] - if {[llength $durationNodes] != 0} { - set duration [lindex $durationNodes 0] - set as_assessments__duration [as::qti::duration [$duration nodeValue]] - } - } - } - set qtimetadataNodes [$assessment selectNodes {qtimetadata}] - set as_assessments__run_mode "" - set as_assessments__anonymous_p f - set as_assessments__secure_access_p f - set as_assessments__reuse_responses_p f - set as_assessments__show_item_name_p f - set as_assessments__consent_page "" - set as_assessments__return_url "" - set as_assessments__start_time "" - set as_assessments__end_time "" - set as_assessments__number_tries "" - set as_assessments__wait_between_tries "" - set as_assessments__ip_mask "" - set as_assessments__show_feedback "none" - set as_assessments__section_navigation "default path" - - set itemfeedbacknodes [$root selectNodes {/questestinterop/assessment/section/item/itemfeedback}] - if { [llength $itemfeedbacknodes] >0} { - set as_assessments__show_feedback "all" - } - set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] - set as_assessments__type test - if { [llength $resprocessNodes] == 0 } { - set as_assessments__type survey - #if it's a survey don't show feedback - set as_assessments__show_feedback "none" - } - - if {[llength $qtimetadataNodes] > 0} { - #nodes qtimetadatafield - set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] - foreach qtimetadatafieldnode $qtimetadatafieldNodes { - set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] - set label [$label nodeValue] - set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] - if { $value ne ""} { set value [$value nodeValue] } - - switch -exact -- $label { - run_mode { - set as_assessments__run_mode $value - } - anonymous_p { - set as_assessments__anonymous_p $value - } - secure_access_p { - set as_assessments__secure_access_p $value - } - reuse_responses_p { - set as_assessments__reuse_responses_p $value - } - show_item_name_p { - set as_assessments__show_item_name_p $value - } - consent_page { - set as_assessments__consent_page $value - } - start_time { - set as_assessments__start_time $value - } - end_time { - set as_assessments__end_time $value - } - number_tries { - set as_assessments__number_tries $value - } - wait_between_tries { - set as_assessments__wait_between_tries $value - } - ip_mask { - set as_assessments__ip_mask $value - } - show_feedback { - set as_assessments__show_feedback $value - } - section_navigation { - set as_assessments__section_navigation $value - } - } - - } - } - - # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id) - set as_assessments__assessment_id [as::assessment::new \ - -title $as_assessments__title \ - -description $as_assessments__definition \ - -instructions $as_assessments__instructions \ - -run_mode $as_assessments__run_mode \ - -anonymous_p $as_assessments__anonymous_p \ - -secure_access_p $as_assessments__secure_access_p \ - -reuse_responses_p $as_assessments__reuse_responses_p \ - -show_item_name_p $as_assessments__show_item_name_p \ - -consent_page $as_assessments__consent_page \ - -return_url $as_assessments__return_url \ - -start_time $as_assessments__start_time \ - -end_time $as_assessments__end_time \ - -number_tries $as_assessments__number_tries \ - -wait_between_tries $as_assessments__wait_between_tries \ - -time_for_response $as_assessments__duration \ - -ip_mask $as_assessments__ip_mask \ - -show_feedback $as_assessments__show_feedback \ - -section_navigation $as_assessments__section_navigation \ - -type $as_assessments__type \ - -package_id [ad_conn package_id]] - - set assessment_item_id [content::revision::item_id -revision_id $as_assessments__assessment_id] - permission::grant -party_id [ad_conn user_id] -object_id $assessment_item_id -privilege "admin" - # Section - set sectionNodes [$assessment selectNodes {section}] - set as_asmt_sect_map__sort_order 0 - foreach section $sectionNodes { - set as_sections__title [$section getAttribute {title} {Section}] - set as_sections__ident [$section getAttribute {ident} {Section}] - #get section's children (qticomment, duration, qtimetadata, objectives, sectioncontrol, - #sectionprecondition, sectionpostcondition, rubric, presentation_material, outcomes_processing, - #sectionproc_extension, sectionfeedback, selection_ordering, reference, itemref, item, sectionref, - #section) - set nodesList [$section childNodes] - set as_sections__definition "" - set as_sections__instructions "" - set as_sections__duration "" - set as_sections__sectionfeedback "" - #for each section's child - foreach node $nodesList { - set nodeName [$node nodeName] - #as_sectionsx.description = or - if {$nodeName eq "qticomment"} { - set definitionNodes [$section selectNodes {qticomment}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_sections__definition [as::qti::mattext_gethtml $definition] - } - } elseif {$nodeName eq "objectives"} { - set definitionNodes [$section selectNodes {objectives/material/mattext}] - if {[llength $definitionNodes] != 0} { - set definition [lindex $definitionNodes 0] - set as_sections__definition [as::qti::mattext_gethtml $definition] - } - #as_sections.max_time_to_complete = - } elseif {$nodeName eq "duration"} { - set section_durationNodes [$section selectNodes {duration/text()}] - if {[llength $section_durationNodes] != 0} { - set section_duration [lindex $section_durationNodes 0] - set as_sections__duration [as::qti::duration [$section_duration nodeValue]] - } - #as_sections.instructions = - } elseif {$nodeName eq "rubric"} { - set section_instructionNodes [$section selectNodes {rubric/material/mattext}] - if {[llength $section_instructionNodes] != 0} { - set section_instruction [lindex $section_instructionNodes 0] - set as_sections__instructions [as::qti::mattext_gethtml $section_instruction] - } - #as_sections.feedback_text = - } elseif {$nodeName eq "sectionfeedback"} { - set sectionfeedbackNodes [$section selectNodes {sectionfeedback/material/mattext}] - if {[llength $sectionfeedbackNodes] != 0} { - set sectionfeedback [lindex $sectionfeedbackNodes 0] - set as_sections__sectionfeedback [as::qti::mattext_gethtml $sectionfeedback] - } - } - } - - set qtimetadataNodes [$section selectNodes {qtimetadata}] - set as_sections__num_items "" - set as_sections__points "" - set asdt__display_type none - set asdt__s_num_items "" - set asdt__adp_chunk "" - set asdt__branched_p f - set asdt__back_button_p t - set asdt__submit_answer_p f - set asdt__sort_order_type order_of_entry - - if {[llength $qtimetadataNodes] > 0} { - #nodes qtimetadatafield - set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] - foreach qtimetadatafieldnode $qtimetadatafieldNodes { - set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] - set label [$label nodeValue] - set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] - if { $value ne ""} { set value [$value nodeValue] } - - switch -exact -- $label { - num_items { - set as_sections__num_items $value - } - points { - set as_sections__points $value - } - display_type { - set asdt__display_type $value - } - s_num_items { - set asdt__s_num_items $value - } - adp_chunk { - set asdt__adp_chunk $value - } - branched_p { - set asdt__branched_p $value - } - back_button_p { - set asdt__back_button_p $value - } - submit_answer_p { - set asdt__submit_answer_p $value - } - sort_order_type { - set asdt__sort_order_type $value - } - } - } - } - - #section display type - set display_type_id [as::section_display::new \ - -title $asdt__display_type \ - -num_items $asdt__s_num_items \ - -adp_chunk $asdt__adp_chunk \ - -branched_p $asdt__branched_p \ - -back_button_p $asdt__back_button_p \ - -submit_answer_p $asdt__submit_answer_p \ - -sort_order_type $asdt__sort_order_type] - # Insert section in the CR (and in the as_sections table) getting the revision_id (section_id) - set section_id [as::section::new \ - -name $as_sections__ident \ - -title $as_sections__title \ - -description $as_sections__definition \ - -instructions $as_sections__instructions \ - -feedback_text $as_sections__sectionfeedback \ - -max_time_to_complete $as_sections__duration \ - -num_items $as_sections__num_items \ - -points $as_sections__points \ - -display_type_id $display_type_id] - - # Relation between as_sections and as_assessments -ns_log debug " -DB -------------------------------------------------------------------------------- -DB DAVE debugging procedure as::qti::parse_qti_xml -DB -------------------------------------------------------------------------------- + # Looks for assessments + set assessmentNodes [$questestinterop selectNodes {assessment}] + if { [llength $assessmentNodes] > 0 } { + # There are assessments + foreach assessment $assessmentNodes { + set as_assessments__title [$assessment getAttribute {title} {Assessment}] + #get assessment's children: section, (qticomment, duration, qtimetadata, objectives, assessmentcontrol, + #rubric, presentation_material, outcomes_processing, assessproc_extension, assessfeedback, + #selection_ordering, reference, sectionref) + set nodesList [$assessment childNodes] + set as_assessments__definition "" + set as_assessments__instructions "" + set as_assessments__duration "" + #for each assessment's child + foreach node $nodesList { + set nodeName [$node nodeName] + #as_assessmentsx.description = or + if {$nodeName eq "qticomment"} { + set definitionNodes [$assessment selectNodes {qticomment}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_assessments__definition [as::qti::mattext_gethtml $definition] + } + } elseif {$nodeName eq "objectives"} { + set definitionNodes [$assessment selectNodes {objectives/material/mattext}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_assessments__definition [as::qti::mattext_gethtml $definition] + } + #as_assessments.instructions = + } elseif {$nodeName eq "rubric"} { + set instructionNodes [$assessment selectNodes {rubric/material/mattext}] + if {[llength $instructionNodes] != 0} { + set instruction [lindex $instructionNodes 0] + set as_assessments__instructions [as::qti::mattext_gethtml $instruction] + } + #as_assessments.time_for_response = + } elseif {$nodeName eq "duration"} { + set durationNodes [$assessment selectNodes {duration/text()}] + if {[llength $durationNodes] != 0} { + set duration [lindex $durationNodes 0] + set as_assessments__duration [as::qti::duration [$duration nodeValue]] + } + } + } + set qtimetadataNodes [$assessment selectNodes {qtimetadata}] + set as_assessments__run_mode "" + set as_assessments__anonymous_p f + set as_assessments__secure_access_p f + set as_assessments__reuse_responses_p f + set as_assessments__show_item_name_p f + set as_assessments__consent_page "" + set as_assessments__return_url "" + set as_assessments__start_time "" + set as_assessments__end_time "" + set as_assessments__number_tries "" + set as_assessments__wait_between_tries "" + set as_assessments__ip_mask "" + set as_assessments__show_feedback "none" + set as_assessments__section_navigation "default path" -DB --------------------------------------------------------------------------------" - db_dml as_assessment_section_map_insert {} - incr as_asmt_sect_map__sort_order - set as_item_sect_map__sort_order 0 - # Process the items - set as_items [as::qti::parse_item -prop $prop $section [file dirname $xmlfile]] - # Relation between as_items and as_sections - foreach as_item_list $as_items { - array set as_item $as_item_list - set as_item_id $as_item(as_item_id) - set as_item__duration $as_item(duration) - set as_item__points [expr {int($as_item(points))}] - set as_item__required_p $as_item(required_p) - db_dml as_item_section_map_insert {} - incr as_item_sect_map__sort_order - } - - #get points from a section - db_0or1row get_section_points {} - #update as_assessment_section_map with section points - db_dml update_as_assessment_section_map {} - } - } - } else { - # Just items (no assessments) - as::qti::parse_item -prop $prop $questestinterop [file dirname $xmlfile]] + set itemfeedbacknodes [$root selectNodes {/questestinterop/assessment/section/item/itemfeedback}] + if { [llength $itemfeedbacknodes] >0} { + set as_assessments__show_feedback "all" + } + set resprocessNodes [$root selectNodes {/questestinterop/assessment/section/item/resprocessing}] + set as_assessments__type test + if { [llength $resprocessNodes] == 0 } { + set as_assessments__type survey + #if it's a survey don't show feedback + set as_assessments__show_feedback "none" + } + + if {[llength $qtimetadataNodes] > 0} { + #nodes qtimetadatafield + set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] + foreach qtimetadatafieldnode $qtimetadatafieldNodes { + set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] + set label [$label nodeValue] + set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] + if { $value ne ""} { set value [$value nodeValue] } + + switch -exact -- $label { + run_mode { + set as_assessments__run_mode $value + } + anonymous_p { + set as_assessments__anonymous_p $value + } + secure_access_p { + set as_assessments__secure_access_p $value + } + reuse_responses_p { + set as_assessments__reuse_responses_p $value + } + show_item_name_p { + set as_assessments__show_item_name_p $value + } + consent_page { + set as_assessments__consent_page $value + } + start_time { + set as_assessments__start_time $value + } + end_time { + set as_assessments__end_time $value + } + number_tries { + set as_assessments__number_tries $value + } + wait_between_tries { + set as_assessments__wait_between_tries $value + } + ip_mask { + set as_assessments__ip_mask $value + } + show_feedback { + set as_assessments__show_feedback $value + } + section_navigation { + set as_assessments__section_navigation $value + } + } + + } + } + + # Insert assessment in the CR (and as_assessments table) getting the revision_id (assessment_id) + set as_assessments__assessment_id [as::assessment::new \ + -title $as_assessments__title \ + -description $as_assessments__definition \ + -instructions $as_assessments__instructions \ + -run_mode $as_assessments__run_mode \ + -anonymous_p $as_assessments__anonymous_p \ + -secure_access_p $as_assessments__secure_access_p \ + -reuse_responses_p $as_assessments__reuse_responses_p \ + -show_item_name_p $as_assessments__show_item_name_p \ + -consent_page $as_assessments__consent_page \ + -return_url $as_assessments__return_url \ + -start_time $as_assessments__start_time \ + -end_time $as_assessments__end_time \ + -number_tries $as_assessments__number_tries \ + -wait_between_tries $as_assessments__wait_between_tries \ + -time_for_response $as_assessments__duration \ + -ip_mask $as_assessments__ip_mask \ + -show_feedback $as_assessments__show_feedback \ + -section_navigation $as_assessments__section_navigation \ + -type $as_assessments__type \ + -package_id [ad_conn package_id]] + + set assessment_item_id [content::revision::item_id -revision_id $as_assessments__assessment_id] + permission::grant -party_id [ad_conn user_id] -object_id $assessment_item_id -privilege "admin" + # Section + set sectionNodes [$assessment selectNodes {section}] + set as_asmt_sect_map__sort_order 0 + foreach section $sectionNodes { + set as_sections__title [$section getAttribute {title} {Section}] + set as_sections__ident [$section getAttribute {ident} {Section}] + #get section's children (qticomment, duration, qtimetadata, objectives, sectioncontrol, + #sectionprecondition, sectionpostcondition, rubric, presentation_material, outcomes_processing, + #sectionproc_extension, sectionfeedback, selection_ordering, reference, itemref, item, sectionref, + #section) + set nodesList [$section childNodes] + set as_sections__definition "" + set as_sections__instructions "" + set as_sections__duration "" + set as_sections__sectionfeedback "" + #for each section's child + foreach node $nodesList { + set nodeName [$node nodeName] + #as_sectionsx.description = or + if {$nodeName eq "qticomment"} { + set definitionNodes [$section selectNodes {qticomment}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_sections__definition [as::qti::mattext_gethtml $definition] + } + } elseif {$nodeName eq "objectives"} { + set definitionNodes [$section selectNodes {objectives/material/mattext}] + if {[llength $definitionNodes] != 0} { + set definition [lindex $definitionNodes 0] + set as_sections__definition [as::qti::mattext_gethtml $definition] + } + #as_sections.max_time_to_complete = + } elseif {$nodeName eq "duration"} { + set section_durationNodes [$section selectNodes {duration/text()}] + if {[llength $section_durationNodes] != 0} { + set section_duration [lindex $section_durationNodes 0] + set as_sections__duration [as::qti::duration [$section_duration nodeValue]] + } + #as_sections.instructions = + } elseif {$nodeName eq "rubric"} { + set section_instructionNodes [$section selectNodes {rubric/material/mattext}] + if {[llength $section_instructionNodes] != 0} { + set section_instruction [lindex $section_instructionNodes 0] + set as_sections__instructions [as::qti::mattext_gethtml $section_instruction] + } + #as_sections.feedback_text = + } elseif {$nodeName eq "sectionfeedback"} { + set sectionfeedbackNodes [$section selectNodes {sectionfeedback/material/mattext}] + if {[llength $sectionfeedbackNodes] != 0} { + set sectionfeedback [lindex $sectionfeedbackNodes 0] + set as_sections__sectionfeedback [as::qti::mattext_gethtml $sectionfeedback] + } + } + } + + set qtimetadataNodes [$section selectNodes {qtimetadata}] + set as_sections__num_items "" + set as_sections__points "" + set asdt__display_type none + set asdt__s_num_items "" + set asdt__adp_chunk "" + set asdt__branched_p f + set asdt__back_button_p t + set asdt__submit_answer_p f + set asdt__sort_order_type order_of_entry + + if {[llength $qtimetadataNodes] > 0} { + #nodes qtimetadatafield + set qtimetadatafieldNodes [$qtimetadataNodes selectNodes {qtimetadatafield}] + foreach qtimetadatafieldnode $qtimetadatafieldNodes { + set label [$qtimetadatafieldnode selectNodes {fieldlabel/text()}] + set label [$label nodeValue] + set value [$qtimetadatafieldnode selectNodes {fieldentry/text()}] + if { $value ne ""} { set value [$value nodeValue] } + + switch -exact -- $label { + num_items { + set as_sections__num_items $value + } + points { + set as_sections__points $value + } + display_type { + set asdt__display_type $value + } + s_num_items { + set asdt__s_num_items $value + } + adp_chunk { + set asdt__adp_chunk $value + } + branched_p { + set asdt__branched_p $value + } + back_button_p { + set asdt__back_button_p $value + } + submit_answer_p { + set asdt__submit_answer_p $value + } + sort_order_type { + set asdt__sort_order_type $value + } + } + } + } + + #section display type + set display_type_id [as::section_display::new \ + -title $asdt__display_type \ + -num_items $asdt__s_num_items \ + -adp_chunk $asdt__adp_chunk \ + -branched_p $asdt__branched_p \ + -back_button_p $asdt__back_button_p \ + -submit_answer_p $asdt__submit_answer_p \ + -sort_order_type $asdt__sort_order_type] + # Insert section in the CR (and in the as_sections table) getting the revision_id (section_id) + set section_id [as::section::new \ + -name $as_sections__ident \ + -title $as_sections__title \ + -description $as_sections__definition \ + -instructions $as_sections__instructions \ + -feedback_text $as_sections__sectionfeedback \ + -max_time_to_complete $as_sections__duration \ + -num_items $as_sections__num_items \ + -points $as_sections__points \ + -display_type_id $display_type_id] + + # Relation between as_sections and as_assessments + ns_log debug " + DB -------------------------------------------------------------------------------- + DB DAVE debugging procedure as::qti::parse_qti_xml + DB -------------------------------------------------------------------------------- + + DB --------------------------------------------------------------------------------" + db_dml as_assessment_section_map_insert {} + incr as_asmt_sect_map__sort_order + set as_item_sect_map__sort_order 0 + # Process the items + set as_items [as::qti::parse_item -prop $prop $section [file dirname $xmlfile]] + # Relation between as_items and as_sections + foreach as_item_list $as_items { + array set as_item $as_item_list + set as_item_id $as_item(as_item_id) + set as_item__duration $as_item(duration) + set as_item__points [expr {int($as_item(points))}] + set as_item__required_p $as_item(required_p) + db_dml as_item_section_map_insert {} + incr as_item_sect_map__sort_order + } + + #get points from a section + db_0or1row get_section_points {} + #update as_assessment_section_map with section points + db_dml update_as_assessment_section_map {} + } + } + } else { + # Just items (no assessments) + as::qti::parse_item -prop $prop $questestinterop [file dirname $xmlfile]] } } return $as_assessments__assessment_id @@ -458,40 +458,40 @@ #get all elements set itemNodes [$qtiNode selectNodes {item}] foreach item $itemNodes { - set as_items__ident "" - set as_items__description "" - set as_items__subtext "" - set as_items__field_code "" - set as_items__required_p t - set as_items__data_type "varchar" - set as_items__duration "" - set aitmc__increasing_p f - set aitmc__allow_negative_p f - set aitmc__num_correct_answers "" - set aitmc__num_answers "" - set aitoq__default_value "" - set aitoq__feedback_text "" - set aidrb__html_options "" - set aidrb__choice_orientation "vertical" - set aidrb__label_orientation "top" - set aidrb__order_type "order_of_entry" - set aidrb__answer_alignment "besideright" - set aidta__abs_size 1000 - set aidtb__abs_size 20 - + set as_items__ident "" + set as_items__description "" + set as_items__subtext "" + set as_items__field_code "" + set as_items__required_p t + set as_items__data_type "varchar" + set as_items__duration "" + set aitmc__increasing_p f + set aitmc__allow_negative_p f + set aitmc__num_correct_answers "" + set aitmc__num_answers "" + set aitoq__default_value "" + set aitoq__feedback_text "" + set aidrb__html_options "" + set aidrb__choice_orientation "vertical" + set aidrb__label_orientation "top" + set aidrb__order_type "order_of_entry" + set aidrb__answer_alignment "besideright" + set aidta__abs_size 1000 + set aidtb__abs_size 20 + #item's child - set nodesList [$item childNodes] + set nodesList [$item childNodes] #for each item's child foreach node $nodesList { set nodeName [$node nodeName] - #as_items.max_time_to_complete = + #as_items.max_time_to_complete = if {$nodeName eq "duration"} { set durationNodes [$item selectNodes {duration/text()}] if {[llength $durationNodes] != 0} { set duration [lindex $durationNodes 0] set as_items__duration [as::qti::duration [$duration nodeValue]] } - #as_items.description = + #as_items.description = } elseif {$nodeName eq "qticomment"} { set qticommentNodes [$item selectNodes {qticomment/text()}] if {[llength $qticommentNodes] != 0} { @@ -505,9 +505,9 @@ set instruction [lindex $instructionNodes 0] set as_items__subtext [as::qti::mattext_gethtml $instruction] } - } - } - + } + } + set itemmetadataNodes [$item selectNodes {itemmetadata}] if { [llength $itemmetadataNodes] > 0 } { @@ -524,13 +524,13 @@ switch -exact -- $label { field_code { - set as_items__field_code $value + set as_items__field_code $value } required_p { set as_items__required_p $value } data_type { - set as_items__data_type $value + set as_items__data_type $value } increasing_p { set aitmc__increasing_p $value @@ -540,10 +540,10 @@ } num_correct_answers { set aitmc__num_correct_answers $value - } + } num_answers { set aitmc__num_answers $value - } + } default_value { set aitoq__default_value $value } @@ -564,18 +564,18 @@ } item_answer_alignment { set aidrb__answer_alignment $value - } + } abs_size { set aidta__abs_size $value - } + } tb_abs_size { set aidtb__abs_size $value - } - } - } + } + } + } } } - + # Order of the item_choices set sort_order 0 set as_items__title [$item getAttribute {title} {Item}] @@ -586,16 +586,16 @@ array set as_item_choices__feedback_text {} set as_items__points 0 set as_items__feedback_right {} - set as_items__feedback_wrong {} - # + set as_items__feedback_wrong {} + # set objectivesNodes [$item selectNodes {objectives}] foreach objectives $objectivesNodes { set mattextNodes [$objectives selectNodes {material/mattext}] foreach mattext $mattextNodes { set as_items__description [as::qti::mattext_gethtml $mattext] } } - + # set resprocessingNodes [$item selectNodes {resprocessing}] foreach resprocessing $resprocessingNodes { @@ -631,7 +631,7 @@ foreach choice $scoreNodes { set choice_id "" set choice_id [string trim [$choice nodeValue]] - + if {[info exists choice_id]} { set score 0 # get score @@ -646,12 +646,12 @@ incr as_items__points $score } } - + set scoreNodes [$respcondition selectNodes {conditionvar/and/varequal/text()}] foreach choice $scoreNodes { set choice_id "" set choice_id [string trim [$choice nodeValue]] - + if {[info exists choice_id]} { set score 0 # get score @@ -665,41 +665,41 @@ set scoreNodes1 [$respcondition selectNodes {conditionvar/and/varequal}] if {[llength $scoreNodes1]>0} { set score1 [expr ($score*1.0/[llength $scoreNodes1])] - } + } set as_item_choices__score($choice_id) $score1 - set as_items__points $score + set as_items__points $score } } - - set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] - if {[llength $resp_cond_varNodes]==1} { } else { + + set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] + if {[llength $resp_cond_varNodes]==1} { } else { set resp_cond_or_varNodes [$respcondition selectNodes {conditionvar/or/not/and/varequal/text() | conditionvar/not/or/varequal/text() | conditionvar/not/and/or/varequal/text()}] if {[llength $resp_cond_or_varNodes]>0} { set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] if {[llength $displayfeedbackNode]>0} { - set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] + set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] set as_items__feedback_wrong [$item selectNodes "//itemfeedback\[@ident='$displayfeedback__ident'\]/flow_mat/material/mattext"] if {$as_items__feedback_wrong ne ""} { - set as_items__feedback_wrong [$as_items__feedback_wrong text] + set as_items__feedback_wrong [$as_items__feedback_wrong text] } } } else { set resp_cond_and_varNodes [$respcondition selectNodes {conditionvar/and/varequal/text()| conditionvar/or/varequal/text()}] - if {[llength $resp_cond_and_varNodes]>0} { + if {[llength $resp_cond_and_varNodes]>0} { set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] if {[llength $displayfeedbackNode]>0} { - set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] + set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] set as_items__feedback_right [$item selectNodes "//itemfeedback\[@ident='$displayfeedback__ident'\]/flow_mat/material/mattext"] if {$as_items__feedback_right ne ""} { - set as_items__feedback_right [$as_items__feedback_right text] - } + set as_items__feedback_right [$as_items__feedback_right text] + } } } } - } + } } } - + # element set presentationNodes [$item selectNodes {presentation}] foreach presentation $presentationNodes { @@ -731,7 +731,7 @@ set cols [$render_fib getAttribute {columns} {55}] # we need the size of textarea (values of rows and cols) set html "rows $rows cols $cols" - # insert as_item_display_ta in the CR (and in the as_item_display_ta table) getting the revision_id (item_display_id) + # insert as_item_display_ta in the CR (and in the as_item_display_ta table) getting the revision_id (item_display_id) set as_item_display_id [as::item_display_ta::new \ -html_display_options $html \ -abs_size $aidta__abs_size \ @@ -749,7 +749,7 @@ # insert as_item_type_oq (textarea) set as_item_type_id [as::item_type_oq::new \ -default_value $aitoq__default_value \ - -feedback_text $aitoq__feedback_text] + -feedback_text $aitoq__feedback_text] # if render_fib element has not the attribute rows then it's a fill in blank item } else { # textbox (shortanswer) @@ -758,7 +758,7 @@ -item_answer_alignment $aidrb__answer_alignment] set as_item_type_id [as::item_type_sa::new] } - + # Insert as_item set as_item_id [as::item::new \ -title $as_items__title \ @@ -813,14 +813,14 @@ -sort_order_type $aidrb__order_type \ -item_answer_alignment $aidrb__answer_alignment] } - + # insert as_item_type_mc set as_item_type_id [as::item_type_mc::new \ -increasing_p $aitmc__increasing_p \ -allow_negative_p $aitmc__allow_negative_p \ -num_correct_answers $aitmc__num_correct_answers \ - -num_answers $aitmc__num_answers] - + -num_answers $aitmc__num_answers] + # Insert as_item set as_item_id [as::item::new \ -title $as_items__title \ @@ -833,7 +833,7 @@ -feedback_right $as_items__feedback_right \ -feedback_wrong $as_items__feedback_wrong \ -max_time_to_complete $as_items__duration \ - -points $as_items__points] + -points $as_items__points] # set the relation between as_items and as_item_type tables as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_type_id -type as_item_type_rel # set the relation between as_items and as_item_display tables @@ -867,35 +867,35 @@ if {[info exists as_item_choices__score($as_item_choices__ident)]} { if {$as_items__points== 0} { #if is missing - set as_items__points 1 + set as_items__points 1 } set as_item_choices__score($as_item_choices__ident) [expr {round(100 * $as_item_choices__score($as_item_choices__ident) / $as_items__points)}] } else { set as_item_choices__score($as_item_choices__ident) 0 } - set as_item_choices__feedback_text($as_item_choices__ident) "" - + set as_item_choices__feedback_text($as_item_choices__ident) "" + set resprocessingNodes [$item selectNodes {resprocessing}] foreach resprocessing $resprocessingNodes { # - set respconditionNodes [$resprocessing selectNodes {respcondition}] + set respconditionNodes [$resprocessing selectNodes {respcondition}] foreach respcondition $respconditionNodes { set displayfeedbackNode "" set resp_cond_varNodes [$respcondition selectNodes {conditionvar/varequal/text()}] - if {[llength $resp_cond_varNodes]==1} { - set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] + if {[llength $resp_cond_varNodes]==1} { + set displayfeedbackNode [$respcondition selectNodes {displayfeedback}] set choice_identifier [$resp_cond_varNodes nodeValue] if {[llength $displayfeedbackNode]>0} { - set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] - set choice_identifier [$resp_cond_varNodes nodeValue] - if {$as_item_choices__ident == $choice_identifier} { + set displayfeedback__ident [$displayfeedbackNode getAttribute {linkrefid}] + set choice_identifier [$resp_cond_varNodes nodeValue] + if {$as_item_choices__ident == $choice_identifier} { set choices__feedback_text [$item selectNodes "//itemfeedback\[@ident='$displayfeedback__ident'\]/flow_mat/material/mattext/text()"] if {[llength $choices__feedback_text]>0} { set as_item_choices__feedback_text($as_item_choices__ident) [$choices__feedback_text nodeValue] - } + } } - } - } + } + } } } # insert as_item_choice @@ -914,12 +914,12 @@ } #import an image as title of item set matmediaNodes [$presentation selectNodes {material/matimage[@uri]}] - if {[llength $matmediaNodes]>0} { + if {[llength $matmediaNodes]>0} { set mediabasepath [file join $basepath [$matmediaNodes getAttribute {uri}]] # insert as_file in the CR (and in the as_file table) getting the content value set as_item_choices__content_value [as::file::new -file_pathname $mediabasepath] as::item_rels::new -item_rev_id $as_item_id -target_rev_id $as_item_choices__content_value -type as_item_content_rel - } + } } } return $as_items @@ -929,25 +929,25 @@ duration } { Convert duration - + @author Roel Canicula (roel@solutiongrove.com) @creation-date 2006-05-04 - + @param duration - @return - - @error + @return + + @error } { if { [regexp {^\d+$} $duration] } { - return $duration + return $duration } elseif { [regexp {^p|P$} $duration] } { - return "" + return "" } elseif { [regexp {^p|P} $duration] } { - # check for format P0Y0M0DT0H1M0S - regexp {t|T(\d+)h|H(\d+)m|M(\d+)s|S} $duration match h m s - # ignore year, month and days for now - return [expr {$h*3600+$m*60+$s}] + # check for format P0Y0M0DT0H1M0S + regexp {t|T(\d+)h|H(\d+)m|M(\d+)s|S} $duration match h m s + # ignore year, month and days for now + return [expr {$h*3600+$m*60+$s}] } } Index: openacs-4/packages/categories/tcl/categories-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/tcl/categories-procs.tcl,v diff -u -r1.39 -r1.40 --- openacs-4/packages/categories/tcl/categories-procs.tcl 12 Feb 2019 17:12:19 -0000 1.39 +++ openacs-4/packages/categories/tcl/categories-procs.tcl 12 Feb 2019 17:28:59 -0000 1.40 @@ -374,7 +374,7 @@ Gets the category name in the specified language, if available. Use default language otherwise. - @param category_ids category_ids for which to get the name. + @param category_ids category_ids for which to get the name. @param locale language in which to get the name. [ad_conn locale] used by default. @return list of names corresponding to the list of category_id's supplied. @author Timo Hentschel (timo@timohentschel.de) Index: openacs-4/packages/content-portlet/misc/admin/category-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/content-portlet/misc/admin/category-add-edit.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/content-portlet/misc/admin/category-add-edit.tcl 12 Feb 2019 17:12:19 -0000 1.3 +++ openacs-4/packages/content-portlet/misc/admin/category-add-edit.tcl 12 Feb 2019 17:28:59 -0000 1.4 @@ -1,20 +1,17 @@ ad_page_contract { - - - @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local) @creation-date 2007-08-24 @cvs-id $Id$ } { - + tree_id:integer name:notnull category_id:integer,optional return_url:optional {parent_id:integer,optional ""} {language "es_GT"} {mode 1} - + } -properties { } -validate { } -errors { @@ -28,33 +25,39 @@ if {$mode eq 1 && [exists_and_not_null category_id]} { ## edit mode#### category::update -category_id $category_id \ - -locale $language \ - -name $name \ - -description $description + -locale $language \ + -name $name \ + -description $description } elseif {$mode eq 2} { if {[content_category::valid_level_and_count -tree_id $tree_id \ - -category_id $parent_id]} { - set new_cat [category::add -tree_id $tree_id \ - -parent_id $parent_id \ - -locale $language \ - -name $name \ - -description $description] - set parent_cat [content_category::category_parent -category_id $new_cat -tree_id $tree_id] + -category_id $parent_id]} { + set new_cat [category::add -tree_id $tree_id \ + -parent_id $parent_id \ + -locale $language \ + -name $name \ + -description $description] + set parent_cat [content_category::category_parent -category_id $new_cat -tree_id $tree_id] } } elseif {$mode eq 3} { set new_cat [content_category::new_subtree -tree_id $tree_id] set parent_cat $new_cat - + } if {[exists_and_not_null return_url]} { if {[exists_and_not_null new_cat]} { - ad_returnredirect "$return_url&new_cat=$new_cat&parent_cat=$parent_cat" + ad_returnredirect "$return_url&new_cat=$new_cat&parent_cat=$parent_cat" } else { - ad_returnredirect $return_url + ad_returnredirect $return_url } ad_script_abort } else { - # ad_return_template +# ad_return_template } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/content-portlet/tcl/content-portlet-compare-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/content-portlet/tcl/content-portlet-compare-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/content-portlet/tcl/content-portlet-compare-procs.tcl 12 Feb 2019 17:12:19 -0000 1.6 +++ openacs-4/packages/content-portlet/tcl/content-portlet-compare-procs.tcl 12 Feb 2019 17:28:59 -0000 1.7 @@ -1,7 +1,4 @@ ad_library { - - - @author byron Haroldo Linares Roman (bhlr@byronLs-Computer.local) @creation-date 2007-06-21 @cvs-id $Id$ @@ -17,236 +14,236 @@ -category_id } { set tree_list [content_category::get_tree_levels \ - -subtree_id $category_id $tree_id] + -subtree_id $category_id $tree_id] set tree_list [linsert $tree_list 0 $category_id] foreach category $tree_list { - set my_category_id [lindex $category 0] - if {[db_string check_mapped_objects {}] eq 1} { - return 0 - } + set my_category_id [lindex $category 0] + if {[db_string check_mapped_objects {}] eq 1} { + return 0 + } } return 1 } ad_proc -private content_page::update_object { {-wiki_package_id ""} } { - + if {[empty_string_p $wiki_package_id]} { set wiki_package_list [xowiki::Package instances] } else { set wiki_package_list [list $wiki_package_id] } foreach wiki_package_id $wiki_package_list { - set wiki_folder_id [::xowiki::Page require_folder \ - -name xowiki \ - -package_id $wiki_package_id] - - if { [db_0or1row select_instance [::xowiki::Object \ - instance_select_query \ - -folder_id $wiki_folder_id \ - -select_attributes {name} \ - -where_clause "name ='es:o_index'"]]} { - set template_id $item_id - - set myobject [xowiki::Package instantiate_page_from_id -item_id $item_id] + set wiki_folder_id [::xowiki::Page require_folder \ + -name xowiki \ + -package_id $wiki_package_id] - set text [list {proc content {} { -set community_id [dotlrn_community::get_community_id] -set com_package_id [dotlrn_community::get_package_id $community_id] -set package_id [site_node_apm_integration::get_child_package_id \ - -package_id $com_package_id \ - -package_key "xowiki"] + if { [db_0or1row select_instance [::xowiki::Object \ + instance_select_query \ + -folder_id $wiki_folder_id \ + -select_attributes {name} \ + -where_clause "name ='es:o_index'"]]} { + set template_id $item_id -set wk_folder_id [::xowiki::Page require_folder -name xowiki -package_id $package_id] -if { ![db_0or1row select_instance [::xowiki::PageInstance instance_select_query \ - -folder_id $wk_folder_id -select_attributes {name} \ - -where_clause "name = 'es:header_page'"]]} { - - db_0or1row select_instance [::xowiki::PageTemplate instance_select_query \ - -folder_id $wk_folder_id -select_attributes {name} \ - -where_clause "name = 'es:Template_de_header'"] - set tmp_item_id $item_id - - set fn "[acs_root_dir]/packages/content-portlet/www/prototypes/gestemplate/GesTemplateheaderpage.page" - set standard_page "es:header_page" - if {[file readable $fn]} { - set page [source $fn] - $page configure -name $standard_page -parent_id $wk_folder_id -package_id $package_id - if {![$page exists title]} { - $page set title $template1 - } - $page set page_template $tmp_item_id - $page destroy_on_cleanup - $page set instance_attributes "Curso Curso Carrera Carrera Facultad Facultad" - $page initialize_loaded_object - $page save_new - } -} + set myobject [xowiki::Package instantiate_page_from_id -item_id $item_id] -set user_id [ad_conn user_id] -set admin_p [dotlrn::user_can_admin_community_p -user_id $user_id -community_id [dotlrn_community::get_community_id]] -if {$admin_p} { - return { -

- #content-portlet.welcome# -

-

- #content-portlet.welcome_body# -

-
[[es:header_page|#content-portlet.edit_header#]] + set text [list {proc content {} { + set community_id [dotlrn_community::get_community_id] + set com_package_id [dotlrn_community::get_package_id $community_id] + set package_id [site_node_apm_integration::get_child_package_id \ + -package_id $com_package_id \ + -package_key "xowiki"] + + set wk_folder_id [::xowiki::Page require_folder -name xowiki -package_id $package_id] + if { ![db_0or1row select_instance [::xowiki::PageInstance instance_select_query \ + -folder_id $wk_folder_id -select_attributes {name} \ + -where_clause "name = 'es:header_page'"]]} { + + db_0or1row select_instance [::xowiki::PageTemplate instance_select_query \ + -folder_id $wk_folder_id -select_attributes {name} \ + -where_clause "name = 'es:Template_de_header'"] + set tmp_item_id $item_id + + set fn "[acs_root_dir]/packages/content-portlet/www/prototypes/gestemplate/GesTemplateheaderpage.page" + set standard_page "es:header_page" + if {[file readable $fn]} { + set page [source $fn] + $page configure -name $standard_page -parent_id $wk_folder_id -package_id $package_id + if {![$page exists title]} { + $page set title $template1 + } + $page set page_template $tmp_item_id + $page destroy_on_cleanup + $page set instance_attributes "Curso Curso Carrera Carrera Facultad Facultad" + $page initialize_loaded_object + $page save_new + } + } + + set user_id [ad_conn user_id] + set admin_p [dotlrn::user_can_admin_community_p -user_id $user_id -community_id [dotlrn_community::get_community_id]] + if {$admin_p} { + return { +

+ #content-portlet.welcome# +

+

+ #content-portlet.welcome_body# +

+
[[es:header_page|#content-portlet.edit_header#]] + } + } else { + return { +

+ #content-portlet.e_welcome# +

+

+ #content-portlet.e_welcome_body# +

+ } + } + } + }] + + $myobject set text [lindex $text 0] + $myobject destroy_on_cleanup + $myobject save + $myobject initialize_loaded_object + ns_cache flush xotcl_object_cache ::[$myobject set item_id] + } } -} else { - return { -

- #content-portlet.e_welcome# -

-

- #content-portlet.e_welcome_body# -

- } } -} -}] -$myobject set text [lindex $text 0] -$myobject destroy_on_cleanup -$myobject save -$myobject initialize_loaded_object -ns_cache flush xotcl_object_cache ::[$myobject set item_id] -} -} -} - ad_proc -private content_category::up { {-wiki_package_id ""} {-level 1} } { - + set count 0 if {[empty_string_p $wiki_package_id]} { - set wiki_package_list [xowiki::Package instances] + set wiki_package_list [xowiki::Package instances] } else { - set wiki_package_list [list $wiki_package_id] + set wiki_package_list [list $wiki_package_id] } foreach wiki_package_id $wiki_package_list { - ns_log notice "inicia actualizacion de content" - set trees [category_tree::get_mapped_trees $wiki_package_id] - set tree_id [lindex [lindex $trees 0] 0] - set wiki_folder_id [::xowiki::Page require_folder \ - -name xowiki \ - -package_id $wiki_package_id] - - if {$level eq 1} { - set tree_list [content_category::get_tree_levels $tree_id] - } else { - set tree_list [content_category::get_tree_levels -only_level 2 $tree_id] - } - - set wiki_url [site_node::get_url_from_object_id \ - -object_id $wiki_package_id] - set community_id [dotlrn_community::get_community_id_from_url -url $wiki_url] - - set instructors [dotlrn_community::list_users_in_role \ - -rel_type "dotlrn_instructor_rel" $community_id] - - set instructor_id [lindex [lindex $instructors 0] 3] - - set new_tree_id [content_category::map_new_tree -object_id $wiki_package_id \ - -tree_name "Indice De Contenido." \ - -user_id $instructor_id] - - set new_tree_list [content_category::get_tree_levels \ - -only_level 2 $new_tree_id] - - - ns_log notice " Package_id $wiki_package_id $tree_list :: $new_tree_list" - foreach category $tree_list { - set cat_id [lindex $category 0] - set new_cat_id [lindex [lindex $new_tree_list $count] 0] - db_foreach select_content { - select ci.item_id, p.page_order, - ci.name, ci.content_type, category_id, xpi.page_instance_id - from category_object_map c, cr_items ci, xowiki_page p, - xowiki_page_instance xpi - where c.object_id = ci.item_id - and ci.parent_id = :wiki_folder_id - and ci.content_type not in ('::xowiki::PageTemplate') - and p.page_id = xpi.page_instance_id - and category_id = :cat_id - and xpi.page_instance_id = ci.live_revision - order by p.page_order} { - ns_log notice "--------- -object_id $item_id $new_cat_id " - category::map_object -remove_old -object_id $item_id $new_cat_id - } - incr count - } - - set count 0 - - foreach tree $trees { - set tree_id [lindex $tree 0] - category_tree::unmap -tree_id $tree_id -object_id $wiki_package_id - } - - db_0or1row select_instance [::xowiki::PageTemplate instance_select_query \ - -folder_id $wiki_folder_id \ - -select_attributes {name} \ - -where_clause "name = 'es:Template_de_ges'"] - - set template_id $item_id - - set template [xowiki::Package instantiate_page_from_id -item_id $item_id] - - set text [list { -
- {{adp /packages/xowiki/www/admin/order {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@ dir "decreasing" action 0 page_name @name@ status @publish_status@}}} -
- - - - - - - - - +
{{adp portlets/wiki {name header_page skin plain-include}}}
{{adp /packages/content-portlet/www/unit-navbar {page_id @revision_id@ content_id @package_id@}}}
- + ns_log notice "inicia actualizacion de content" + set trees [category_tree::get_mapped_trees $wiki_package_id] + set tree_id [lindex [lindex $trees 0] 0] + set wiki_folder_id [::xowiki::Page require_folder \ + -name xowiki \ + -package_id $wiki_package_id] + + if {$level eq 1} { + set tree_list [content_category::get_tree_levels $tree_id] + } else { + set tree_list [content_category::get_tree_levels -only_level 2 $tree_id] + } + + set wiki_url [site_node::get_url_from_object_id \ + -object_id $wiki_package_id] + set community_id [dotlrn_community::get_community_id_from_url -url $wiki_url] + + set instructors [dotlrn_community::list_users_in_role \ + -rel_type "dotlrn_instructor_rel" $community_id] + + set instructor_id [lindex [lindex $instructors 0] 3] + + set new_tree_id [content_category::map_new_tree -object_id $wiki_package_id \ + -tree_name "Indice De Contenido." \ + -user_id $instructor_id] + + set new_tree_list [content_category::get_tree_levels \ + -only_level 2 $new_tree_id] + + + ns_log notice " Package_id $wiki_package_id $tree_list :: $new_tree_list" + foreach category $tree_list { + set cat_id [lindex $category 0] + set new_cat_id [lindex [lindex $new_tree_list $count] 0] + db_foreach select_content { + select ci.item_id, p.page_order, + ci.name, ci.content_type, category_id, xpi.page_instance_id + from category_object_map c, cr_items ci, xowiki_page p, + xowiki_page_instance xpi + where c.object_id = ci.item_id + and ci.parent_id = :wiki_folder_id + and ci.content_type not in ('::xowiki::PageTemplate') + and p.page_id = xpi.page_instance_id + and category_id = :cat_id + and xpi.page_instance_id = ci.live_revision + order by p.page_order} { + ns_log notice "--------- -object_id $item_id $new_cat_id " + category::map_object -remove_old -object_id $item_id $new_cat_id + } + incr count + } + + set count 0 + + foreach tree $trees { + set tree_id [lindex $tree 0] + category_tree::unmap -tree_id $tree_id -object_id $wiki_package_id + } + + db_0or1row select_instance [::xowiki::PageTemplate instance_select_query \ + -folder_id $wiki_folder_id \ + -select_attributes {name} \ + -where_clause "name = 'es:Template_de_ges'"] + + set template_id $item_id + + set template [xowiki::Package instantiate_page_from_id -item_id $item_id] + + set text [list { +
+ {{adp /packages/xowiki/www/admin/order {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@ dir "decreasing" action 0 page_name @name@ status @publish_status@}}} +
+
+ + + + + + + + - - {{adp /packages/content-portlet/www/complete-titlebar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ my_title {@title@}}}} - - - - - - - - - - - - - - - -
{{adp portlets/wiki {name header_page skin plain-include}}}
{{adp /packages/content-portlet/www/unit-navbar {page_id @revision_id@ content_id @package_id@}}}
+ - + - -
    {{adp /packages/content-portlet/www/complete-navbar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@}}}
{{adp /packages/content-portlet/www/complete-subnavbar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@}}}
@contenido@
- - - }] +
+ + {{adp /packages/content-portlet/www/complete-titlebar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ my_title {@title@}}}} + + + {{adp /packages/content-portlet/www/complete-subnavbar {page_pos @page_order@ page_id @revision_id@ content_id @package_id@ type @object_type@}}} + + + + + @contenido@
+ + + + + + + + +
+
+ }] - $template set text $text - $template destroy_on_cleanup - $template save - $template initialize_loaded_object + $template set text $text + $template destroy_on_cleanup + $template save + $template initialize_loaded_object } } @@ -258,17 +255,17 @@ -wiki_folder_id } { set tree_list [content_category::get_tree_levels \ - -subtree_id $category_id $tree_id] + -subtree_id $category_id $tree_id] set tree_list [linsert $tree_list 0 $category_id] foreach cat_tree $tree_list { - set cat_id [lindex $cat_tree 0] - set page_list [db_list_of_lists select_content {}] - - if {[llength $page_list] > 0} { - #set next_list [lindex $order_page 0] - #set nexturl "${wiki_url}[lindex $next_list 2]\\\#cont1" - break - } + set cat_id [lindex $cat_tree 0] + set page_list [db_list_of_lists select_content {}] + + if {[llength $page_list] > 0} { + #set next_list [lindex $order_page 0] + #set nexturl "${wiki_url}[lindex $next_list 2]\\\#cont1" + break + } } return $page_list } @@ -279,15 +276,15 @@ -category_id -wiki_folder_id } { - + set tree_list [content_category::get_tree_levels -subtree_id $category_id $tree_id] set tree_list [linsert $tree_list 0 [list $category_id "n"]] foreach category $tree_list { - set cat_id [lindex $category 0] - set count [db_string select_cat {*SQL*} -default 0] - if {$count > 0} { - return 1 - } + set cat_id [lindex $category 0] + set count [db_string select_cat {*SQL*} -default 0] + if {$count > 0} { + return 1 + } } return 0 } @@ -298,20 +295,20 @@ category_ids {locale ""} } { - + set user_id [auth::get_user_id] permission::require_permission \ - -object_id $tree_id \ - -privilege category_tree_write - + -object_id $tree_id \ + -privilege category_tree_write + set result 1 db_transaction { - foreach category_id [db_list order_categories_for_delete ""] { - category::delete $category_id - } - category_tree::flush_cache $tree_id + foreach category_id [db_list order_categories_for_delete ""] { + category::delete $category_id + } + category_tree::flush_cache $tree_id } on_error { - set result 0 + set result 0 } return $result } @@ -322,19 +319,19 @@ } { set tree_list [content_category::get_tree_levels $tree_id] set my_level [lindex \ - [lindex $tree_list \ - [lsearch -regexp \ - $tree_list $category_id]] \ - 3] - + [lindex $tree_list \ + [lsearch -regexp \ + $tree_list $category_id]] \ + 3] + if {$my_level > 2} { - return 0 + return 0 } set sub_tree_list [content_category::get_tree_levels -only_level 1 \ - -subtree_id $category_id $tree_id] + -subtree_id $category_id $tree_id] if {[llength $sub_tree_list] >= 5} { - return 0 + return 0 } return 1 } @@ -345,18 +342,18 @@ -tree_name {-user_id ""} } { - + if {[empty_string_p $user_id]} { set user_id [ad_conn user_id] } - + db_transaction { - set tree_id [category_tree::add -name $tree_name -user_id $user_id] - content_category::new_subtree -tree_id $tree_id -user_id $user_id - category_tree::map -tree_id $tree_id \ - -object_id $object_id \ - -assign_single_p t \ - -require_category_p t + set tree_id [category_tree::add -name $tree_name -user_id $user_id] + content_category::new_subtree -tree_id $tree_id -user_id $user_id + category_tree::map -tree_id $tree_id \ + -object_id $object_id \ + -assign_single_p t \ + -require_category_p t } return $tree_id } @@ -374,20 +371,20 @@ set description "New unit for content" set parent_id "" set unit_id [category::add -tree_id $tree_id \ - -parent_id $parent_id \ - -locale $language \ - -name "Unidad N" \ - -user_id $user_id \ - -description $description] + -parent_id $parent_id \ + -locale $language \ + -name "Unidad N" \ + -user_id $user_id \ + -description $description] foreach cat_name {Introduccion Contenido Actividades Glosario Anexo} { - - category::add -tree_id $tree_id \ - -parent_id $unit_id \ - -locale $language \ - -name $cat_name \ - -user_id $user_id \ - -description $description + + category::add -tree_id $tree_id \ + -parent_id $unit_id \ + -locale $language \ + -name $cat_name \ + -user_id $user_id \ + -description $description } return $unit_id @@ -398,26 +395,26 @@ -tree_id {-level 0} } { - + if {[db_0or1row select_parent { - select parent_id, category_id as category from categories - where category_id = :category_id - and tree_id = :tree_id + select parent_id, category_id as category from categories + where category_id = :category_id + and tree_id = :tree_id }]} { - - if {![empty_string_p $parent_id] && $level eq 0} { - return [content_category::category_parent -category_id $parent_id -tree_id $tree_id] - } elseif {![empty_string_p $parent_id] && $level ne 0} { - return $parent_id - } else { - return $category - } + + if {![empty_string_p $parent_id] && $level eq 0} { + return [content_category::category_parent -category_id $parent_id -tree_id $tree_id] + } elseif {![empty_string_p $parent_id] && $level ne 0} { + return $parent_id + } else { + return $category + } } } - - - + + + ad_proc -public content_compare::value_compare { x y @@ -426,38 +423,38 @@ set xp [string first . $x] set yp [string first . $y] if {$xp == -1 && $yp == -1} { - if {$x < $y} { - return -1 - } elseif {$x > $y} { - return 1 - } else { - return $def - } + if {$x < $y} { + return -1 + } elseif {$x > $y} { + return 1 + } else { + return $def + } } elseif {$xp == -1} { - set yh [string range $y 0 [expr {$yp-1}]] - return [value_compare $x $yh -1] + set yh [string range $y 0 [expr {$yp-1}]] + return [value_compare $x $yh -1] } elseif {$yp == -1} { - set xh [string range $x 0 [expr {$xp-1}]] - return [value_compare $xh $y 1] + set xh [string range $x 0 [expr {$xp-1}]] + return [value_compare $xh $y 1] } else { - set xh [string range $x 0 $xp] - set yh [string range $y 0 $yp] - if {$xh < $yh} { - return -1 - } elseif {$xh > $yh} { - return 1 - } else { - incr xp - incr yp - #puts "rest [string range $x $xp end] [string range $y $yp - # end]" - return [value_compare [string range $x $xp end] [string range $y $yp end] $def] - } + set xh [string range $x 0 $xp] + set yh [string range $y 0 $yp] + if {$xh < $yh} { + return -1 + } elseif {$xh > $yh} { + return 1 + } else { + incr xp + incr yp + #puts "rest [string range $x $xp end] [string range $y $yp + # end]" + return [value_compare [string range $x $xp end] [string range $y $yp end] $def] + } } } ad_proc -public content_compare::compare { - a + a b } { set x [lindex $a 1] @@ -466,8 +463,8 @@ } ad_proc -public content_compare::simple_compare { - a - b + a + b } { return [content_compare::value_compare $a $b 0] @@ -482,58 +479,64 @@ {locale ""} } { Get all categories of a category tree from the cache. - + @option all Indicates that phased_out categories should be included. @option subtree_id Return only categories of the given subtree. @param tree_id category tree to get the categories of. @param locale language in which to get the categories. [ad_conn locale] used by default. @return tcl list of lists: category_id category_name deprecated_p level } { if {[catch {set tree [nsv_get category_trees $tree_id]}]} { - return + return } if {$to_level ne 0 && $only_level ne 0} { - set only_level 0 + set only_level 0 } set result "" if {[empty_string_p $subtree_id]} { - foreach category $tree { - util_unlist $category category_id deprecated_p level - if {$all_p || $deprecated_p == "f"} { - if {$to_level < $level && $to_level ne 0} { - continue - } - if {$only_level ne $level && $only_level ne 0} { - continue - } - lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p $level] - } - } + foreach category $tree { + util_unlist $category category_id deprecated_p level + if {$all_p || $deprecated_p == "f"} { + if {$to_level < $level && $to_level ne 0} { + continue + } + if {$only_level ne $level && $only_level ne 0} { + continue + } + lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p $level] + } + } } else { - set in_subtree_p 0 - set subtree_level 0 - foreach category $tree { - util_unlist $category category_id deprecated_p level - if {$level == $subtree_level || $level < $subtree_level} { - set in_subtree_p 0 - } - if {$in_subtree_p && $deprecated_p == "f"} { - if {$to_level < [expr $level - $subtree_level] && $to_level ne 0} { - continue - } - - if {$only_level ne [expr $level - $subtree_level] && $only_level ne 0} { - continue - } - - lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p [expr $level - $subtree_level]] - } - if {$category_id == $subtree_id} { - set in_subtree_p 1 - set subtree_level $level - } - } + set in_subtree_p 0 + set subtree_level 0 + foreach category $tree { + util_unlist $category category_id deprecated_p level + if {$level == $subtree_level || $level < $subtree_level} { + set in_subtree_p 0 + } + if {$in_subtree_p && $deprecated_p == "f"} { + if {$to_level < [expr $level - $subtree_level] && $to_level ne 0} { + continue + } + + if {$only_level ne [expr $level - $subtree_level] && $only_level ne 0} { + continue + } + + lappend result [list $category_id [category::get_name $category_id $locale] $deprecated_p [expr $level - $subtree_level]] + } + if {$category_id == $subtree_id} { + set in_subtree_p 1 + set subtree_level $level + } + } } - + return $result } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/ecommerce/www/admin/products/delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/www/admin/products/delete-2.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/ecommerce/www/admin/products/delete-2.tcl 12 Feb 2019 17:12:19 -0000 1.6 +++ openacs-4/packages/ecommerce/www/admin/products/delete-2.tcl 12 Feb 2019 17:28:59 -0000 1.7 @@ -1,13 +1,13 @@ # /www/[ec_url_concat [ec_url] /admin]/products/delete-2.tcl ad_page_contract { - Delete a product. + Delete a product. - @author - @creation-date - @cvs-id $Id$ - @author ported by Jerry Asher (jerry@theashergroup.com) + @author + @creation-date + @cvs-id $Id$ + @author ported by Jerry Asher (jerry@theashergroup.com) } { - product_id:integer,notnull + product_id:integer,notnull } ad_require_permission [ad_conn package_id] admin @@ -45,135 +45,141 @@ db_transaction { - # 1. Offers - set offer_list [db_list offer_list_select "select offer_id from ec_offers where product_id=:product_id"] +# 1. Offers + set offer_list [db_list offer_list_select "select offer_id from ec_offers where product_id=:product_id"] - db_dml offers_delete "delete from ec_offers where product_id=:product_id" + db_dml offers_delete "delete from ec_offers where product_id=:product_id" - # audit - foreach offer_id $offer_list { - ec_audit_delete_row [list $offer_id $product_id] [list offer_id product_id] ec_offers_audit - } + # audit + foreach offer_id $offer_list { + ec_audit_delete_row [list $offer_id $product_id] [list offer_id product_id] ec_offers_audit + } - # 2. Custom Product Field Values - db_dml custom_product_fields_delete "delete from ec_custom_product_field_values where product_id=:product_id" - ec_audit_delete_row [list $product_id] [list product_id] ec_custom_p_field_values_audit + # 2. Custom Product Field Values + db_dml custom_product_fields_delete "delete from ec_custom_product_field_values where product_id=:product_id" + ec_audit_delete_row [list $product_id] [list product_id] ec_custom_p_field_values_audit - # 3. Subsubcategory Product map - set subsubcategory_list [db_list subsubcategory_list_select "select subsubcategory_id from ec_subsubcategory_product_map where product_id=:product_id"] + # 3. Subsubcategory Product map + set subsubcategory_list [db_list subsubcategory_list_select "select subsubcategory_id from ec_subsubcategory_product_map where product_id=:product_id"] - db_dml subsubcategory_delete "delete from ec_subsubcategory_product_map where product_id=:product_id" + db_dml subsubcategory_delete "delete from ec_subsubcategory_product_map where product_id=:product_id" - # audit - foreach subsubcategory_id $subsubcategory_list { - ec_audit_delete_row [list $subsubcategory_id $product_id] [list subsubcategory_id product_id] ec_subsubcat_prod_map_audit - } + # audit + foreach subsubcategory_id $subsubcategory_list { + ec_audit_delete_row [list $subsubcategory_id $product_id] [list subsubcategory_id product_id] ec_subsubcat_prod_map_audit + } - # 4. Subcategory Product map - set subcategory_list [db_list subcategory_list_select "select subcategory_id from ec_subcategory_product_map where product_id=:product_id"] + # 4. Subcategory Product map + set subcategory_list [db_list subcategory_list_select "select subcategory_id from ec_subcategory_product_map where product_id=:product_id"] - db_dml subcategory_delete "delete from ec_subcategory_product_map where product_id=:product_id" + db_dml subcategory_delete "delete from ec_subcategory_product_map where product_id=:product_id" - # audit - foreach subcategory_id $subcategory_list { - ec_audit_delete_row [list $subcategory_id $product_id] [list subcategory_id product_id] ec_subcat_prod_map_audit - } + # audit + foreach subcategory_id $subcategory_list { + ec_audit_delete_row [list $subcategory_id $product_id] [list subcategory_id product_id] ec_subcat_prod_map_audit + } - # 5. Category Product map - set category_list [db_list category_list_select "select category_id from ec_category_product_map where product_id=:product_id"] + # 5. Category Product map + set category_list [db_list category_list_select "select category_id from ec_category_product_map where product_id=:product_id"] - db_dml category_delete "delete from ec_category_product_map where product_id=:product_id" + db_dml category_delete "delete from ec_category_product_map where product_id=:product_id" - # audit - foreach category_id $category_list { - ec_audit_delete_row [list $category_id $product_id] [list category_id product_id] ec_category_product_map_audit - } + # audit + foreach category_id $category_list { + ec_audit_delete_row [list $category_id $product_id] [list category_id product_id] ec_category_product_map_audit + } - # 6. Product Reviews - set review_list [db_list review_list_select "select review_id from ec_product_reviews where product_id=:product_id"] + # 6. Product Reviews + set review_list [db_list review_list_select "select review_id from ec_product_reviews where product_id=:product_id"] - db_dml review_delete "delete from ec_product_reviews where product_id=:product_id" + db_dml review_delete "delete from ec_product_reviews where product_id=:product_id" - # audit - foreach review_id $review_list { - ec_audit_delete_row [list $review_id $product_id] [list review_id product_id] ec_product_reviews_audit - } + # audit + foreach review_id $review_list { + ec_audit_delete_row [list $review_id $product_id] [list review_id product_id] ec_product_reviews_audit + } - # 7. Product Comments - db_dml product_comments_delete "delete from ec_product_comments where product_id=:product_id" + # 7. Product Comments + db_dml product_comments_delete "delete from ec_product_comments where product_id=:product_id" - # comments aren't audited + # comments aren't audited - # 8. Product Relationship Links - set product_a_list [db_list product_a_list_select "select product_a from ec_product_links where product_b=:product_id"] - set product_b_list [db_list product_b_list_select "select product_b from ec_product_links where product_a=:product_id"] + # 8. Product Relationship Links + set product_a_list [db_list product_a_list_select "select product_a from ec_product_links where product_b=:product_id"] + set product_b_list [db_list product_b_list_select "select product_b from ec_product_links where product_a=:product_id"] - db_dml links_delete "delete from ec_product_links where product_a=:product_id or product_b=:product_id" + db_dml links_delete "delete from ec_product_links where product_a=:product_id or product_b=:product_id" - # audit - foreach product_a $product_a_list { - ec_audit_delete_row [list $product_a $product_id] [list product_a product_id] ec_product_links_audit - } - foreach product_b $product_b_list { - ec_audit_delete_row [list $product_b $product_id] [list product_b product_id] ec_product_links_audit - } + # audit + foreach product_a $product_a_list { + ec_audit_delete_row [list $product_a $product_id] [list product_a product_id] ec_product_links_audit + } + foreach product_b $product_b_list { + ec_audit_delete_row [list $product_b $product_id] [list product_b product_id] ec_product_links_audit + } - # 9. User Class - set user_class_id_list [list] - set user_class_price_list [list] - db_foreach user_class_select "select user_class_id, price from ec_product_user_class_prices where product_id=:product_id" { - lappend user_class_id_list $user_class_id - lappend user_class_price_list $price - } - db_dml delete_from_session_info "delete from ec_user_session_info where product_id=:product_id" + # 9. User Class + set user_class_id_list [list] + set user_class_price_list [list] + db_foreach user_class_select "select user_class_id, price from ec_product_user_class_prices where product_id=:product_id" { + lappend user_class_id_list $user_class_id + lappend user_class_price_list $price + } + db_dml delete_from_session_info "delete from ec_user_session_info where product_id=:product_id" - db_dml user_class_prices_delete "delete from ec_product_user_class_prices where product_id=:product_id" + db_dml user_class_prices_delete "delete from ec_product_user_class_prices where product_id=:product_id" - # audit - set counter 0 - foreach user_class_id $user_class_id_list { - ec_audit_delete_row [list $user_class_id [lindex $user_class_price_list $counter] $product_id] [list user_class_id price product_id] ec_product_u_c_prices_audit - incr counter - } + # audit + set counter 0 + foreach user_class_id $user_class_id_list { + ec_audit_delete_row [list $user_class_id [lindex $user_class_price_list $counter] $product_id] [list user_class_id price product_id] ec_product_u_c_prices_audit + incr counter + } - # 10. Product Series map - set series_id_list [db_list series_id_list_select "select series_id from ec_product_series_map where component_id=:product_id"] - set component_id_list [db_list component_id_list_select "select component_id from ec_product_series_map where series_id=:product_id"] + # 10. Product Series map + set series_id_list [db_list series_id_list_select "select series_id from ec_product_series_map where component_id=:product_id"] + set component_id_list [db_list component_id_list_select "select component_id from ec_product_series_map where series_id=:product_id"] - db_dml series_delete "delete from ec_product_series_map where series_id=:product_id or component_id=:product_id" + db_dml series_delete "delete from ec_product_series_map where series_id=:product_id or component_id=:product_id" - # audit - foreach series_id $series_id_list { - ec_audit_delete_row [list $series_id $product_id] [list series_id component_id] ec_product_series_map_audit - } - foreach component_id $component_id_list { - ec_audit_delete_row [list $product_id $component_id] [list series_id component_id] ec_product_series_map_audit - } + # audit + foreach series_id $series_id_list { + ec_audit_delete_row [list $series_id $product_id] [list series_id component_id] ec_product_series_map_audit + } + foreach component_id $component_id_list { + ec_audit_delete_row [list $product_id $component_id] [list series_id component_id] ec_product_series_map_audit + } - # 11. ec_sale_prices - set sale_price_list [db_list sale_price_list_select "select sale_price_id from ec_sale_prices where product_id=:product_id"] + # 11. ec_sale_prices + set sale_price_list [db_list sale_price_list_select "select sale_price_id from ec_sale_prices where product_id=:product_id"] - db_dml sale_price_delete "delete from ec_sale_prices where product_id=:product_id" + db_dml sale_price_delete "delete from ec_sale_prices where product_id=:product_id" - # audit - foreach sale_price_id $sale_price_list { - ec_audit_delete_row [list $sale_price_id] [list sale_price_id] ec_sale_prices_audit - } + # audit + foreach sale_price_id $sale_price_list { + ec_audit_delete_row [list $sale_price_id] [list sale_price_id] ec_sale_prices_audit + } - # 12. Products - # wtem@olywa.net, 2001-03-25 - # replaced straight delete statement - # with ec_product.delete pl/sql procedure - db_exec_plsql product_delete { - begin - ec_product.delete(:product_id); - end; - } + # 12. Products + # wtem@olywa.net, 2001-03-25 + # replaced straight delete statement + # with ec_product.delete pl/sql procedure + db_exec_plsql product_delete { + begin + ec_product.delete(:product_id); + end; + } - # audit - ec_audit_delete_row [list $product_id] [list product_id] ec_products_audit + # audit + ec_audit_delete_row [list $product_id] [list product_id] ec_products_audit } ad_returnredirect "index" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/forums/tcl/forums-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-callback-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/forums/tcl/forums-callback-procs.tcl 12 Feb 2019 17:12:19 -0000 1.13 +++ openacs-4/packages/forums/tcl/forums-callback-procs.tcl 12 Feb 2019 17:28:59 -0000 1.14 @@ -1,6 +1,6 @@ ad_library { Forum callbacks. - + Navigation callbacks. @author Jeff Davis @@ -112,15 +112,15 @@ set pm_name [pm::project::name -project_item_id $project_id] foreach forum_package_id [application_link::get_linked -from_package_id $package_id -to_package_key "forums"] { - set forum_id [forum::new \ - -name $pm_name \ - -package_id $forum_package_id \ - -no_callback] + set forum_id [forum::new \ + -name $pm_name \ + -package_id $forum_package_id \ + -no_callback] - # Automatically allow new threads on this forum + # Automatically allow new threads on this forum forum::new_questions_allow -forum_id $forum_id - application_data_link::new -this_object_id $project_id -target_object_id $forum_id + application_data_link::new -this_object_id $project_id -target_object_id $forum_id } } @@ -136,7 +136,7 @@ this is the content that will be indexed by the full text search engine. - We expect message_id to be a root message of a thread only, + We expect message_id to be a root message of a thread only, and return the text of all the messages below. } { @@ -181,23 +181,23 @@ append combined_content "$subject\n\n" } - # - # GN: The standard conversion from "text/enhanced" to - # "text/plain" converts first from "text/enhanced" to - # "text/html" and then from "text/html" to "text/plain". This - # can take for large forums posting a long time (e.g a few - # minutes on openacs.org). Since this function is used just - # for the summarizer (when listing a short paragraph in the - # context of the search result), we can live here with a much - # simpler version, which computes the same in less than one - # ms. - # - if {$message(format) eq "text/enhanced"} { - regsub -all {

} $content "\n\n" content - regsub -all {(]*>)} $content "" content - } else { - set content [ad_html_text_convert -from $format -to text/plain -- $content] - } + # + # GN: The standard conversion from "text/enhanced" to + # "text/plain" converts first from "text/enhanced" to + # "text/html" and then from "text/html" to "text/plain". This + # can take for large forums posting a long time (e.g a few + # minutes on openacs.org). Since this function is used just + # for the summarizer (when listing a short paragraph in the + # context of the search result), we can live here with a much + # simpler version, which computes the same in less than one + # ms. + # + if {$message(format) eq "text/enhanced"} { + regsub -all {

} $content "\n\n" content + regsub -all {(]*>)} $content "" content + } else { + set content [ad_html_text_convert -from $format -to text/plain -- $content] + } append combined_content $content # In case this text is not only used for indexing but also for display, beautify it @@ -213,7 +213,7 @@ keywords {} \ storage_type text \ mime text/plain \ - package_id $package_id] + package_id $package_id] } ad_proc -public -callback search::url -impl forums_message {} { @@ -272,12 +272,12 @@ The from_user_id is the user_id of the user that will be deleted and all the *forums* of this user will be mapped to the to_user_id. - + } { set msg "Forums items of $user_id" ns_log Notice $msg set result [list $msg] - + set last_poster [db_list_of_lists sel_poster {} ] set msg "Last Poster of $last_poster" lappend result $msg @@ -297,12 +297,12 @@ The from_user_id is the user_id of the user that will be deleted and all the *forums* of this user will be mapped to the to_user_id. - + } { - set msg "Merging forums" + set msg "Merging forums" ns_log Notice $msg set result [list $msg] - + db_dml upd_poster {} db_dml upd_user_id {} @@ -314,64 +314,64 @@ # application-track callbacks -ad_proc -callback application-track::getApplicationName -impl forums {} { +ad_proc -callback application-track::getApplicationName -impl forums {} { Callback implementation. } { return "forums" -} - -ad_proc -callback application-track::getGeneralInfo -impl forums {} { +} + +ad_proc -callback application-track::getGeneralInfo -impl forums {} { Callback implementation. } { db_1row my_query { - select count(f.forum_id) as result - FROM forums_forums f, dotlrn_communities_full com - WHERE com.community_id=:comm_id - and apm_package__parent_id(f.package_id) = com.package_id + select count(f.forum_id) as result + FROM forums_forums f, dotlrn_communities_full com + WHERE com.community_id=:comm_id + and apm_package__parent_id(f.package_id) = com.package_id } - + return $result } - -ad_proc -callback application-track::getSpecificInfo -impl forums {} { + +ad_proc -callback application-track::getSpecificInfo -impl forums {} { Callback implementation. } { - + upvar $query_name my_query upvar $elements_name my_elements set my_query { - SELECT f.name as name,f.thread_count as threads, - f.last_post, - to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date - FROM forums_forums f,dotlrn_communities_full com,acs_objects o - WHERE com.community_id=:class_instance_id - and f.forum_id = o.object_id - and apm_package__parent_id(f.package_id) = com.package_id + SELECT f.name as name,f.thread_count as threads, + f.last_post, + to_char(o.creation_date, 'YYYY-MM-DD HH24:MI:SS') as creation_date + FROM forums_forums f,dotlrn_communities_full com,acs_objects o + WHERE com.community_id=:class_instance_id + and f.forum_id = o.object_id + and apm_package__parent_id(f.package_id) = com.package_id } - + set my_elements { name { label "Name" - display_col name - html {align center} - + display_col name + html {align center} + } threads { label "Threads" - display_col threads - html {align center} + display_col threads + html {align center} } creation_date { label "creation_date" - display_col creation_date - html {align center} + display_col creation_date + html {align center} } last_post { label "last_post" - display_col last_post - html {align center} - } + display_col last_post + html {align center} + } } return "OK" Index: openacs-4/packages/logger/tcl/util-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/util-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/logger/tcl/util-procs.tcl 12 Feb 2019 17:12:19 -0000 1.6 +++ openacs-4/packages/logger/tcl/util-procs.tcl 12 Feb 2019 17:28:59 -0000 1.7 @@ -1,7 +1,7 @@ ad_library { Procedures in the logger::util namespace. Contains helper procedures used by the package. - + @creation-date 2003-04-22 @author Peter Marklund (peter@collaboraid.biz) @cvs-id $Id$ @@ -34,7 +34,7 @@ upvar $variable_name $variable_name set $variable_name "" } - } + } } ad_proc -private logger::util::lookup_ad_conn_var_name { @@ -68,13 +68,13 @@ logger instance is set up to be integrated in project-manager. This is set in the project-manager admin pages. Currently, this proc assumes it is called from within logger. - + @author Jade Rubick (jader@bread.com) @creation-date 2004-05-24 - + @return empty string if there is no linked in project-manager - - @error + + @error } { set package_id [ad_conn package_id] @@ -87,14 +87,14 @@ -package_id:required } { Memoized portion of project_manager_url - + @author Jade Rubick (jader@bread.com) @creation-date 2004-05-24 @see logger::util::project_manager_url - - @return - + + @return + @error empty string if project manager is not installed } { @@ -107,13 +107,13 @@ ad_proc -public logger::util::project_manager_linked_p { } { Returns 1 if there is a project manager linked to this instance - + @author Jade Rubick (jader@bread.com) @creation-date 2004-06-03 - - @return - - @error + + @return + + @error } { set url [logger::util::project_manager_url] @@ -123,3 +123,9 @@ return 1 } } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/logger/tcl/variable-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/variable-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/logger/tcl/variable-procs.tcl 12 Feb 2019 17:12:19 -0000 1.12 +++ openacs-4/packages/logger/tcl/variable-procs.tcl 12 Feb 2019 17:28:59 -0000 1.13 @@ -1,7 +1,7 @@ ad_library { Procedures in the logger::variable namespace. Those procedures operate on logger variable objects. - + @creation-date 4:th of April 2003 @author Peter Marklund (peter@collaboraid.biz) @cvs-id $Id$ @@ -22,7 +22,7 @@ @param variable_id Any pre-generated id of the variable. Optional. @param name The name of the new variable. Required. - @param unit The unit of the variable, for example hours, minutes, or + @param unit The unit of the variable, for example hours, minutes, or a currency code such as USD or EUR. @param type Must be either additive (default) or non-additive. @param pre_installed_p Indicates whether this is a variable that is comes pre-installed @@ -33,11 +33,11 @@ @author Peter Marklund } { ad_assert_arg_value_in_list type {additive non-additive} - + set name [lang::util::convert_to_i18n -package_key "logger" -prefix "name" -text $name] set unit [lang::util::convert_to_i18n -package_key "logger" -prefix "unit" -text $unit] - # Use ad_conn to initialize variables + # Use ad_conn to initialize variables logger::util::set_vars_from_ad_conn {package_id creation_user creation_ip} if { $pre_installed_p } { @@ -53,7 +53,7 @@ -party_id [acs_magic_object registered_users] \ -object_id $variable_id \ -privilege read - } + } return $variable_id } @@ -76,7 +76,7 @@ @author Peter Marklund } { ad_assert_arg_value_in_list type {additive non-additive} - + set package_id [ad_conn package_id] db_dml update_variable {} @@ -100,7 +100,7 @@ {-variable_id:required} {-array:required} } { - Retrieve attributes of the variable with given id into an + Retrieve attributes of the variable with given id into an array (using upvar) in the callers scope. The array will contain the keys variable_id, name, unit, and type. @@ -140,3 +140,9 @@ return $variable_id } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/news/tcl/test/news-db-test-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/test/news-db-test-init.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/news/tcl/test/news-db-test-init.tcl 12 Feb 2019 17:12:19 -0000 1.19 +++ openacs-4/packages/news/tcl/test/news-db-test-init.tcl 12 Feb 2019 17:28:59 -0000 1.20 @@ -136,7 +136,7 @@ _news_cr_news_root_folder_id } { aa_export_vars {_news_cr_root_folder_id _news_cr_news_root_folder_id} - + set _news_cr_root_folder_id [content::item::get_root_folder] set p_parent_id $_news_cr_root_folder_id set _news_cr_news_root_folder_id [db_string get-cr-news-root-folder { @@ -163,7 +163,7 @@ news_id } { aa_export_vars {p_full_details p_title p_text p_package_id p_is_live - p_approval_user p_approval_ip p_approval_date p_archive_date + p_approval_user p_approval_ip p_approval_date p_archive_date news_id} if {$p_full_details == "t"} { set p_approval_user [ad_conn "user_id"] @@ -224,10 +224,10 @@ Populates:
revision_id } { - aa_export_vars {p_item_id + aa_export_vars {p_item_id p_full_details p_title p_text p_package_id p_make_active_revision_p p_description - p_approval_user p_approval_ip p_approval_date p_archive_date + p_approval_user p_approval_ip p_approval_date p_archive_date revision_id} if {$p_full_details == "t"} { set p_approval_user [ad_conn "user_id"] @@ -371,7 +371,7 @@ set retrieval_ok_p 1 if {![db_0or1row get-cr-news-row { select package_id, archive_date, - approval_user, approval_date, approval_ip + approval_user, approval_date, approval_ip from cr_news where news_id = :p_news_id }]} { @@ -646,7 +646,7 @@ db config } -on_error { - The "news" object type doesn't exist, or has isn't configured correctly. + The "news" object type doesn't exist, or has isn't configured correctly. The most probable cause of this is that the news package datamodel hasn't been installed. } "check_object_type" { @@ -797,7 +797,7 @@ # Call the news.name function to retrieve the item name. # aa_log "Call news.name function to retrieve title of content revision" - set p_news_id $news_id + set p_news_id $news_id set name [db_exec_plsql news-name {}] aa_equals "Check the return from news.name is correct" $name $p_title } @@ -820,7 +820,7 @@ set p_item_id $item_id aa_call_component db-get-cr-items-row aa_false "Check the cr_items row was deleted" {$retrieval_ok_p} - + set p_revision_id $news_id aa_call_component db-get-cr-revisions-row aa_false "Check the cr_revisions row was deleted" {$retrieval_ok_p} Index: openacs-4/packages/news/www/item-create-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/item-create-3.tcl,v diff -u -r1.23 -r1.24 --- openacs-4/packages/news/www/item-create-3.tcl 12 Feb 2019 17:12:19 -0000 1.23 +++ openacs-4/packages/news/www/item-create-3.tcl 12 Feb 2019 17:28:59 -0000 1.24 @@ -36,7 +36,7 @@ # # the news_admin or an open approval policy allow immediate publishing # -if { $news_admin_p == 1 || $approval_policy eq "open" } { +if { $news_admin_p == 1 || $approval_policy eq "open" } { set approval_user [ad_conn user_id] set approval_ip [ad_conn peeraddr] set approval_date [dt_sysdate] @@ -51,7 +51,7 @@ # Allow the user to "never expire" a news item. if {$permanent_p == "t"} { set archive_date_ansi "" -} +} # get creation_foo set creation_date [dt_sysdate] @@ -80,9 +80,9 @@ # case: user submitted news item, is returned to a Thank-you page set title [_ news.News_item_submitted] set context [list $title] - ad_return_template item-create-thankyou + ad_return_template item-create-thankyou } -} else { +} else { # case: administrator returned to index page ad_returnredirect "" ad_script_abort Index: openacs-4/packages/news/www/admin/approve-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/admin/approve-2.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/news/www/admin/approve-2.tcl 12 Feb 2019 17:12:19 -0000 1.10 +++ openacs-4/packages/news/www/admin/approve-2.tcl 12 Feb 2019 17:28:59 -0000 1.11 @@ -5,12 +5,12 @@ This page makes the insert of publish_date and archive_date (optionally) into cr_revisions and cr_news(news_id) resp. without intermediate confirmation. The administrator is redirected to return_url:localurl - + @author stefan@arsdigita.com @creation-date 2000-12-20 @cvs-id $Id$ -} { +} { revision_id:naturalnum,notnull {return_url:localurl ""} {permanent_p:boolean "f"} @@ -32,10 +32,10 @@ set archive_date_ansi $archive_date(date) if { [dt_interval_check $archive_date_ansi $publish_date_ansi] >= 0 } { - ad_return_error "[_ news.Scheduling_Error]" \ - "[_ news.lt_The_archive_date_must]" + ad_return_error "[_ news.Scheduling_Error]" \ + "[_ news.lt_The_archive_date_must]" ad_script_abort - } + } } @@ -46,9 +46,9 @@ foreach id $revision_id { - - db_exec_plsql news_item_approve_publish {} + db_exec_plsql news_item_approve_publish {} + } set package_id [ad_conn package_id] if {[rss_support::subscription_exists \ Index: openacs-4/packages/news/www/admin/revision-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/admin/revision-add-3.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/news/www/admin/revision-add-3.tcl 12 Feb 2019 17:12:19 -0000 1.17 +++ openacs-4/packages/news/www/admin/revision-add-3.tcl 12 Feb 2019 17:28:59 -0000 1.18 @@ -2,14 +2,14 @@ ad_page_contract { - This page adds a new revision to a news item + This page adds a new revision to a news item and redirects to the item page of that item @author stefan@arsdigita.com @creation-date 2000-12-20 @cvs-id $Id$ -} { +} { item_id:naturalnum,notnull publish_title:notnull publish_lead @@ -26,35 +26,35 @@ if {$permanent_p == "t"} { set archive_date_ansi "" -} +} # approval foo set approval_user [ad_conn "user_id"] set approval_ip [ad_conn "peeraddr"] set approval_date [dt_sysdate] set live_revision_p "t" -# creation foo +# creation foo set creation_ip [ad_conn "peeraddr"] set creation_user [ad_conn "user_id"] # make new revision the active revision set active_revision_p "t" # Insert is 2-step process, same as in item-create-3.tcl -if {[catch { +if {[catch { set revision_id [db_exec_plsql create_news_item_revision {}] set content_add [db_map content_add] - if {![string match $content_add ""]} { - db_dml content_add { + if {![string match $content_add ""]} { + db_dml content_add { update cr_revisions set content = empty_blob() where revision_id = :revision_id returning content into :1 } -blobs [list $publish_body] } - + } errmsg ]} { set complaint " [_ news.lt_The_database_did_not_] \ Index: openacs-4/packages/photo-album/www/photo-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/photo-album/www/photo-add-2.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/photo-album/www/photo-add-2.tcl 12 Feb 2019 17:12:19 -0000 1.12 +++ openacs-4/packages/photo-album/www/photo-add-2.tcl 12 Feb 2019 17:28:59 -0000 1.13 @@ -17,36 +17,36 @@ {story ""} } -validate { valid_album -requires {album_id:integer} { - if [string equal [pa_is_album_p $album_id] "f"] { - ad_complain "The specified album is not valid." - } + if [string equal [pa_is_album_p $album_id] "f"] { + ad_complain "The specified album is not valid." + } } valid_mime_type { - + if { ![parameter::get -parameter ConverttoJpgorPng -package_id [ad_conn package_id] -default 1] } { - - if { [catch {set photo_info [pa_file_info ${upload_file.tmpfile}]} errMsg] } { - ns_log Warning "Error parsing file data Error: $errMsg" - ad_complain "error" - } - - lassign $photo_info base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256 - - if {$base_mime eq ""} { - set base_mime invalid - } - - if ![regexp $base_mime [parameter::get -parameter AcceptableUploadMIMETypes -package_id [ad_conn package_id]]] { - ad_complain "[_ photo-album._The_5]" - ad_complain "[_ photo-album._The_6]" - } - } + + if { [catch {set photo_info [pa_file_info ${upload_file.tmpfile}]} errMsg] } { + ns_log Warning "Error parsing file data Error: $errMsg" + ad_complain "error" + } + + lassign $photo_info base_bytes base_width base_height base_type base_mime base_colors base_quantum base_sha256 + + if {$base_mime eq ""} { + set base_mime invalid + } + + if ![regexp $base_mime [parameter::get -parameter AcceptableUploadMIMETypes -package_id [ad_conn package_id]]] { + ad_complain "[_ photo-album._The_5]" + ad_complain "[_ photo-album._The_6]" + } + } } valid_photo_id -requires {photo_id:integer} { - # supplied photo_id must not already exist + # supplied photo_id must not already exist if {[db_string check_photo_id {}]} { - ad_complain "The photo already exists. Check if it is already in the album." - } + ad_complain "The photo already exists. Check if it is already in the album." + } } } @@ -58,16 +58,22 @@ permission::require_permission -object_id $album_id -privilege "pa_create_photo" set new_photo_ids [pa_load_images \ - -remove 1 \ - -client_name $upload_file \ - -description $description \ - -story $story \ - -caption $caption \ - ${upload_file.tmpfile} $album_id $user_id] + -remove 1 \ + -client_name $upload_file \ + -description $description \ + -story $story \ + -caption $caption \ + ${upload_file.tmpfile} $album_id $user_id] pa_flush_photo_in_album_cache $album_id # page used as part of redirect so user returns to the album page containing the newly uploaded photo set page [pa_page_of_photo_in_album [lindex $new_photo_ids 0] $album_id] ad_returnredirect "album?album_id=$album_id&page=$page" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/spam/tcl/spam-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/spam/tcl/spam-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/spam/tcl/spam-procs.tcl 12 Feb 2019 17:12:19 -0000 1.3 +++ openacs-4/packages/spam/tcl/spam-procs.tcl 12 Feb 2019 17:28:59 -0000 1.4 @@ -4,36 +4,36 @@ @author Bill Schneider (bschneid@arsdigita.com) } -ad_proc spam_package_key {} { +ad_proc spam_package_key {} { returns the package key in apm_packages for the spam package; 'spam' by default -} { +} { return "spam" } -ad_proc spam_package_id {} { +ad_proc spam_package_id {} { returns the package key in apm_packages for the spam package; 'spam' by default -} { +} { return [db_string spam_get_package_id " - select min(package_id) from apm_packages - where package_key = '[spam_package_key]' + select min(package_id) from apm_packages + where package_key = '[spam_package_key]' "] } -ad_proc -public spam_base {} { +ad_proc -public spam_base {} { returns the base URL of the spam system. } { return [util_memoize { - db_string spam_base_query " - select - site_node.url(node_id) - from - site_nodes, apm_packages - where - object_id=package_id and package_key='[spam_package_key]' - "}] + db_string spam_base_query " + select + site_node.url(node_id) + from + site_nodes, apm_packages + where + object_id=package_id and package_key='[spam_package_key]' + "}] } @@ -47,38 +47,38 @@ {-sql ""} {-approved_p ""} } { - insert a new spam message into the acs_messages and spam_messages + insert a new spam message into the acs_messages and spam_messages table, and indirectly into the content repository. Requires that send_date be a string in the format "YYYY-MM-DD HH:MI:SS AM"; nearly ANSI but 12-hour time with AM/PM } { - # TilmannS: add a leading zero to the time, otherwise postgresql's - # to_timestamp chokes. The default (produced by - # spam_timeentrywidget, which uses ns_dbformvalueput) brings us a - # string like this: '2001-08-31 7:45:00 PM' but we need something - # like that: '2001-08-31 07:45:00 PM'. Not the most elegant - # solution and not meant to be final - in my opinion the - # time_widget needs some overall improvement here (is there - # something general in ACS for this kind of stuff?). - regsub { (\d):} $send_date { 0\1:} send_date +# TilmannS: add a leading zero to the time, otherwise postgresql's +# to_timestamp chokes. The default (produced by +# spam_timeentrywidget, which uses ns_dbformvalueput) brings us a +# string like this: '2001-08-31 7:45:00 PM' but we need something +# like that: '2001-08-31 07:45:00 PM'. Not the most elegant +# solution and not meant to be final - in my opinion the +# time_widget needs some overall improvement here (is there +# something general in ACS for this kind of stuff?). +regsub { (\d):} $send_date { 0\1:} send_date set sql_proc " begin - :1 := spam.new ( - spam_id => :spam_id, - send_date => to_date(:send_date, 'yyyy-mm-dd hh:mi:ss AM'), - title => :subject, - sql_query => :sql, - html_text => :html, - plain_text => :plain, - creation_user => [ad_get_user_id], - creation_ip => '[ad_conn peeraddr]', - context_id => :context_id, - approved_p => :approved_p - ); - end;" - + :1 := spam.new ( + spam_id => :spam_id, + send_date => to_date(:send_date, 'yyyy-mm-dd hh:mi:ss AM'), + title => :subject, + sql_query => :sql, + html_text => :html, + plain_text => :plain, + creation_user => [ad_get_user_id], + creation_ip => '[ad_conn peeraddr]', + context_id => :context_id, + approved_p => :approved_p + ); + end;" + set user_id [ad_get_user_id] set peeraddr [ad_conn peeraddr] @@ -93,22 +93,22 @@ {-html ""} {-sql ""} } { - update an existing spam message into the acs_messages and spam_messages + update an existing spam message into the acs_messages and spam_messages table, and indirectly into the content repository. Requires that send_date be a string in the format "YYYY-MM-DD HH:MI:SS AM"; nearly ANSI but 12-hour time with AM/PM } { set sql_proc " begin - spam.edit ( - spam_id => :spam_id, - send_date => to_date(:send_date, 'yyyy-mm-dd hh:mi:ss AM'), - title => :subject, - sql_query => :sql, - html_text => :html, - plain_text => :plain - ); - end;" + spam.edit ( + spam_id => :spam_id, + send_date => to_date(:send_date, 'yyyy-mm-dd hh:mi:ss AM'), + title => :subject, + sql_query => :sql, + html_text => :html, + plain_text => :plain + ); + end;" # TilmannS: add a leading zero to the time, otherwise postgresql's # to_timestamp chokes. The default (produced by @@ -119,24 +119,24 @@ # time_widget needs some overall improvement here (is there # something general in ACS for this kind of stuff?). regsub { (\d):} $send_date { 0\1:} send_date - + return [db_exec_plsql spam_update_message $sql_proc] } -ad_proc spam_send_immediate {msg_id} { +ad_proc spam_send_immediate {msg_id} { Sends the previously-entered spam message with id - msg_id immediately by immediately queueing it in + msg_id immediately by immediately queueing it in the outgoing acs_mail_queue_outgoing table. } { db_dml spam_update_for_immediate_send { - spam_put_in_outgoing_queue $msg_id - acs_mail_process_queue + spam_put_in_outgoing_queue $msg_id + acs_mail_process_queue } } -ad_proc -private spam_put_in_outgoing_queue {spam_id} { +ad_proc -private spam_put_in_outgoing_queue {spam_id} { puts a single spam messages in the outgoing queue immediately. requires approved_p to be true, which should generally be redundant (that is, program logic should check for approval before calling @@ -145,74 +145,74 @@ set spam_sender [ad_parameter -package_id [spam_package_id] SpamSender] db_1row spam_get_outgoing_message { - select body_id, send_date, sql_query, context_id, - creation_date, creation_user, creation_ip - from spam_messages, acs_objects, acs_mail_links - where - object_id = spam_id - and mail_link_id = spam_id - and spam_id = :spam_id - and approved_p = 't' - } + select body_id, send_date, sql_query, context_id, + creation_date, creation_user, creation_ip + from spam_messages, acs_objects, acs_mail_links + where + object_id = spam_id + and mail_link_id = spam_id + and spam_id = :spam_id + and approved_p = 't' + } set recipients [db_list spam_get_recipients " - select email from parties, ($sql_query) p2 - where p2.party_id = parties.party_id + select email from parties, ($sql_query) p2 + where p2.party_id = parties.party_id "] db_transaction { - foreach email $recipients { + foreach email $recipients { set id [db_exec_plsql spam_insert_into_outgoing { begin :1 := acs_mail_queue_message.new ( - body_id => :body_id, - context_id => :context_id, - creation_date => :creation_date, - creation_user => :creation_user, - creation_ip => :creation_ip - ); + body_id => :body_id, + context_id => :context_id, + creation_date => :creation_date, + creation_user => :creation_user, + creation_ip => :creation_ip + ); end; }] - db_dml spam_set_outgoing_addresses { - insert into acs_mail_queue_outgoing - (message_id, envelope_from, envelope_to) - values - (:id, :spam_sender, :email) - } - } - db_dml spam_set_sent_p { - update spam_messages - set sent_p = 't' - where spam_id = :spam_id - } + db_dml spam_set_outgoing_addresses { + insert into acs_mail_queue_outgoing + (message_id, envelope_from, envelope_to) + values + (:id, :spam_sender, :email) + } + } + db_dml spam_set_sent_p { + update spam_messages + set sent_p = 't' + where spam_id = :spam_id + } } } -ad_proc spam_sweeper {} { +ad_proc spam_sweeper {} { sweeps the spam_messages table for spams that have been approved but not yet been sent, but are due to be sent. All of these messages will be inserted into the acs_mail_queue_outgoing table (once per recipient) - and also in acs_mail_queue_messages (once total). + and also in acs_mail_queue_messages (once total). } { set spam_list [db_list spam_get_list_of_outgoing_messages { - select spam_id - from spam_messages - where - sysdate >= send_date - and approved_p = 't' - and sent_p = 'f' + select spam_id + from spam_messages + where + sysdate >= send_date + and approved_p = 't' + and sent_p = 'f' }] foreach spam_id $spam_list { - spam_put_in_outgoing_queue $spam_id + spam_put_in_outgoing_queue $spam_id } } ad_proc spam_p {spam_id} { return 1 if spam_id is a valid spam message, 0 if not } { - return [db_string spam_p_count - "select count(spam_id) from spam_messages where spam_id = :spam_id" + return [db_string spam_p_count + "select count(spam_id) from spam_messages where spam_id = :spam_id" ] } @@ -221,19 +221,21 @@ time } { if {$default != ""} { - set timestamp $default + set timestamp $default } else { - set timestamp [lindex [split [ns_localsqltimestamp] " "] 1] + set timestamp [lindex [split [ns_localsqltimestamp] " "] 1] } set output " " +