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.18 -r1.18.2.1 --- openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 4 Apr 2018 08:11:26 -0000 1.18 +++ openacs-4/packages/acs-admin/www/apm/package-add-2.tcl 14 Feb 2019 16:15:00 -0000 1.18.2.1 @@ -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 [db_null] } - { vendor_uri [db_null] } + { 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.14 -r1.14.2.1 --- openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl 16 May 2018 17:08:51 -0000 1.14 +++ openacs-4/packages/acs-admin/www/apm/parameter-add-2.tcl 14 Feb 2019 16:15:00 -0000 1.14.2.1 @@ -13,40 +13,40 @@ description:notnull,nohtml datatype:notnull scope:notnull - {default_value [db_null]} + {default_value ""} {min_n_values:integer 1} {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.12 -r1.12.2.1 --- openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl 16 May 2018 17:08:51 -0000 1.12 +++ openacs-4/packages/acs-admin/www/apm/parameter-edit-2.tcl 14 Feb 2019 16:15:00 -0000 1.12.2.1 @@ -12,34 +12,33 @@ section_name description:notnull,nohtml datatype:notnull - {default_value [db_null]} + {default_value ""} {min_n_values:integer 1} {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-authentication/tcl/authentication-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl,v diff -u -r1.114 -r1.114.2.1 --- openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 30 Jan 2019 22:12:34 -0000 1.114 +++ openacs-4/packages/acs-authentication/tcl/authentication-procs.tcl 14 Feb 2019 16:15:00 -0000 1.114.2.1 @@ -1096,18 +1096,6 @@ set user_id [db_nextval acs_object_id_seq] } - if { $password_question eq "" } { - set password_question [db_null] - } - - if { $password_answer eq "" } { - set password_answer [db_null] - } - - if { $url eq "" } { - set url [db_null] - } - set creation_user "" set peeraddr "" Index: openacs-4/packages/acs-core-docs/www/db-api-detailed.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api-detailed.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-core-docs/www/db-api-detailed.adp 25 Apr 2018 08:38:27 -0000 1.5 +++ openacs-4/packages/acs-core-docs/www/db-api-detailed.adp 14 Feb 2019 16:15:00 -0000 1.5.2.1 @@ -332,22 +332,6 @@ # null, because Oracle has coerced the empty string (even for the # numeric column "bar") into null in both cases -

Since databases other than Oracle do not coerce empty strings -into null, this code has -different semantics depending on the underlying database (i.e., the -row that gets inserted may not have null as its column values), -which defeats the purpose of SQL abstraction.

Therefore, the Database Access API provides a -database-independent way to represent null (instead of the Oracle-specific idiom -of the empty string): db_null.

Use it instead of the empty string whenever you want to set a -column value explicitly to null, e.g.:

-
-set bar [db_null]
-set baz [db_null]
-
-db_dml foo_create {insert into foo(bar, baz) values(:bar, :baz)}
-#
-# sets the values for both the "bar" and "baz" columns to null
-
 

@@ -707,4 +691,4 @@ Requirements" homeLink="index" homeLabel="Home" upLink="kernel-doc" upLabel="Up"> - \ No newline at end of file + Index: openacs-4/packages/acs-core-docs/www/db-api-detailed.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api-detailed.html,v diff -u -r1.52 -r1.52.2.1 --- openacs-4/packages/acs-core-docs/www/db-api-detailed.html 25 Apr 2018 08:38:27 -0000 1.52 +++ openacs-4/packages/acs-core-docs/www/db-api-detailed.html 14 Feb 2019 16:15:00 -0000 1.52.2.1 @@ -482,36 +482,9 @@ -

-Since databases other than Oracle do not coerce empty strings into -null, this code has different semantics depending on the -underlying database (i.e., the row that gets inserted may not have null as -its column values), which defeats the purpose of SQL abstraction. -

-

Therefore, the Database Access API provides a database-independent way to -represent null (instead of the Oracle-specific idiom of the -empty string): db_null.

-

Use it instead of the empty string whenever you want to set a column value -explicitly to null, e.g.:

- - -
-
-set bar [db_null]
-set baz [db_null]
-
-db_dml foo_create {insert into foo(bar, baz) values(:bar, :baz)}
-#
-# sets the values for both the "bar" and "baz" columns to null
-
-
- - - -

SQL Abstraction

Index: openacs-4/packages/acs-core-docs/www/db-api.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-core-docs/www/db-api.adp 24 May 2018 06:54:57 -0000 1.5 +++ openacs-4/packages/acs-core-docs/www/db-api.adp 14 Feb 2019 16:15:00 -0000 1.5.2.1 @@ -216,19 +216,7 @@ # null, because Oracle has coerced the empty string (even for the # numeric column "bar") into null in both cases -

Since databases other than Oracle do not coerce empty strings -into null, this code has -different semantics depending on the underlying database (i.e., the -row that gets inserted may not have null as its column values), -which defeats the purpose of SQL abstraction.

Therefore, the Database Access API provides a -database-independent way to represent null (instead of the Oracle-specific idiom -of the empty string): db_null.

Use it instead of the empty string whenever you want to set a -column value explicitly to null, e.g.:

set bar [db_null]
-set baz [db_null]
-
-db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)"
-#
-# sets the values for both the "bar" and "baz" columns to null
+

@@ -332,12 +320,6 @@

Technically it's equivalent to using a code block on the end of your db_multirow.

-db_null
-
db_null

Returns a value which can be used in a bind variable to -represent the SQL value null. -See Nulls and Bind Variables -above.

-
db_foreach
 db_foreach statement-name sql [ -bind bind_set_id | -bind bind_value_list ] \
@@ -543,34 +525,6 @@
 }
 
           
-
-db_nullify_empty_string
-
-db_nullify_empty_string string
-

For true SQL purists, we provide the convenience function -db_nullify_empty_string, which -returns [db_null] if its string argument is the empty -string and can be used to encapsulate another Oracle quirk:

-
-set baz ""
-
-# Clean out the foo table
-#
-db_dml unused {delete from foo}
-db_dml unused {insert into foo(baz) values(:baz)}
-
-set n_rows [db_string unused "select count(*) from foo where baz is null"]
-#
-# $n_rows is 1; in effect, the "baz is null" criterion is matching
-# the empty string we just inserted (because of Oracle's coercion
-# quirk)
-
-          

To balance out this asymmetry, you can explicitly set -baz to null by writing:

-
-db_dml foo_insert {insert into foo(baz) values(:1)} {[db_nullify_empty_string $baz]}
-
-          

($‌Id: db-api.xml,v 1.14 2017/08/07 23:47:54 gustafn Exp $)

@@ -615,4 +569,4 @@ rightLink="templates" rightLabel="Next" rightTitle="Using Templates in OpenACS" homeLink="index" homeLabel="Home" upLink="dev-guide" upLabel="Up"> - \ No newline at end of file + Index: openacs-4/packages/acs-core-docs/www/db-api.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/db-api.html,v diff -u -r1.53 -r1.53.2.1 --- openacs-4/packages/acs-core-docs/www/db-api.html 25 Apr 2018 08:38:27 -0000 1.53 +++ openacs-4/packages/acs-core-docs/www/db-api.html 14 Feb 2019 16:15:00 -0000 1.53.2.1 @@ -339,27 +339,6 @@ # numeric column "bar") into null in both cases - -

- Since databases other than Oracle do not coerce empty strings into - null, this code has different semantics depending on the - underlying database (i.e., the row that gets inserted may not have null as - its column values), which defeats the purpose of SQL abstraction. -

- -

Therefore, the Database Access API provides a database-independent way to - represent null (instead of the Oracle-specific idiom of the - empty string): db_null.

- -

Use it instead of the empty string whenever you want to set a column value - explicitly to null, e.g.:

- -
set bar [db_null]
-set baz [db_null]
-
-db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)"
-#
-# sets the values for both the "bar" and "baz" columns to null
@@ -545,25 +524,6 @@

Technically it's equivalent to using a code block on the end of your db_multirow.

-
- - - db_null - - - -
-
-db_null
-	  
- -

- Returns a value which can be used in a bind variable - to represent the SQL value - null. - See Nulls and - Bind Variables above. -

@@ -885,51 +845,7 @@ } -
- - - db_nullify_empty_string - - -
-
-db_nullify_empty_string string
-	  
-

For true SQL purists, we provide the convenience function - db_nullify_empty_string, which returns - [db_null] if its string argument is the empty string - and can be used to encapsulate another Oracle quirk:

- -
-
-set baz ""
-
-# Clean out the foo table
-#
-db_dml unused {delete from foo}
-db_dml unused {insert into foo(baz) values(:baz)}
-
-set n_rows [db_string unused "select count(*) from foo where baz is null"]
-#
-# $n_rows is 1; in effect, the "baz is null" criterion is matching
-# the empty string we just inserted (because of Oracle's coercion
-# quirk)
-
-	  
- -

- To balance out this asymmetry, you can explicitly set baz to - null by writing: -

- - -
-
-db_dml foo_insert {insert into foo(baz) values(:1)} {[db_nullify_empty_string $baz]}
-
-	  
-

Index: openacs-4/packages/acs-core-docs/www/xml/developers-guide/db-api.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/developers-guide/db-api.xml,v diff -u -r1.17 -r1.17.2.1 --- openacs-4/packages/acs-core-docs/www/xml/developers-guide/db-api.xml 30 Sep 2018 15:53:28 -0000 1.17 +++ openacs-4/packages/acs-core-docs/www/xml/developers-guide/db-api.xml 14 Feb 2019 16:15:00 -0000 1.17.2.1 @@ -366,27 +366,6 @@ # numeric column "bar") into null in both cases - - - Since databases other than Oracle do not coerce empty strings into - null, this code has different semantics depending on the - underlying database (i.e., the row that gets inserted may not have null as - its column values), which defeats the purpose of SQL abstraction. - - - Therefore, the Database Access API provides a database-independent way to - represent null (instead of the Oracle-specific idiom of the - empty string): db_null. - - Use it instead of the empty string whenever you want to set a column value - explicitly to null, e.g.: - - set bar [db_null] -set baz [db_null] - -db_dml foo_create "insert into foo(bar, baz) values(:bar, :baz)" -# -# sets the values for both the "bar" and "baz" columns to null @@ -590,31 +569,6 @@ - db_null - - - - - - - -db_null - - - - Returns a value which can be used in a bind variable - to represent the SQL value - null. - See Nulls and - Bind Variables above. - - - - - - - - db_foreach @@ -1014,57 +968,6 @@ - - - - - - db_nullify_empty_string - - - - - -db_nullify_empty_string string - - - For true SQL purists, we provide the convenience function - db_nullify_empty_string, which returns - [db_null] if its string argument is the empty string - and can be used to encapsulate another Oracle quirk: - - - -set baz "" - -# Clean out the foo table -# -db_dml unused {delete from foo} -db_dml unused {insert into foo(baz) values(:baz)} - -set n_rows [db_string unused "select count(*) from foo where baz is null"] -# -# $n_rows is 1; in effect, the "baz is null" criterion is matching -# the empty string we just inserted (because of Oracle's coercion -# quirk) - - - - - To balance out this asymmetry, you can explicitly set baz to - null by writing: - - - - - -db_dml foo_insert {insert into foo(baz) values(:1)} {[db_nullify_empty_string $baz]} - - - - - Index: openacs-4/packages/acs-core-docs/www/xml/kernel/db-api.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/xml/kernel/db-api.xml,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/acs-core-docs/www/xml/kernel/db-api.xml 7 Aug 2017 23:47:55 -0000 1.12 +++ openacs-4/packages/acs-core-docs/www/xml/kernel/db-api.xml 14 Feb 2019 16:15:00 -0000 1.12.2.1 @@ -515,36 +515,8 @@ - -Since databases other than Oracle do not coerce empty strings into -null, this code has different semantics depending on the -underlying database (i.e., the row that gets inserted may not have null as -its column values), which defeats the purpose of SQL abstraction. - -Therefore, the Database Access API provides a database-independent way to -represent null (instead of the Oracle-specific idiom of the -empty string): db_null. -Use it instead of the empty string whenever you want to set a column value -explicitly to null, e.g.: - - - - - -set bar [db_null] -set baz [db_null] - -db_dml foo_create {insert into foo(bar, baz) values(:bar, :baz)} -# -# sets the values for both the "bar" and "baz" columns to null - - - - - - Index: openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl,v diff -u -r1.19 -r1.19.2.1 --- openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 24 Jul 2018 08:24:07 -0000 1.19 +++ openacs-4/packages/acs-datetime/tcl/acs-datetime-procs.tcl 14 Feb 2019 16:15:00 -0000 1.19.2.1 @@ -552,6 +552,8 @@ Used to get around Tcl interpreter problems w/ thinking leading zeros are octal. We could just use validate_integer, but it runs one extra regexp that we don't need to run. + + @see util::trim_leading_zeros } { return [util::trim_leading_zeros $string] } 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.68 -r1.68.2.1 --- openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 6 Dec 2018 20:06:00 -0000 1.68 +++ openacs-4/packages/acs-lang/tcl/lang-message-procs.tcl 14 Feb 2019 16:15:00 -0000 1.68.2.1 @@ -287,7 +287,7 @@ [list deleted_p t \ upgrade_status no_upgrade \ conflict_p f \ - sync_time [db_null] \ + sync_time "" \ ] } @@ -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-tcl/tcl/00-database-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/00-database-procs.tcl,v diff -u -r1.126 -r1.126.2.1 --- openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 8 Feb 2019 15:04:30 -0000 1.126 +++ openacs-4/packages/acs-tcl/tcl/00-database-procs.tcl 14 Feb 2019 16:15:00 -0000 1.126.2.1 @@ -336,11 +336,15 @@ # can't hurt anything to have them defined in when OpenACS is using # Postgres too. --atp@piskorski.com, 2003/04/08 05:34 EDT -ad_proc db_null {} { - @return an empty string, which Oracle thinks is null. This routine was - invented to provide an RDBMS-specific null value but doesn't actually - work. I (DRB) left it in to speed porting - we should really clean up - the code an pull out the calls instead, though. +ad_proc -deprecated db_null {} { + + @return an empty string, which Oracle thinks is null. + + Deprecated: This routine was invented to provide an RDBMS-specific null + value but doesn't actually work. I (DRB) left it in to speed porting - we + should really clean up the code an pull out the calls instead, though. + + @see "" } { return "" } @@ -352,14 +356,14 @@ return $result } -ad_proc -public db_nullify_empty_string { string } { +ad_proc -public -deprecated db_nullify_empty_string { string } { A convenience function that returns [db_null] if $string is the empty string. + + Deprecated: essentially just returns the passed string. + + @see: db_null } { - if { $string eq "" } { - return [db_null] - } else { - return $string - } + return $string } ad_proc -public db_boolean { bool } { Index: openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl,v diff -u -r1.126 -r1.126.2.1 --- openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 25 Nov 2018 02:40:16 -0000 1.126 +++ openacs-4/packages/acs-tcl/tcl/apm-install-procs.tcl 14 Feb 2019 16:15:00 -0000 1.126.2.1 @@ -1086,13 +1086,6 @@ } { upvar $array local_array - if { $version_id eq "" } { - set version_id [db_null] - } - if { $release_date eq "" } { - set release_date [db_null] - } - set version_id [db_exec_plsql version_insert {}] apm::package_version::attributes::store \ @@ -1553,14 +1546,6 @@ Register the package in the system. } { - if { $spec_file_path eq "" } { - set spec_file_path [db_null] - } - - if { $spec_file_mtime eq "" } { - set spec_file_mtime [db_null] - } - if { $package_type eq "apm_application" } { db_exec_plsql application_register {} } elseif { $package_type eq "apm_service" } { @@ -1580,10 +1565,6 @@ } { upvar $array local_array - if { $release_date eq "" } { - set release_date [db_null] - } - set version_id [db_exec_plsql apm_version_update {}] apm::package_version::attributes::store \ Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -r1.114 -r1.114.2.1 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 11 Feb 2019 11:50:04 -0000 1.114 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 14 Feb 2019 16:15:00 -0000 1.114.2.1 @@ -1060,10 +1060,6 @@ } { @return The parameter id that has been updated. } { - if {$section_name eq ""} { - set section_name [db_null] - } - db_dml parameter_update { update apm_parameters set parameter_name = :parameter_name, @@ -1106,14 +1102,6 @@ @return The parameter id of the new parameter. } { - if {$parameter_id eq ""} { - set parameter_id [db_null] - } - - if {$section_name eq ""} { - set section_name [db_null] - } - ns_log debug "apm_parameter_register: Registering $parameter_name, $section_name, $default_value" set parameter_id [db_exec_plsql parameter_register {}] @@ -1168,11 +1156,6 @@ Add a dependency to a version. @return The id of the new dependency. } { - - if {$dependency_id eq ""} { - set dependency_id [db_null] - } - return [db_exec_plsql dependency_add {}] } @@ -1195,11 +1178,6 @@ Add a interface to a version. @return The id of the new interface. } { - - if {$interface_id eq ""} { - set interface_id [db_null] - } - return [db_exec_plsql interface_add {}] } @@ -1836,10 +1814,6 @@ } } - if { $package_id eq "" } { - set package_id [db_null] - } - set package_id [db_exec_plsql invoke_new {}] apm_parameter_sync $package_key $package_id 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.35 -r1.35.2.1 --- openacs-4/packages/acs-tcl/tcl/install-procs.tcl 11 Jun 2018 09:14:55 -0000 1.35 +++ openacs-4/packages/acs-tcl/tcl/install-procs.tcl 14 Feb 2019 16:15:00 -0000 1.35.2.1 @@ -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] @@ -291,9 +291,7 @@ set context_id [apm_attribute_value -default "" $node context-id] set security_inherit_p [apm_attribute_value -default "t" $node security-inherit-p] - if {$context_id eq ""} { - set context_id [db_null] - } else { + if {$context_id ne ""} { set context_id [install::xml::util::get_id $context_id] } @@ -317,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] @@ -362,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] @@ -372,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 } @@ -409,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 ","] @@ -419,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]] @@ -438,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 ","] @@ -452,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]] @@ -491,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. } { @@ -578,7 +576,7 @@ WHERE user_id = :user_id } } - + if {$id ne ""} { set ::install::xml::ids($id) $result(user_id) } @@ -708,7 +706,7 @@ -extension $extension \ -package_id $package \ -context_id $context] - } + } if {$id ne ""} { set ::install::xml::ids($id) $result @@ -774,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"} { @@ -791,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 \ @@ -813,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 } @@ -848,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] } @@ -866,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 { @@ -890,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 } @@ -993,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 @@ -1030,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" ] />

@@ -1067,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"} { @@ -1127,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] @@ -1148,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. @@ -1166,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/acs-tcl/tcl/membership-rel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl 17 Jan 2019 17:02:00 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/membership-rel-procs.tcl 14 Feb 2019 16:15:00 -0000 1.11.2.1 @@ -53,7 +53,7 @@ if { [ad_conn isconnected] } { set user_id [ad_conn user_id] } else { - set user_id [db_null] + set user_id "" } db_dml update_modifying_user {} } Index: openacs-4/packages/ajaxhelper/tcl/ajax-dojo-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-dojo-procs.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/ajaxhelper/tcl/ajax-dojo-procs.tcl 26 Apr 2018 08:56:37 -0000 1.5 +++ openacs-4/packages/ajaxhelper/tcl/ajax-dojo-procs.tcl 14 Feb 2019 16:15:00 -0000 1.5.2.1 @@ -191,7 +191,7 @@ @creation-date 2006-11-05 } { - set objargs {} + set objargs [list] foreach args $argslist { lappend objargs [join $args ":"] } Index: openacs-4/packages/ajaxhelper/tcl/ajax-listbuilder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-listbuilder-procs.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/ajaxhelper/tcl/ajax-listbuilder-procs.tcl 25 Apr 2018 19:47:46 -0000 1.6 +++ openacs-4/packages/ajaxhelper/tcl/ajax-listbuilder-procs.tcl 14 Feb 2019 16:15:00 -0000 1.6.2.1 @@ -33,13 +33,13 @@ if {[info exists _hide_column]} { set hide_column $_hide_column } else { - set hide_column {} + set hide_column [list] } upvar move _move if {[info exists _move]} { set move $_move } else { - set move {} + set move [list] } upvar groupby _groupby set previous_index 0 @@ -49,7 +49,7 @@ template::list::get_reference -name $list_name upvar #[template::adp_level] ${list_name}:filter:groupby:properties groupby_ref - set groupbys {} + set groupbys [list] foreach elm $groupby_ref(values) { set value [lindex $elm 1] lappend groupbys [lindex $value 0 1] @@ -73,16 +73,16 @@ set first_not_checkbox 1 } - set sortmenuitems {} + set sortmenuitems [list] lappend sortmenuitems [list [list "text" "A-Z"] [list "url" "[filter_url -list_name $list_name -filter_name orderby -filter_value ${element},asc -return_url $return_url]"]] lappend sortmenuitems [list [list "text" "Z-A"] [list "url" "[filter_url -list_name $list_name -filter_name orderby -filter_value ${element},desc -return_url $return_url]"]] - set groupmenuitems {} + set groupmenuitems [list] lappend groupmenuitems [list [list "text" "By Exact Value"] [list "url" "[filter_url -list_name $list_name -filter_name groupby -filter_value $element -return_url $return_url]"] ] # lappend groupmenuitems [list [list "text" "By First Letter"] [list "url" "javascript:void(0)"] ] - set movemenuitems {} + set movemenuitems [list] set this_move $move if {[set this_move_index [lsearch $move $element]] > -1} { set this_move [lreplace $move $this_move_index [expr {$this_move_index + 1}]] @@ -97,7 +97,7 @@ lappend movemenuitems [list [list "text" "First"] [list "url" "[filter_url -list_name $list_name -filter_name move -filter_value [concat $this_move [list $element $first_not_checkbox]] -return_url $return_url]"]] } - set menulist {} + set menulist [list] if {[lsearch $list_properties(orderby_refs) "*${element_properties(name)}*"] > -1} { lappend menulist [list [list "text" "Sort"] [list "submenu" [list [list "id" "sort-$element_properties(name)"] [list "itemdata" $sortmenuitems] ] ] ] } @@ -169,9 +169,8 @@ @param list_name template::list list name @param allowed_elements List of element names that may appear in add - column dropdown - @parma add_url_var Name of URL variable to use to add the chosen column - @param -hidden_elements List of hidden elements that should be passed in the + column dropdown + @param add_url_var Name of URL variable to use to add the chosen column } { if {$return_url eq ""} { set return_url [ad_return_url] @@ -180,9 +179,9 @@ if {[info exists _add_column]} { set add_column $_add_column } else { - set add_column {} + set add_column [list] } - set addcolumnlist {} + set addcolumnlist [list] template::list::get_reference -name $list_name lappend list_properties(actions) [_ acs-templating.Add_Column] "javascript:void(0)" [_ acs-templating.Add_Column] @@ -252,7 +251,7 @@ foreach view $view_names { set view_name [lindex $view 0] set value [lindex $view 1] - set viewmenuitems {} + set viewmenuitems [list] lappend viewlist [list [list "text" $view_name] [list "url" "[filter_url -list_name $list_name -filter_name __list_view -filter_value $value -return_url [ad_conn url]]" ]] } @@ -455,7 +454,7 @@ } if {[info exists hide]} { - set reset_filters {} + set reset_filters [list] if {[info exists orderby] && [lsearch $hide [lindex [split $orderby ,] 0]] > -1} { unset orderby lappend reset_filters orderby Index: openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl,v diff -u -r1.18 -r1.18.2.1 --- openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl 25 Apr 2018 19:47:46 -0000 1.18 +++ openacs-4/packages/ajaxhelper/tcl/ajax-procs.tcl 14 Feb 2019 16:15:01 -0000 1.18.2.1 @@ -1,9 +1,9 @@ ad_library { - Library for Ajax Helper Procs + Library for Ajax Helper Procs - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 } namespace eval ah { } @@ -19,37 +19,37 @@ global ajax_helper_dojo_js_sources global ajax_helper_custom_scripts global ajax_helper_init_scripts - + set js_sources "" set init_body "" - + if { [info exists ajax_helper_js_sources] } { append js_sources [ah::load_js_sources -source_list $ajax_helper_js_sources] } - + if { [info exists ajax_helper_yui_js_sources] } { - + append js_sources [ah::yui::load_js_sources -source_list $ajax_helper_yui_js_sources] - + # Yahoo has implemented a theming system, to make the css work, a class must be added # to the body of the page before any widget is rendered append init_body [ah::yui::cssclass \ - -varname "yuiclass" \ - -action "add" \ - -element "document.body" \ - -classname "yui-skin-sam" \ - -element_is_var ] + -varname "yuiclass" \ + -action "add" \ + -element "document.body" \ + -classname "yui-skin-sam" \ + -element_is_var ] } - + if { [info exists ajax_helper_dojo_js_sources] } { append js_sources [ah::dojo::load_js_sources -source_list $ajax_helper_dojo_js_sources] } - + if { ![info exists ajax_helper_custom_scripts] } { set ajax_helper_custom_scripts "" } - if { [info exists ajax_helper_init_scripts] } { append init_body $ajax_helper_init_scripts } - + if { [info exists ajax_helper_init_scripts] } { append init_body $ajax_helper_init_scripts } + set js_init_script [ah::create_js_function -name "ah_page_init" -body ${init_body}] - + set script " ${js_init_script} ${ajax_helper_custom_scripts} @@ -59,7 +59,7 @@ return $js_sources -} +} # ********* Loading Sources ********** @@ -68,13 +68,13 @@ -sources } { This proc should be called by an ajaxhelper proc with a comma separated list of javascript sources - that the ajaxhelper proc needs in order to work. + that the ajaxhelper proc needs in order to work. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-12-19 - @param sources Comma separated list of sources + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-12-19 + @param sources Comma separated list of sources } { - #split up the comma delimited sources into a list +#split up the comma delimited sources into a list set source_list [split $sources ","] set ah_base_url [ah::get_url] @@ -121,41 +121,41 @@ } } -ad_proc -public ah::js_sources { - {-source "default"} +ad_proc -deprecated -public ah::js_sources { + {-source "default"} } { - DEPRECATED. Use ah::requires instead. + Will load any of the following javascript sources + prototype, + scriptaculous, + rounder, + overlibmws. + This will also check global variables. + If the sources have already been defined, we will not define them again. + Once the js_source has been loaded, the global variable with list of sources will be updated. + Calling this function is not necessary anymore as long as the required code to dynamically call + javascript functions is in the blank-master template, unless of course you want to write your own javascript. - Will load any of the following javascript sources - prototype, - scriptaculous, - rounder, - overlibmws. - This will also check global variables. - If the sources have already been defined, we will not define them again. - Once the js_source has been loaded, the global variable with list of sources will be updated. - Calling this function is not necessary anymore as long as the required code to dynamically call - javascript functions is in the blank-master template, unless of course you want to write your own javascript. + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @see ah::requires instead - @param source The caller can specify which set of javascript source files to load. This can be a comma seprated list - Valid values include - "default" : to load prototype and scriptaculous libraries - "rounder" : to load the rico corner rounder functions only, use this if you are working primarily with scriptaculous, - "overlibmws" : to load the overlibmws javascript files for dhtml callouts and popups. - "overlibmws_bubble" : to load the overlibmws javascript files for dhtml callouts and popups. - "overlibmws_scroll" : to load the overlibmws javascript files for dhtml bubble callouts and popups that scroll. - "overlibmws_drag" : to load the overlibmws javascript files for draggable dhtml callouts and popups. + @param source The caller can specify which set of javascript source files to load. This can be a comma seprated list + Valid values include + "default" : to load prototype and scriptaculous libraries + "rounder" : to load the rico corner rounder functions only, use this if you are working primarily with scriptaculous, + "overlibmws" : to load the overlibmws javascript files for dhtml callouts and popups. + "overlibmws_bubble" : to load the overlibmws javascript files for dhtml callouts and popups. + "overlibmws_scroll" : to load the overlibmws javascript files for dhtml bubble callouts and popups that scroll. + "overlibmws_drag" : to load the overlibmws javascript files for draggable dhtml callouts and popups. "prototype" : to load ONLY the prototype javascript source. "scriptaculous" : to load all scriptaculous javascript sources. - @return - @error + @return + @error } { - set ah_base_url [ah::get_url] + set ah_base_url [ah::get_url] set script "" set minsuffix "" @@ -166,50 +166,50 @@ # js_sources was called with no parameters, just load the defaults if { $source eq "default" } { if { ![ah::is_js_sources_loaded -js_source "prototype"] } { - # load prototype - template::head::add_javascript -src "${ah_base_url}prototype/prototype${minsuffix}.js" - # make sure helper procs don't load it again - lappend ajax_helper_js_sources "prototype" + # load prototype + template::head::add_javascript -src "${ah_base_url}prototype/prototype${minsuffix}.js" + # make sure helper procs don't load it again + lappend ajax_helper_js_sources "prototype" } if { ![ah::is_js_sources_loaded -js_source "scriptaculous"] } { - # load scriptaculous - template::head::add_javascript -src "${ah_base_url}scriptaculous/scriptaculous${minsuffix}.js" - # make sure it doesn't get loaded again - lappend ajax_helper_js_sources "scriptaculous" + # load scriptaculous + template::head::add_javascript -src "${ah_base_url}scriptaculous/scriptaculous${minsuffix}.js" + # make sure it doesn't get loaded again + lappend ajax_helper_js_sources "scriptaculous" } } - set js_file_list [split $source ","] + set js_file_list [split $source ","] - foreach x $js_file_list { - switch $x { - "rounder" { - if { ![ah::is_js_sources_loaded -js_source "rounder"] } { - template::head::add_javascript -src "${ah_base_url}curvycorners/rounded_corners_lite.inc.js" - } - } - "overlibmws" { - if { ![ah::is_js_sources_loaded -js_source "overlibmws"] } { - template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws${minsuffix}.js" - template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_overtwo${minsuffix}.js" - } - } - "overlibmws_bubble" { - if { ![ah::is_js_sources_loaded -js_source "overlibmws_bubble"] } { - template::head::add_javascript -script "var OLbubbleImageDir=\"${ah_base_url}overlibmws\";" - template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_bubble${minsuffix}.js" - } - } - "overlibmws_scroll" { - if { ![ah::is_js_sources_loaded -js_source "overlibmws_scroll"] } { - template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_scroll${minsuffix}.js" - } - } - "overlibmws_drag" { - if { ![ah::is_js_sources_loaded -js_source "overlibmws_drag"] } { - template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_draggable${minsuffix}.js" - } - } + foreach x $js_file_list { + switch $x { + "rounder" { + if { ![ah::is_js_sources_loaded -js_source "rounder"] } { + template::head::add_javascript -src "${ah_base_url}curvycorners/rounded_corners_lite.inc.js" + } + } + "overlibmws" { + if { ![ah::is_js_sources_loaded -js_source "overlibmws"] } { + template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws${minsuffix}.js" + template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_overtwo${minsuffix}.js" + } + } + "overlibmws_bubble" { + if { ![ah::is_js_sources_loaded -js_source "overlibmws_bubble"] } { + template::head::add_javascript -script "var OLbubbleImageDir=\"${ah_base_url}overlibmws\";" + template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_bubble${minsuffix}.js" + } + } + "overlibmws_scroll" { + if { ![ah::is_js_sources_loaded -js_source "overlibmws_scroll"] } { + template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_scroll${minsuffix}.js" + } + } + "overlibmws_drag" { + if { ![ah::is_js_sources_loaded -js_source "overlibmws_drag"] } { + template::head::add_javascript -src "${ah_base_url}overlibmws/overlibmws_draggable${minsuffix}.js" + } + } "prototype" { if { ![ah::is_js_sources_loaded -js_source "prototype"] } { template::head::add_javascript -src "${ah_base_url}prototype/prototype${minsuffix}.js" @@ -226,10 +226,10 @@ template::head::add_css -href "${ah_base_url}autosuggest/autosuggest.css" } } - } - } + } + } - return $script + return $script } # ********* UTILS ************ @@ -238,18 +238,18 @@ -lists_of_pairs } { Converts a properly structured list of lists into JSON format. - The list of lists may look something like + The list of lists may look something like - set data {} - lappend data [list [list "x" "1"] [list "y" "10"] ] - lappend data [list [list "x" "5"] [list "y" "20"] ] + set data [list] + lappend data [list [list "x" "1"] [list "y" "10"] ] + lappend data [list [list "x" "5"] [list "y" "20"] ] - each line represents a row composed of lists. - Each list in the row holds a pair that will be joined by ":". + each line represents a row composed of lists. + Each list in the row holds a pair that will be joined by ":". } { - set rows {} + set rows [list] foreach row $lists_of_pairs { - set pairs {} + set pairs [list] foreach pair $row { lappend pairs [join $pair ":"] } @@ -261,173 +261,173 @@ ad_proc -private ah::get_package_id { } { - Return the package_id of the installed and mounted ajax helper instance + Return the package_id of the installed and mounted ajax helper instance - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 - @return + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 + @return - @error + @error } { - return [apm_package_id_from_key "ajaxhelper"] + return [apm_package_id_from_key "ajaxhelper"] } ad_proc -private ah::get_url { } { - Return the path to the ajaxhelper resource files + Return the path to the ajaxhelper resource files - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 - @return + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 + @return - @error + @error } { - return "/resources/ajaxhelper/" + return "/resources/ajaxhelper/" } ad_proc -private ah::isnot_js_var { - element + element } { - Receives a string and surrounds it with single quotes. - This is a utility proc used to turn a parameter passed to a proc into a string. - The assumption is that an element passed as a parameter is a javascript variable. + Receives a string and surrounds it with single quotes. + This is a utility proc used to turn a parameter passed to a proc into a string. + The assumption is that an element passed as a parameter is a javascript variable. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 - @return + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 + @return } { - return "'$element'" + return "'$element'" } ad_proc -private ah::enclose_in_script { - -script:required + -script:required } { - Encloses whatever is passed to the script parameter in javascript tags. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + Encloses whatever is passed to the script parameter in javascript tags. + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param script string to enclose in javascript tags. + @param script string to enclose in javascript tags. } { - set tag "" - return $tag + set tag "" + return $tag } ad_proc -public ah::create_js_function { - -body:required - {-name ""} - {-parameters "" } + -body:required + {-name ""} + {-parameters "" } } { - Helper procedure to generate a javascript function - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + Helper procedure to generate a javascript function + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 - @param name The name of the javascript function - @param body The body of the javascript function - @param parameters The comma separated list of parameters of the javascript function + @param name The name of the javascript function + @param body The body of the javascript function + @param parameters The comma separated list of parameters of the javascript function } { - set script "function ${name} (" - if { $parameters ne "" } { append script [join $parameters ","] } - append script ") \{ $body \}" - return $script + set script "function ${name} (" + if { $parameters ne "" } { append script [join $parameters ","] } + append script ") \{ $body \}" + return $script } ad_proc -public ah::insert { - -element:required - -text:required - {-position "After"} + -element:required + -text:required + {-position "After"} } { - Inserts text or html in a position given the element as reference. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + Inserts text or html in a position given the element as reference. + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 - @param element The element that will be used as reference - @param text What you want to insert. - @param position Where you want to insert text. This is case sensitive. Possible values include After, Bottom, Before and Top. Defaults to After. + @param element The element that will be used as reference + @param text What you want to insert. + @param position Where you want to insert text. This is case sensitive. Possible values include After, Bottom, Before and Top. Defaults to After. } { - ah::requires -sources "prototype" + ah::requires -sources "prototype" - set script "new Insertion.${position}('${element}','${text}'); " - return $script + set script "new Insertion.${position}('${element}','${text}'); " + return $script } # ************ Listeners ************** ad_proc -public ah::starteventwatch { - -element:required - -event:required - -obs_function:required - {-element_is_var:boolean} - {-useCapture "false"} + -element:required + -event:required + -obs_function:required + {-element_is_var:boolean} + {-useCapture "false"} } { - Use prototype's Event object to watch/listen for a specific event from a specific html element. - Valid events include click, load, mouseover etc. - See ah::yui::addlistener for Yahoo's implementation which some say is superior. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-28 + Use prototype's Event object to watch/listen for a specific event from a specific html element. + Valid events include click, load, mouseover etc. + See ah::yui::addlistener for Yahoo's implementation which some say is superior. + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-28 - @param element the element you want to observe - @param event the event that the observer will wait for - @param obs_function the function that will be executed when the event is detected + @param element the element you want to observe + @param event the event that the observer will wait for + @param obs_function the function that will be executed when the event is detected } { - ah::requires -sources "prototype" + ah::requires -sources "prototype" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "Event.observe(${element}, '${event}', ${obs_function}, $useCapture);" - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "Event.observe(${element}, '${event}', ${obs_function}, $useCapture);" + return $script } ad_proc -public ah::stopeventwatch { - -element:required - -event:required - -obs_function:required - {-useCapture "false"} - {-element_is_var:boolean} + -element:required + -event:required + -obs_function:required + {-useCapture "false"} + {-element_is_var:boolean} } { - Use prototype's Event object to watch/listen to a specific event from a specific html element. - Valid events include click, load, mouseover etc. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-28 + Use prototype's Event object to watch/listen to a specific event from a specific html element. + Valid events include click, load, mouseover etc. + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-28 - @param element the element you want to observe - @param event the event that the observer will wait for - @param obs_function the function that will be executed when the event is detected + @param element the element you want to observe + @param event the event that the observer will wait for + @param obs_function the function that will be executed when the event is detected } { ah::requires -sources "prototype" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "Event.stopObserving(${element}, '${event}', ${obs_function}, $useCapture);" - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "Event.stopObserving(${element}, '${event}', ${obs_function}, $useCapture);" + return $script } # *********** Ajax Procs ************* ad_proc -public ah::ajaxperiodical { - -url:required - -container:required - {-frequency "5"} - {-asynchronous "true"} - {-pars ""} - {-options ""} + -url:required + -container:required + {-frequency "5"} + {-asynchronous "true"} + {-pars ""} + {-options ""} } { - Returns javascript that calls the prototype javascript library's ajax periodic updater object. - This object makes "polling" possible. Polling is a way by which a website can regularly update itself. - The ajax script is executed periodically in a set interval. - It has the same properties as ajax update, the only difference is that it is executed after x number of seconds. - Parameters and options are case sensitive, refer to scriptaculous documentation - http://wiki.script.aculo.us/scriptaculous/show/Ajax.PeriodicalUpdater + Returns javascript that calls the prototype javascript library's ajax periodic updater object. + This object makes "polling" possible. Polling is a way by which a website can regularly update itself. + The ajax script is executed periodically in a set interval. + It has the same properties as ajax update, the only difference is that it is executed after x number of seconds. + Parameters and options are case sensitive, refer to scriptaculous documentation + http://wiki.script.aculo.us/scriptaculous/show/Ajax.PeriodicalUpdater @author Hamilton Chua (ham@solutiongrove.com) @creation-date 2006-11-05 @@ -439,480 +439,480 @@ ah::requires -sources "prototype" - set preoptions "asynchronous:${asynchronous},frequency:${frequency},method:'post'" + set preoptions "asynchronous:${asynchronous},frequency:${frequency},method:'post'" - if { $pars ne "" } { - append preoptions ",parameters:$pars" - } - if { $options ne "" } { append preoptions ",$options" } - set script "new Ajax.PeriodicalUpdater('$container','$url',{$preoptions}); " + if { $pars ne "" } { + append preoptions ",parameters:$pars" + } + if { $options ne "" } { append preoptions ",$options" } + set script "new Ajax.PeriodicalUpdater('$container','$url',{$preoptions}); " - return $script + return $script } ad_proc -public ah::ajaxrequest { - -url:required - {-asynchronous "true"} - {-pars ""} - {-options ""} + -url:required + {-asynchronous "true"} + {-pars ""} + {-options ""} } { - Returns javascript that calls the prototype javascript library's ajax request (Ajax.Request) object. - The Ajax.Request object will only perform an xmlhttp request to a url. - If you prefer to perform an xmlhttp request and then update the contents of a < div >, look at ah::ajaxupdate. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request + Returns javascript that calls the prototype javascript library's ajax request (Ajax.Request) object. + The Ajax.Request object will only perform an xmlhttp request to a url. + If you prefer to perform an xmlhttp request and then update the contents of a < div >, look at ah::ajaxupdate. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Ajax.Request - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param url the url that the javascript will call/query - @param pars the parameters that will be passed to Ajax.Request. these parameters should normally be enclosed in single quotes ('') unless you intend to provide a javascript variable or function as a parameter - @param options the options that will be passed to the Ajax.Request javascript function + @param url the url that the javascript will call/query + @param pars the parameters that will be passed to Ajax.Request. these parameters should normally be enclosed in single quotes ('') unless you intend to provide a javascript variable or function as a parameter + @param options the options that will be passed to the Ajax.Request javascript function @param asynchronous the default is true } { ah::requires -sources "prototype" - set preoptions "asynchronous:${asynchronous},method:'post'" + set preoptions "asynchronous:${asynchronous},method:'post'" - if { $pars ne "" } { - append preoptions ",parameters:$pars" - } - if { $options ne "" } { append preoptions ",$options" } - set script "new Ajax.Request('$url',{$preoptions}); " + if { $pars ne "" } { + append preoptions ",parameters:$pars" + } + if { $options ne "" } { append preoptions ",$options" } + set script "new Ajax.Request('$url',{$preoptions}); " - return $script + return $script } ad_proc -public ah::ajaxupdate { - -container:required - -url:required - {-asynchronous "true"} - {-pars ""} - {-options ""} - {-effect ""} - {-effectopts ""} - {-enclose:boolean} - {-container_is_var:boolean} + -container:required + -url:required + {-asynchronous "true"} + {-pars ""} + {-options ""} + {-effect ""} + {-effectopts ""} + {-enclose:boolean} + {-container_is_var:boolean} } { - Generate an Ajax.Updater javascript object. - The parameters are passed directly to the Ajax.Update script. - You can optionally specify an effect to use as the container is updated. - By default it will use the "Appear" effect. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater + Generate an Ajax.Updater javascript object. + The parameters are passed directly to the Ajax.Update script. + You can optionally specify an effect to use as the container is updated. + By default it will use the "Appear" effect. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Ajax.Updater -
-		set script [ah::ajaxupdate -container "connections"  \
-				-url "/xmlhttp/getconnections" \
-				-pars "'q=test&limit_n=3'"
-				-enclose  \
-				-effectopts "duration: 1.5"]
-	
+
+    set script [ah::ajaxupdate -container "connections"  \
+        -url "/xmlhttp/getconnections" \
+        -pars "'q=test&limit_n=3'"
+    -enclose  \
+        -effectopts "duration: 1.5"]
+    
- @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param container the 'id' of the layer (div) you want to update via ajax - @param url the url that will be querried for the content to update the container's innerHtml - @param options optional parameters that you can pass to the Ajax.Updater script - @param effect optionally specify an effect to use as the container is updated - @param effectopts options for the effect - @param enclose optionally specify whether you want your script to be enclosed in < script > tags + @param container the 'id' of the layer (div) you want to update via ajax + @param url the url that will be querried for the content to update the container's innerHtml + @param options optional parameters that you can pass to the Ajax.Updater script + @param effect optionally specify an effect to use as the container is updated + @param effectopts options for the effect + @param enclose optionally specify whether you want your script to be enclosed in < script > tags - @return + @return - @error + @error } { ah::requires -sources "scriptaculous" - if { !$container_is_var_p } { - set container [ah::isnot_js_var $container] - } + if { !$container_is_var_p } { + set container [ah::isnot_js_var $container] + } - set preoptions "asynchronous:$asynchronous,method:'post'" + set preoptions "asynchronous:$asynchronous,method:'post'" - if { $pars ne "" } { - append preoptions ",parameters:$pars" - } - if { $options ne "" } { append preoptions ",$options" } + if { $pars ne "" } { + append preoptions ",parameters:$pars" + } + if { $options ne "" } { append preoptions ",$options" } - if { $effect ne "" } { - set effects_script [ah::effects -element $container -effect $effect -options $effectopts -element_is_var] - append preoptions ",onSuccess: function(t) { $effects_script }" - } + if { $effect ne "" } { + set effects_script [ah::effects -element $container -effect $effect -options $effectopts -element_is_var] + append preoptions ",onSuccess: function(t) { $effects_script }" + } - set script "new Ajax.Updater ($container,'$url',\{$preoptions\}); " + set script "new Ajax.Updater ($container,'$url',\{$preoptions\}); " - if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } - return $script + return $script } # *********** Overlib PopUp ************** ad_proc -public ah::popup { - -content:required - {-options ""} + -content:required + {-options ""} } { - This proc will generate javascript for an overlibmws popup. - This script has to go into a javascript event like onClick or onMouseover. - The ah::source must be executed with -source "overlibmws" - For more information about the options that you can pass - http://www.macridesweb.com/oltest/ - See ah::yui::tooltip for Yahoo's implementation + This proc will generate javascript for an overlibmws popup. + This script has to go into a javascript event like onClick or onMouseover. + The ah::source must be executed with -source "overlibmws" + For more information about the options that you can pass + http://www.macridesweb.com/oltest/ + See ah::yui::tooltip for Yahoo's implementation - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-12 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-12 - @param content this is what the popup will contain or display. if content is text, enclose it in single quotes (' '). - @param options the options to pass to overlibmws + @param content this is what the popup will contain or display. if content is text, enclose it in single quotes (' '). + @param options the options to pass to overlibmws - @return + @return - @error + @error } { ah::requires -sources "overlibmws" - if { $options ne "" } { - set overlibopt "," - append overlibopt $options - } else { - set overlibopt "" - } - set script "return overlib\(${content}${overlibopt}\);" - return $script + if { $options ne "" } { + set overlibopt "," + append overlibopt $options + } else { + set overlibopt "" + } + set script "return overlib\(${content}${overlibopt}\);" + return $script } ad_proc -public ah::clearpopup { } { - This proc will generate javascript for to clear a popup. - This script has to go into a javascript event like onClick or onMouseover. - The ah::source must be executed with -source "overlibmws" + This proc will generate javascript for to clear a popup. + This script has to go into a javascript event like onClick or onMouseover. + The ah::source must be executed with -source "overlibmws" - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-12 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-12 - @return + @return - @error + @error } { ah::requires -sources "overlibmws" - set script "nd();" - return $script + set script "nd();" + return $script } ad_proc -public ah::bubblecallout { - -text:required - {-type "square"} - {-textsize "x-small"} + -text:required + {-type "square"} + {-textsize "x-small"} } { - This proc will generate mouseover and mouseout javascript - for dhtml callout or popup using overlibmws - and the overlibmws bubble plugin. + This proc will generate mouseover and mouseout javascript + for dhtml callout or popup using overlibmws + and the overlibmws bubble plugin. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param type this is passed to the overlibmws script, refer to overlib documentation for possible values. - @param text the text that will appear in the popup. - @param textsize the size of the text in the popup + @param type this is passed to the overlibmws script, refer to overlib documentation for possible values. + @param text the text that will appear in the popup. + @param textsize the size of the text in the popup - @return - @error + @return + @error } { ah::requires -sources "overlibmws_bubble" - set script "onmouseover=\"" - append script [ah::popup -content "'$text'" -options "BUBBLE,BUBBLETYPE,'$type',TEXTSIZE,'$textsize'"] - append script "\" onmouseout=\"" - append script [ah::clearpopup] - append script "\"" - return $script + set script "onmouseover=\"" + append script [ah::popup -content "'$text'" -options "BUBBLE,BUBBLETYPE,'$type',TEXTSIZE,'$textsize'"] + append script "\" onmouseout=\"" + append script [ah::clearpopup] + append script "\"" + return $script } ad_proc -public ah::ajax_bubblecallout { - -url:required - {-pars ""} - {-options ""} - {-type "square"} - {-textsize "x-small"} + -url:required + {-pars ""} + {-options ""} + {-type "square"} + {-textsize "x-small"} } { - This proc executes an xmlhttp call and outputs the response text in a bubblecallout. + This proc executes an xmlhttp call and outputs the response text in a bubblecallout. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param url the url to make the xmlhttp call to - @param pars the parameters in querystring format you want to pass to the url - @param options the options you want to pass to overlibmws - @param type parameter specific to the bubble callout - @param textsize the size of the text in the callout + @param url the url to make the xmlhttp call to + @param pars the parameters in querystring format you want to pass to the url + @param options the options you want to pass to overlibmws + @param type parameter specific to the bubble callout + @param textsize the size of the text in the callout - @return + @return - @error + @error } { ah::requires -sources "overlibmws_bubble" - set popup [ah::popup -content "t.responseText" -options "BUBBLE,BUBBLETYPE,'$type',TEXTSIZE,'$textsize'"] - set request [ah::ajaxrequest -url $url -pars '$pars' -options "onSuccess: function(t) { $popup }" ] - set script "onmouseover=\"$request\" onmouseout=\"nd();\"" - return $script + set popup [ah::popup -content "t.responseText" -options "BUBBLE,BUBBLETYPE,'$type',TEXTSIZE,'$textsize'"] + set request [ah::ajaxrequest -url $url -pars '$pars' -options "onSuccess: function(t) { $popup }" ] + set script "onmouseover=\"$request\" onmouseout=\"nd();\"" + return $script } # ********** Effects ************** ad_proc -public ah::effects { - -element:required - {-effect "Appear"} - {-options ""} - {-element_is_var:boolean} + -element:required + {-effect "Appear"} + {-options ""} + {-element_is_var:boolean} } { - Generates javascript for effects by scriptaculous. - Refer to the scriptaculous documentation for a list of effects. - This proc by default will use the "Appear" effect - The parameters are passed directly to the scriptaculous effects script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/CoreEffects + Generates javascript for effects by scriptaculous. + Refer to the scriptaculous documentation for a list of effects. + This proc by default will use the "Appear" effect + The parameters are passed directly to the scriptaculous effects script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/CoreEffects - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 - @param element the page element that you want to apply the effect to - @param effect specify one of the scriptaculous effects you want to implement - @param options specify the options to pass to the scritpaculous javascript - @param element_is_var specify this if the element you are passing is a javascript variable + @param element the page element that you want to apply the effect to + @param effect specify one of the scriptaculous effects you want to implement + @param options specify the options to pass to the scritpaculous javascript + @param element_is_var specify this if the element you are passing is a javascript variable - @return - @error + @return + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "new Effect.$effect\($element,\{$options\}\); " - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "new Effect.$effect\($element,\{$options\}\); " + return $script } ad_proc -public ah::toggle { - -element:required - {-effect "Appear"} - {-options ""} - {-element_is_var:boolean} + -element:required + {-effect "Appear"} + {-options ""} + {-element_is_var:boolean} } { - Generates javascript that toggles the state of an element. - The parameters are passed directly to the scriptaculous toggle script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Effect.toggle + Generates javascript that toggles the state of an element. + The parameters are passed directly to the scriptaculous toggle script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Effect.toggle - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-23 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-23 - @param element the page element that you want to apply the effect to - @param effect specify one of the scriptaculous effects you want to toggle - @param options specify the options to pass to the scritpaculous javascript - @param element_is_var specify this if the element you are passing is a javascript variable + @param element the page element that you want to apply the effect to + @param effect specify one of the scriptaculous effects you want to toggle + @param options specify the options to pass to the scritpaculous javascript + @param element_is_var specify this if the element you are passing is a javascript variable - @return - @error + @return + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "Effect.toggle\($element,'$effect',{$options}\)" - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "Effect.toggle\($element,'$effect',{$options}\)" + return $script } # ********** Drag n Drop ************** ad_proc -public ah::draggable { - -element:required - {-options ""} - {-uid ""} - {-element_is_var:boolean} + -element:required + {-options ""} + {-uid ""} + {-element_is_var:boolean} } { - Generates javascript to make the given element a draggable. - The parameters are passed directly to the scriptaculous script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Draggables + Generates javascript to make the given element a draggable. + The parameters are passed directly to the scriptaculous script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Draggables - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-24 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-24 - @param element the page element that you want to make draggable - @param options specify the scriptaculous options - @param uid provide a unique id that is used as a variable to associate with the draggable - @param element_is_var specify this parameter if the element you are passing is a javascript variable + @param element the page element that you want to make draggable + @param options specify the scriptaculous options + @param uid provide a unique id that is used as a variable to associate with the draggable + @param element_is_var specify this parameter if the element you are passing is a javascript variable - @return + @return - @error + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "new Draggable \($element,\{$options\}\);" - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "new Draggable \($element,\{$options\}\);" + return $script } ad_proc -public ah::droppable { - -element:required - {-options ""} - {-uid ""} - {-element_is_var:boolean} + -element:required + {-options ""} + {-uid ""} + {-element_is_var:boolean} } { - Generates javascript to make the given element a droppable. - If a uid parameter is provided, the script will also check if the droppable with the same uid has already been created. - The parameters are passed directly to the scriptaculous script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Droppables + Generates javascript to make the given element a droppable. + If a uid parameter is provided, the script will also check if the droppable with the same uid has already been created. + The parameters are passed directly to the scriptaculous script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Droppables - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-24 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-24 - @param element the page element that you want to be a droppable - @param element_is_var specify this parameter if the element you are passing is a javascript variable - @param uid provide a unique id that is used as a variable to associate with the droppable - @param options specify the scriptaculous options for droppables + @param element the page element that you want to be a droppable + @param element_is_var specify this parameter if the element you are passing is a javascript variable + @param uid provide a unique id that is used as a variable to associate with the droppable + @param options specify the scriptaculous options for droppables - @return + @return - @error + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } - set script "Droppables.add (${element},{${options}});" + set script "Droppables.add (${element},{${options}});" - return $script + return $script } ad_proc -public ah::droppableremove { - -element:required - {-element_is_var:boolean} + -element:required + {-element_is_var:boolean} } { - Generates javascript to remove a droppable. - The parameters are passed directly to the scriptaculous script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Droppables + Generates javascript to remove a droppable. + The parameters are passed directly to the scriptaculous script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Droppables - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-02-24 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-02-24 - @param element the page element that you want to be a droppable - @param element_is_var specify this parameter if the element you are passing is a javascript variable + @param element the page element that you want to be a droppable + @param element_is_var specify this parameter if the element you are passing is a javascript variable - @return - @error + @return + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "Droppables.remove \($element);" - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "Droppables.remove \($element);" + return $script } ad_proc -public ah::sortable { - -element:required - {-options ""} - {-element_is_var:boolean} + -element:required + {-options ""} + {-element_is_var:boolean} } { - Generates javascript for sortable elements. - The parameters are passed directly to the scriptaculous sortable script. - Parameters and options are case sensitive, refer to scriptaculous documentation. - http://wiki.script.aculo.us/scriptaculous/show/Sortables + Generates javascript for sortable elements. + The parameters are passed directly to the scriptaculous sortable script. + Parameters and options are case sensitive, refer to scriptaculous documentation. + http://wiki.script.aculo.us/scriptaculous/show/Sortables - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-24 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-24 - @param element the page element that you want to apply the effect to - @param options specify the scriptaculous options - @param element_is_var specify this parameter if the element you are passing is a javascript variable + @param element the page element that you want to apply the effect to + @param options specify the scriptaculous options + @param element_is_var specify this parameter if the element you are passing is a javascript variable - @return - @error + @return + @error } { ah::requires -sources "scriptaculous" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } - set script "Sortable.destroy($element); " - append script "Sortable.create\($element, \{$options\}\); " - return $script + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } + set script "Sortable.destroy($element); " + append script "Sortable.create\($element, \{$options\}\); " + return $script } # ********** Round Corners ************ ad_proc -public ah::rounder { - -classname:required - {-jsobjname "myBoxObject"} - {-validtags "div"} - {-radius "20"} - {-element_is_var:boolean} - {-enclose:boolean} + -classname:required + {-jsobjname "myBoxObject"} + {-validtags "div"} + {-radius "20"} + {-element_is_var:boolean} + {-enclose:boolean} } { - Generates javascript to round html div elements. - Parameters are case sensitive. - http://www.curvycorners.net/ + Generates javascript to round html div elements. + Parameters are case sensitive. + http://www.curvycorners.net/ - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-24 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-24 - @param classname The name of the html class that the script will look for. All validtags with this classname will be rounded. - @param jsobjname The javascript object name you want to use. - @param validtags Comma separated values of valid tags to apply rounded corners. Values include "div", "form" or "div,form" - @param radius The radius of the rounded corners. + @param classname The name of the html class that the script will look for. All validtags with this classname will be rounded. + @param jsobjname The javascript object name you want to use. + @param validtags Comma separated values of valid tags to apply rounded corners. Values include "div", "form" or "div,form" + @param radius The radius of the rounded corners. } { ah::requires -sources "rounder" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } - set script "var settings = { tl: { radius: ${radius} },tr: { radius: ${radius} },bl: { radius: ${radius} },br: { radius: ${radius} },antiAlias: true,autoPad: true,validTags: \[\"${validtags}\"\]}; - var ${jsobjname} = new curvyCorners(settings, \"${classname}\"); - ${jsobjname}.applyCornersToAll();" + set script "var settings = { tl: { radius: ${radius} },tr: { radius: ${radius} },bl: { radius: ${radius} },br: { radius: ${radius} },antiAlias: true,autoPad: true,validTags: \[\"${validtags}\"\]}; + var ${jsobjname} = new curvyCorners(settings, \"${classname}\"); + ${jsobjname}.applyCornersToAll();" - if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } - return $script + return $script } # ************* Auto Suggest ***************** @@ -930,65 +930,65 @@ @creation-date 2006-06-21 @param array_list a list of lists which will be constructed - as the javascript array. this takes priority - over sql_query parameter. + as the javascript array. this takes priority + over sql_query parameter. @param sql_query sql query to pass to db_list_of_lists to generate - the array + the array } { ah::requires -sources "autosuggest" if {[llength $array_list]} { - set suggestion_list $array_list + set suggestion_list $array_list } elseif {$sql_query ne {} } { - set suggestion_list [db_list_of_lists get_array_list $sql_query] + set suggestion_list [db_list_of_lists get_array_list $sql_query] } else { - # just do something for failover - set suggestion_list {} + # just do something for failover + set suggestion_list {} } set suggestions_stub {} append suggestions_stub " -function AUTOSuggestions() { - this.auto = \[ - " + function AUTOSuggestions() { + this.auto = \[ + " -set suggestion_formatted_list {} -foreach suggestion $suggestion_list { - lappend suggestion_formatted_list "\[\"[lindex $suggestion 0]\",\"[lindex $suggestion 1]\"\]" -} + set suggestion_formatted_list {} + foreach suggestion $suggestion_list { + lappend suggestion_formatted_list "\[\"[lindex $suggestion 0]\",\"[lindex $suggestion 1]\"\]" + } -append suggestions_stub [join $suggestion_formatted_list ","] + append suggestions_stub [join $suggestion_formatted_list ","] -append suggestions_stub " - \]; -} -" -append suggestions_stub { - AUTOSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/, - bTypeAhead /*:boolean*/) { - var aSuggestions = []; - var aDescriptions = []; - var sTextboxValue = oAutoSuggestControl.textbox.value.toLowerCase(); + append suggestions_stub " + \]; + } + " + append suggestions_stub { + AUTOSuggestions.prototype.requestSuggestions = function (oAutoSuggestControl /*:AutoSuggestControl*/, + bTypeAhead /*:boolean*/) { + var aSuggestions = []; + var aDescriptions = []; + var sTextboxValue = oAutoSuggestControl.textbox.value.toLowerCase(); - if (sTextboxValue.length > 0){ + if (sTextboxValue.length > 0){ - //search for matching states - for (var i=0; i < this.auto.length; i++) { - if (this.auto[i][0].toLowerCase().indexOf(sTextboxValue) == 0) { - aSuggestions.push(this.auto[i][0]); - aDescriptions.push(this.auto[i][1]); - } - } - } + //search for matching states + for (var i=0; i < this.auto.length; i++) { + if (this.auto[i][0].toLowerCase().indexOf(sTextboxValue) == 0) { + aSuggestions.push(this.auto[i][0]); + aDescriptions.push(this.auto[i][1]); + } + } + } - //provide suggestions to the control - oAutoSuggestControl.autosuggest(aSuggestions, aDescriptions, bTypeAhead); - }; -} + //provide suggestions to the control + oAutoSuggestControl.autosuggest(aSuggestions, aDescriptions, bTypeAhead); + }; + } -return $suggestions_stub + return $suggestions_stub } Index: openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl,v diff -u -r1.14 -r1.14.2.1 --- openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl 25 Apr 2018 19:47:46 -0000 1.14 +++ openacs-4/packages/ajaxhelper/tcl/ajax-yahoo-procs.tcl 14 Feb 2019 16:15:01 -0000 1.14.2.1 @@ -1,10 +1,10 @@ ad_library { - Library for Ajax Helper Procs - based on Yahoo's User Interface Libraries + Library for Ajax Helper Procs + based on Yahoo's User Interface Libraries - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-01-16 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-01-16 } namespace eval ah::yui { } @@ -48,12 +48,12 @@ -js_source } { This proc will determine if the YUI js_source file is the name is a valid name associated to - a javascript source. This proc contains hard coded list of javascript sources that - ajaxhelper supports. + a javascript source. This proc contains hard coded list of javascript sources that + ajaxhelper supports. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-12-19 - @param js_source The name of the javascript source to check + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-12-19 + @param js_source The name of the javascript source to check } { set valid_sources [list "utilities" \ @@ -78,37 +78,38 @@ } ad_proc -private ah::yui::is_js_sources_loaded { - -js_source + -js_source } { - This proc will loop thru the global source_list - and check for the presence of the given js_source. - If found, this proc will return 1 - If not found, this proc will return 0 + This proc will loop thru the global source_list + and check for the presence of the given js_source. + If found, this proc will return 1 + If not found, this proc will return 0 - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 } { - set state 0 - if { [info exists ::ajax_helper_yui_js_sources] } { - foreach source $::ajax_helper_yui_js_sources { - if { [string match $source $js_source] } { - set state 1 - break - } - } - } - return $state + set state 0 + if { [info exists ::ajax_helper_yui_js_sources] } { + foreach source $::ajax_helper_yui_js_sources { + if { [string match $source $js_source] } { + set state 1 + break + } + } + } + return $state } ad_proc -private ah::yui::requires { -sources } { - This proc should be called by an ajaxhelper proc that uses YUI with a comma separated list of YUI javascript sources - that the ajaxhelper proc needs in order to work. + This proc should be called by an ajaxhelper proc that + uses YUI with a comma separated list of YUI javascript sources + that the ajaxhelper proc needs in order to work. - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-12-19 - @param sources Comma separated list of sources + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-12-19 + @param sources Comma separated list of sources } { #split up the comma delimited sources into a list set source_list [split $sources ","] @@ -138,41 +139,40 @@ } -ad_proc -public ah::yui::js_sources { - {-source "default"} - {-min:boolean} +ad_proc -deprecated -public ah::yui::js_sources { + {-source "default"} + {-min:boolean} } { + Generates the \n" - } - } - "event" { - if { ![ah::yui::is_js_sources_loaded -js_source "event"] } { - append script " \n" - } - } - "treeview" { - if { ![ah::yui::is_js_sources_loaded -js_source "treeview"] } { - append script " \n" - } - } - "calendar" { - if { ![ah::yui::is_js_sources_loaded -js_source "calendar"] } { - append script " \n" - } - } - "dragdrop" { - if { ![ah::yui::is_js_sources_loaded -js_source "dragdrop"] } { - append script " \n" - } - } - "slider" { - if { ![ah::yui::is_js_sources_loaded -js_source "slider"] } { - append script " \n" - } - } - "container" { - if { ![ah::yui::is_js_sources_loaded -js_source "container"] } { - append script " \n" - append script " \n" - } - } - "menu" { - if { ![ah::yui::is_js_sources_loaded -js_source "menu"] } { - append script " \n" - append script " \n" - } - } - "connection" { - if { ![ah::yui::is_js_sources_loaded -js_source "connection"] } { - append script " \n" - } - } - "dom" { - if { ![ah::yui::is_js_sources_loaded -js_source "yahoo"] } { - append script " \n" - } + foreach x $js_file_list { + switch $x { + "animation" { + if { ![ah::yui::is_js_sources_loaded -js_source "animation"] } { + append script " \n" + } } + "event" { + if { ![ah::yui::is_js_sources_loaded -js_source "event"] } { + append script " \n" + } + } + "treeview" { + if { ![ah::yui::is_js_sources_loaded -js_source "treeview"] } { + append script " \n" + } + } + "calendar" { + if { ![ah::yui::is_js_sources_loaded -js_source "calendar"] } { + append script " \n" + } + } + "dragdrop" { + if { ![ah::yui::is_js_sources_loaded -js_source "dragdrop"] } { + append script " \n" + } + } + "slider" { + if { ![ah::yui::is_js_sources_loaded -js_source "slider"] } { + append script " \n" + } + } + "container" { + if { ![ah::yui::is_js_sources_loaded -js_source "container"] } { + append script " \n" + append script " \n" + } + } + "menu" { + if { ![ah::yui::is_js_sources_loaded -js_source "menu"] } { + append script " \n" + append script " \n" + } + } + "connection" { + if { ![ah::yui::is_js_sources_loaded -js_source "connection"] } { + append script " \n" + } + } + "dom" { + if { ![ah::yui::is_js_sources_loaded -js_source "yahoo"] } { + append script " \n" + } + } "yahoo" { - if { ![ah::yui::is_js_sources_loaded -js_source "yahoo"] } { - append script " \n" - } - } + if { ![ah::yui::is_js_sources_loaded -js_source "yahoo"] } { + append script " \n" + } + } "utilities" { if { ![ah::yui::is_js_sources_loaded -js_source "utilities"] } { append script " \n" } } - } - } - return $script + } + } + return $script } ad_proc -public ah::yui::cssclass { @@ -276,7 +276,7 @@ } { Generates javascript code to control css class on html elements. - + http://developer.yahoo.com/yui/dom/ @author Hamilton Chua (ham@solutiongrove.com) @@ -299,75 +299,75 @@ "add" { append script "addClass(${element},\"${classname}\"); " } "remove" { append script "removeClass(${element},\"${classname}\") ;" } "check" { append script "hasClass(${element},\"${classname}\"); " } - + } return ${script} } ad_proc -public ah::yui::addlistener { - -element:required - -event:required - -callback:required - {-element_is_var:boolean} + -element:required + -event:required + -callback:required + {-element_is_var:boolean} } { - Creates javascript for Yahoo's Event Listener. - http://developer.yahoo.com/yui/event/ + Creates javascript for Yahoo's Event Listener. + http://developer.yahoo.com/yui/event/ - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 - @param element The element that this function will listen for events. This is the id of an html element (e.g. div or a form) - @param event The event that this function waits for. Values include load, mouseover, mouseout, unload etc. - @param callback The name of the javascript function to execute when the event for the given element has been triggered. + @param element The element that this function will listen for events. This is the id of an html element (e.g. div or a form) + @param event The event that this function waits for. Values include load, mouseover, mouseout, unload etc. + @param callback The name of the javascript function to execute when the event for the given element has been triggered. } { ah::yui::requires -sources "event" - if { !$element_is_var_p } { - set element [ah::isnot_js_var $element] - } + if { !$element_is_var_p } { + set element [ah::isnot_js_var $element] + } - return "YAHOO.util.Event.addListener($element,\"$event\",${callback});\n" + return "YAHOO.util.Event.addListener($element,\"$event\",${callback});\n" } ad_proc -public ah::yui::tooltip { - -varname:required - -element:required - -message:required - {-enclose:boolean} - {-options ""} + -varname:required + -element:required + -message:required + {-enclose:boolean} + {-options ""} } { - Generates the javascript to create a tooltip using yahoo's user interface javascript library. - http://developer.yahoo.com/yui/container/tooltip/index.html + Generates the javascript to create a tooltip using yahoo's user interface javascript library. + http://developer.yahoo.com/yui/container/tooltip/index.html - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 - @param varname The variable name you want to give to the tooltip - @param element The element where you wish to attache the tooltip - @param message The message that will appear in the tooltip + @param varname The variable name you want to give to the tooltip + @param element The element where you wish to attache the tooltip + @param message The message that will appear in the tooltip } { ah::yui::requires -sources "container" - set script "var $varname = new YAHOO.widget.Tooltip(\"alertTip\", { context:\"$element\", text:\"$message\", $options });" + set script "var $varname = new YAHOO.widget.Tooltip(\"alertTip\", { context:\"$element\", text:\"$message\", $options });" global ajax_helper_init_scripts append ajax_helper_init_scripts $script } ad_proc -public ah::yui::create_tree { - -element:required - -nodes:required - {-varname "tree"} - {-css ""} + -element:required + -nodes:required + {-varname "tree"} + {-css ""} {-nodedroppable:boolean} } { - Generates the javascript to create a yahoo tree view control. + Generates the javascript to create a yahoo tree view control. Nodes accepts a list of lists. This is an example of a node list. - set nodes {} + set nodes [list] lappend nodes [list "fld1" "Folder 1" "tree" "" "" "" ""] lappend nodes [list "fld2" "Folder 2" "tree" "javascript:alert('this is a tree node')" "" "" ""] @@ -381,44 +381,44 @@ 5 - a javascript function to execute if the node should load it's children dynamically 6 - should the node be opened or closed - http://developer.yahoo.com/yui/treeview/ + http://developer.yahoo.com/yui/treeview/ - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 - @param element This is the id of the html elment where you want to generate the tree view control. - @param nodes Is list of lists. Each list contains the node information to be passed to ah::yui::create_tree_node to create a node. - @param varname The javascript variable name to give the tree. + @param element This is the id of the html element where you want to generate the tree view control. + @param nodes Is list of lists. Each list contains the node information to be passed to ah::yui::create_tree_node to create a node. + @param varname The javascript variable name to give the tree. } { ah::yui::requires -sources "dom,treeview" if { $css ne "" } { template::head::add_css -href $css } - set script "var ${varname} = new YAHOO.widget.TreeView(\"${element}\"); " - append script "var ${varname}root = ${varname}.getRoot(); " - foreach node $nodes { + set script "var ${varname} = new YAHOO.widget.TreeView(\"${element}\"); " + append script "var ${varname}root = ${varname}.getRoot(); " + foreach node $nodes { if { $nodedroppable_p } { - append script [ah::yui::create_tree_node -varname [lindex $node 0] \ - -label [lindex $node 1] \ - -treevarname [lindex $node 2] \ - -href [lindex $node 3] \ - -attach_to_node [lindex $node 4] \ - -dynamic_load [lindex $node 5] \ - -open [lindex $node 6] \ - -droppable ] + append script [ah::yui::create_tree_node -varname [lindex $node 0] \ + -label [lindex $node 1] \ + -treevarname [lindex $node 2] \ + -href [lindex $node 3] \ + -attach_to_node [lindex $node 4] \ + -dynamic_load [lindex $node 5] \ + -open [lindex $node 6] \ + -droppable ] } else { - append script [ah::yui::create_tree_node -varname [lindex $node 0] \ - -label [lindex $node 1] \ - -treevarname [lindex $node 2] \ - -href [lindex $node 3] \ - -attach_to_node [lindex $node 4] \ - -dynamic_load [lindex $node 5] \ - -open [lindex $node 6] ] + append script [ah::yui::create_tree_node -varname [lindex $node 0] \ + -label [lindex $node 1] \ + -treevarname [lindex $node 2] \ + -href [lindex $node 3] \ + -attach_to_node [lindex $node 4] \ + -dynamic_load [lindex $node 5] \ + -open [lindex $node 6] ] } - } - append script "${varname}.draw(); " + } + append script "${varname}.draw(); " global ajax_helper_init_scripts append ajax_helper_init_scripts [ah::yui::addlistener \ @@ -431,20 +431,20 @@ } ad_proc -private ah::yui::create_tree_node { - -varname:required - -label:required - -treevarname:required - {-href "javascript:void(0)"} - {-attach_to_node ""} - {-dynamic_load ""} - {-open "false"} + -varname:required + -label:required + -treevarname:required + {-href "javascript:void(0)"} + {-attach_to_node ""} + {-dynamic_load ""} + {-open "false"} {-droppable:boolean} } { - Generates the javascript to add a node to a yahoo tree view control - http://developer.yahoo.com/yui/treeview/ + Generates the javascript to add a node to a yahoo tree view control + http://developer.yahoo.com/yui/treeview/ - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-05 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-05 @param varname The name to give the javascript variable to represent the node. @param label The label to assign the node. @@ -454,28 +454,28 @@ @param dynamic_load A javascript function that is executed when the children of this node are loaded. @param open Set this to "true" if you want this node to be open by default when it is rendered. } { - set script "var od${varname} = {label: \"${label}\", id: \"${varname}\", href: \"${href}\"}; " + set script "var od${varname} = {label: \"${label}\", id: \"${varname}\", href: \"${href}\"}; " - if { $attach_to_node ne "" } { - append script "var node = ${treevarname}.getNodeByProperty('id','${attach_to_node}'); " - append script "if ( node == null ) { var node = nd${attach_to_node}; } " - } else { - append script "var node = ${treevarname}root; " - } + if { $attach_to_node ne "" } { + append script "var node = ${treevarname}.getNodeByProperty('id','${attach_to_node}'); " + append script "if ( node == null ) { var node = nd${attach_to_node}; } " + } else { + append script "var node = ${treevarname}root; " + } - if { $open eq "" } { set open "false" } + if { $open eq "" } { set open "false" } - append script "var nd${varname} = new YAHOO.widget.TextNode(od${varname},node,${open}); " + append script "var nd${varname} = new YAHOO.widget.TextNode(od${varname},node,${open}); " if { $droppable_p } { append script "var dd${varname} = new YAHOO.util.DDTarget(nd${varname}.labelElId); " } - if { $dynamic_load ne "" } { - append script "nd${varname}.setDynamicLoad(${dynamic_load}); " - } + if { $dynamic_load ne "" } { + append script "nd${varname}.setDynamicLoad(${dynamic_load}); " + } - return $script + return $script } ad_proc -public ah::yui::menu_from_markup { @@ -531,17 +531,17 @@ Converts a properly structured list of menu items into JSON format. The list of lists may look something like - set submenu {} + set submenu [list] lappend submenu [list [list "text" "Submenu1"] [list "url" "http://www.google.com"] ] lappend submenu [list [list "text" "Submenu2"] [list "url" "http://www.yahoo.com"] ] each line represents a row composed of lists. Each list in the row holds a pair that will be joined by ":". } { - set rows {} + set rows [list] foreach row $lists_of_pairs { - set pairs {} + set pairs [list] foreach pair $row { if { [lindex $pair 0] eq "submenu" } { set submenulist [lindex $pair 1] @@ -695,33 +695,33 @@ if { [llength [lindex $suggestlist 0]] > 1} { # yes , let's create the array for the innerlist and put each array into one big array - set outerlist {} + set outerlist [list] foreach onelist $suggestlist { - set escaped_list {} + set escaped_list [list] foreach elm $onelist { lappend escaped_list [string map {' \\'} $elm] } lappend outerlist "\[ '[join $escaped_list "','"]' \]" } set script "var ${varname}Arr = \[ [join $outerlist ","] \];" - set markup {} + set markup [list] for { set x 0} { $x < [llength [lindex $suggestlist 0]] } { incr x} { lappend markup "oResultItem\[${x}\]" } set markup [join $markup "+\" \"+"] set format "${varname}.formatResult=function(oResultItem, sQuery) { var sMarkup=${markup}; return sMarkup; };" } else { - + # no, transform the list into an array set script "var ${varname}Arr = \[ '[join $suggestlist "','"]' \];" set format "" } - + # create the datasource object append script "var ${varname}DS = new YAHOO.widget.DS_JSArray(${varname}Arr);" - + # create autocomplete object with some predefined options append script "if (document.getElementById('${inputid}')) {" append script "var ${varname} = new YAHOO.widget.AutoComplete('${inputid}','${id}', ${varname}DS);" @@ -733,33 +733,32 @@ append script "${varname}.delimChar=\"${delimchar}\";" append script "${varname}.forceSelection=\"${forceselection}\";" - append script "${varname}.allowBrowserAutocomplete=false;" - append script "${varname}.typeAhead=true;" - append script ${format} + append script "${varname}.allowBrowserAutocomplete=false;" + append script "${varname}.typeAhead=true;" + append script ${format} -# append script "${varname}.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {var pos = YAHOO.util.Dom.getXY(oTextbox);pos\[1\] += YAHOO.util.Dom.get(oTextbox).offsetHeight;YAHOO.util.Dom.setXY(oContainer,pos);YAHOO.util.Dom.setStyle(oContainer,'overflow-y','auto');YAHOO.util.Dom.setStyle(oContainer,'overflow-x','hidden');YAHOO.util.Dom.setStyle(oContainer,'position','absolute');YAHOO.util.Dom.setStyle(oContainer,'height','150px');YAHOO.util.Dom.setStyle(oContainer,'z-index','100');return true;};" -# append script ${format} -# append script "${varname}.containerCollapseEvent.subscribe([ah::create_js_function -body "YAHOO.util.Dom.setStyle('${id}', 'height', 0)" -parameters [list "type" "args"] ]);" -# append script "${varname}.itemArrowToEvent.subscribe([ah::create_js_function -body "elItem\[1\].scrollIntoView(false)" -parameters [list "oSelf" "elItem"] ]); " + # append script "${varname}.doBeforeExpandContainer = function(oTextbox, oContainer, sQuery, aResults) {var pos = YAHOO.util.Dom.getXY(oTextbox);pos\[1\] += YAHOO.util.Dom.get(oTextbox).offsetHeight;YAHOO.util.Dom.setXY(oContainer,pos);YAHOO.util.Dom.setStyle(oContainer,'overflow-y','auto');YAHOO.util.Dom.setStyle(oContainer,'overflow-x','hidden');YAHOO.util.Dom.setStyle(oContainer,'position','absolute');YAHOO.util.Dom.setStyle(oContainer,'height','150px');YAHOO.util.Dom.setStyle(oContainer,'z-index','100');return true;};" + # append script ${format} + # append script "${varname}.containerCollapseEvent.subscribe([ah::create_js_function -body "YAHOO.util.Dom.setStyle('${id}', 'height', 0)" -parameters [list "type" "args"] ]);" + # append script "${varname}.itemArrowToEvent.subscribe([ah::create_js_function -body "elItem\[1\].scrollIntoView(false)" -parameters [list "oSelf" "elItem"] ]); " - foreach {name value} $events { + foreach {name value} $events { append script "${varname}.${name}.subscribe${value};\n" } - + # prevent the container from overlapping other elements, e.g. buttons, links - # remove the yui-ac-input class + # remove the yui-ac-input class append script [ah::yui::cssclass \ -varname "yuiinputclass${varname}" \ -action "remove" \ -element ${inputid} \ -classname "yui-ac-input" ] - + append script "}; " - + global ajax_helper_init_scripts append ajax_helper_init_scripts $script } } - Index: openacs-4/packages/ajaxhelper/tcl/dynamic-load-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/dynamic-load-procs.tcl,v diff -u -r1.1 -r1.1.6.1 --- openacs-4/packages/ajaxhelper/tcl/dynamic-load-procs.tcl 6 Nov 2006 13:15:29 -0000 1.1 +++ openacs-4/packages/ajaxhelper/tcl/dynamic-load-procs.tcl 14 Feb 2019 16:15:01 -0000 1.1.6.1 @@ -1,149 +1,149 @@ ad_library { - Ajax Exprimental Procs + Ajax Experimental Procs - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-11-1 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-11-1 } namespace eval ah::exp { } ad_proc -public ah::exp::yui_js_source_dynamic { - {-js "default"} - {-enclose:boolean} + {-js "default"} + {-enclose:boolean} } { - Dynamically Loads the Yahoo UI javascript libraries. - WARNING : experimental, use ah::yui::js_sources instead + Dynamically Loads the Yahoo UI javascript libraries. + WARNING : experimental, use ah::yui::js_sources instead - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-04-20 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-04-20 - @param js Comma separated list of javascript files to load - Valid values include - "default" : loads yui.js and dom.js, the most commonly used - "animation" : loads js for animation - "event" : loads js for event monitoring (e.g. listnern) - "treeview" : loads js for Yahoo's Tree View control - "calendar" : loads js for Yahoo's Calendar Control - "dragdrop" : loads js for Yahoo's Drag and Drop functions - "slider" : loads js for slider functions + @param js Comma separated list of javascript files to load + Valid values include + "default" : loads yui.js and dom.js, the most commonly used + "animation" : loads js for animation + "event" : loads js for event monitoring (e.g. listnern) + "treeview" : loads js for Yahoo's Tree View control + "calendar" : loads js for Yahoo's Calendar Control + "dragdrop" : loads js for Yahoo's Drag and Drop functions + "slider" : loads js for slider functions } { - set ah_base_url [ah::get_url] - set script "" - set js_file_list [split $js ","] - - foreach x $js_file_list { - switch $x { - "animation" { - append script [ah::js_include -js_file "${ah_base_url}yui/animation/animation.js"] - } - "event" { - append script [ah::js_include -js_file "${ah_base_url}yui/event/event.js"] - } - "treeview" { - append script [ah::js_include -js_file "${ah_base_url}yui/treeview/treeview.js"] - } - "calendar" { - append script [ah::js_include -js_file "${ah_base_url}yui/calendar/calendar.js"] - } - "dragdrop" { - append script [ah::js_include -js_file "${ah_base_url}yui/dragdrop/dragdrop.js"] - } - "slider" { - append script [ah::js_include -js_file "${ah_base_url}yui/slider/slider.js"] - } - default { - append script [ah::js_include -js_file "${ah_base_url}yui/yui.js"] - append script [ah::js_include -js_file "${ah_base_url}yui/dom/dom.js"] - } - } - } + set ah_base_url [ah::get_url] + set script "" + set js_file_list [split $js ","] - if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + foreach x $js_file_list { + switch $x { + "animation" { + append script [ah::js_include -js_file "${ah_base_url}yui/animation/animation.js"] + } + "event" { + append script [ah::js_include -js_file "${ah_base_url}yui/event/event.js"] + } + "treeview" { + append script [ah::js_include -js_file "${ah_base_url}yui/treeview/treeview.js"] + } + "calendar" { + append script [ah::js_include -js_file "${ah_base_url}yui/calendar/calendar.js"] + } + "dragdrop" { + append script [ah::js_include -js_file "${ah_base_url}yui/dragdrop/dragdrop.js"] + } + "slider" { + append script [ah::js_include -js_file "${ah_base_url}yui/slider/slider.js"] + } + default { + append script [ah::js_include -js_file "${ah_base_url}yui/yui.js"] + append script [ah::js_include -js_file "${ah_base_url}yui/dom/dom.js"] + } + } + } - return $script + if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + + return $script } ad_proc -private ah::exp::dynamic_load_functions { - + } { - Generates the javascript functions that perform dynamic loading of local javascript files. - http://www.phpied.com/javascript-include/ - WARNING : experimental + Generates the javascript functions that perform dynamic loading of local javascript files. + http://www.phpied.com/javascript-include/ + WARNING : experimental - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-04-20 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-04-20 } { - set ah_base_url [ah::get_url] - set script "" - return $script + set ah_base_url [ah::get_url] + set script "" + return $script } ad_proc -public ah::exp::js_include { - {-js_file ""} + {-js_file ""} } { - Generates the javscript to include a js file dynamically via DOM to the head section of the page. - WARNING : experimental + Generates the javscript to include a js file dynamically via DOM to the head section of the page. + WARNING : experimental - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-04-20 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-04-20 } { - return "js_include_once('$js_file'); " + return "js_include_once('$js_file'); " } ad_proc -public ah::exp::js_source_dynamic { - {-js "default"} - {-enclose:boolean} + {-js "default"} + {-enclose:boolean} } { - Uses the javascript dynamic loading functions to load the comma separated list of javascript source file. - WARNING : experimental + Uses the javascript dynamic loading functions to load the comma separated list of javascript source file. + WARNING : experimental - @author Hamilton Chua (ham@solutiongrove.com) - @creation-date 2006-04-20 + @author Hamilton Chua (ham@solutiongrove.com) + @creation-date 2006-04-20 - @param js A comma separated list of js files to load. Possible values include prototype, scriptaculous, rounder, rico, overlibmws, overlibmws_bubble, overlibmws_scroll, overlibmws_drag - @param enclose Specify this if you want the javascript to be enclosed in script tags, which is usually the case unless you include this along with other javascript. + @param js A comma separated list of js files to load. Possible values include prototype, scriptaculous, rounder, rico, overlibmws, overlibmws_bubble, overlibmws_scroll, overlibmws_drag + @param enclose Specify this if you want the javascript to be enclosed in script tags, which is usually the case unless you include this along with other javascript. } { - set ah_base_url [ah::get_url] - set script "" - set js_file_list [split $js ","] - - foreach x $js_file_list { - switch $x { - "rico" { - append script [ah::js_include -js_file "${ah_base_url}rico/rico.js"] - } - "rounder" { - append script [ah::js_include -js_file "${ah_base_url}rico/rico.js"] - append script [ah::js_include -js_file "${ah_base_url}rico/rounder.js"] - } - "overlibmws" { - append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws.js"] - append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_overtwo.js"] - } - "overlibmws_bubble" { - append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_bubble.js"] - } - "overlibmws_scroll" { - append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_scroll.js"] - } - "overlibmws_drag" { - append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_draggable.js"] - } - default { - append script [ah::js_include -js_file "${ah_base_url}prototype/prototype.js"] - append script [ah::js_include -js_file "${ah_base_url}scriptaculous/scriptaculous.js"] - } - } - } + set ah_base_url [ah::get_url] + set script "" + set js_file_list [split $js ","] - if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + foreach x $js_file_list { + switch $x { + "rico" { + append script [ah::js_include -js_file "${ah_base_url}rico/rico.js"] + } + "rounder" { + append script [ah::js_include -js_file "${ah_base_url}rico/rico.js"] + append script [ah::js_include -js_file "${ah_base_url}rico/rounder.js"] + } + "overlibmws" { + append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws.js"] + append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_overtwo.js"] + } + "overlibmws_bubble" { + append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_bubble.js"] + } + "overlibmws_scroll" { + append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_scroll.js"] + } + "overlibmws_drag" { + append script [ah::js_include -js_file "${ah_base_url}overlibmws/overlibmws_draggable.js"] + } + default { + append script [ah::js_include -js_file "${ah_base_url}prototype/prototype.js"] + append script [ah::js_include -js_file "${ah_base_url}scriptaculous/scriptaculous.js"] + } + } + } - return $script + if { $enclose_p } { set script [ah::enclose_in_script -script ${script} ] } + + return $script } Index: openacs-4/packages/ajaxhelper/tcl/json-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/tcl/json-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/ajaxhelper/tcl/json-procs.tcl 25 Apr 2018 19:47:46 -0000 1.4 +++ openacs-4/packages/ajaxhelper/tcl/json-procs.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -67,7 +67,7 @@ # we are dealing with an Object getc set state OBJECT - set dictVal {} + set dictVal [list] } VALUE { # this object element's value is an Object Index: openacs-4/packages/ajaxhelper/www/doc/default-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/doc/default-master.tcl,v diff -u -r1.2 -r1.2.4.1 --- openacs-4/packages/ajaxhelper/www/doc/default-master.tcl 27 Oct 2014 16:40:53 -0000 1.2 +++ openacs-4/packages/ajaxhelper/www/doc/default-master.tcl 14 Feb 2019 16:15:01 -0000 1.2.4.1 @@ -45,7 +45,7 @@ accesskey \ class \ id \ - tabindex + tabindex } for {set i 1} {$i <= [template::multirow size navigation]} {incr i} { template::multirow get navigation $i @@ -65,7 +65,7 @@ en \ "all" -# +# # User information and top level navigation links # set user_id [ad_conn user_id] @@ -108,7 +108,7 @@ # util_get_user_messages -multirow user_messages -# +# # Set acs-lang urls # set acs_lang_url [apm_package_url_from_key "acs-lang"] @@ -161,7 +161,7 @@ # # Curriculum specific bar -# TODO: remove this and add a more systematic / package independent way +# TODO: remove this and add a more systematic / package independent way # TODO of getting this content here # set curriculum_bar_p [expr { Index: openacs-4/packages/ajaxhelper/www/doc/head-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/doc/head-procs.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/ajaxhelper/www/doc/head-procs.tcl 25 Apr 2018 19:47:46 -0000 1.5 +++ openacs-4/packages/ajaxhelper/www/doc/head-procs.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -20,28 +20,28 @@ } { variable ::template::head::scripts array unset scripts - array set scripts {} + array set scripts [list] variable ::template::head::links array unset links - array set links {} + array set links [list] variable ::template::head::metas array unset metas - array set metas {} + array set metas [list] variable ::template::body_handlers array unset body_handlers - array set body_handlers {} + array set body_handlers [list] variable ::template::body_scripts array unset body_scripts - set body_scripts {} + set body_scripts [list] variable ::template::headers - set headers {} + set headers [list] variable ::template::footers - set footers {} + set footers [list] } ad_proc -public template::head::add_script { @@ -349,7 +349,7 @@ } if {$direction eq "outer"} { - set headers [concat [list $values] $headers] + set headers [linsert $headers 0 [list $values]] } else { lappend headers $values } Index: openacs-4/packages/ajaxhelper/www/tests/test_dojochartengine.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/tests/test_dojochartengine.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/ajaxhelper/www/tests/test_dojochartengine.tcl 26 Apr 2018 08:56:37 -0000 1.3 +++ openacs-4/packages/ajaxhelper/www/tests/test_dojochartengine.tcl 14 Feb 2019 16:15:01 -0000 1.3.2.1 @@ -1,6 +1,6 @@ # create the list that holds our data -set data {} +set data [list] lappend data [list [list "x" "1"] [list "y" "10"] ] lappend data [list [list "x" "5"] [list "y" "20"] ] @@ -25,7 +25,7 @@ return $type } $objname proc bindings_from_list {lists_of_pairs} { - set pairs {} + set pairs [list] foreach pair $lists_of_pairs { lappend pairs [join $pair ":"] } @@ -58,7 +58,7 @@ return $varname } $objname proc range_from_list {rangelist} { - set pairs {} + set pairs [list] foreach pair $rangelist { lappend pairs [join $pair ":"] } @@ -100,7 +100,7 @@ return $varname } $objname proc range_from_list {rangelist} { - set pairs {} + set pairs [list] foreach pair $rangelist { lappend pairs [join $pair ":"] } @@ -135,7 +135,7 @@ $objname set axis_obj_list [list "axis1" "axis2"] $objname proc createscript { } { my instvar varname series_obj_list axis_obj_list - set axislist {} + set axislist [list] foreach axis $axis_obj_list { lappend axislist [$axis getvarname] } Index: openacs-4/packages/ajaxhelper/www/tests/test_yahoomenu-js.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/tests/test_yahoomenu-js.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/ajaxhelper/www/tests/test_yahoomenu-js.tcl 25 Apr 2018 19:47:46 -0000 1.4 +++ openacs-4/packages/ajaxhelper/www/tests/test_yahoomenu-js.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -2,7 +2,7 @@ # Menu 1 -# set menulist1 {} +# set menulist1 [list] # lappend menulist1 [list [list "text" "Google"] [list "url" "http://www.google.com"] ] # lappend menulist1 [list [list "text" "Yahoo"] [list "url" "http://www.yahoo.com"] ] @@ -19,11 +19,11 @@ # Menu 2 -# set submenuitems {} +# set submenuitems [list] # lappend submenuitems [list [list "text" "Home Page"] [list "url" "http://www.solutiongrove.com"] ] # lappend submenuitems [list [list "text" "Blog"] [list "url" "http://www.solutiongrove.com/blogger/"] ] # set submenulist1 [list [list "id" "sgrovelinks"] [list "itemdata" $submenuitems] ] -# set menulist2 {} +# set menulist2 [list] # lappend menulist2 [list [list "text" "OpenACS"] [list "url" "http://www.openacs.org"] ] # lappend menulist2 [list [list "text" "Solution Grove"] [list "submenu" $submenulist1] ] Index: openacs-4/packages/ajaxhelper/www/tests/test_yahootreeview.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ajaxhelper/www/tests/test_yahootreeview.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/ajaxhelper/www/tests/test_yahootreeview.tcl 26 Apr 2018 08:56:37 -0000 1.4 +++ openacs-4/packages/ajaxhelper/www/tests/test_yahootreeview.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -1,5 +1,5 @@ # create the nodes for our tree -set nodes {} +set nodes [list] # 1st level lappend nodes [list "fld1" "Folder 1" "tree" "" "" "" ""] Index: openacs-4/packages/assessment/tcl/as-action-proc.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-action-proc.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/assessment/tcl/as-action-proc.tcl 3 May 2018 20:27:42 -0000 1.4 +++ openacs-4/packages/assessment/tcl/as-action-proc.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -2,33 +2,29 @@ Assessment action procs @author vivian@viaro.net Viaro Networks (www.viaro.net) @creation-date 2005-01-13 - } namespace eval as::action_p {} ad_proc -public as::action_p::action_exec { {-inter_item_check_id} {-session_id} - - } { Execute the action created on the tcl_code } { db_foreach get_check_params { select * from as_param_map where inter_item_check_id = :inter_item_check_id } { - set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"] - if {![info exists value] || $value eq ""} { - set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}] + set parameter_name [db_1row select_name "select varname from as_action_params where parameter_id = :parameter_id"] + if {![info exists value] || $value eq ""} { + set $varname [db_string get_item_choice {select idc.choice_id from as_item_data_choices idc,as_item_data id where id.as_item_id=$item_id and id.item_data_id=idc.item_data_id and id.session_id=:session_id}] - }else { + } else { - set $varname $value + set $varname $value + } } - } set tcl_code [db_1row select_tcl "select a.tcl_code from as_actions a,as_actions_map am where am.action_id = a.action_id and inter_item_check_id = :inter_item_check_id"] eval $tcl_code return - } # Local variables: Index: openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl,v diff -u -r1.27 -r1.27.2.1 --- openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 7 Aug 2017 23:48:03 -0000 1.27 +++ openacs-4/packages/assessment/tcl/as-item-type-mc-procs.tcl 14 Feb 2019 16:15:01 -0000 1.27.2.1 @@ -28,14 +28,14 @@ db_transaction { set item_item_type_mc_id [content::item::new -parent_id $folder_id -content_type {as_item_type_mc} -name [as::item::generate_unique_name]] set as_item_type_mc_id [content::revision::new \ - -item_id $item_item_type_mc_id \ - -content_type {as_item_type_mc} \ - -title $title \ - -attributes [list [list increasing_p $increasing_p] \ - [list allow_negative_p $allow_negative_p] \ - [list num_correct_answers $num_correct_answers] \ - [list num_answers $num_answers] \ - [list allow_other_p $allow_other_p] ] ] + -item_id $item_item_type_mc_id \ + -content_type {as_item_type_mc} \ + -title $title \ + -attributes [list [list increasing_p $increasing_p] \ + [list allow_negative_p $allow_negative_p] \ + [list num_correct_answers $num_correct_answers] \ + [list num_answers $num_answers] \ + [list allow_other_p $allow_other_p] ] ] } return $as_item_type_mc_id @@ -57,16 +57,16 @@ } { # Update as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { - set type_item_id [db_string type_item_id {}] + set type_item_id [db_string type_item_id {}] set new_item_type_id [content::revision::new \ - -item_id $type_item_id \ - -content_type {as_item_type_mc} \ - -title $title \ - -attributes [list [list increasing_p $increasing_p] \ - [list allow_negative_p $allow_negative_p] \ - [list num_correct_answers $num_correct_answers] \ - [list num_answers $num_answers] \ - [list allow_other_p $allow_other_p] ] ] + -item_id $type_item_id \ + -content_type {as_item_type_mc} \ + -title $title \ + -attributes [list [list increasing_p $increasing_p] \ + [list allow_negative_p $allow_negative_p] \ + [list num_correct_answers $num_correct_answers] \ + [list num_answers $num_answers] \ + [list allow_other_p $allow_other_p] ] ] } return $new_item_type_id @@ -83,23 +83,23 @@ } { # Update as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { - db_1row item_type_data {} + db_1row item_type_data {} set new_item_type_id [content::revision::new \ - -item_id $type_item_id \ - -content_type {as_item_type_mc} \ - -title $title \ - -attributes [list [list increasing_p $increasing_p] \ - [list allow_negative_p $allow_negative_p] \ - [list num_correct_answers $num_correct_answers] \ - [list num_answers $num_answers] \ - [list allow_other_p $allow_other_p] ] ] + -item_id $type_item_id \ + -content_type {as_item_type_mc} \ + -title $title \ + -attributes [list [list increasing_p $increasing_p] \ + [list allow_negative_p $allow_negative_p] \ + [list num_correct_answers $num_correct_answers] \ + [list num_answers $num_answers] \ + [list allow_other_p $allow_other_p] ] ] - if {$with_choices_p == "t"} { - set choices [db_list get_choices {}] - foreach choice_id $choices { - set new_choice_id [as::item_choice::new_revision -choice_id $choice_id -mc_id $new_item_type_id] - } - } + if {$with_choices_p == "t"} { + set choices [db_list get_choices {}] + foreach choice_id $choices { + set new_choice_id [as::item_choice::new_revision -choice_id $choice_id -mc_id $new_item_type_id] + } + } } return $new_item_type_id @@ -120,24 +120,24 @@ # Insert as_item_type_mc in the CR (and as_item_type_mc table) getting the revision_id (as_item_type_id) db_transaction { - db_1row item_type_data {} + db_1row item_type_data {} if {[info exists new_title]} { - set title $new_title - } - if {[string is false $copy_correct_answer_p]} { - set num_correct_answers 0 - } - set new_item_type_id [new -title $title \ - -increasing_p $increasing_p \ - -allow_negative_p $allow_negative_p \ - -num_correct_answers $num_correct_answers \ - -num_answers $num_answers \ + set title $new_title + } + if {[string is false $copy_correct_answer_p]} { + set num_correct_answers 0 + } + set new_item_type_id [new -title $title \ + -increasing_p $increasing_p \ + -allow_negative_p $allow_negative_p \ + -num_correct_answers $num_correct_answers \ + -num_answers $num_answers \ -allow_other_p $allow_other_p] - set choices [db_list get_choices {}] - foreach choice_id $choices { - set new_choice_id [as::item_choice::copy -choice_id $choice_id -mc_id $new_item_type_id -copy_correct_answer_p $copy_correct_answer_p] - } + set choices [db_list get_choices {}] + foreach choice_id $choices { + set new_choice_id [as::item_choice::copy -choice_id $choice_id -mc_id $new_item_type_id -copy_correct_answer_p $copy_correct_answer_p] + } } return $new_item_type_id @@ -157,52 +157,52 @@ Render a Multiple Choice Type } { set allow_other_p [as::item_type_mc::allow_other_p -item_type_id $type_id] - + set defaults "" if {$default_value ne ""} { array set values $default_value - set defaults $values(choice_answer) + set defaults $values(choice_answer) if {$allow_other_p} { set defaults [list $defaults $values(clob_answer)] } } if {$session_id ne ""} { - if {$show_feedback eq "" || $show_feedback eq "none"} { - set choice_list "" - db_foreach get_sorted_choices {} { - if {$content_value ne ""} { - db_1row get_content_value "" - set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] - } - lappend choice_list [list $title $choice_id] - } - } else { - # incorrect correct - set choice_list "" + if {$show_feedback eq "" || $show_feedback eq "none"} { + set choice_list "" + db_foreach get_sorted_choices {} { + if {$content_value ne ""} { + db_1row get_content_value "" + set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] + } + lappend choice_list [list $title $choice_id] + } + } else { + # incorrect correct + set choice_list "" - db_foreach get_sorted_choices_with_feedback {} { - if {$content_value ne ""} { - db_1row get_content_value "" - set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] - } - set pos [lsearch -exact $defaults $choice_id] - if {$pos>-1 && $correct_answer_p == "t" && $show_feedback ne "incorrect"} { - lappend choice_list [list "$title $feedback_text" $choice_id] - } elseif {$pos>-1 && $correct_answer_p == "f" && $show_feedback ne "correct"} { - lappend choice_list [list "$title $feedback_text" $choice_id] - } else { - if {[llength $defaults] && $correct_answer_p == "t" && $show_feedback ne "incorrect" && $show_feedback ne "correct"} { - lappend choice_list [list "$title " $choice_id] - } else { - lappend choice_list [list $title $choice_id] - } - } - } - } - - if {[llength $choice_list] > 0} { - return [list $defaults $choice_list] - } + db_foreach get_sorted_choices_with_feedback {} { + if {$content_value ne ""} { + db_1row get_content_value "" + set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] + } + set pos [lsearch -exact $defaults $choice_id] + if {$pos>-1 && $correct_answer_p == "t" && $show_feedback ne "incorrect"} { + lappend choice_list [list "$title $feedback_text" $choice_id] + } elseif {$pos>-1 && $correct_answer_p == "f" && $show_feedback ne "correct"} { + lappend choice_list [list "$title $feedback_text" $choice_id] + } else { + if {[llength $defaults] && $correct_answer_p == "t" && $show_feedback ne "incorrect" && $show_feedback ne "correct"} { + lappend choice_list [list "$title " $choice_id] + } else { + lappend choice_list [list $title $choice_id] + } + } + } + } + + if {[llength $choice_list] > 0} { + return [list $defaults $choice_list] + } } db_1row item_type_data {} @@ -212,108 +212,108 @@ set wrong_choices [list] set total 0 db_foreach choices {} { - incr total - if {$content_value ne ""} { - db_1row get_content_value "" - set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] - } - if {$show_feedback ne "" && $show_feedback ne "none"} { - set pos [lsearch -exact $defaults $choice_id] - if {$pos > -1 && $correct_answer_p == "t" && $show_feedback ne "incorrect"} { - lappend display_choices [list "$title $feedback_text" $choice_id] - } elseif {$pos>-1 && $correct_answer_p == "f" && $show_feedback ne "correct"} { - lappend display_choices [list "$title $feedback_text" $choice_id] - } else { - if {$correct_answer_p == "t" && $show_feedback ne "incorrect" && $show_feedback ne "correct"} { - lappend display_choices [list "$title " $choice_id] - } else { - lappend display_choices [list $title $choice_id] - } - } - } else { - lappend display_choices [list $title $choice_id] - } - -# lappend display_choices [list $title $choice_id] - if {$selected_p == "t"} { - lappend defaults $choice_id - } - if {$fixed_position ne ""} { - set fixed_pos($fixed_position) [list $title $choice_id] - if {$num_answers ne ""} { - incr num_answers -1 - } - if {$correct_answer_p == "t" && $num_correct_answers ne ""} { - incr num_correct_answers -1 - } - } else { - if {$correct_answer_p == "t"} { - lappend correct_choices [list $title $choice_id] - } else { - lappend wrong_choices [list $title $choice_id] - } - } + incr total + if {$content_value ne ""} { + db_1row get_content_value "" + set title [as::assessment::display_content -content_id $content_rev_id -filename $content_filename -content_type $content_type -title $title] + } + if {$show_feedback ne "" && $show_feedback ne "none"} { + set pos [lsearch -exact $defaults $choice_id] + if {$pos > -1 && $correct_answer_p == "t" && $show_feedback ne "incorrect"} { + lappend display_choices [list "$title $feedback_text" $choice_id] + } elseif {$pos>-1 && $correct_answer_p == "f" && $show_feedback ne "correct"} { + lappend display_choices [list "$title $feedback_text" $choice_id] + } else { + if {$correct_answer_p == "t" && $show_feedback ne "incorrect" && $show_feedback ne "correct"} { + lappend display_choices [list "$title " $choice_id] + } else { + lappend display_choices [list $title $choice_id] + } + } + } else { + lappend display_choices [list $title $choice_id] + } + + # lappend display_choices [list $title $choice_id] + if {$selected_p == "t"} { + lappend defaults $choice_id + } + if {$fixed_position ne ""} { + set fixed_pos($fixed_position) [list $title $choice_id] + if {$num_answers ne ""} { + incr num_answers -1 + } + if {$correct_answer_p == "t" && $num_correct_answers ne ""} { + incr num_correct_answers -1 + } + } else { + if {$correct_answer_p == "t"} { + lappend correct_choices [list $title $choice_id] + } else { + lappend wrong_choices [list $title $choice_id] + } + } } if {[array exists fixed_pos]} { - if {$num_answers eq ""} { - set num_answers [expr {[llength $correct_choices] + [llength $wrong_choices]}] - } - if {$num_correct_answers eq ""} { - set num_correct_answers [llength $correct_choices] - } + if {$num_answers eq ""} { + set num_answers [expr {[llength $correct_choices] + [llength $wrong_choices]}] + } + if {$num_correct_answers eq ""} { + set num_correct_answers [llength $correct_choices] + } } if {$num_answers ne "" && $num_answers < $total} { - # display fewer choices, select random - set correct_choices [util::randomize_list $correct_choices] - set wrong_choices [util::randomize_list $wrong_choices] + # display fewer choices, select random + set correct_choices [util::randomize_list $correct_choices] + set wrong_choices [util::randomize_list $wrong_choices] - if {$num_correct_answers ne "" && $num_correct_answers > 0 && $num_correct_answers < [llength $correct_choices]} { - # display fewer correct answers than there are - set display_choices [lrange $correct_choices 1 $num_correct_answers] - } else { - # display all correct answers - set display_choices $correct_choices - } + if {$num_correct_answers ne "" && $num_correct_answers > 0 && $num_correct_answers < [llength $correct_choices]} { + # display fewer correct answers than there are + set display_choices [lrange $correct_choices 1 $num_correct_answers] + } else { + # display all correct answers + set display_choices $correct_choices + } - # now fill up with wrong answers - set display_choices [concat $display_choices [lrange $wrong_choices 0 [expr $num_answers - [llength $display_choices] -1]]] - set display_choices [util::randomize_list $display_choices] + # now fill up with wrong answers + set display_choices [concat $display_choices [lrange $wrong_choices 0 [expr $num_answers - [llength $display_choices] -1]]] + set display_choices [util::randomize_list $display_choices] } # now add fixed positions in result list if {[array exists fixed_pos]} { - set max_pos [expr {$num_answers + [array size fixed_pos]}] - set open_positions $display_choices - set display_choices [list] + set max_pos [expr {$num_answers + [array size fixed_pos]}] + set open_positions $display_choices + set display_choices [list] - for {set position 1} {$position <= $max_pos} {incr position} { - if {[info exists fixed_pos($position)]} { - lappend display_choices $fixed_pos($position) - array unset fixed_pos $position - } elseif {[llength $open_positions] > 0} { - lappend display_choices [lindex $open_positions 0] - set open_positions [lreplace $open_positions 0 0] - } - } - # set negative fixed positions relative to the end of the choice list - if {[array exists fixed_pos]} { - foreach position [lsort -integer [array names fixed_pos]] { - if {$position < 0} { - lappend display_choices $fixed_pos($position) - } - } - } + for {set position 1} {$position <= $max_pos} {incr position} { + if {[info exists fixed_pos($position)]} { + lappend display_choices $fixed_pos($position) + array unset fixed_pos $position + } elseif {[llength $open_positions] > 0} { + lappend display_choices [lindex $open_positions 0] + set open_positions [lreplace $open_positions 0 0] + } + } + # set negative fixed positions relative to the end of the choice list + if {[array exists fixed_pos]} { + foreach position [lsort -integer [array names fixed_pos]] { + if {$position < 0} { + lappend display_choices $fixed_pos($position) + } + } + } } # save choice order if {$session_id ne ""} { - set count 0 - foreach one_choice $display_choices { - lassign $one_choice title choice_id - incr count - db_dml save_order {} - } + set count 0 + foreach one_choice $display_choices { + lassign $one_choice title choice_id + incr count + db_dml save_order {} + } } return [list $defaults $display_choices] @@ -339,36 +339,36 @@ array set type [util_memoize [list as::item_type_mc::data -type_id $type_id]] array set choices $type(choices) if {[info exists type(correct_choices)]} { - array set correct_choices $type(correct_choices) + array set correct_choices $type(correct_choices) } if {$type(increasing_p) == "t"} { - # if not all correct answers are given, award fraction of the points - set percent 0 - foreach choice_id $response { - incr percent $choices($choice_id) - } + # if not all correct answers are given, award fraction of the points + set percent 0 + foreach choice_id $response { + incr percent $choices($choice_id) + } } else { - # award 100% points if and only if all correct answers are given - set count_correct 0 - if {[array exists correct_choices] && [lsort -integer $response] == [lsort -integer [array names correct_choices]]} { - set points $max_points - } elseif {[array size correct_choices] > 0} { - # FIXME !! create setting for partial credit or use existing one - foreach elm $response { - if {[lsearch [array names correct_choices] $elm] > -1} { - incr count_correct - } - } - set points [expr {$count_correct / (0.0 + [array size correct_choices]) * $max_points}] - } else { - set points 0 - } + # award 100% points if and only if all correct answers are given + set count_correct 0 + if {[array exists correct_choices] && [lsort -integer $response] == [lsort -integer [array names correct_choices]]} { + set points $max_points + } elseif {[array size correct_choices] > 0} { + # FIXME !! create setting for partial credit or use existing one + foreach elm $response { + if {[lsearch [array names correct_choices] $elm] > -1} { + incr count_correct + } + } + set points [expr {$count_correct / (0.0 + [array size correct_choices]) * $max_points}] + } else { + set points 0 + } } if {$type(allow_negative_p) == "f" && $points < 0} { - # don't allow negative percentage - set points 0 + # don't allow negative percentage + set points 0 } if {$type(allow_other_p)} { @@ -394,15 +394,15 @@ db_1row item_type_data {} -column_array type db_foreach check_choices {} { - if {$correct_answer_p == "t"} { - set correct_choices($choice_id) $percent_score - } - set choices($choice_id) $percent_score + if {$correct_answer_p == "t"} { + set correct_choices($choice_id) $percent_score + } + set choices($choice_id) $percent_score } set type(choices) [array get choices] if {[array exists correct_choices]} { - set type(correct_choices) [array get correct_choices] + set type(correct_choices) [array get correct_choices] } return [array get type] @@ -419,28 +419,28 @@ Return the results of a given item in a given list of sessions as an array } { - + db_foreach get_results {} { - if {$text_value eq ""} { - lappend results($session_id) [as::assessment::quote_export -text $title] - } else { - lappend results($session_id) [as::assessment::quote_export -text $text_value] - } + if {$text_value eq ""} { + lappend results($session_id) [as::assessment::quote_export -text $title] + } else { + lappend results($session_id) [as::assessment::quote_export -text $text_value] + } } foreach session_id [array names results] { - set results($session_id) [join $results($session_id) ","] + set results($session_id) [join $results($session_id) ","] } if {[array exists results]} { - return [array get results] + return [array get results] } else { - return + return } } ad_proc -private as::item_type_mc::add_choices_to_form { - -form_id + -form_id -num_choices -choice_array_name -correct_choice_array_name @@ -469,7 +469,7 @@ } else { ad_form -extend -name $form_id -form [list [list choice.$i:text,optional,nospell {label "[_ assessment.Choice] $i"} {html {style {width: 80%;} maxlength 1000}}]] } - + if {[info exists correct($i)]} { ad_form -extend -name $form_id -form [list [list correct.$i:text(checkbox),optional {label "[_ assessment.Correct_Answer_Choice] $i"} {options $correct_options} {values t }]] } else { @@ -491,7 +491,7 @@ {-allow_negative_p "f"} {-allow_other_p "f"} } { - Add the multiple choice item to an assessment. The creates the + Add the multiple choice item to an assessment. The creates the as_item_type_mc object and all the choices and associates the as_item_id with an assessment, or updates the assessment with the latest version @@ -519,23 +519,23 @@ } foreach c [array names correct] { if {$correct($c) == "t"} { - incr num_correct_answers + incr num_correct_answers } } - + if {![as::item::get_item_type_info -as_item_id $as_item_id] \ - || $item_type_info(object_type) ne "as_item_type_mc"} { - # always set mc title to empty on new mc question - # we ask for a title for the mc answer set separately if - # required + || $item_type_info(object_type) ne "as_item_type_mc"} { + # always set mc title to empty on new mc question + # we ask for a title for the mc answer set separately if + # required set mc_id [as::item_type_mc::new \ -title $title \ -increasing_p $increasing_p \ -allow_negative_p $allow_negative_p \ -num_correct_answers $num_correct_answers \ -num_answers $num_answers \ -allow_other_p $allow_other_p] - + if {![info exists item_type_info(object_type)]} { # first item type mapped as::item_rels::new -item_rev_id $as_item_id -target_rev_id $mc_id -type as_item_type_rel @@ -553,7 +553,7 @@ -allow_negative_p $allow_negative_p \ -num_correct_answers $num_correct_answers \ -num_answers $num_answers] - + as::item::update_item_type -item_type_id $mc_id -as_item_id $as_item_id } @@ -593,15 +593,15 @@ } ad_proc -private as::item_type_mc::add_existing_choices_to_edit_form { - -form_id + -form_id -existing_choices -choice_array_name -correct_choice_array_name } { Add form elements for multiple choice question choices @param form_id Form builder form_id of the form to add the elements to. Error if form does not exist - @param num_choices Number of choice form elements to add + @param existing_choices Choice form elements to add @param choice_array_name Name of array in callers scope to look for existing choices @param correct_choice_array_name Name of array in the caller's scope to check for correct choices @@ -722,9 +722,9 @@ db_1row get_sort_order_to_be_removed {} set choices [db_list get_choices {}] foreach old_choice_id $choices { - if {$old_choice_id != $choice_id} { - set new_choice_id [as::item_choice::new_revision -choice_id $old_choice_id -mc_id $new_mc_id] - } + if {$old_choice_id != $choice_id} { + set new_choice_id [as::item_choice::new_revision -choice_id $old_choice_id -mc_id $new_mc_id] + } } db_dml move_up_choices {} } Index: openacs-4/packages/assessment/tcl/as-list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-list-procs.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/assessment/tcl/as-list-procs.tcl 10 Jul 2018 15:14:01 -0000 1.12 +++ openacs-4/packages/assessment/tcl/as-list-procs.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -135,7 +135,7 @@ {-hide_p 0} {-element_select 1} {-element_from 1} -} { +} { Build list template specs from assessment item information. @return list of specs @@ -217,8 +217,7 @@ } { Generate list builder filter spec from one assessment question - @param as_item_id Revision_id of hte question - @param item_type Type of question + @param as_item_id Revision_id of the question @param item_title What we display for the filter label for the question } { @@ -364,8 +363,7 @@ } { Generate list builder groupby filter spec from one assessment question - @param as_item_id Revision_id of hte question - @param item_type Type of question + @param as_item_id Revision_id of the question @param item_title What we display for the filter label for the question } { @@ -380,8 +378,7 @@ } { Generate list builder orderby filter spec from one assessment question - @param as_item_id Revision_id of hte question - @param item_type Type of question + @param as_item_id Revision_id of the question @param item_title What we display for the filter label for the question } { set item_ref as_item_id_$cr_item_id 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.50 -r1.50.2.1 --- openacs-4/packages/assessment/tcl/as-qti-procs.tcl 7 Aug 2017 23:48:03 -0000 1.50 +++ openacs-4/packages/assessment/tcl/as-qti-procs.tcl 14 Feb 2019 16:15:01 -0000 1.50.2.1 @@ -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 @@ -849,14 +849,14 @@ set selected_p f set as_item_choices__ident [$response_label getAttribute {ident}] set mattextNodes [$response_label selectNodes {material/mattext}] - set as_item_choices__choice_text [db_null] + set as_item_choices__choice_text "" # get the title of each choice foreach mattext $mattextNodes { set as_item_choices__choice_text [as::qti::mattext_gethtml $mattext] } # for multimedia items set matmediaNodes [$response_label selectNodes {material/matimage[@uri]}] - set as_item_choices__content_value [db_null] + set as_item_choices__content_value "" foreach matmedia $matmediaNodes { set mediabasepath [file join $basepath [$matmedia getAttribute {uri}]] # insert as_file in the CR (and in the as_file table) getting the content value @@ -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/assessment/www/admin/asm-action-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/asm-action-new.tcl,v diff -u -r1.13 -r1.13.2.1 --- openacs-4/packages/assessment/www/admin/asm-action-new.tcl 29 Jun 2018 17:27:18 -0000 1.13 +++ openacs-4/packages/assessment/www/admin/asm-action-new.tcl 14 Feb 2019 16:15:01 -0000 1.13.2.1 @@ -13,38 +13,38 @@ if { ![ad_form_new_p -key action_id] } { set page_title [_ assessment.Edit_Assessment] - set parameter_exist "y" + set parameter_exist "y" db_0or1row get_action_info {} } else { set page_title [_ assessment.New_Assessment2] - set parameter_exist "n" + set parameter_exist "n" } set page_title "[_ assessment.add_new_action]" set context_bar [ad_context_bar [list [export_vars -base asm-action-admin ] [_ assessment.action_admin]] $page_title] ad_form -name action_admin -form { action_id:key - {name:text {label "[_ assessment.action_name]"} - {html {size 30 maxlength 40}} - {help_text "[_ assessment.as_action_help]"} + {name:text {label "[_ assessment.action_name]"} + {html {size 30 maxlength 40}} + {help_text "[_ assessment.as_action_help]"} } - {description:text(textarea) {label "[_ assessment.action_description]"} - {html {rows 5 cols 80}} - {help_text "[_ assessment.as_action_description_help]"} - } + {description:text(textarea) {label "[_ assessment.action_description]"} + {html {rows 5 cols 80}} + {help_text "[_ assessment.as_action_description_help]"} + } {tcl_code:text(textarea) {label "[_ assessment.action_tcl_code]"} - {html {rows 5 cols 80}} + {html {rows 5 cols 80}} {help_text "[_ assessment.as_action_tcl_code_help]"} } } -validate { {tcl_code {$tcl_code ne ""} "[_ assessment.error_enter_tcl_code]"} } -select_query { - select name,description,tcl_code - from as_actions - where action_id = :action_id + select name,description,tcl_code + from as_actions + where action_id = :action_id } -new_data { db_exec_plsql insert_action {} @@ -56,8 +56,6 @@ } - - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 29 Jun 2018 17:27:18 -0000 1.6 +++ openacs-4/packages/assessment/www/admin/set-reg-assessment.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -1,6 +1,6 @@ ad_page_contract { This display the anonymous assessments available for registration - + @author Vivian Hernandez (vivian@viaro.net) Viaro Networks (www.viaro.net) @creation-date 2005-01-20 @cvs-id $Id$ @@ -18,7 +18,6 @@ } - set page_title "[_ acs-subsite.set_reg_asm]" set context [list "[_ acs-subsite.set_reg_asm]"] @@ -30,76 +29,32 @@ ad_form -name get_assessment -form { {assessment_id:text(select) - {label "[_ acs-subsite.choose_assessment]"} - {options $assessments} - {help_text "[_ acs-subsite.choose_assessment_help]"} - {value $assessment_id}} + {label "[_ acs-subsite.choose_assessment]"} + {options $assessments} + {help_text "[_ acs-subsite.choose_assessment_help]"} + {value $assessment_id}} {submit:text(submit) - {label " OK "}} + {label " OK "}} {edit:text(submit) - {label "[_ acs-subsite.edit_asm]"}} + {label "[_ acs-subsite.edit_asm]"}} } -after_submit { if {$edit ne ""} { - if { $assessment_id != 0} { - set package_id [db_string package_id {}] - set url [apm_package_url_from_id $package_id] - ad_returnredirect "${url}asm-admin/one-a?assessment_id=$assessment_id®_p=1&asm_instance=$asm_instance" + if { $assessment_id != 0} { + set package_id [db_string package_id {}] + set url [apm_package_url_from_id $package_id] + ad_returnredirect "${url}asm-admin/one-a?assessment_id=$assessment_id®_p=1&asm_instance=$asm_instance" ad_script_abort - } - } else { - parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationId -value $assessment_id - parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationImplName -value "asm_url" - ad_returnredirect "" + } + } else { + parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationId -value $assessment_id + parameter::set_value -package_id [subsite::main_site_id] -parameter RegistrationImplName -value "asm_url" + ad_returnredirect "" ad_script_abort } } ad_return_template - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/assessment/www/asm-admin/item-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/asm-admin/item-add.tcl,v diff -u -r1.27 -r1.27.2.1 --- openacs-4/packages/assessment/www/asm-admin/item-add.tcl 29 Jun 2018 17:27:18 -0000 1.27 +++ openacs-4/packages/assessment/www/asm-admin/item-add.tcl 14 Feb 2019 16:15:01 -0000 1.27.2.1 @@ -339,7 +339,7 @@ && (![info exists formbutton_add_another_choice] || $formbutton_add_another_choice eq "")} { set return_url "[export_vars -base questions {assessment_id}]\&#Q$as_item_id" } elseif {([info exists formbutton_add_another_question] && $formbutton_add_another_question ne "")} { - set after [expr {$after + 1}] + incr after set return_url "[export_vars -base item-add {after assessment_id section_id}]\#Q$as_item_id" } if {[info exists return_url] && $return_url ne ""} { Index: openacs-4/packages/assessment/www/doc/asm_trigger_doc/doc-source/asm_user_manual.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/www/doc/asm_trigger_doc/doc-source/asm_user_manual.xml,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/assessment/www/doc/asm_trigger_doc/doc-source/asm_user_manual.xml 5 Apr 2018 14:44:08 -0000 1.3 +++ openacs-4/packages/assessment/www/doc/asm_trigger_doc/doc-source/asm_user_manual.xml 14 Feb 2019 16:15:01 -0000 1.3.2.1 @@ -551,7 +551,7 @@ If the Assessment Package is installed and mounted, the link can be follow and will lead to a page that shows all the assessment - that can be responded for anonymous users created in all of the diferent + that can be responded for anonymous users created in all of the different instances of the assessment package that could exist. If the option "None" is selected, it means that the registration process will be the same as always has been, if any other option is selected, the assessment will be Index: openacs-4/packages/attachments/attachments.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/attachments.info,v diff -u -r1.20 -r1.20.2.1 --- openacs-4/packages/attachments/attachments.info 7 Aug 2017 23:48:04 -0000 1.20 +++ openacs-4/packages/attachments/attachments.info 14 Feb 2019 16:15:01 -0000 1.20.2.1 @@ -8,22 +8,22 @@ t attachments - + OpenACS Attachment support 2 2017-08-06 OpenACS Provide widgets and datamodel to support attachments on arbitrary objects. Used by forums. - + - + Fisheye: Tag 1.1.26.1 refers to a dead (removed) revision in file `openacs-4/packages/attachments/www/file-add-2-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.26.1 refers to a dead (removed) revision in file `openacs-4/packages/attachments/www/file-add-2-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/attachments/www/file-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/attachments/www/file-add-2.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/attachments/www/file-add-2.tcl 31 Jan 2018 20:32:52 -0000 1.9 +++ openacs-4/packages/attachments/www/file-add-2.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -21,14 +21,20 @@ max_size -requires {upload_file} { set n_bytes [file size ${upload_file.tmpfile}] - set max_bytes [parameter::get -parameter "MaximumFileSize"] + set root_folder [attachments::get_root_folder] + set fs_package_id [db_string get_fs_package_id { + select package_id + from fs_root_folders + where folder_id=:root_folder + }] + set max_bytes [fs::max_upload_size -package_id $fs_package_id] if { $n_bytes > $max_bytes } { # Max number of bytes is used in the error message set max_number_of_bytes [util_commify_number $max_bytes] ad_complain "[_ attachments.lt_Your_file_is_larger_t]" } } -} +} # Check for write permission on this folder permission::require_permission -object_id $folder_id -privilege write @@ -39,14 +45,12 @@ set filename $upload_file } -# Get the user -set user_id [ad_conn user_id] - -# Get the ip -set creation_ip [ad_conn peeraddr] - set root_folder [attachments::get_root_folder] -set fs_package_id [db_string get_fs_package_id {}] +set fs_package_id [db_string get_fs_package_id { + select package_id + from fs_root_folders + where folder_id=:root_folder +}] #db_transaction { set file_id [db_nextval "acs_object_id_seq"] @@ -55,12 +59,10 @@ -item_id $file_id \ -parent_id $folder_id \ -tmp_filename ${upload_file.tmpfile}\ - -creation_user $user_id \ - -creation_ip $creation_ip \ -title $title \ -description $description \ -package_id $fs_package_id - + # attach the file_id attachments::attach -object_id $object_id -attachment_id $file_id Fisheye: Tag 1.2.8.1 refers to a dead (removed) revision in file `openacs-4/packages/attachments/www/file-add-2.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/bm-portlet/tcl/bm-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bm-portlet/tcl/bm-portlet-procs.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/bm-portlet/tcl/bm-portlet-procs.tcl 7 Aug 2017 23:48:04 -0000 1.7 +++ openacs-4/packages/bm-portlet/tcl/bm-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.7.2.1 @@ -38,11 +38,15 @@ ad_proc -public get_pretty_name { } { + Gets portlet pretty name. + } { return [parameter::get_from_package_key -package_key [my_package_key] -parameter pretty_name] } ad_proc -public link { } { + Gets portlet link (empty). + } { return "" } @@ -53,7 +57,7 @@ {-extra_params ""} {-force_region ""} } { - add the portlet element to the given portal + Add the portlet element to the given portal. } { return [portal::add_element_parameters \ -portal_id $portal_id \ @@ -71,7 +75,7 @@ {-portal_id:required} {-package_id:required} } { - remove the portal element from the given portal + Remove the portal element from the given portal. } { portal::remove_element_parameters \ -portal_id $portal_id \ @@ -83,7 +87,7 @@ ad_proc -public show { cf } { - shoe the portal element + Show the portal element. } { portal::show_proc_helper \ -package_key [my_package_key] \ Index: openacs-4/packages/bm-portlet/www/bm-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/bm-portlet/www/bm-portlet.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/bm-portlet/www/bm-portlet.tcl 7 Aug 2017 23:48:04 -0000 1.7 +++ openacs-4/packages/bm-portlet/www/bm-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.7.2.1 @@ -20,7 +20,7 @@ @author yon (yon@openforce.net) @creation-date 2002-05-13 - @version $Id$ + @cvs-id $Id$ } -query { } -properties { Index: openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl,v diff -u -r1.44 -r1.44.2.1 --- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 29 Jun 2018 17:27:18 -0000 1.44 +++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.44.2.1 @@ -27,7 +27,7 @@ {period_days:naturalnum,optional} {julian_date ""} } -properties { - + } -validate { valid_date -requires { date } { if {$date ne "" } { @@ -64,15 +64,15 @@ if {[apm_package_installed_p dotlrn]} { set site_node [site_node::get_node_id_from_object_id -object_id [ad_conn package_id]] set dotlrn_package_id [site_node::closest_ancestor_package -node_id $site_node -package_key dotlrn -include_self] - set community_id [db_string get_community_id {select community_id from dotlrn_communities_all where package_id=:dotlrn_package_id} -default [db_null]] + set community_id [db_string get_community_id {select community_id from dotlrn_communities_all where package_id=:dotlrn_package_id} -default ""] } else { set community_id "" } set calendar_id [lindex $list_of_calendar_ids 0] db_0or1row select_calendar_package_id {select package_id from calendars where calendar_id=:calendar_id} if { ![info exists period_days] } { - if { ([info exists community_id] && $community_id ne "") } { + if { [info exists community_id] && $community_id ne "" } { set period_days [parameter::get -package_id $package_id -parameter ListView_DefaultPeriodDays -default 31] } else { foreach calendar $list_of_calendar_ids { @@ -138,7 +138,7 @@ } ad_script_abort } else { - ad_return_template + ad_return_template } # Local variables: 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.38 -r1.38.2.1 --- openacs-4/packages/categories/tcl/categories-procs.tcl 18 Sep 2018 18:28:55 -0000 1.38 +++ openacs-4/packages/categories/tcl/categories-procs.tcl 14 Feb 2019 16:15:01 -0000 1.38.2.1 @@ -160,7 +160,7 @@ ad_proc -public category::change_parent { -category_id:required -tree_id:required - {-parent_id [db_null]} + {-parent_id ""} } { Changes parent category of a category. @option category_id category_id whose parent should change. @@ -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/categories/www/cadmin/category-form.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-form.tcl,v diff -u -r1.14 -r1.14.2.1 --- openacs-4/packages/categories/www/cadmin/category-form.tcl 29 Jun 2018 17:27:18 -0000 1.14 +++ openacs-4/packages/categories/www/cadmin/category-form.tcl 14 Feb 2019 16:15:01 -0000 1.14.2.1 @@ -6,7 +6,7 @@ } { tree_id:naturalnum,notnull category_id:naturalnum,optional - {parent_id:naturalnum,optional [db_null]} + {parent_id:naturalnum,optional ""} {locale ""} object_id:naturalnum,optional ctx_id:naturalnum,optional Index: openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl 29 Jun 2018 17:27:18 -0000 1.6 +++ openacs-4/packages/categories/www/cadmin/category-parent-change-2.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -7,7 +7,7 @@ } { tree_id:naturalnum,notnull category_id:naturalnum,notnull - {parent_id:naturalnum,optional [db_null]} + {parent_id:naturalnum,optional ""} {locale ""} object_id:naturalnum,optional ctx_id:naturalnum,optional Index: openacs-4/packages/chat/chat.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/chat.info,v diff -u -r1.22 -r1.22.2.1 --- openacs-4/packages/chat/chat.info 9 Nov 2018 20:09:40 -0000 1.22 +++ openacs-4/packages/chat/chat.info 14 Feb 2019 16:15:01 -0000 1.22.2.1 @@ -9,29 +9,26 @@ f t - + Peter Alberer Server based chat with an html and ajax client. - 2017-08-06 + 2019-01-18 OpenACS Adapted by Peter Alberer 2006/03/25 to allow java and ajax to coexist. Adapted by Tekne 2006/03/01 to replace JAVA server with AJAX; make use of generalized chat class from xotcl-core. 0 - + - - - - - + + Index: openacs-4/packages/chat/lib/current-messages.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/current-messages.tcl,v diff -u -r1.4 -r1.4.8.1 --- openacs-4/packages/chat/lib/current-messages.tcl 19 Nov 2007 01:14:15 -0000 1.4 +++ openacs-4/packages/chat/lib/current-messages.tcl 14 Feb 2019 16:15:01 -0000 1.4.8.1 @@ -1,3 +1,8 @@ +ad_include_contract { + This include displays currently persisted chat room messages +} { + room_id:naturalnum +} set sql { select to_char(creation_date, 'DD.MM.YYYY hh24:mi:ss') as creation_date, creation_user, msg @@ -7,7 +12,8 @@ } db_multirow -extend { person_name } messages select_msg_itens $sql { - if { [catch { set person_name [chat_user_name $creation_user] }] } { + set person_name [chat_user_name $creation_user] + if {$person_name eq ""} { set person_name "Unknown" } } Index: openacs-4/packages/chat/lib/transcript-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/transcript-view.tcl,v diff -u -r1.5 -r1.5.6.1 --- openacs-4/packages/chat/lib/transcript-view.tcl 9 Nov 2008 23:29:23 -0000 1.5 +++ openacs-4/packages/chat/lib/transcript-view.tcl 14 Feb 2019 16:15:01 -0000 1.5.6.1 @@ -1,3 +1,9 @@ +ad_include_contract { + This include displays and manages specified chat transcript +} { + room_id:naturalnum + transcript_id:naturalnum +} db_1row get_transcript { select pretty_name as transcript_name, Index: openacs-4/packages/chat/lib/transcripts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/lib/transcripts.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/lib/transcripts.tcl 20 Jan 2018 22:56:50 -0000 1.5 +++ openacs-4/packages/chat/lib/transcripts.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,3 +1,8 @@ +ad_include_contract { + This include is the UI to display and manage chat room transcripts +} { + room_id:naturalnum +} set transcript_create_p [permission::permission_p -object_id $room_id -privilege chat_transcript_create] set transcript_delete_p [permission::permission_p -object_id $room_id -privilege chat_transcript_delete] @@ -9,7 +14,12 @@ viewer transcript_url delete_url -} chat_transcripts list_transcripts {} { +} chat_transcripts list_transcripts { + select ct.transcript_id, ct.pretty_name, ao.creation_date + from chat_transcripts ct, acs_objects ao + where ct.transcript_id = ao.object_id and ct.room_id = :room_id + order by ao.creation_date desc +} { set creation_date_pretty [lc_time_fmt $creation_date "%q %X"] set transcript_url [export_vars -base "chat-transcript" {room_id transcript_id}] set delete_url [export_vars -base "transcript-delete" {room_id transcript_id}] Index: openacs-4/packages/chat/tcl/chat-ajax-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-ajax-procs.tcl,v diff -u -r1.23 -r1.23.2.1 --- openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 24 Oct 2018 11:05:08 -0000 1.23 +++ openacs-4/packages/chat/tcl/chat-ajax-procs.tcl 14 Feb 2019 16:15:01 -0000 1.23.2.1 @@ -7,15 +7,53 @@ @cvs-id $Id$ } +namespace eval ::xowiki::includelet { + + ::xowiki::IncludeletClass create chat_room \ + -superclass ::xowiki::Includelet \ + -parameter { + {parameter_declaration { + {-chat_id} + {-mode:optional ""} + {-path:optional ""} + }} + } + + chat_room instproc render {} { + :get_parameters + set html [subst { +
+ [::chat::Chat login \ + -chat_id $chat_id \ + -mode $mode \ + -path $path] +
+ }] + } + +} + namespace eval ::chat { ::xo::ChatClass Chat -superclass ::xowiki::Chat Chat proc login {-chat_id {-package_id ""} {-mode ""} {-path ""}} { - if {$package_id eq "" && [chat_room_exists_p $chat_id]} { + if {![chat_room_exists_p $chat_id]} { + return [_ chat.Room_not_found] + } else { chat_room_get -room_id $chat_id -array c set package_id $c(context_id) + set chat_skin [parameter::get -package_id $package_id -parameter ChatSkin] + set chat_avatar_p [parameter::get -package_id $package_id -parameter ShowAvatarP] + next -chat_id $chat_id \ + -skin $chat_skin \ + -show_avatar $chat_avatar_p \ + -package_id $package_id \ + -mode $mode \ + -path $path \ + -logout_messages_p $c(logout_messages_p) \ + -login_messages_p $c(login_messages_p) \ + -timewindow $c(messages_time_window) } - next -chat_id $chat_id -package_id $package_id -mode $mode -path $path } Chat instproc initialize_nsvs {} { @@ -31,11 +69,10 @@ } Chat instproc init {} { - if {[chat_room_exists_p ${:chat_id}]} { - chat_room_get -room_id ${:chat_id} -array c - set :login_messages_p $c(login_messages_p) - set :logout_messages_p $c(logout_messages_p) - set :timewindow $c(messages_time_window) + set ban_p [permission::permission_p -object_id ${:chat_id} -privilege "chat_ban"] + if {$ban_p} { + ad_return_forbidden + ad_script_abort } next } Index: openacs-4/packages/chat/tcl/chat-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/tcl/chat-procs.tcl,v diff -u -r1.24 -r1.24.2.1 --- openacs-4/packages/chat/tcl/chat-procs.tcl 24 Oct 2018 10:29:13 -0000 1.24 +++ openacs-4/packages/chat/tcl/chat-procs.tcl 14 Feb 2019 16:15:01 -0000 1.24.2.1 @@ -544,8 +544,6 @@ set status "pending" } - set default_client [parameter::get -parameter "DefaultClient" -default "ajax"] - # do not write messages to the database if the room should not be archived chat_room_get -room_id $room_id -array room_info if { $room_info(archive_p) == "f" } { return } Index: openacs-4/packages/chat/www/chat-room-grant.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/chat-room-grant.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/chat-room-grant.tcl 7 Aug 2017 23:48:07 -0000 1.5 +++ openacs-4/packages/chat/www/chat-room-grant.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,5 +1,5 @@ ad_page_contract { - + @author David Dao (ddao@arsdigita.com) @creation-date November 16, 2000 @cvs-id $Id$ @@ -39,3 +39,8 @@ [ad_footer] " +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/chat-transcript.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcript.adp,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/www/chat-transcript.adp 17 Jun 2016 17:48:21 -0000 1.4 +++ openacs-4/packages/chat/www/chat-transcript.adp 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -2,9 +2,9 @@ @context;literal@ #chat.transcript_of_room# "@room_name;noquote@" - - + + - + Index: openacs-4/packages/chat/www/chat-transcript.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcript.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/chat-transcript.tcl 20 Jan 2018 22:56:50 -0000 1.6 +++ openacs-4/packages/chat/www/chat-transcript.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -3,9 +3,9 @@ } { room_id:naturalnum,notnull {transcript_id:naturalnum,optional 0} -} +} -set page_title "[_ chat.Transcript]" +set page_title "[_ chat.Transcript]" set context [list $page_title] set user_id [ad_conn user_id] @@ -17,20 +17,20 @@ #Display unauthorize privilege page. ad_returnredirect unauthorized ad_script_abort -} +} if { [catch {set room_name [chat_room_name $room_id]} errmsg] } { ad_return_complaint 1 "[_ chat.Room_not_found]" ad_script_abort } -template::head::add_style -style "#messages { - border: 1px dotted black; +template::head::add_style -style "#messages { + border: 1px dotted black; padding: 5px; - margin-top:10px; - font-size: 12px; - color: #666666; - font-family: Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif; + margin-top:10px; + font-size: 12px; + color: #666666; + font-family: Trebuchet MS, Lucida Grande, Lucida Sans Unicode, Arial, sans-serif; } #messages .timestamp {vertical-align: top; color: #CCCCCC; } #messages .user {text-align: right; vertical-align: top; font-weight:bold; } @@ -39,3 +39,8 @@ ad_return_template +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/chat-transcripts.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat-transcripts.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/www/chat-transcripts.tcl 7 Aug 2017 23:48:07 -0000 1.4 +++ openacs-4/packages/chat/www/chat-transcripts.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -6,7 +6,7 @@ @creation-date March 26, 2006 } { room_id:naturalnum,notnull -} +} if { [catch {set room_name [chat_room_name $room_id]} errmsg] } { ad_return_complaint 1 "[_ chat.Room_not_found]" @@ -15,3 +15,8 @@ set active [room_active_status $room_id] +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/chat.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/chat/www/chat.adp 9 Nov 2018 16:48:36 -0000 1.2 +++ openacs-4/packages/chat/www/chat.adp 14 Feb 2019 16:15:01 -0000 1.2.2.1 @@ -3,8 +3,6 @@ doc ichat_form.msg - -

@doc.title@

#chat.Log_off# Index: openacs-4/packages/chat/www/chat.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/chat.tcl,v diff -u -r1.20 -r1.20.2.1 --- openacs-4/packages/chat/www/chat.tcl 24 Oct 2018 10:29:13 -0000 1.20 +++ openacs-4/packages/chat/www/chat.tcl 14 Feb 2019 16:15:01 -0000 1.20.2.1 @@ -53,11 +53,8 @@ ad_script_abort } -template::head::add_css -href resources/chat.css +set chat_frame [::chat::Chat login -chat_id $room_id] -set chat_frame [::chat::Chat login \ - -chat_id $room_id] - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/chat/www/message-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete-2.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/chat/www/message-delete-2.tcl 7 Aug 2017 23:48:07 -0000 1.9 +++ openacs-4/packages/chat/www/message-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -19,3 +19,9 @@ ::chat::Chat flush_messages -chat_id $room_id ad_returnredirect . + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/message-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/message-delete.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/message-delete.tcl 7 Aug 2017 23:48:07 -0000 1.8 +++ openacs-4/packages/chat/www/message-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -22,4 +22,10 @@ set message_count [chat_message_count $room_id] -ad_return_template \ No newline at end of file +ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/moderator-grant-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-grant-2.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/www/moderator-grant-2.tcl 7 Aug 2017 23:48:07 -0000 1.4 +++ openacs-4/packages/chat/www/moderator-grant-2.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -1,8 +1,8 @@ #/chat/www/moderator-grant-2.tcl ad_page_contract { - + Add moderator to a room. - + @author David Dao (ddao@arsdigita.com) @creation-date November 17, 2000 @cvs-id $Id$ @@ -16,3 +16,9 @@ chat_moderator_grant $room_id $party_id ad_returnredirect "room?room_id=$room_id" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/moderator-grant.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-grant.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/moderator-grant.tcl 7 Aug 2017 23:48:07 -0000 1.6 +++ openacs-4/packages/chat/www/moderator-grant.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -28,3 +28,8 @@ ad_return_template grant-entry +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/moderator-revoke-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-revoke-2.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/www/moderator-revoke-2.tcl 7 Aug 2017 23:48:07 -0000 1.4 +++ openacs-4/packages/chat/www/moderator-revoke-2.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -15,4 +15,10 @@ chat_moderator_revoke $room_id $party_id -ad_returnredirect "room?room_id=$room_id" \ No newline at end of file +ad_returnredirect "room?room_id=$room_id" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/moderator-revoke.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/moderator-revoke.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/moderator-revoke.tcl 18 Jun 2018 14:30:00 -0000 1.8 +++ openacs-4/packages/chat/www/moderator-revoke.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -18,3 +18,9 @@ set party_pretty_name [acs_object_name $party_id] set pretty_name [chat_room_name $room_id] + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/noactive.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/noactive.tcl,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/chat/www/noactive.tcl 14 Mar 2006 12:16:09 -0000 1.1 +++ openacs-4/packages/chat/www/noactive.tcl 14 Feb 2019 16:15:01 -0000 1.1.14.1 @@ -12,3 +12,9 @@ set context_bar [list "[_ chat.Unauthorized_privilege]"] ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/room-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete-2.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/room-delete-2.tcl 7 Aug 2017 23:48:07 -0000 1.8 +++ openacs-4/packages/chat/www/room-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -16,8 +16,10 @@ ad_script_abort } -ad_returnredirect . +ad_returnredirect . - - - +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/room-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-delete.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/room-delete.tcl 7 Aug 2017 23:48:07 -0000 1.8 +++ openacs-4/packages/chat/www/room-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -19,4 +19,10 @@ set pretty_name [chat_room_name $room_id] -ad_return_template \ No newline at end of file +ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/room-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room-edit.tcl,v diff -u -r1.15 -r1.15.2.1 --- openacs-4/packages/chat/www/room-edit.tcl 25 Jun 2018 14:46:38 -0000 1.15 +++ openacs-4/packages/chat/www/room-edit.tcl 14 Feb 2019 16:15:01 -0000 1.15.2.1 @@ -70,72 +70,72 @@ {messages_time_window:integer {label "#chat.MessagesTimeWindow#" } {help_text "[_ chat.MessagesTimeWindowHelp]"} - {value "$four_hours"} + {value "$four_hours"} } } -new_data { if {[catch { - set room_id [chat_room_new \ - -moderated_p $moderated_p \ - -description $description \ - -active_p $active_p \ - -archive_p $archive_p \ - -auto_flush_p $auto_flush_p \ - -auto_transcript_p $auto_transcript_p \ - -login_messages_p $login_messages_p \ - -logout_messages_p $logout_messages_p \ - -messages_time_window $messages_time_window \ - -context_id [ad_conn package_id] \ - -creation_user [ad_conn user_id] \ - -creation_ip [ad_conn peeraddr] $pretty_name] + set room_id [chat_room_new \ + -moderated_p $moderated_p \ + -description $description \ + -active_p $active_p \ + -archive_p $archive_p \ + -auto_flush_p $auto_flush_p \ + -auto_transcript_p $auto_transcript_p \ + -login_messages_p $login_messages_p \ + -logout_messages_p $logout_messages_p \ + -messages_time_window $messages_time_window \ + -context_id [ad_conn package_id] \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] $pretty_name] } errmsg]} { ad_return_complaint 1 "[_ chat.Create_new_room_failed]: $errmsg" ad_script_abort } set comm_id "" if {[info commands dotlrn_community::get_community_id] ne ""} { - set comm_id [dotlrn_community::get_community_id] + set comm_id [dotlrn_community::get_community_id] } if {$comm_id ne ""} { - chat_user_grant $room_id $comm_id + chat_user_grant $room_id $comm_id } else { - #-2 Registered Users - #chat_user_grant $room_id -2 - #0 Unregistered Visitor - #chat_user_grant $room_id 0 - #-1 The Public - chat_user_grant $room_id -2 + #-2 Registered Users + #chat_user_grant $room_id -2 + #0 Unregistered Visitor + #chat_user_grant $room_id 0 + #-1 The Public + chat_user_grant $room_id -2 } } -edit_request { if {[catch { - chat_room_get -room_id $room_id -array r - set pretty_name $r(pretty_name) - set description $r(description) - set moderated_p $r(moderated_p) - set archive_p $r(archive_p) - set auto_flush_p $r(auto_flush_p) - set auto_transcript_p $r(auto_transcript_p) - set login_messages_p $r(login_messages_p) - set logout_messages_p $r(logout_messages_p) - set messages_time_window $r(messages_time_window) + chat_room_get -room_id $room_id -array r + set pretty_name $r(pretty_name) + set description $r(description) + set moderated_p $r(moderated_p) + set archive_p $r(archive_p) + set auto_flush_p $r(auto_flush_p) + set auto_transcript_p $r(auto_transcript_p) + set login_messages_p $r(login_messages_p) + set logout_messages_p $r(logout_messages_p) + set messages_time_window $r(messages_time_window) } errmsg]} { - ad_return_complaint 1 "[_ chat.Room_not_found]." + ad_return_complaint 1 "[_ chat.Room_not_found]." ad_script_abort } } -edit_data { if {[catch { - chat_room_edit \ - $room_id \ - $pretty_name \ - $description \ - $moderated_p \ - $active_p \ - $archive_p \ - $auto_flush_p \ - $auto_transcript_p \ - $login_messages_p \ - $logout_messages_p \ - $messages_time_window + chat_room_edit \ + $room_id \ + $pretty_name \ + $description \ + $moderated_p \ + $active_p \ + $archive_p \ + $auto_flush_p \ + $auto_transcript_p \ + $login_messages_p \ + $logout_messages_p \ + $messages_time_window } errmsg]} { ad_return_complaint 1 "[_ chat.Could_not_update_room]: $errmsg" ad_script_abort @@ -144,3 +144,9 @@ ad_returnredirect "room?room_id=$room_id" ad_script_abort } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/room.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.adp,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/chat/www/room.adp 7 Aug 2017 23:48:07 -0000 1.11 +++ openacs-4/packages/chat/www/room.adp 14 Feb 2019 16:15:01 -0000 1.11.2.1 @@ -73,3 +73,26 @@ + + +

XoWiki Includelet

+ + + + +
Index: openacs-4/packages/chat/www/room.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/room.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/chat/www/room.tcl 29 May 2018 17:09:02 -0000 1.11 +++ openacs-4/packages/chat/www/room.tcl 14 Feb 2019 16:15:01 -0000 1.11.2.1 @@ -88,6 +88,9 @@ } } +set xowiki_includelet_code "\{\{chat_room -chat_id $room_id\}\}" +set xowiki_includelet_size [string length $xowiki_includelet_code] + set actions "" if { $user_ban_p } { set actions [list [_ chat.Ban_user] [export_vars -base "search" {room_id {type ban}}]] @@ -117,3 +120,9 @@ } ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/search-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/search-3.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/search-3.tcl 20 Jun 2016 08:37:04 -0000 1.6 +++ openacs-4/packages/chat/www/search-3.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -15,3 +15,8 @@ } ad_returnredirect "room?room_id=$room_id" +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/search.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/search.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/chat/www/search.tcl 20 Jun 2016 08:37:04 -0000 1.2 +++ openacs-4/packages/chat/www/search.tcl 14 Feb 2019 16:15:01 -0000 1.2.2.1 @@ -3,8 +3,8 @@ } { type:notnull room_id:naturalnum,notnull -} - +} + set context [list "Users"] db_1row users_n_users {} @@ -13,17 +13,22 @@ set last_registration [lc_time_fmt $last_registration "%q"] set groups [db_html_select_value_options groups_select { - select groups.group_id, - groups.group_name, - m.num as n_members, - c.num as n_components - from groups, - (select group_id, count(*) as num - from group_member_map group by group_id) m, - (select group_id, count(*) as num - from group_component_map group by group_id) c - where groups.group_id=m.group_id + select groups.group_id, + groups.group_name, + m.num as n_members, + c.num as n_components + from groups, + (select group_id, count(*) as num + from group_member_map group by group_id) m, + (select group_id, count(*) as num + from group_component_map group by group_id) c + where groups.group_id=m.group_id and groups.group_id = c.group_id order by group_name } ] +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-delete-2.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/transcript-delete-2.tcl 7 Aug 2017 23:48:07 -0000 1.6 +++ openacs-4/packages/chat/www/transcript-delete-2.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -4,16 +4,20 @@ } { room_id:naturalnum,notnull transcript_id:naturalnum,notnull - + } permission::require_permission -object_id $transcript_id -privilege chat_transcript_delete - - if { [catch {chat_transcript_delete $transcript_id} errmsg] } { ad_return_complaint 1 "[_ chat.Delete_transcript_failed]: $errmsg" ad_script_abort } ad_returnredirect "room?room_id=$room_id" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-delete.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/transcript-delete.tcl 7 Aug 2017 23:48:07 -0000 1.8 +++ openacs-4/packages/chat/www/transcript-delete.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -23,3 +23,9 @@ set context [list "[_ chat.Delete_transcript]"] ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-edit-2.tcl,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/chat/www/transcript-edit-2.tcl 20 Jan 2018 22:56:50 -0000 1.10 +++ openacs-4/packages/chat/www/transcript-edit-2.tcl 14 Feb 2019 16:15:01 -0000 1.10.2.1 @@ -22,3 +22,9 @@ ad_returnredirect "transcript-view?transcript_id=$transcript_id&room_id=$room_id" ad_script_abort + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-edit.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/chat/www/transcript-edit.tcl 17 Nov 2018 10:10:02 -0000 1.12 +++ openacs-4/packages/chat/www/transcript-edit.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -24,30 +24,36 @@ ad_form -name "edit-transcription" -edit_buttons [list [list [_ chat.Edit] next]] -has_edit 1 -form { {room_id:integer(hidden) - {value $room_id} + {value $room_id} } {transcript_id:integer(hidden) - {value $transcript_id} + {value $transcript_id} } {pretty_name:text(text) - {label "#chat.Transcript_name#" } - {value $pretty_name} + {label "#chat.Transcript_name#" } + {value $pretty_name} } {description:text(textarea),optional - {label "#chat.Description#" } - {html {rows 6 cols 65}} - {value $description} + {label "#chat.Description#" } + {html {rows 6 cols 65}} + {value $description} } {contents:text(textarea) - {label "#chat.Transcript#" } - {html {rows 6 cols 65}} - {value $contents} + {label "#chat.Transcript#" } + {html {rows 6 cols 65}} + {value $contents} } } -on_submit { if { [catch {chat_transcript_edit $transcript_id $pretty_name $description $contents} errmsg] } { - ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" + ad_return_complaint 1 "[_ chat.Could_not_update_transcript]: $errmsg" } else { - ad_returnredirect [export_vars -base "chat-transcript" {transcript_id room_id}] + ad_returnredirect [export_vars -base "chat-transcript" {transcript_id room_id}] } ad_script_abort } + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/Attic/transcript-new-2.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/transcript-new-2.tcl 20 Jun 2016 08:37:04 -0000 1.5 +++ openacs-4/packages/chat/www/transcript-new-2.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -8,7 +8,7 @@ {delete_messages:optional "off"} {deactivate_room:optional "off"} contents:trim,notnull,html -} +} permission::require_permission -object_id $room_id -privilege chat_transcript_create @@ -36,3 +36,8 @@ ad_returnredirect "chat-transcript?room_id=$room_id&transcript_id=$transcript_id" +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-new.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat/www/transcript-new.tcl 20 Jun 2016 08:37:04 -0000 1.8 +++ openacs-4/packages/chat/www/transcript-new.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -34,3 +34,8 @@ ad_return_template "transcript-entry" +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/transcript-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/transcript-view.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/transcript-view.tcl 7 Aug 2017 23:48:07 -0000 1.6 +++ openacs-4/packages/chat/www/transcript-view.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -29,3 +29,9 @@ } ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/unauthorized.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/unauthorized.tcl,v diff -u -r1.3 -r1.3.14.1 --- openacs-4/packages/chat/www/unauthorized.tcl 14 Mar 2006 12:16:09 -0000 1.3 +++ openacs-4/packages/chat/www/unauthorized.tcl 14 Feb 2019 16:15:01 -0000 1.3.14.1 @@ -11,4 +11,10 @@ set context_bar [list "[_ chat.Unauthorized_privilege]"] -ad_return_template \ No newline at end of file +ad_return_template + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/user-ban-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-ban-2.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/chat/www/user-ban-2.tcl 7 Aug 2017 23:48:07 -0000 1.5 +++ openacs-4/packages/chat/www/user-ban-2.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,6 +1,6 @@ #/chat/www/user-ban-2.tcl ad_page_contract { - + Ban user. @author David Dao (ddao@arsdigita.com) @@ -16,3 +16,9 @@ chat_user_ban $room_id $party_id ad_returnredirect "room?room_id=$room_id" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/user-ban.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-ban.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/chat/www/user-ban.tcl 7 Aug 2017 23:48:07 -0000 1.6 +++ openacs-4/packages/chat/www/user-ban.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -1,6 +1,6 @@ #/chat/www/user-ban.tcl ad_page_contract { - + Explicit ban user from the chat room. @author David Dao (ddao@arsdigita.com) @@ -28,3 +28,9 @@ db_multirow parties list_parties {} ad_return_template grant-entry + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/user-unban-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-unban-2.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/chat/www/user-unban-2.tcl 7 Aug 2017 23:48:07 -0000 1.4 +++ openacs-4/packages/chat/www/user-unban-2.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -16,3 +16,9 @@ chat_user_unban $room_id $party_id ad_returnredirect "room?room_id=$room_id" + +# Local variables: +# mode: tcl +# tcl-indent-level: 4 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/chat/www/user-unban.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat/www/user-unban.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/chat/www/user-unban.tcl 18 Jun 2018 14:35:33 -0000 1.7 +++ openacs-4/packages/chat/www/user-unban.tcl 14 Feb 2019 16:15:01 -0000 1.7.2.1 @@ -1,6 +1,6 @@ #/chat/www/user-unban.tcl ad_page_contract { - + Display confirmation before unban user. @author David Dao (ddao@arsdigita.com) @@ -20,3 +20,8 @@ set pretty_name [chat_room_name $room_id] +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Fisheye: Tag 1.10.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/ajax/chat.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.13.2.1 refers to a dead (removed) revision in file `openacs-4/packages/chat/www/resources/chat.css'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/chat-portlet/tcl/chat-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/tcl/chat-admin-portlet-procs.tcl,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/chat-portlet/tcl/chat-admin-portlet-procs.tcl 14 Mar 2006 12:23:38 -0000 1.1 +++ openacs-4/packages/chat-portlet/tcl/chat-admin-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.1.14.1 @@ -20,7 +20,7 @@ @author agustin (Agustin.Lopez@uv.es) @creation-date 2004-10-10 - @version $Id: chat-admin-portlet-procs.tcl,v 0.1 2004/10/10 + @cvs-id $Id: chat-admin-portlet-procs.tcl,v 0.1 2004/10/10 } Index: openacs-4/packages/chat-portlet/tcl/chat-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/tcl/chat-portlet-procs.tcl,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/chat-portlet/tcl/chat-portlet-procs.tcl 14 Mar 2006 12:23:38 -0000 1.1 +++ openacs-4/packages/chat-portlet/tcl/chat-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.1.14.1 @@ -20,7 +20,7 @@ @author agustin (Agustin.Lopez@uv.es) @creation-date 2004-10-10 - @version $Id: chat-portlet-procs.tcl,v 0.1 2004/10/10 + @cvs-id $Id: chat-portlet-procs.tcl,v 0.1 2004/10/10 } Index: openacs-4/packages/chat-portlet/www/chat-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-admin-portlet.tcl,v diff -u -r1.1 -r1.1.14.1 --- openacs-4/packages/chat-portlet/www/chat-admin-portlet.tcl 14 Mar 2006 12:23:38 -0000 1.1 +++ openacs-4/packages/chat-portlet/www/chat-admin-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.1.14.1 @@ -19,7 +19,7 @@ @author agustin (Agustin.Lopez@uv.es) @creation-date 2004-10-10 - @version $Id: chat-admin-portlet.tcl,v 0.1 2004/10/10 + @cvs-id $Id: chat-admin-portlet.tcl,v 0.1 2004/10/10 } -properties { } Index: openacs-4/packages/chat-portlet/www/chat-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/chat-portlet/www/chat-portlet.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/chat-portlet/www/chat-portlet.tcl 7 Aug 2017 23:48:07 -0000 1.8 +++ openacs-4/packages/chat-portlet/www/chat-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -19,7 +19,7 @@ @author agustin (Agustin.Lopez@uv.es) @creation-date 2004-10-10 - @version $Id: chat-portlet.tcl,v 0.1 2004/10/10 + @cvs-id $Id: chat-portlet.tcl,v 0.1 2004/10/10 } -properties { context:onevalue @@ -37,23 +37,20 @@ set user_id [ad_conn user_id] set community_id [dotlrn_community::get_community_id] set room_create_p [permission::permission_p -object_id $user_id -privilege chat_room_create] -set default_mode [parameter::get -parameter DefaultClient -default "ajax"] set num_rooms 0 if { $community_id eq 0 } { - set query_name "rooms_list_all" + set query_name "rooms_list_all" } else { - set query_name "rooms_list" + set query_name "rooms_list" } -db_multirow -extend { can_see_p room_enter_url room_html_url html_text } rooms $query_name {} { - set can_see_p 0 - if { $user_p || $admin_p } { - set can_see_p 1 - set num_rooms [expr {$num_rooms + 1}] - } - set room_enter_url [export_vars -base "${base_url}room-enter" {room_id {client $default_mode}}] - set room_html_url [export_vars -base "${base_url}room-enter" {room_id {client html}}] - set html_text [_ chat.html_client_msg] +db_multirow -extend { can_see_p room_enter_url } rooms $query_name {} { + set can_see_p 0 + if { $user_p || $admin_p } { + set can_see_p 1 + incr num_rooms + } + set room_enter_url [export_vars -base "${base_url}room-enter" {room_id}] } template::list::create -name chat_rooms -multirow rooms \ @@ -68,12 +65,6 @@ description { label "[_ chat.Description]" } - html_mode { - label "[_ chat-portlet.html_mode]" - link_url_col room_html_url - display_col html_text - link_html {title "[_ chat.Enter_html_pretty_name]"} - } } ad_return_template Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.234 -r1.234.2.1 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 18 Sep 2018 17:27:14 -0000 1.234 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 14 Feb 2019 16:15:01 -0000 1.234.2.1 @@ -393,9 +393,9 @@ } { db_dml update_package_id {} db_dml update_application_group_package_id {} - + ::dotlrn::dotlrn_community_cache flush -partition_key $community_id \ - $community_id-package_id + $community_id-package_id } ad_proc -public get_url { @@ -434,7 +434,7 @@ ::dotlrn::dotlrn_community_cache eval -partition_key $community_id \ $community_id-default_roles { dotlrn_community::get_default_roles_not_cached -community_type $community_type - } + } } ad_proc -private get_default_roles_not_cached { @@ -528,10 +528,10 @@ ad_proc -public get_all_roles {} { Return the list of roles used in dotLRN. } { - + ::dotlrn::dotlrn_cache eval get_all_roles { dotlrn_community::get_all_roles_not_cached - } + } } ad_proc -private get_all_roles_not_cached {} { @@ -779,12 +779,12 @@ } { Check membership. } { - + ::dotlrn::dotlrn_community_cache eval -partition_key $community_id \ $community_id-member-$user_id { db_string select_count_membership {} -default 0 - } - + } + } ad_proc -public member_pending_p { @@ -885,11 +885,11 @@ # # Flush all permission checks pertaining to this user. # - permission::cache_flush -party_id $user_id - + permission::cache_flush -party_id $user_id + # Remove record of this membership in the cache ::dotlrn::dotlrn_community_cache flush -partition_key $community_id \ - $community_id-member-$user_id + $community_id-member-$user_id } @@ -1063,10 +1063,10 @@ Returns the community type key depending on the node we're at. } { set package_id [ad_conn package_id] - + ::dotlrn::dotlrn_cache eval pkg_id-$package_id-community_type { dotlrn_community::get_community_type_not_cached -package_id $package_id - } + } } ad_proc -private get_community_type_not_cached { @@ -1147,7 +1147,7 @@ ::dotlrn::dotlrn_cache eval pkg_id-$package_id-parent_community_id { dotlrn_community::get_parent_community_id_not_cached -package_id $package_id - } + } } ad_proc -private get_parent_community_id_not_cached { @@ -1567,7 +1567,11 @@ } { Get the key for a community. } { - return [db_string select_community_key {} -default ""] + + ::dotlrn::dotlrn_community_cache eval -partition_key $community_id \ + $community_id-community_key { + db_string select_community_key {} -default "" + } } ad_proc -public not_closed_p { @@ -1729,6 +1733,10 @@ # Delete from the DB set applet_id [dotlrn_applet::get_applet_id_from_key -applet_key $applet_key] db_dml delete_applet_from_community {} + + # flush "applet_active" entry from the cache + ::dotlrn::dotlrn_community_cache flush -partition_key $community_id \ + $community_id-applet_active-$applet_key } } @@ -2155,7 +2163,7 @@ # candidate general cache ::dotlrn::dotlrn_cache eval available_attributes { dotlrn_community::get_available_attributes_not_cached - } + } } ad_proc -private get_available_attributes_not_cached {} { @@ -2250,7 +2258,7 @@ db_dml update_attribute_value {} } - ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-attributes + ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-attributes } ad_proc -public unset_attribute { @@ -2282,7 +2290,7 @@ } { db_dml delete_attributes {} - ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-attributes + ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-attributes } ad_proc -public get_attribute_id { @@ -2479,7 +2487,7 @@ db_dml update_portal_theme {} set portal_id [get_admin_portal_id -community_id $community_id] db_dml update_portal_theme {} - ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-site_template + ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-site_template } ad_proc -public get_dotlrn_master { @@ -2553,12 +2561,11 @@ set new_theme_id [db_string select_portal_theme {}] db_dml update_portal_themes {} db_dml update_portal_admin_themes {} - + foreach community_id [db_list affected_portals {}] { ::dotlrn::dotlrn_community_cache flush -partition_key $community_id $community_id-site_template } } - } # Local variables: Index: openacs-4/packages/dotlrn/www/register.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/register.tcl,v diff -u -r1.22 -r1.22.2.1 --- openacs-4/packages/dotlrn/www/register.tcl 29 Jun 2018 17:27:19 -0000 1.22 +++ openacs-4/packages/dotlrn/www/register.tcl 14 Feb 2019 16:15:01 -0000 1.22.2.1 @@ -31,9 +31,9 @@ set redirect_to [parameter::get -parameter SelfRegistrationRedirectTo -package_id [dotlrn::get_package_id] -default ""] if { $redirect_to ne "" } { - ad_returnredirect $redirect_to + ad_returnredirect $redirect_to } else { - ad_returnredirect "not-allowed" + ad_returnredirect "not-allowed" } ad_script_abort } @@ -61,11 +61,11 @@ # This should prevent most double clicks, leaving # the catch below to trap the rest. -if { [dotlrn_community::member_p $community_id $user_id] || - ($join_policy eq "needs approval" +if { [dotlrn_community::member_p $community_id $user_id] || + ($join_policy eq "needs approval" && [dotlrn_community::member_pending_p -community_id $community_id -user_id $user_id] ) - } { +} { ad_returnredirect $referer ad_script_abort } @@ -75,7 +75,7 @@ switch -exact $join_policy { "open" { dotlrn_community::add_user -member_state approved $community_id $user_id - dotlrn_community::send_member_email -community_id $community_id -to_user $user_id + dotlrn_community::send_member_email -community_id $community_id -to_user $user_id } "needs approval" { dotlrn_community::add_user -member_state "needs approval" $community_id $user_id @@ -95,7 +95,7 @@ set subject "$full_name ($email) has requested to join $community_name." set message "$full_name ($email) has requested to join $community_name. - + Visit this link to approve or reject this request: $community_url/members @@ -111,20 +111,19 @@ -subject $subject \ -message $message \ -query $query - } } } errmsg]} { - # Check to see if they are already a member + # Check to see if they are already a member # (in which case this was likely a double click) - + if {[dotlrn_community::member_p $community_id $user_id]} { ad_returnredirect $referer ad_script_abort } else { ns_log Error "register.tcl failed: $errmsg\n$::errorInfo" - + ad_return_error \ "Error adding user to community" \ "An error occurred while trying to add a user to a community. This error has been logged." Index: openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl,v diff -u -r1.41 -r1.41.2.1 --- openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl 7 Aug 2017 23:48:10 -0000 1.41 +++ openacs-4/packages/dotlrn-dotlrn/tcl/dotlrn-dotlrn-procs.tcl 14 Feb 2019 16:15:01 -0000 1.41.2.1 @@ -15,12 +15,12 @@ # ad_library { - - Procs to set up the core dotLRN portlets. + Procs to set up the core dotLRN portlets. + 1. the soon-to-be-renamed "dotlrn-main" portlet (The thing that lists a users communities on their portal) - 2. the "dotlrn" portlet (aka "subgroups" on comm portals) + 2. the "dotlrn" portlet (a.k.a. "subgroups" on comm portals) 3. the "dotlrn-admin portlet" (basic group admin) and experimentally (so we eliminate these 2 applets): @@ -33,18 +33,18 @@ } namespace eval dotlrn_dotlrn { - + ad_proc portal_element_key { } { What portlet is this applet associated with? } { - return "dotlrn-portlet" + return "dotlrn-portlet" } ad_proc -public get_pretty_name { } { } { - return "[_ dotlrn-dotlrn.Core_DotLRN_Applets]" + return "[_ dotlrn-dotlrn.Core_DotLRN_Applets]" } ad_proc -public my_package_key { @@ -62,30 +62,30 @@ ad_proc -public add_applet { } { - Add the applet to dotlrn - one time init - must be repeatable! + Add the applet to dotlrn - one time init - must be repeatable! } { dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key] } ad_proc -public remove_applet { - package_id + package_id } { - Remove the applet from dotlrn. + Remove the applet from dotlrn. } { ad_return_complaint \ 1 \ "[applet_key] remove_applet called - this should not happen ever!" } ad_proc -public add_applet_to_community { - community_id + community_id } { - Add the core dotlrn applets to a specific community + Add the core dotlrn applets to a specific community } { # # comm type-specific stuff # - # we call add_self_to_page again with the + # we call add_self_to_page again with the # real comm_id, and it gets overwritten set portal_id [dotlrn_community::get_portal_id \ @@ -138,24 +138,24 @@ dotlrn_dotlrn::add_portlet_helper $portal_id $args - # return the empty string - return "" + # return the empty string + return "" } ad_proc -public remove_applet_from_community { - community_id + community_id } { - remove the dotlrn applet from a specific community + remove the dotlrn applet from a specific community } { ad_return_complaint \ 1 \ "[applet_key] remove_applet_from_community not implemented!" } ad_proc -public add_user { - user_id + user_id } { - Called for one time init when this user is added to dotlrn. + Called for one time init when this user is added to dotlrn. Do nothing, since the portal system will copy the dotlrn-main portal from the user template. that's set up below } { @@ -171,35 +171,35 @@ } ad_proc -public add_user_to_community { - community_id - user_id + community_id + user_id } { Add user to a comm } { # noop } ad_proc -public remove_user_from_community { - community_id - user_id + community_id + user_id } { - Remove a user from a community. Since this applet is not shown - on a user's portal, no action is required here. + Remove a user from a community. Since this applet is not shown + on a user's portal, no action is required here. } { # noop } - + ad_proc -public add_portlet { portal_id } { - @param portal_id + @param portal_id } { set community_id 0 set args [ns_set create] ns_set put $args community_id $community_id set type [dotlrn::get_type_from_portal_id -portal_id $portal_id] - + switch $type { user { dotlrn_main_portlet::add_self_to_page -portal_id $portal_id @@ -234,10 +234,10 @@ } ad_proc -private add_portlet_helper { - portal_id - args + portal_id + args } { - Does the call to add the portlet to the portal. + Does the call to add the portlet to the portal. Params for the portlet are sent to this proc by the caller. } { dotlrn_portlet::add_self_to_page \ @@ -249,8 +249,8 @@ portal_id args } { - A helper proc to remove the underlying portlet from the given portal. - + A helper proc to remove the underlying portlet from the given portal. + @param portal_id @param args } { @@ -262,7 +262,7 @@ new_community_id } { Clone this applet's content from the old community to the new one. - Since there's no data to copy, just add the applet to the new + Since there's no data to copy, just add the applet to the new community. } { ns_log notice "Cloning: [applet_key]" @@ -274,10 +274,10 @@ event old_value new_value - } { - listens for the following events: - } { - } + } { + listens for the following events: + } { + } ad_proc -private get_default_page { portal_type } { The pretty name of the page to add the portlet to. @@ -303,7 +303,7 @@ } return $page_name - } + } } # Local variables: Index: openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-staff-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-staff-portlet-procs.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-staff-portlet-procs.tcl 11 Jul 2018 08:37:54 -0000 1.12 +++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-staff-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -16,7 +16,7 @@ ad_library { - Procedures to supports the dotlrn "members staff" portlet aka "Staff List" + Procedures to supports the dotlrn "members staff" portlet a.k.a. "Staff List" @author arjun@openforce.net @cvs-id $Id$ @@ -38,60 +38,59 @@ } { Get the pretty name. } { - return "#dotlrn-portlet.members_staff_portlet_pretty_name#" + return "#dotlrn-portlet.members_staff_portlet_pretty_name#" } ad_proc -public link { } { Get the link. This is currently empty. } { - return "" + return "" } ad_proc -public add_self_to_page { - {-portal_id:required} - {-community_id:required} + {-portal_id:required} + {-community_id:required} } { Add the "dotlrn members staff" portlet to the page. } { set force_region [parameter::get_from_package_key \ - -package_key [my_package_key] \ - -parameter "dotlrn_members_staff_portlet_force_region" + -package_key [my_package_key] \ + -parameter "dotlrn_members_staff_portlet_force_region" ] return [portal::add_element_parameters \ - -portal_id $portal_id \ - -pretty_name [get_pretty_name] \ - -portlet_name [get_my_name] \ - -force_region $force_region \ - -key "community_id" \ - -value $community_id + -portal_id $portal_id \ + -pretty_name [get_pretty_name] \ + -portlet_name [get_my_name] \ + -force_region $force_region \ + -key "community_id" \ + -value $community_id ] } ad_proc -public remove_self_from_page { {-portal_id:required} } { - Removes the PE from the given page. + Removes the PE from the given page. } { portal::remove_element \ -portal_id $portal_id \ -portlet_name [get_my_name] } ad_proc -public show { - cf + cf } { - Call the template to display. + Call the template to display. - @param cf A config array + @param cf A config array } { portal::show_proc_helper \ -package_key [my_package_key] \ -config_list $cf \ -template_src "dotlrn-members-staff-portlet" } - } # Local variables: Index: openacs-4/packages/faq/faq.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/faq.info,v diff -u -r1.31 -r1.31.2.1 --- openacs-4/packages/faq/faq.info 12 Jul 2018 08:51:04 -0000 1.31 +++ openacs-4/packages/faq/faq.info 14 Feb 2019 16:15:01 -0000 1.31.2.1 @@ -6,21 +6,21 @@ FAQs f f - - + + Nima Mazloumi Jennie Kim Housman Elizabeth Wirth Manage simple and categorized Question and Answer style FAQs with WYSIWYG and notification functionalities. - 2017-08-06 + 2019-01-18 Ybos Corporation Handles frequently asked questions Q&A presentation. Can be one Q&A per page or all presented flat. Straightforward application with room for improvement. Support for notification as well as WYSIQYG Editor and Categories - both optional. Category trees are displayed flat. No multiple filters. 2 #faq.FAQs# - + - + Index: openacs-4/packages/faq/catalog/faq.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/catalog/faq.de_DE.ISO-8859-1.xml,v diff -u -r1.13 -r1.13.10.1 --- openacs-4/packages/faq/catalog/faq.de_DE.ISO-8859-1.xml 10 Dec 2007 09:12:33 -0000 1.13 +++ openacs-4/packages/faq/catalog/faq.de_DE.ISO-8859-1.xml 14 Feb 2019 16:15:01 -0000 1.13.10.1 @@ -8,7 +8,7 @@ Antwort Antwort im HTML-Format Zur�ck zu FAQs - &Auml;nderungen &uuml;bernehmen + �nderungen �bernehmen Konfigurieren Neues FAQ erstellen Neues FAQ erstellen @@ -24,6 +24,7 @@ Ein FAQ bearbeiten Kategorien aktivieren WYSIWYG aktivieren + Aktiviert FAQs verwalten %faq_name% verwalten FAQs @@ -34,8 +35,10 @@ Keine FAQs vorhanden Keine Fragen vorhanden Titel: + Titel Neuen F&A-Eintrag hinzuf�gen Nein + Anzahl von Fragen Eine Frage Einfacher Text Vorformatierter Text Index: openacs-4/packages/faq/catalog/faq.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/catalog/faq.en_US.ISO-8859-1.xml,v diff -u -r1.15 -r1.15.10.1 --- openacs-4/packages/faq/catalog/faq.en_US.ISO-8859-1.xml 10 Dec 2007 09:12:33 -0000 1.15 +++ openacs-4/packages/faq/catalog/faq.en_US.ISO-8859-1.xml 14 Feb 2019 16:15:01 -0000 1.15.10.1 @@ -33,6 +33,7 @@ Enable Categories Enable FAQ: Enable WYSIWYG + Enabled FAQ Administration %faq_name% Admin FAQs @@ -44,8 +45,10 @@ There are no FAQs available. There are no questions available. Name: + Name New No + Q&A One Question Plain Preformatted Index: openacs-4/packages/faq/catalog/faq.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/catalog/faq.es_ES.ISO-8859-1.xml,v diff -u -r1.12 -r1.12.10.1 --- openacs-4/packages/faq/catalog/faq.es_ES.ISO-8859-1.xml 10 Dec 2007 09:12:33 -0000 1.12 +++ openacs-4/packages/faq/catalog/faq.es_ES.ISO-8859-1.xml 14 Feb 2019 16:15:01 -0000 1.12.10.1 @@ -33,6 +33,7 @@ Activar Categor�as Activar FAQ: Activar WYSIWYG + Activada �Administraci�n de Preguntas m�s Frecuentes? Administrar %faq_name% Preguntas m�s Frecuentes @@ -44,8 +45,10 @@ No hay Preguntas m�s Frecuentes disponibles. No hay preguntas disponibles Nombre: + Nombre Nuevo No + N�mero de P&R Una pregunta Plano Preformateado Index: openacs-4/packages/faq/catalog/faq.it_IT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/catalog/faq.it_IT.ISO-8859-1.xml,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/faq/catalog/faq.it_IT.ISO-8859-1.xml 22 Jun 2018 08:59:58 -0000 1.12 +++ openacs-4/packages/faq/catalog/faq.it_IT.ISO-8859-1.xml 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -33,6 +33,7 @@ Abilita Categorie Abilita FAQ: Abilita WYSIWYG + Attivata Amministrazione FAQ Amministrazione %faq_name% FAQs @@ -44,8 +45,10 @@ Nessuna FAQ disponibile Nessuna domanda disponibile Nome: + Nome Nuova No + D&R Una domanda Semplice Preformattato Index: openacs-4/packages/faq/sql/oracle/faq-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/oracle/faq-create.sql,v diff -u -r1.5 -r1.5.16.1 --- openacs-4/packages/faq/sql/oracle/faq-create.sql 1 Apr 2004 22:52:45 -0000 1.5 +++ openacs-4/packages/faq/sql/oracle/faq-create.sql 14 Feb 2019 16:15:01 -0000 1.5.16.1 @@ -21,6 +21,7 @@ create table faqs ( faq_id constraint faqs_faq_id_fk references acs_objects (object_id) + on delete cascade constraint faqs_pk primary key, faq_name varchar (250) @@ -49,9 +50,10 @@ create table faq_q_and_as ( entry_id constraint faq_q_and_as_entry_id_fk references acs_objects (object_id) + on delete cascade constraint faq_q_sand_a_pk primary key, - faq_id integer references faqs not null, + faq_id integer not null references faqs on delete cascade, question varchar (4000) not null, answer varchar (4000) not null, -- determines the order of questions in a FAQ @@ -122,4 +124,4 @@ end; / -@@ faq-package-create.sql \ No newline at end of file +@@ faq-package-create.sql Index: openacs-4/packages/faq/sql/postgresql/faq-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-create.sql,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/faq/sql/postgresql/faq-create.sql 12 Jul 2018 08:51:04 -0000 1.9 +++ openacs-4/packages/faq/sql/postgresql/faq-create.sql 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -30,6 +30,7 @@ create table faqs ( faq_id integer constraint faqs_faq_id_fk references acs_objects(object_id) + on delete cascade constraint faqs_pk primary key, faq_name varchar (250) @@ -66,9 +67,10 @@ create table faq_q_and_as ( entry_id integer constraint faq_q_and_as_entry_id_fk references acs_objects (object_id) + on delete cascade constraint faq_q_sand_a_pk primary key, - faq_id integer references faqs not null, + faq_id integer not null references faqs on delete cascade, question varchar (4000) not null, answer varchar (4000) not null, -- determines the order of questions in a FAQ Index: openacs-4/packages/faq/sql/postgresql/faq-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/sql/postgresql/faq-sc-create.sql,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/faq/sql/postgresql/faq-sc-create.sql 15 Aug 2018 16:55:08 -0000 1.4 +++ openacs-4/packages/faq/sql/postgresql/faq-sc-create.sql 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -31,5 +31,24 @@ $$ language plpgsql; create trigger faq_sc__itrg after insert on faq_q_and_as for each row execute procedure faq_sc__itrg (); -create trigger faq_sc__dtrg after delete on faq_q_and_as for each row execute procedure faq_sc__dtrg (); +-- apisano 2019-01-30: intended purpose of this trigger is to schedule +-- deletion of faq content from the search package engine indexes by +-- calling search_observer__enqueue(entry_id, 'DELETE') on the just +-- deleted entry. However, as this entry depends on the corresponding +-- q_and_a acs_object, either we keep this object hanging around until +-- the unindexing happens, or we just delete this as well (e.g. this +-- happens in faq__delete_q_and_a stored procedure): +-- -- delete from faq_q_and_as where entry_id = p_entry_id; +-- -- raise NOTICE 'Deleting FAQ_Q_and_A...'; +-- -- PERFORM acs_object__delete(p_entry_id); +-- Deleting the object brings the entry in the search queue to be +-- deleted as well via on delete cascade, de-facto preventing this +-- tuple from being used at all in the scheduled search indexer. +-- Furthermore, unindexing will take place anyway via on delete +-- cascate defined on txt.object_id for tsearch2-driver and apparently +-- also on site_wide_index.object_id for the intermedia-driver on +-- Oracle, making all this trigger daydream quite pointless. To make +-- things worse, this trigger complicates removal of a faq instance, +-- as long as faqs with entries are there. +-- create trigger faq_sc__dtrg after delete on faq_q_and_as for each row execute procedure faq_sc__dtrg (); create trigger faq_sc__utrg after update on faq_q_and_as for each row execute procedure faq_sc__utrg (); Index: openacs-4/packages/faq/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/apm-callback-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/faq/tcl/apm-callback-procs.tcl 12 Jul 2018 12:39:45 -0000 1.4 +++ openacs-4/packages/faq/tcl/apm-callback-procs.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -55,7 +55,6 @@ } } - ad_proc -public faq::apm_callback::delete_one_faq_impl {} { Unregister the NotificationType implementation for one_faq_qa_notif_type. } { Index: openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql,v diff -u -r1.1 -r1.1.26.1 --- openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 +++ openacs-4/packages/faq/www/admin/faq-delete-postgresql.xql 14 Feb 2019 16:15:01 -0000 1.1.26.1 @@ -1,13 +1,15 @@ - - postgresql7.1 + + postgresql + 7.1 + - - - select faq__delete_faq (:faq_id); - - + + + select acs_object__delete(faq_id) + from faqs where faq_id = :faq_id + + - Index: openacs-4/packages/faq/www/admin/faq-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/faq-delete.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/faq/www/admin/faq-delete.tcl 19 Jan 2018 14:44:17 -0000 1.5 +++ openacs-4/packages/faq/www/admin/faq-delete.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -16,16 +16,7 @@ permission::require_permission -object_id $package_id -privilege faq_delete_faq -db_transaction { - db_exec_plsql delete_faq { - begin - faq.delete_faq ( - faq_id => :faq_id - ); - end; - } - db_dml delete_named_object "delete from acs_named_objects where object_id in (select entry_id from faq_q_and_as where faq_id = :faq_id)" -} +db_exec_plsql delete_faq {} ad_returnredirect "index" ad_script_abort Index: openacs-4/packages/faq/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/index.tcl,v diff -u -r1.13 -r1.13.2.1 --- openacs-4/packages/faq/www/admin/index.tcl 19 Jan 2018 14:44:17 -0000 1.13 +++ openacs-4/packages/faq/www/admin/index.tcl 14 Feb 2019 16:15:01 -0000 1.13.2.1 @@ -9,7 +9,7 @@ @author Elizabeth Wirth (wirth@ybos.net) @author Nima Mazloumi (nima.mazloumi@gmx.de) @creation-date 2000-10-24 - + } { } -properties { context:onevalue @@ -31,40 +31,45 @@ -elements { edit { display_template { - - #faq.Edit# + + #faq.Edit# + } sub_class narrow } faq_name { - label "Name" - display_template { - - @faqs.faq_name;noquote@ - } + label "#faq.name#" + display_template { + + @faqs.faq_name;noquote@ + + } } num_q_and_as { - label "# Q&A" + label "#faq.number_qa#" html { align center } } disabled_p { - label "Enabled" + label "#faq.enabled#" display_template { - #faq.Disable# + #faq.Disable# + - #faq.Enable# + #faq.Enable# + } html { align center } } delete { display_template { - - #faq.Delete# + + #faq.Delete# + } sub_class narrow } Index: openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql,v diff -u -r1.1 -r1.1.26.1 --- openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql 17 Jul 2002 20:20:17 -0000 1.1 +++ openacs-4/packages/faq/www/admin/q_and_a-delete-postgresql.xql 14 Feb 2019 16:15:01 -0000 1.1.26.1 @@ -1,12 +1,15 @@ - - postgresql7.1 + + postgresql + 7.1 + - - - select faq__delete_q_and_a (:entry_id ); - - + + + select acs_object__delete(entry_id) + from faq_q_and_as where entry_id = :entry_id; + + Index: openacs-4/packages/faq/www/admin/q_and_a-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/www/admin/q_and_a-delete.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/faq/www/admin/q_and_a-delete.tcl 19 Jan 2018 14:44:17 -0000 1.6 +++ openacs-4/packages/faq/www/admin/q_and_a-delete.tcl 14 Feb 2019 16:15:01 -0000 1.6.2.1 @@ -16,16 +16,7 @@ db_1row get_faq_id "select faq_id from faq_q_and_as where entry_id=:entry_id" -db_transaction { - db_exec_plsql delete_q_and_a { - begin - faq.delete_q_and_a ( - entry_id => :entry_id - ); - end; - } - db_dml delete_named_object "delete from acs_named_objects where object_id = :entry_id" -} +db_exec_plsql delete_entry {} ad_returnredirect "one-faq?faq_id=$faq_id" ad_script_abort Index: openacs-4/packages/faq-portlet/catalog/faq-portlet.it_IT.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/catalog/faq-portlet.it_IT.ISO-8859-1.xml,v diff -u -r1.13 -r1.13.10.1 --- openacs-4/packages/faq-portlet/catalog/faq-portlet.it_IT.ISO-8859-1.xml 10 Dec 2007 09:12:33 -0000 1.13 +++ openacs-4/packages/faq-portlet/catalog/faq-portlet.it_IT.ISO-8859-1.xml 14 Feb 2019 16:15:01 -0000 1.13.10.1 @@ -2,13 +2,20 @@ Amministrazione FAQ + Crea una nuova FAQ Disabilita + Disabilita %faqs.faq_name% Disabilitato + Mostra domanda e risposta Abilita + Abilita %faqs.faq_name% + Vai alla FAQ %faq_name% + Vai alla FAQ %faqs.faq_name% + Vai all'amministrazione di %faqs.faq_name% Gruppo Nome Nuova FAQ Nessuna FAQ - Ci dovrebbe essere un'unica istanza FAQ per scopi amministrativi + Ci dovrebbe essere un'unica istanza FAQ per scopi amministrativi Domande Ricorrenti (FAQ) Index: openacs-4/packages/faq-portlet/tcl/faq-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/faq-admin-portlet-procs.tcl,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/faq-portlet/tcl/faq-admin-portlet-procs.tcl 7 Aug 2017 23:48:11 -0000 1.10 +++ openacs-4/packages/faq-portlet/tcl/faq-admin-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.10.2.1 @@ -34,6 +34,8 @@ ad_proc -public get_pretty_name { } { + Get the pretty name. + } { return "#faq-portlet.admin_pretty_name#" } @@ -44,6 +46,8 @@ ad_proc -public link { } { + Get the link. This is currently empty. + } { return "" } @@ -52,7 +56,7 @@ {-package_id:required} } { Adds a faq admin PE to the given admin portal. There should only - ever be one of these portals on an admin page with only one faq_package_id + ever be one of these portals on an admin page with only one faq_package_id. @param portal_id The page to add self to @param package_id the id of the faq package @@ -70,14 +74,15 @@ ad_proc -public remove_self_from_page { portal_id } { - Removes a faq admin PE from the given portal + Removes a faq admin PE from the given portal. } { portal::remove_element -portal_id $portal_id -portlet_name [get_my_name] } ad_proc -public show { cf } { + Show the FAQ admin portlet. } { portal::show_proc_helper \ -package_key [my_package_key] \ Index: openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl,v diff -u -r1.34 -r1.34.2.1 --- openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 7 Aug 2017 23:48:11 -0000 1.34 +++ openacs-4/packages/faq-portlet/tcl/faq-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.34.2.1 @@ -38,11 +38,15 @@ ad_proc -public get_pretty_name { } { + Get pretty name. + } { return "#faq-portlet.pretty_name#" } ad_proc -public link { } { + Get link. This is currently empty. + } { return "" } @@ -52,10 +56,10 @@ {-param_action:required} } { Adds a faq PE to the given portal or appends the given - faq_package_id to the params of the faq pe already there + faq_package_id to the params of the faq pe already there. @param portal_id The page to add self to - @param faq_package_id the id of the faq package for this community + @param package_id the id of the faq package for this community @return element_id The new element's id } { @@ -78,7 +82,7 @@ } { Removes a faq PE from the given page or just the passed in faq_package_id parameter from the portlet - (that has other faq_package_ids) + (that has other faq_package_ids). @param portal_id The page to remove self from @param package_id @@ -93,6 +97,7 @@ ad_proc -public show { cf } { + Show the FAQ admin portlet. } { portal::show_proc_helper \ -package_key [my_package_key] \ Index: openacs-4/packages/faq-portlet/tcl/test/faq-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/test/faq-portlet-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/faq-portlet/tcl/test/faq-portlet-procs.tcl 27 Mar 2018 15:54:14 -0000 1.4 +++ openacs-4/packages/faq-portlet/tcl/test/faq-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -10,178 +10,178 @@ Testing the creation a Faq from the portlet. } { - aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) + aa_run_with_teardown -test_code { - # Create new Faq - set faq_name [ad_generate_random_string] - set response [faq_portlet::twt::new $faq_name] - aa_display_result -response $response -explanation {Webtest for creating a New Faq from the portlet} - - twt::user::logout - } -} + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + # Create new Faq + set faq_name [ad_generate_random_string] + set response [faq_portlet::twt::new $faq_name] + aa_display_result -response $response -explanation {Webtest for creating a New Faq from the portlet} + + twt::user::logout + } +} + aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_delete_faq_portlet { Testing the process of creating and deleting a Faq from the portlet. } { - aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) + aa_run_with_teardown -test_code { - # Create a new Faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Delete the faq - set response [faq_portlet::twt::delete $faq_name] - aa_display_result -response $response -explanation {Webtest for deleting a Faq} - - twt::user::logout - } + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + + # Create a new Faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Delete the faq + set response [faq_portlet::twt::delete $faq_name] + aa_display_result -response $response -explanation {Webtest for deleting a Faq} + + twt::user::logout + } } aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_disable_faq_portlet { - Testing the process of creating and disableing a Faq. + Testing the process of creating and disabling a Faq. } { - aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) + aa_run_with_teardown -test_code { - # Create new faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Disable the Faq - set option "disable" - set response [faq_portlet::twt::disable_enable $faq_name $option] - aa_display_result -response $response -explanation {Webtest for disabling a Faq} - - twt::user::logout - } + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + + # Create new faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Disable the Faq + set option "disable" + set response [faq_portlet::twt::disable_enable $faq_name $option] + aa_display_result -response $response -explanation {Webtest for disabling a Faq} + + twt::user::logout + } } aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_enable_faq_portlet { - Testing the process of creating, desableing and enableing Faq. + Testing the process of creating, disabling and enabling Faq. } { - aa_run_with_teardown -test_code { + aa_run_with_teardown -test_code { - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) - # Create the Faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Disable the faq - set option "disable" - faq_portlet::twt::disable_enable $faq_name $option - - # Enable the faq - set option "enable" - set response [faq_portlet::twt::disable_enable $faq_name $option] - aa_display_result -response $response -explanation {Webtest for enabling a Faq} - - twt::user::logout - } + # Create the Faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Disable the faq + set option "disable" + faq_portlet::twt::disable_enable $faq_name $option + + # Enable the faq + set option "enable" + set response [faq_portlet::twt::disable_enable $faq_name $option] + aa_display_result -response $response -explanation {Webtest for enabling a Faq} + + twt::user::logout + } } aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_edit_faq_portlet { - Testing the process of creating and editing a Faq. + Testing the process of creating and editing a Faq. } { - aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) + aa_run_with_teardown -test_code { - # Creat a new faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Edit the faq - set new_faq_name [ad_generate_random_string] - set response [faq_portlet::twt::edit_faq $faq_name $new_faq_name] - aa_display_result -response $response -explanation {Webtest for editing a Faq} - - twt::user::logout - } + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + + # Creat a new faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Edit the faq + set new_faq_name [ad_generate_random_string] + set response [faq_portlet::twt::edit_faq $faq_name $new_faq_name] + aa_display_result -response $response -explanation {Webtest for editing a Faq} + + twt::user::logout + } } aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_new_Q_A_faq_portlet { - Testing the process of create a Faq and create a new Q&A. + Testing the process of create a Faq and create a new Q&A. } { - aa_run_with_teardown -test_code { + aa_run_with_teardown -test_code { - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) - - # Creat a new faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Create a new Question_Answer - set question [ad_generate_random_string] - set answer [ad_generate_random_string] - set response [faq_portlet::twt::new_Q_A $faq_name $question $answer] - aa_display_result -response $response -explanation {Webtest for creating a New Question in a dotLRN Faq} - - twt::user::logout - } + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + + # Creat a new faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Create a new Question_Answer + set question [ad_generate_random_string] + set answer [ad_generate_random_string] + set response [faq_portlet::twt::new_Q_A $faq_name $question $answer] + aa_display_result -response $response -explanation {Webtest for creating a New Question in a dotLRN Faq} + + twt::user::logout + } } aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_delete_Q_A_faq_portlet { - Testing the process of create a faq, create a Q&A and then delete the Q&A. + Testing the process of create a faq, create a Q&A and then delete the Q&A. } { - aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) - - # Creat a new faq - set faq_name [ad_generate_random_string] - faq_portlet::twt::new $faq_name - - # Create a new Question_Answer - set question [ad_generate_random_string] - set answer [ad_generate_random_string] - faq_portlet::twt::new_Q_A $faq_name $question $answer - - # Delete the Question_Answer - set response [faq_portlet::twt::delete_Q_A $faq_name $question] - aa_display_result -response $response -explanation {Webtest for deleting a Question in a Faq} - - twt::user::logout - } + aa_run_with_teardown -test_code { + + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + + # Creat a new faq + set faq_name [ad_generate_random_string] + faq_portlet::twt::new $faq_name + + # Create a new Question_Answer + set question [ad_generate_random_string] + set answer [ad_generate_random_string] + faq_portlet::twt::new_Q_A $faq_name $question $answer + + # Delete the Question_Answer + set response [faq_portlet::twt::delete_Q_A $faq_name $question] + aa_display_result -response $response -explanation {Webtest for deleting a Question in a Faq} + + twt::user::logout + } } # Local variables: Index: openacs-4/packages/faq-portlet/tcl/test/tclwebtest-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/tcl/test/tclwebtest-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/faq-portlet/tcl/test/tclwebtest-procs.tcl 29 Mar 2018 00:13:46 -0000 1.4 +++ openacs-4/packages/faq-portlet/tcl/test/tclwebtest-procs.tcl 14 Feb 2019 16:15:01 -0000 1.4.2.1 @@ -3,7 +3,6 @@ @author Mounir Lallali @author Gerardo Morales @creation-date 14 June 2005 - } @@ -15,216 +14,216 @@ namespace eval faq_portlet::twt {} -ad_proc faq_portlet::twt::new { faq_name } { +ad_proc -private faq_portlet::twt::new { faq_name } { - set response 0 - - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url - tclwebtest::link follow "Classes" + set response 0 - # Create a new FAQ - tclwebtest::link follow ~u {one-community-admin$} + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url + tclwebtest::link follow "Classes" - tclwebtest::link follow "New FAQ" - tclwebtest::form find ~n "faq" - tclwebtest::field find ~n "faq_name" - tclwebtest::field fill "$faq_name" - tclwebtest::form submit - aa_log "Faq form submited" + # Create a new FAQ + tclwebtest::link follow ~u {one-community-admin$} - set response_url [tclwebtest::response url] - - if {[string match "*/dotlrn/classes*/faq/admin*" $response_url] } { - if {[catch {tclwebtest::link find "$faq_name"} errmsg] } { - aa_error "faq_portlet::twt::new failed $errmsg : Did't create a New Faq" - } else { - aa_log "New faq Created !!" - set response 1 - } - } else { - aa_error "faq_portlet::twt::new failed, bad response url : $response_url" - } - - return $response + tclwebtest::link follow "New FAQ" + tclwebtest::form find ~n "faq" + tclwebtest::field find ~n "faq_name" + tclwebtest::field fill "$faq_name" + tclwebtest::form submit + aa_log "Faq form submitted" + + set response_url [tclwebtest::response url] + + if {[string match "*/dotlrn/classes*/faq/admin*" $response_url] } { + if {[catch {tclwebtest::link find "$faq_name"} errmsg] } { + aa_error "faq_portlet::twt::new failed $errmsg : Didn't create a New Faq" + } else { + aa_log "New faq Created !!" + set response 1 + } + } else { + aa_error "faq_portlet::twt::new failed, bad response url : $response_url" + } + + return $response } -ad_proc faq_portlet::twt::delete { faq_name} { +ad_proc -private faq_portlet::twt::delete { faq_name} { - set response 0 + set response 0 - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url - - tclwebtest::link follow "Classes" + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url - # Create a new FAQ - tclwebtest::link follow ~u {one-community-admin$} - - tclwebtest::link follow $faq_name - tclwebtest::link follow {View All FAQs} + tclwebtest::link follow "Classes" - db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" - ::twt::do_request [export_vars -base "faq-delete" {faq_id}] + # Create a new FAQ + tclwebtest::link follow ~u {one-community-admin$} - set response_url [tclwebtest::response url] - - if { [string match "*/faq/admin/index" $response_url] } { - if {![catch {tclwebtest::link find "$faq_name" } errmsg]} { - aa_error "faq_portlet::twt::delete failed $errmsg : Did't delete $faq_name Faq" - } else { - aa_log "Faq Deleted" - set response 1 - } - } else { - aa_error "faq_portlet::twt::delete failed, bad response url : $response_url" - } - - return $response + tclwebtest::link follow $faq_name + tclwebtest::link follow {View All FAQs} + + db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" + ::twt::do_request [export_vars -base "faq-delete" {faq_id}] + + set response_url [tclwebtest::response url] + + if { [string match "*/faq/admin/index" $response_url] } { + if {![catch {tclwebtest::link find "$faq_name" } errmsg]} { + aa_error "faq_portlet::twt::delete failed $errmsg : Didn't delete $faq_name Faq" + } else { + aa_log "Faq Deleted" + set response 1 + } + } else { + aa_error "faq_portlet::twt::delete failed, bad response url : $response_url" + } + + return $response } -ad_proc faq_portlet::twt::disable_enable { faq_name option } { +ad_proc -private faq_portlet::twt::disable_enable { faq_name option } { - set response 0 + set response 0 - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url - tclwebtest::link follow "Classes" + tclwebtest::link follow "Classes" - # Create a new FAQ - tclwebtest::link follow ~u {one-community-admin$} + # Create a new FAQ + tclwebtest::link follow ~u {one-community-admin$} - tclwebtest::link follow $faq_name - tclwebtest::link follow {View All FAQs} + tclwebtest::link follow $faq_name + tclwebtest::link follow {View All FAQs} - db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" - set url_option [export_vars -base "faq-$option" {faq_id}] - ::twt::do_request $url_option - - set response_url [tclwebtest::response url] + db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" + set url_option [export_vars -base "faq-$option" {faq_id}] + ::twt::do_request $url_option - if {[string match "*/dotlrn/classes*/faq/admin*" $response_url] } { - if {! [catch {tclwebtest::link find ~u $url_option } errmsg]} { - aa_error "faq_portlet::twt::$option failed $errmsg : Did't $option $faq_name Faq" - } else { - aa_log "Faq $option" - set response 1 - } - } else { - aa_error "faq_portlet::twt::$option failed. Bad response url : $response_url " - } - - return $response + set response_url [tclwebtest::response url] + + if {[string match "*/dotlrn/classes*/faq/admin*" $response_url] } { + if {! [catch {tclwebtest::link find ~u $url_option } errmsg]} { + aa_error "faq_portlet::twt::$option failed $errmsg : Didn't $option $faq_name Faq" + } else { + aa_log "Faq $option" + set response 1 + } + } else { + aa_error "faq_portlet::twt::$option failed. Bad response url : $response_url " + } + + return $response } -ad_proc faq_portlet::twt::edit_faq { faq_name faq_new_name } { +ad_proc -private faq_portlet::twt::edit_faq { faq_name faq_new_name } { - set response 0 + set response 0 - db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" - - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url - tclwebtest::link follow "Classes" + db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" - tclwebtest::link follow ~u {one-community-admin$} - tclwebtest::link follow $faq_name - - tclwebtest::form find ~n "faq_add_edit" - tclwebtest::form submit + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url + tclwebtest::link follow "Classes" - tclwebtest::form find ~n "faq_add_edit" - tclwebtest::field find ~n "faq_name" - tclwebtest::field fill "$faq_new_name" - tclwebtest::form submit - aa_log " Faq form submited" + tclwebtest::link follow ~u {one-community-admin$} + tclwebtest::link follow $faq_name - set response_url [tclwebtest::response url] - - if {[string match "*/faq/admin/one-faq*" $response_url] } { - if { [catch {tclwebtest::form find ~n "faq_add_edit"} errmsg] || [catch {tclwebtest::field find ~v "$faq_new_name"} errmsg] } { - aa_error "faq_portlet::twt::edit_faq failed $errmsg : Did't Edit the Faq" - } else { - aa_log "Faq Edited" - set response 1 - } - } else { - aa_error "faq_portlet::twt::new failed, bad response url : $response_url" - } - - return $response + tclwebtest::form find ~n "faq_add_edit" + tclwebtest::form submit + + tclwebtest::form find ~n "faq_add_edit" + tclwebtest::field find ~n "faq_name" + tclwebtest::field fill "$faq_new_name" + tclwebtest::form submit + aa_log " Faq form submitted" + + set response_url [tclwebtest::response url] + + if {[string match "*/faq/admin/one-faq*" $response_url] } { + if { [catch {tclwebtest::form find ~n "faq_add_edit"} errmsg] || [catch {tclwebtest::field find ~v "$faq_new_name"} errmsg] } { + aa_error "faq_portlet::twt::edit_faq failed $errmsg : Didn't Edit the Faq" + } else { + aa_log "Faq Edited" + set response 1 + } + } else { + aa_error "faq_portlet::twt::new failed, bad response url : $response_url" + } + + return $response } -ad_proc faq_portlet::twt::new_Q_A { faq_name question answer} { +ad_proc -private faq_portlet::twt::new_Q_A { faq_name question answer} { - set response 0 + set response 0 - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url - tclwebtest::link follow "Classes" - tclwebtest::link follow ~u {one-community-admin$} - tclwebtest::link follow $faq_name - - tclwebtest::link follow "Create New Q&A" - - tclwebtest::form find ~n "new_quest_answ" - tclwebtest::field find ~n "question" - tclwebtest::field fill "$question" - tclwebtest::field find ~n "answer" - tclwebtest::field fill "$answer" - tclwebtest::form submit - aa_log " Faq Question Form submited" - - set response_url [tclwebtest::response url] + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url + tclwebtest::link follow "Classes" + tclwebtest::link follow ~u {one-community-admin$} + tclwebtest::link follow $faq_name - if { [string match "*/faq/admin/one-faq*" $response_url] } { - if { [catch {tclwebtest::assert text "$question"} errmsg] } { - aa_error "faq_portlet::twt::new_Q_A : failed $errmsg : Did't Create a New Question" - } else { - aa_log "New Faq Question Created" - set response 1 - } - } else { - aa_error "dotlrn_faq::twt::new_Q_A failed. Bad response url : $response_url" - } - - return $response + tclwebtest::link follow "Create New Q&A" + + tclwebtest::form find ~n "new_quest_answ" + tclwebtest::field find ~n "question" + tclwebtest::field fill "$question" + tclwebtest::field find ~n "answer" + tclwebtest::field fill "$answer" + tclwebtest::form submit + aa_log " Faq Question Form submitted" + + set response_url [tclwebtest::response url] + + if { [string match "*/faq/admin/one-faq*" $response_url] } { + if { [catch {tclwebtest::assert text "$question"} errmsg] } { + aa_error "faq_portlet::twt::new_Q_A : failed $errmsg : Didn't Create a New Question" + } else { + aa_log "New Faq Question Created" + set response 1 + } + } else { + aa_error "dotlrn_faq::twt::new_Q_A failed. Bad response url : $response_url" + } + + return $response } -ad_proc faq_portlet::twt::delete_Q_A { faq_name question} { +ad_proc -private faq_portlet::twt::delete_Q_A { faq_name question} { - set response 0 + set response 0 - set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" - ::twt::do_request $dotlrn_page_url - tclwebtest::link follow "Classes" - tclwebtest::link follow ~u {one-community-admin$} - tclwebtest::link follow $faq_name + set dotlrn_page_url "[site_node::get_package_url -package_key dotlrn]admin" + ::twt::do_request $dotlrn_page_url + tclwebtest::link follow "Classes" + tclwebtest::link follow ~u {one-community-admin$} + tclwebtest::link follow $faq_name - tclwebtest::link follow {View All FAQs} - tclwebtest::link follow $faq_name + tclwebtest::link follow {View All FAQs} + tclwebtest::link follow $faq_name - db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" - tclwebtest::link follow delete - - set response_url [tclwebtest::response url] + db_1row faq_id "select faq_id from faqs where faq_name=:faq_name" + tclwebtest::link follow delete - if { [string match "*/faq/admin/one-faq*" $response_url] } { - if { [catch {tclwebtest::assert text -fail "$question"} errmsg] } { - aa_error "faq_portlet::twt::delete_Q_A : failed $errmsg : Did't Delete a Question" - } else { - aa_log "Faq Question Deleted" - set response 1 - } + set response_url [tclwebtest::response url] + + if { [string match "*/faq/admin/one-faq*" $response_url] } { + if { [catch {tclwebtest::assert text -fail "$question"} errmsg] } { + aa_error "faq_portlet::twt::delete_Q_A : failed $errmsg : Didn't Delete a Question" } else { - aa_error "dotlrn_faq::twt::delete_Q_A failed. Bad response url : $response_url" + aa_log "Faq Question Deleted" + set response 1 } - - return $response + } else { + aa_error "dotlrn_faq::twt::delete_Q_A failed. Bad response url : $response_url" } + return $response +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/faq-portlet/www/faq-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq-portlet/www/faq-admin-portlet.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/faq-portlet/www/faq-admin-portlet.tcl 7 Aug 2017 23:48:11 -0000 1.9 +++ openacs-4/packages/faq-portlet/www/faq-admin-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -16,9 +16,9 @@ ad_page_contract { The display logic for the FAQ admin portlet - + @author Ben Adida (ben@openforce) - @cvs_id $Id$ + @cvs-id $Id$ } -properties { } Fisheye: Tag 1.10.22.1 refers to a dead (removed) revision in file `openacs-4/packages/faq-portlet/www/faq-portlet-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2.22.1 refers to a dead (removed) revision in file `openacs-4/packages/faq-portlet/www/faq-portlet-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/download-zip.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/download-zip.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/file-storage/www/download-zip.tcl 29 Dec 2017 11:30:40 -0000 1.9 +++ openacs-4/packages/file-storage/www/download-zip.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -1,5 +1,5 @@ ad_page_contract { - delete items + Download items as a ZIP file } { object_id:naturalnum,notnull,multiple {confirm_p:optional,boolean 0} Index: openacs-4/packages/file-storage/www/folder-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-chunk.tcl,v diff -u -r1.61 -r1.61.2.1 --- openacs-4/packages/file-storage/www/folder-chunk.tcl 20 Dec 2018 18:18:05 -0000 1.61 +++ openacs-4/packages/file-storage/www/folder-chunk.tcl 14 Feb 2019 16:15:01 -0000 1.61.2.1 @@ -99,9 +99,9 @@ if {$delete_p && $root_folder_id ne $folder_id} { lappend actions \ - "#file-storage.Delete_this_folder#" \ - [export_vars -base "${fs_url}folder-delete" {folder_id}] \ - "#file-storage.Delete_this_folder#" + "#file-storage.Delete_this_folder#" \ + [export_vars -base "${fs_url}folder-delete" {folder_id}] \ + "#file-storage.Delete_this_folder#" } if {$admin_p} { if { $root_folder_id ne $folder_id } { @@ -112,8 +112,8 @@ } lappend actions \ "#file-storage.lt_Modify_permissions_on_1#" \ - [export_vars -base "${fs_url}permissions" -override {{object_id $folder_id}} {{return_url "[ad_conn url]"}}] \ - "#file-storage.lt_Modify_permissions_on_1#" + [export_vars -base "${fs_url}permissions" -override {{object_id $folder_id}} {{return_url "[ad_conn url]"}}] \ + "#file-storage.lt_Modify_permissions_on_1#" if { $expose_rss_p } { lappend actions "Configure RSS" [export_vars -base "${fs_url}admin/rss-subscrs" {folder_id}] "Configure RSS" } @@ -122,9 +122,9 @@ if { $categories_p } { if { [permission::permission_p -party_id $viewing_user_id -object_id $package_id -privilege "admin"] } { lappend actions \ - [_ categories.cadmin] \ - [export_vars -base "/categories/cadmin/object-map" -url {{object_id $package_id}}] \ - [_ categories.cadmin] + [_ categories.cadmin] \ + [export_vars -base "/categories/cadmin/object-map" -url {{object_id $package_id}}] \ + [_ categories.cadmin] } set category_links [fs::category_links -object_id $folder_id -folder_id $folder_id -selected_category_id $category_id -fs_url $fs_url] } @@ -403,7 +403,7 @@ set file_url $download_url } else { set download_url [export_vars -base ${fs_url}download/[ad_urlencode_path $name] {{file_id $target_object_id}}] - set file_url ${fs_url}view/${file_url} + set file_url ${fs_url}view/${file_url} } } default { @@ -422,7 +422,7 @@ set file_url [export_vars -base ${fs_url}download/[ad_urlencode_path $title] {{file_id $object_id}}] } else { set download_url /file/$object_id/[ad_urlencode_path $name] - set file_url ${fs_url}view/[ad_urlencode_folder_path $folder_path][ad_urlencode_path $name] + set file_url ${fs_url}view/[ad_urlencode_folder_path $folder_path][ad_urlencode_path $name] } } } @@ -433,11 +433,11 @@ set cat_folder_id $folder_id } set categories [fs::category_links \ - -object_id $object_id \ - -folder_id $cat_folder_id \ - -selected_category_id $category_id \ - -fs_url $fs_url \ - -joinwith "
"] + -object_id $object_id \ + -folder_id $cat_folder_id \ + -selected_category_id $category_id \ + -fs_url $fs_url \ + -joinwith "
"] } } Index: openacs-4/packages/file-storage/www/folder-zip-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/folder-zip-add.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/file-storage/www/folder-zip-add.tcl 6 Dec 2018 15:48:10 -0000 1.11 +++ openacs-4/packages/file-storage/www/folder-zip-add.tcl 14 Feb 2019 16:15:01 -0000 1.11.2.1 @@ -1,36 +1,49 @@ ad_page_contract { - page to add a new file to the system + Page to upload and decompress a zip file into the file storage. + @author Kevin Scaldeferri (kevin@arsdigita.com) @creation-date 6 Nov 2000 @cvs-id $Id$ + } { + file_id:naturalnum,optional,notnull - folder_id:naturalnum,optional,notnull + {folder_id:naturalnum,notnull ""} upload_file:trim,optional,notnull - return_url:localurl,optional + {return_url:localurl ""} upload_file.tmpfile:tmpfile,optional {title ""} {lock_title_p:boolean 0} } -properties { + folder_id:onevalue context:onevalue title:onevalue lock_title_p:onevalue + } -validate { + file_id_or_folder_id { - if {[info exists file_id] && $file_id ne "" - && (![info exists folder_id] || $folder_id eq "")} { + # + # Get parent folder_id from file_id, if such exists and folder_id is + # empty, and complain if the resultant folder is not valid. + # + if {[info exists file_id] && $file_id ne "" && $folder_id eq ""} { set folder_id [db_string get_folder_id { select parent_id as folder_id from cr_items where item_id=:file_id } -default ""] } - if {![info exists folder_id] || ![fs_folder_p $folder_id]} { + if {$folder_id eq "" || ![fs_folder_p $folder_id]} { ad_complain "The specified parent folder is not valid." } } + max_size -requires {upload_file} { + # + # Check if the file is larger than fs::max_upload_size. + # set n_bytes [file size ${upload_file.tmpfile}] set max_bytes [fs::max_upload_size] if { $n_bytes > $max_bytes } { @@ -39,203 +52,238 @@ } } -set user_id [ad_conn user_id] -set package_id [ad_conn package_id] -# check for write permission on the folder or item +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] +set creation_ip [ad_conn peeraddr] +# Check for write permission on the folder. permission::require_permission \ -object_id $folder_id \ -party_id $user_id \ -privilege "write" if {![ad_form_new_p -key file_id]} { + # + # Check for write permission on the file if we are editing existing data, + # adding a file revision in this case, and set the context bar accordingly. + # permission::require_permission \ - -object_id $file_id \ - -party_id $user_id \ - -privilege "write" + -object_id $file_id \ + -party_id $user_id \ + -privilege "write" set context [fs_context_bar_list -final "[_ file-storage.Add_Revision]" $folder_id] - } else { set context [fs_context_bar_list -final "[_ file-storage.Add_File]" $folder_id] } +# Add file_id and upload_file to the form. ad_form -name file_add -html { enctype multipart/form-data } -export { folder_id lock_title_p } -form { file_id:key {upload_file:file {label \#file-storage.Upload_a_file\#} {html "size 30"}} } -if {[info exists return_url] && $return_url ne ""} { +# Add return_url to the form if is not empty. +if {$return_url ne ""} { ad_form -extend -name file_add -form { - {return_url:text(hidden) {value $return_url}} + {return_url:text(hidden) {value $return_url}} } } +# 'Lock' title if lock_title_p. if {$lock_title_p} { ad_form -extend -name file_add -form { - {title:text(hidden) {value $title}} + {title:text(hidden) {value $title}} } } else { ad_form -extend -name file_add -form { - {title:text {label \#file-storage.Title\#} {html {size 30}} } + {title:text {label \#file-storage.Title\#} {html {size 30}} } } } -if {[ad_form_new_p -key file_id]} { +# Add an explanation about the purpose of the form. +if {[ad_form_new_p -key file_id]} { ad_form -extend -name file_add -form { {unpack_message:text(inform) {label "[_ file-storage.Important]"} {value "[_ file-storage.Use_this_form_to_upload_a_ZIP]"}} } } +# Rest of the form. ad_form -extend -name file_add -form {} -new_data { - - # create a new folder to hold the zip contents - # TODO make sure its name is unique? - + # + # new_data block, which unzips the file and uploads its contents to the file + # storage, creating the necessary folders. + # + # Start defining the title if it does not exist already. + # if {$title eq ""} { - set title [file rootname [list [template::util::file::get_property filename $upload_file]]] + set title [file rootname [list [template::util::file::get_property filename $upload_file]]] } - set folder_id [content::item::get_id_by_name -name $title -parent_id $folder_id] + + # + # Create a new folder to hold the zip contents, if it does not exist already. + # + set parent_folder_id $folder_id + set folder_id [content::item::get_id_by_name -name $title -parent_id $parent_folder_id] if {$folder_id eq ""} { - set folder_id [content::folder::new -name $title -parent_id $folder_id -label $title] + set folder_id [content::folder::new -name $title -parent_id $parent_folder_id -label $title] } - + + # + # Uncompress the file. + # set unzip_binary [string trim [parameter::get -parameter UnzipBinary]] - if { $unzip_binary ne "" } { - + # + # Create temp directory to unzip. + # set unzip_path [ad_tmpnam] file mkdir $unzip_path + + # + # Unzip. + # + # More flexible parameter design could be: + # zip {unzip -jd {out_path} {in_file}} tar {tar xf {in_file} {out_path}} tgz {tar xzf {in_file} {out_path}} + # # save paths! get rid of -j switch --DAVEB 20050628 + # catch { exec $unzip_binary -d $unzip_path ${upload_file.tmpfile} } errmsg - - # More flexible parameter design could be: - # zip {unzip -jd {out_path} {in_file}} tar {tar xf {in_file} {out_path}} tgz {tar xzf {in_file} {out_path}} - + + # + # Get two lists of the files to upload, with and without their full path. + # set upload_files [list] set upload_tmpfiles [list] - foreach file [ad_find_all_files "$unzip_path"] { lappend upload_files [regsub "^$unzip_path\/" $file {}] lappend upload_tmpfiles $file } - } else { - set upload_files [list [template::util::file::get_property filename $upload_file]] + # + # No unzip available, just upload the whole zip file. + # + set upload_files [list [template::util::file::get_property filename $upload_file]] set upload_tmpfiles [list [template::util::file::get_property tmp_filename $upload_file]] } - - if { [lindex $upload_files 0] eq ""} { + set number_upload_files [llength $upload_files] + + # + # Something is quite broken if there are no files to upload. + # + if {$number_upload_files == 0} { ad_return_complaint 1 "
  • You have to upload a file" ad_script_abort } - - set i 0 - set number_upload_files [llength $upload_files] - set unzip_path_list_len [llength [file split $unzip_path]] + # + # Upload the files. + # + set i 0 foreach upload_file $upload_files tmpfile $upload_tmpfiles { - set this_file_id $file_id - set this_title $title - # upload a new file - # if the user choose upload from the folder view - # and the file with the same name already exists - # we create a new revision - - # check if this is in a folder inside the zip and create - # the folders if they don't exist - set p_f_id $folder_id - set file_paths [file split [file dirname $upload_file]] + # + # Upload a file. + # + set this_file_id $file_id + set p_f_id $folder_id + set file_paths [file split [file dirname $upload_file]] + if {"." ne $file_paths && [llength $file_paths] > 0} { + # + # Make sure every folder exists, or create it otherwise. + # + set path "" + foreach p $file_paths { + append path /${p} + if {![info exists paths($path)]} { + set f_id [content::item::get_id -item_path $path -root_folder_id $p_f_id] + if {$f_id eq ""} { + set p_f_id [content::folder::new -parent_id $p_f_id -name $p -label $p] + set paths($path) $p_f_id + } + } else { + set p_f_id $paths($path) + } + } + set upload_file [file tail $upload_file] + } + set this_title $upload_file + set this_folder_id $p_f_id - # remove unzip_path portion by selecting remaining part of list - set file_paths [lrange $file_paths $unzip_path_list_len end] + # + # If the user choose upload from the folder view, and a file with the + # same name already exists, we create a new revision. + # + # Check for permission in the existing file in order to do so. + # + set existing_item_id [fs::get_item_id -name $upload_file -folder_id $this_folder_id] + if {$existing_item_id ne ""} { + set this_file_id $existing_item_id + permission::require_permission \ + -object_id $this_file_id \ + -party_id $user_id \ + -privilege write + } - if {"." ne $file_paths && [llength $file_paths] > 0} { - # make sure every folder exists - set path "" - foreach p $file_paths { - append path /${p} - if {![info exists paths($path)]} { - set f_id [content::item::get_id -item_path $path -root_folder_id $p_f_id] - if {$f_id eq ""} { - set p_f_id [content::folder::new -parent_id $p_f_id -name $p -label $p] - set paths($path) $p_f_id - } - } else { - set p_f_id $paths($path) - } - - } - set upload_file [file tail $upload_file] - } - - set this_folder_id $p_f_id - set this_title $upload_file - - set existing_item_id [fs::get_item_id -name $upload_file -folder_id $this_folder_id] - - if {$existing_item_id ne ""} { - # file with the same name already exists - # in this folder, create a new revision - set this_file_id $existing_item_id - permission::require_permission \ - -object_id $this_file_id \ - -party_id $user_id \ - -privilege write - } - - set rev_id [fs::add_file \ - -name $upload_file \ - -item_id $this_file_id \ - -parent_id $this_folder_id \ - -tmp_filename $tmpfile \ - -creation_user $user_id \ - -creation_ip [ad_conn peeraddr] \ - -title $this_title \ - -package_id $package_id] - - file delete -- $tmpfile - incr i + # + # Add the file. + # + set rev_id [fs::add_file \ + -name $upload_file \ + -item_id $this_file_id \ + -parent_id $this_folder_id \ + -tmp_filename $tmpfile \ + -creation_user $user_id \ + -creation_ip $creation_ip \ + -title $this_title \ + -package_id $package_id] - if {$rev_id ne ""} { - set this_file_id [db_string get_item_id { - select item_id - from cr_revisions - where revision_id = :rev_id - } -default 0] - } - - if {$i < $number_upload_files} { - set file_id [db_nextval "acs_object_id_seq"] - } - + # + # Increment file_id to the next value of acs_object_id_seq. + # + incr i + if {$i < $number_upload_files} { + set file_id [db_nextval "acs_object_id_seq"] + } + + # + # Cleanup of the tmp file. + # + file delete -- $tmpfile } + + # + # Cleanup of zip file and tmp directory. + # + file delete -- $upload_file.tmpfile if {$unzip_path ne ""} { - file delete -force -- $unzip_path + file delete -force -- $unzip_path } - file delete -- $upload_file.tmpfile + } -edit_data { + # + # edit_data block, which just adds a revision of a file. + # fs::add_version \ - -name [template::util::file::get_property filename $upload_file] \ - -tmp_filename [template::util::file::get_property tmp_filename $upload_file] \ - -item_id $file_id \ - -creation_user $user_id \ - -creation_ip [ad_conn peeraddr] \ - -title $title \ - -package_id $package_id - + -name [template::util::file::get_property filename $upload_file] \ + -tmp_filename [template::util::file::get_property tmp_filename $upload_file] \ + -item_id $file_id \ + -creation_user $user_id \ + -creation_ip $creation_ip \ + -title $title \ + -package_id $package_id + } -after_submit { - - if {[info exists return_url] && $return_url ne ""} { - ad_returnredirect $return_url + # + # Code to be executed after new_data or edit_data, just redirecting to + # return_url. + # + if {$return_url ne ""} { + ad_returnredirect $return_url } else { - ad_returnredirect [export_vars -base ./ {folder_id}] + ad_returnredirect [export_vars -base ./ {folder_id}] } ad_script_abort - } -set unpack_available_p [expr {[string trim [parameter::get -parameter UnzipBinary]] ne ""}] - ad_return_template # Local variables: 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.12 -r1.12.2.1 --- openacs-4/packages/forums/tcl/forums-callback-procs.tcl 10 Jul 2018 10:20:32 -0000 1.12 +++ openacs-4/packages/forums/tcl/forums-callback-procs.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -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 @@ -209,11 +209,11 @@ title $message(subject) \ content $combined_content \ relevant_date $relevant_date \ - community_id [db_null] \ + community_id "" \ 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/forums-portlet/www/forums-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums-portlet/www/forums-portlet.adp,v diff -u -r1.24 -r1.24.2.1 --- openacs-4/packages/forums-portlet/www/forums-portlet.adp 19 Jun 2018 15:23:42 -0000 1.24 +++ openacs-4/packages/forums-portlet/www/forums-portlet.adp 14 Feb 2019 16:15:01 -0000 1.24.2.1 @@ -25,7 +25,7 @@

    • - + @forums.name@ (@forums.count_unread@) Index: openacs-4/packages/general-comments/tcl/general-comments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.tcl,v diff -u -r1.25 -r1.25.2.1 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 16 May 2018 11:56:59 -0000 1.25 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 14 Feb 2019 16:15:01 -0000 1.25.2.1 @@ -43,7 +43,8 @@ db_exec_plsql insert_comment {} db_dml add_entry {} - db_1row get_revision {} + set revision_id [content::item::get_latest_revision \ + -item_id $comment_id] db_dml set_content {} -blobs [list $content] # Grant the user sufficient permissions to @@ -161,12 +162,12 @@ and (:user_id is null or o.creation_user = :user_id) order by o.creation_date $sort_dir }] { - set author [acs_object_name $author] - + set author [person::name -person_id $author] + if {$content ne ""} { set content [template::util::richtext::get_property html_value [list $content $mime_type]] } - + set pretty_date [lc_time_fmt $creation_date %x] set pretty_date2 [lc_time_fmt $creation_date "%q %X"] Fisheye: Tag 1.1.12.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/delete-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.12.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/delete-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/general-comments/www/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete.tcl,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/general-comments/www/delete.tcl 20 Jan 2018 22:56:50 -0000 1.5 +++ openacs-4/packages/general-comments/www/delete.tcl 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -28,7 +28,7 @@ permission::require_permission -party_id [ad_conn user_id] -object_id $comment_id -privilege "write" set revision_id [content::item::get_best_revision -item_id $comment_id] # get data from database -set sql " +set sql { select r.title, r.content, r.mime_type, @@ -39,19 +39,18 @@ general_comments g where g.comment_id = :comment_id and g.comment_id = o.object_id and - r.revision_id = $revision_id" + r.revision_id = :revision_id +} if { ![db_0or1row get_comment $sql] } { - ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" + ad_return_complaint 1 [_ general-comments.lt_The_comment_id_does_n] ad_script_abort } set author [person::name -person_id $creation_user] -set page_title "[_ general-comments.Delete_a_comment]" -set context [list "[_ general-comments.Delete_a_comment]"] +set page_title [_ general-comments.Delete_a_comment] +set context [list $page_title] -ad_return_template - # Local variables: # mode: tcl # tcl-indent-level: 4 Fisheye: Tag 1.4.2.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/index-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5.2.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/index-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/general-comments/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/index.tcl,v diff -u -r1.10 -r1.10.2.1 --- openacs-4/packages/general-comments/www/index.tcl 7 Aug 2017 23:48:12 -0000 1.10 +++ openacs-4/packages/general-comments/www/index.tcl 14 Feb 2019 16:15:01 -0000 1.10.2.1 @@ -2,12 +2,12 @@ ad_page_contract { General comments main page - + @author Phong Nguyen (phong@arsdigita.com) @author Pascal Scheffers (pascal@scheffers.net) @creation-date 2000-10-12 @cvs-id $Id$ -} -query { +} -query { {orderby:token,optional} {approval "any"} {modified "any"} @@ -51,48 +51,47 @@ -no_data "#general-comments.lt_No_comments_available#" \ -html {style "margin: 0 auto"} \ -elements { - counter { - label "#general-comments.Num#" - } + counter { + label "#general-comments.Num#" + display_template {@comments.rownum;literal@} + } comment_id { - label "#general-comments.ID#" - display_template {@comments.comment_id@} - orderby {comment_id} - } - title { - label "#general-comments.Title_1#" - orderby {title} - } - approved_p { - label "#general-comments.Approved#" - html {align center} - orderby {approved_p} - } - live_version_p { - label "#general-comments.Has_live_version#" - html {align center} - orderby {approved_p} - } - pretty_date { - label "#general-comments.Last_Modified#" - orderby {creation_date} - } - } -filters {approval {} modified {}} + label "#general-comments.ID#" + display_template {@comments.comment_id@} + orderby {comment_id} + } + title { + label "#general-comments.Title_1#" + orderby {title} + } + approved_p { + label "#general-comments.Approved#" + html {align center} + orderby {approved_p} + } + live_version_p { + label "#general-comments.Has_live_version#" + html {align center} + orderby {approved_p} + } + pretty_date { + label "#general-comments.Last_Modified#" + orderby {creation_date} + } +} -filters {approval {} modified {}} -set count 0 -db_multirow -extend {user_id return_url counter pretty_date} comments comments_select {} { - set counter [incr count] +set yes [_ acs-kernel.common_Yes] +set no [_ acs-kernel.common_No] + +db_multirow -extend {user_id return_url pretty_date} comments comments_select {} { + set live_version_p [expr {$live_version_p ? $yes : $no}] + set approved_p [expr {$approved_p ? $yes : $no}] set pretty_date [lc_time_fmt $creation_date "%x %X"] - set approved_p [util_PrettyTclBoolean $approved_p] - set live_version_p [util_PrettyTclBoolean $live_version_p] } -set page_title "[_ general-comments.General_Comments]" +set page_title [_ general-comments.General_Comments] set context {} -ad_return_template - - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/general-comments/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/index.xql,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/packages/general-comments/www/index.xql 22 Nov 2017 14:13:32 -0000 1.2 +++ openacs-4/packages/general-comments/www/index.xql 14 Feb 2019 16:15:01 -0000 1.2.2.1 @@ -3,17 +3,15 @@ - - i.live_revision is not null - + (i.live_revision is not null and + i.live_revision = r.revision_id) - - i.live_revision is null - + (i.live_revision is null or + i.live_revision <> r.revision_id) @@ -40,5 +38,27 @@ + + + + select g.comment_id, + r.title, + i.live_revision is not null as live_version_p, + i.live_revision is not null and + i.live_revision = r.revision_id as approved_p, + o.creation_date + from general_comments g, + cr_items i, + cr_revisions r, + acs_objects o + where g.comment_id = i.item_id and + r.revision_id = o.object_id and + r.revision_id = i.latest_revision and + o.creation_user = :user_id + [ad_dimensional_sql $dimensional] + [template::list::orderby_clause -orderby -name comments_list] + + + Fisheye: Tag 1.3.6.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/view-comment-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3.6.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/view-comment-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/general-comments/www/view-comment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/view-comment.tcl,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/general-comments/www/view-comment.tcl 20 Jan 2018 22:56:50 -0000 1.12 +++ openacs-4/packages/general-comments/www/view-comment.tcl 14 Feb 2019 16:15:01 -0000 1.12.2.1 @@ -40,29 +40,41 @@ set write_perm_p [permission::permission_p -object_id $comment_id -privilege write] set admin_p [permission::permission_p -object_id $package_id -privilege admin] +set live_revision [content::item::get_live_revision -item_id $comment_id] + # if the user has write permissions then allow # viewing of selected revision -if { $write_perm_p == 1 } { - if { $revision_id eq "" } { - # get the latest revision - set revision_id [db_string get_latest_revision { - select content_item.get_latest_revision(:comment_id) from dual - }] - } - # get revision data from the database - if { ![db_0or1row get_revision_comment {}] } { - ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" - ad_script_abort - } +if { !$write_perm_p } { + # get live revision + set revision_id $live_revision +} elseif { $revision_id eq "" } { + # get the latest revision + set revision_id [content::item::get_latest_revision -item_id $comment_id] +} -} else { - # get live revision data from the database - if { ![db_0or1row get_comment {}] } { - ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" - ad_script_abort - } +# get revision data from the database +if { ![db_0or1row get_revision_comment { + select g.object_id, + g.comment_id, + r.revision_id, + r.title, + r.content, + r.mime_type as comment_mime_type, + o.creation_user, + o.creation_date + from general_comments g, + cr_revisions r, + acs_objects o + where g.comment_id = o.object_id and + g.comment_id = r.item_id and + r.revision_id = :revision_id +}] } { + ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" + ad_script_abort } +set author [person::name -person_id $creation_user] + db_multirow -extend {file_edit_url delete_attachment_url view_image_url} attachments get_attachments { select r.title, r.mime_type, @@ -90,25 +102,30 @@ set delete_attachment_url [export_vars -base "delete-attachment" {{attach_id $item_id} {parent_id $comment_id} return_url}] } -db_multirow -extend {view_comment_url} revisions get_revisions {*SQL*} { +db_multirow -unclobber -extend {view_comment_url} revisions get_revisions { + select r.revision_id, + o.creation_date as revision_date + from cr_revisions r, + acs_objects o + where r.item_id = :comment_id and + o.object_id = r.revision_id + order by o.creation_date desc +} { set revision_date [lc_time_fmt $revision_date %c] set view_comment_url [export_vars -base "view-comment" {comment_id revision_id return_url}] } set allow_file_p [parameter::get -parameter AllowFileAttachmentsP -default {t}] set allow_link_p [parameter::get -parameter AllowLinkAttachmentsP -default {t}] -set allow_attach_p "t" -if { $allow_file_p == "f" && $allow_link_p == "f" } { - set allow_attach_p "f" -} -set comment_on_id [db_string get_object_id "select object_id from general_comments where comment_id = :comment_id"] +set allow_attach_p [expr { !($allow_file_p == "f" && $allow_link_p == "f")}] +set comment_on_id [db_string get_object_id { + select object_id from general_comments + where comment_id = :comment_id +}] set page_title "[_ general-comments.View_comment_on]: [acs_object_name $comment_on_id]" set context "\"[_ general-comments.View_comment]\"" set return_url_view "view-comment?[export_ns_set_vars url]" -set is_creator_p "f" -if { $user_id == $creation_user } { - set is_creator_p "t" -} +set is_creator_p [expr {$user_id == $creation_user}] if { $comment_mime_type ne "text/html" } { set html_content "

      [ad_html_text_convert -from $comment_mime_type -- $content]

      " @@ -136,8 +153,6 @@ set admin_toggle_text [_ general-comments.reject_this_revision] } -ad_return_template - # Local variables: # mode: tcl # tcl-indent-level: 4 Fisheye: Tag 1.2.18.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/view-comment.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.30.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/admin/delete-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1.30.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/admin/delete-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/general-comments/www/admin/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/admin/delete.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/general-comments/www/admin/delete.tcl 20 Jan 2018 22:56:50 -0000 1.7 +++ openacs-4/packages/general-comments/www/admin/delete.tcl 14 Feb 2019 16:15:01 -0000 1.7.2.1 @@ -25,31 +25,31 @@ return_url:onevalue } +set revision_id [content::item::get_best_revision -item_id $comment_id] # get data from database -set sql " +set sql { select r.title, r.content, r.mime_type, o.creation_user, - to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date, - acs_object.name(o.creation_user) as author + to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date from acs_objects o, cr_revisions r, general_comments g where g.comment_id = :comment_id and g.comment_id = o.object_id and - r.revision_id = content_item.get_latest_revision(g.comment_id)" + r.revision_id = :revision_id +} if { ![db_0or1row get_comment $sql] } { - ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" + ad_return_complaint 1 [_ general-comments.lt_The_comment_id_does_n] ad_script_abort } -set page_title "[_ general-comments.Delete_a_comment]" -set context [list "[_ general-comments.Delete_a_comment]"] +set author [person::name -person_id $creation_user] +set page_title [_ general-comments.Delete_a_comment] +set context [list $page_title] -ad_return_template - # Local variables: # mode: tcl # tcl-indent-level: 4 Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/admin/index-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.4.2.1 refers to a dead (removed) revision in file `openacs-4/packages/general-comments/www/admin/index-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/general-comments/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/admin/index.tcl,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/general-comments/www/admin/index.tcl 20 Jan 2018 22:56:50 -0000 1.8 +++ openacs-4/packages/general-comments/www/admin/index.tcl 14 Feb 2019 16:15:01 -0000 1.8.2.1 @@ -44,7 +44,8 @@ -html {style "margin: 0 auto"} \ -elements { counter { - label "#general-comments.Num#" + label "#general-comments.Num#" + display_template {@comments.rownum;literal@} } comment_id { label "#general-comments.ID#" @@ -55,7 +56,13 @@ label "#general-comments.Title_1#" orderby {title} } - approved_p_pretty { + author { + label "#general-comments.Author#" + orderby {(select first_names || last_name + from persons + where person_id = o.creation_user)} + } + approved_p { label "#general-comments.Approved#" html {align center} orderby {approved_p} @@ -79,20 +86,41 @@ } } -filters {approval {} modified {}} -set count 0 -db_multirow -extend {user_id return_url counter approved_p_pretty pretty_date} comments comments_select {} { - set counter [incr count] +set yes [_ acs-kernel.common_Yes] +set no [_ acs-kernel.common_No] + +db_multirow -extend { + user_id + return_url + pretty_date + author +} comments comments_select [subst { + select g.comment_id, + r.title, + o.creation_user, + i.live_revision is not null as live_version_p, + i.live_revision = r.revision_id as approved_p, + to_char(o.creation_date, 'MM-DD-YYYY HH12:MI:AM') as pretty_date, + o.creation_date + from general_comments g, + cr_items i, + cr_revisions r, + acs_objects o + where g.comment_id = i.item_id and + r.revision_id = o.object_id and + r.revision_id = i.latest_revision + [ad_dimensional_sql $dimensional] + [template::list::orderby_clause -orderby -name comments_list] +}] { + set author [person::name -person_id $creation_user] + set live_version_p [expr {$live_version_p ? $yes : $no}] + set approved_p [expr {$approved_p ? $yes : $no}] set pretty_date [lc_time_fmt $creation_date "%x %X"] - set approved_p_pretty [util_PrettyTclBoolean $approved_p] - set live_version_p [util_PrettyTclBoolean $live_version_p] } set page_title "[_ general-comments.lt_General_Comments_Admi]" set context {} -ad_return_template - - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.216 -r1.216.2.1 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 19 Dec 2018 18:40:31 -0000 1.216 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 14 Feb 2019 16:15:01 -0000 1.216.2.1 @@ -266,7 +266,7 @@ # put the element IDs into buckets by region... lappend element_ids($entry(region)) $entry(element_id) } if_no_rows { - set element_ids {} + array set element_ids {} } set element_list [array get element_ids] 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.18 -r1.18.2.1 --- openacs-4/packages/news/tcl/test/news-db-test-init.tcl 20 Oct 2018 11:55:29 -0000 1.18 +++ openacs-4/packages/news/tcl/test/news-db-test-init.tcl 14 Feb 2019 16:15:01 -0000 1.18.2.1 @@ -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,18 +163,18 @@ 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"] set p_approval_ip [ad_conn "peeraddr"] set p_approval_date [dt_sysdate] set p_archive_date [dt_sysdate] } else { - set p_approval_user [db_null] - set p_approval_ip [db_null] - set p_approval_date [db_null] - set p_archive_date [db_null] + set p_approval_user "" + set p_approval_ip "" + set p_approval_date "" + set p_archive_date "" } set news_id [db_exec_plsql item-create { begin @@ -224,21 +224,21 @@ 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"] set p_approval_ip [ad_conn "peeraddr"] set p_approval_date [dt_sysdate] set p_archive_date [dt_sysdate] } else { - set p_approval_user [db_null] - set p_approval_ip [db_null] - set p_approval_date [db_null] - set p_archive_date [db_null] + set p_approval_user "" + set p_approval_ip "" + set p_approval_date "" + set p_archive_date "" } set revision_id [db_exec_plsql revision-create { begin @@ -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} @@ -1041,7 +1041,7 @@ # set p_news_id $news_id aa_call_component db-get-cr-news-row - aa_equals "Check the archive_date is null" $archive_date [db_null] + aa_equals "Check the archive_date is null" $archive_date "" # # Set the archive period, providing an explicit archive date. @@ -1162,10 +1162,10 @@ if {!$retrieval_ok_p} { aa_error "cr_news row not found for new revision news_id $revision2_id" } else { - aa_equals "Check the archive_date is null" $archive_date [db_null] - aa_equals "Check the approval_date is null" $approval_date [db_null] - aa_equals "Check the aprroval_user is null" $approval_user [db_null] - aa_equals "Check the approval_ip is null" $approval_ip [db_null] + aa_equals "Check the archive_date is null" $archive_date "" + aa_equals "Check the approval_date is null" $approval_date "" + aa_equals "Check the aprroval_user is null" $approval_user "" + aa_equals "Check the approval_ip is null" $approval_ip "" } # @@ -1176,7 +1176,7 @@ if {!$retrieval_ok_p} { aa_error "cr_revisions row not found for new revision revision_id $revision2_id" } else { - aa_equals "Check revision 2 publish_date is null" $publish_date [db_null] + aa_equals "Check revision 2 publish_date is null" $publish_date "" } # @@ -1295,10 +1295,10 @@ aa_log "Unapproving revision 1, setting publish_date null, archive_date null" set p_revision_id $revision1_id set p_approve_p "t" - set p_publish_date [db_null] - set p_archive_date [db_null] + set p_publish_date "" + set p_archive_date "" set p_approval_user [ad_conn "user_id"] - set p_approval_date [db_null] + set p_approval_date "" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve @@ -1317,7 +1317,7 @@ set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date [clock format [clock scan "+ 1 year"] -format %Y-%m-%d] ; # in the future - set p_archive_date [db_null] + set p_archive_date "" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] @@ -1359,7 +1359,7 @@ set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "2000-11-01" - set p_archive_date [db_null] + set p_archive_date "" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] 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.22 -r1.22.2.1 --- openacs-4/packages/news/www/item-create-3.tcl 19 Jun 2018 10:08:24 -0000 1.22 +++ openacs-4/packages/news/www/item-create-3.tcl 14 Feb 2019 16:15:01 -0000 1.22.2.1 @@ -13,8 +13,8 @@ publish_body:allhtml,notnull,trim publish_body.format:path,notnull,trim {publish_lead {}} - {publish_date_ansi:trim "[db_null]"} - {archive_date_ansi:trim "[db_null]"} + {publish_date_ansi:trim ""} + {archive_date_ansi:trim ""} permanent_p:boolean,notnull } -errors { imgfile_valid {Image file invalid} @@ -36,22 +36,22 @@ # # 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] set live_revision_p "t" } else { - set approval_user [db_null] - set approval_ip [db_null] - set approval_date [db_null] + set approval_user "" + set approval_ip "" + set approval_date "" set live_revision_p "f" } # Allow the user to "never expire" a news item. if {$permanent_p == "t"} { - set archive_date_ansi [db_null] -} + 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.9 -r1.9.2.1 --- openacs-4/packages/news/www/admin/approve-2.tcl 2 Feb 2018 00:17:02 -0000 1.9 +++ openacs-4/packages/news/www/admin/approve-2.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -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"} @@ -25,17 +25,17 @@ if {$permanent_p == "t"} { - set archive_date_ansi [db_null] + set archive_date_ansi "" } else { 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.16 -r1.16.2.1 --- openacs-4/packages/news/www/admin/revision-add-3.tcl 19 Jun 2018 10:08:24 -0000 1.16 +++ openacs-4/packages/news/www/admin/revision-add-3.tcl 14 Feb 2019 16:15:01 -0000 1.16.2.1 @@ -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 @@ -25,36 +25,36 @@ set mime_type ${publish_body.format} if {$permanent_p == "t"} { - set archive_date_ansi [db_null] -} + 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/search/tcl/search-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/search/tcl/search-procs.tcl,v diff -u -r1.55 -r1.55.2.1 --- openacs-4/packages/search/tcl/search-procs.tcl 29 Jan 2019 19:14:32 -0000 1.55 +++ openacs-4/packages/search/tcl/search-procs.tcl 14 Feb 2019 16:15:01 -0000 1.55.2.1 @@ -420,7 +420,7 @@ if {[apm_package_installed_p dotlrn]} { set site_node [site_node::get_node_id_from_object_id -object_id $package_id] set dotlrn_package_id [site_node::closest_ancestor_package -node_id $site_node -package_key dotlrn -include_self] - set community_id [db_string get_community_id {select community_id from dotlrn_communities_all where package_id=:dotlrn_package_id} -default [db_null]] + set community_id [db_string get_community_id {select community_id from dotlrn_communities_all where package_id=:dotlrn_package_id} -default ""] return $community_id } return "" Index: openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl,v diff -u -r1.16 -r1.16.2.1 --- openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl 7 Aug 2017 23:48:29 -0000 1.16 +++ openacs-4/packages/static-portlet/tcl/static-admin-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.16.2.1 @@ -30,6 +30,8 @@ ad_proc -public get_pretty_name { } { + Get pretty name. + } { return [parameter::get_from_package_key -package_key [my_package_key] -parameter static_admin_portlet_pretty_name] } @@ -40,14 +42,16 @@ ad_proc -public link { } { + Get link. This is currently empty. + } { return "" } ad_proc -public add_self_to_page { {-portal_id:required} {-package_id:required} } { - Adds a static admin PE to the given portal + Adds a static admin PE to the given portal. } { return [portal::add_element_parameters \ -portal_id $portal_id \ @@ -61,7 +65,7 @@ ad_proc -public remove_self_from_page { {-portal_id:required} } { - Removes static PE from the given page + Removes static PE from the given page. } { # This is easy since there's one and only one instace_id portal::remove_element \ @@ -72,7 +76,7 @@ ad_proc -public show { cf } { - Display the PE + Display the PE. } { portal::show_proc_helper \ -package_key [my_package_key] \ Index: openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl,v diff -u -r1.22 -r1.22.2.1 --- openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 12 Apr 2018 07:47:22 -0000 1.22 +++ openacs-4/packages/static-portlet/tcl/static-portal-content-procs.tcl 14 Feb 2019 16:15:01 -0000 1.22.2.1 @@ -32,7 +32,7 @@ {-pretty_name:required} {-format "text/html"} } { - Calls the pl/sql to create the new content item + Calls the pl/sql to create the new content item. } { # Create the content item set content_id [db_exec_plsql new_content_item {}] @@ -120,7 +120,7 @@ } { A helper proc for cloning. There could be multiple static portlets that need to be cloned. Make a deep copy of all the static portal - content and update the all the corresponding element's pointers + content and update the all the corresponding element's pointers. } { set ds_id [portal::get_datasource_id [static_portlet::get_my_name]] @@ -145,13 +145,18 @@ ad_proc -public remove_from_portal { {-portal_id:required} {-content_id:required} + } { + Remove content from the portal. This is currently not + implemented and will return an error to the user. } { ad_return_complaint 1 "static_portal_content::remove_from_portal not implemented" } ad_proc -public remove_all_from_portal { {-portal_id:required} } { + Remove all static portlets from the portal. + } { db_transaction { # should remove all of 'em set element_id [portal::remove_element \ @@ -168,7 +173,7 @@ {-pretty_name:required} {-format "text/html"} } { - updates the content item + Updates the content item. } { db_transaction { # update the content item @@ -190,7 +195,7 @@ ad_proc -public delete { {-content_id:required} } { - deletes the item + Deletes the item. } { db_dml delete_content_item { delete from static_portal_content where content_id = :content_id @@ -200,15 +205,15 @@ ad_proc -public get_pretty_name { {-content_id:required} } { - Get the pretty_name of the item + Get the pretty_name of the item. } { return [db_string select {}] } ad_proc -public get_content { {-content_id:required} } { - Get the content of the item + Get the content of the item. } { return [db_string get_content.select { select content @@ -220,15 +225,15 @@ ad_proc -public get_package_id { {-content_id:required} } { - Get the package_id of the item + Get the package_id of the item. } { return [db_string get_package_id.select {}] } ad_proc -public get_content_format { {-content_id:required} } { - Get the format of the content's item + Get the format of the content's item. } { return [db_string get_content_format.select {} ] } Index: openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl 7 Aug 2017 23:48:29 -0000 1.9 +++ openacs-4/packages/static-portlet/tcl/static-portlet-procs.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -33,6 +33,8 @@ ad_proc -public get_pretty_name { } { + Get pretty name. This is currently empty. + } { return "" } @@ -43,14 +45,16 @@ ad_proc -public link { } { + Get link. This is currently empty. + } { return "" } ad_proc -public add_self_to_page { {-portal_id:required} {-package_id:required} } { - Adds a static PE to the given page + Adds a static PE to the given page. } { ns_log notice "static_portlet::add_self_to_page - Don't call me. Use static_portal_content:: instead" error @@ -60,7 +64,7 @@ portal_id element_id } { - Removes static PE from the given page + Removes static PE from the given page. } { # This is easy since there's one and only one instace_id portal::remove_element $element_id @@ -69,6 +73,7 @@ ad_proc -public show { cf } { + Show the static portlet. } { portal::show_proc_helper \ -package_key [my_package_key] \ Index: openacs-4/packages/static-portlet/www/element-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element-delete.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/static-portlet/www/element-delete.tcl 7 Aug 2017 23:48:29 -0000 1.9 +++ openacs-4/packages/static-portlet/www/element-delete.tcl 14 Feb 2019 16:15:01 -0000 1.9.2.1 @@ -16,9 +16,9 @@ ad_page_contract { delete a static element - + @author arjun (arjun@openforce) - @cvs_id $Id$ + @cvs-id $Id$ } -query { {content_id:naturalnum,notnull} {referer:notnull} Index: openacs-4/packages/static-portlet/www/element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element.tcl,v diff -u -r1.23 -r1.23.2.1 --- openacs-4/packages/static-portlet/www/element.tcl 23 Apr 2018 13:45:44 -0000 1.23 +++ openacs-4/packages/static-portlet/www/element.tcl 14 Feb 2019 16:15:01 -0000 1.23.2.1 @@ -18,7 +18,7 @@ edit a static element @author arjun (arjun@openforce) - @cvs_id $Id$ + @cvs-id $Id$ } -query { {content_id:naturalnum,optional ""} referer:notnull @@ -80,59 +80,59 @@ -package_id $package_id \ -content [template::util::richtext::get_property contents $content] \ -format [template::util::richtext::get_property format $content] \ - -pretty_name $pretty_name] - + -pretty_name $pretty_name] + set old_element_id [static_portal_content::add_to_portal \ - -portal_id $portal_id \ - -package_id $package_id \ - -content_id $item_id] + -portal_id $portal_id \ + -package_id $package_id \ + -content_id $item_id] } # support for templates & already created portals for users, # classes, etc. (roc) switch $type { - user { - set query "select portal_id as target_portal_id from dotlrn_users" - set community_id $package_id - set new_content_id $item_id - } - dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } - dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } - dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } - default { - ad_returnredirect $referer - ad_script_abort - } + user { + set query "select portal_id as target_portal_id from dotlrn_users" + set community_id $package_id + set new_content_id $item_id + } + dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } + dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } + dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } + default { + ad_returnredirect $referer + ad_script_abort + } } - + db_foreach dotlrn_type_portals "$query" { - if {$type ne "user" } { - # clone the template's content - set new_content_id [static_portal_content::new \ - -package_id $community_id \ - -content [template::util::richtext::get_property contents $content] \ - -format [template::util::richtext::get_property format $content] \ - -pretty_name $pretty_name ] - } - + if {$type ne "user" } { + # clone the template's content + set new_content_id [static_portal_content::new \ + -package_id $community_id \ + -content [template::util::richtext::get_property contents $content] \ + -format [template::util::richtext::get_property format $content] \ + -pretty_name $pretty_name ] + } - set new_element_id [ static_portal_content::add_to_portal \ - -portal_id $target_portal_id \ - -package_id $community_id \ - -content_id $new_content_id] - + set new_element_id [ static_portal_content::add_to_portal \ + -portal_id $target_portal_id \ + -package_id $community_id \ + -content_id $new_content_id] - portal::set_element_param $new_element_id "package_id" $community_id - portal::set_element_param $new_element_id "content_id" $new_content_id - if {$enforce_portlet == 0} { - db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :new_element_id } - } + portal::set_element_param $new_element_id "package_id" $community_id + portal::set_element_param $new_element_id "content_id" $new_content_id + + if {$enforce_portlet == 0} { + db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :new_element_id } + } + } # redirect and abort @@ -145,84 +145,82 @@ static_portal_content::update \ -portal_id $portal_id \ -content_id $element_content_id \ - -pretty_name $pretty_name \ - -content [template::util::richtext::get_property contents $content] \ - -format [template::util::richtext::get_property format $content] + -pretty_name $pretty_name \ + -content [template::util::richtext::get_property contents $content] \ + -format [template::util::richtext::get_property format $content] } switch $type { - user { - set query "select portal_id as target_portal_id from dotlrn_users" + user { + set query "select portal_id as target_portal_id from dotlrn_users" set community_id $package_id - } - dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } - dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } - dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } - default { - ad_returnredirect $referer - ad_script_abort - } + } + dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } + dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } + dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } + default { + ad_returnredirect $referer + ad_script_abort + } } db_foreach dotlrn_type_portals "$query" { - if { ($type ne "user") } { - catch { - set element_content_id [db_string get_content_id { - select content_id - from static_portal_content - where package_id = :community_id - and pretty_name = :pretty_name - }] - } errmsg2 - } + if { $type ne "user" } { + catch { + set element_content_id [db_string get_content_id { + select content_id + from static_portal_content + where package_id = :community_id + and pretty_name = :pretty_name + }] + } errmsg2 + } - set no_portlet [catch {set element_id [portal::get_element_id_from_unique_param -portal_id $target_portal_id -key content_id -value $element_content_id]} errmsg] + set no_portlet [catch {set element_id [portal::get_element_id_from_unique_param -portal_id $target_portal_id -key content_id -value $element_content_id]} errmsg] - if { $no_portlet } { + if { $no_portlet } { - # if we are here, means that the portlet do not exists - # for given portal_id, then instead of update, we'll - # create it + # if we are here, means that the portlet do not exists + # for given portal_id, then instead of update, we'll + # create it - if {$type ne "user" } { - # clone the template's content - set element_content_id [static_portal_content::new \ - -package_id $community_id \ - -content [template::util::richtext::get_property contents $content] \ - -format [template::util::richtext::get_property format $content] \ - -pretty_name $pretty_name ] - } + if {$type ne "user" } { + # clone the template's content + set element_content_id [static_portal_content::new \ + -package_id $community_id \ + -content [template::util::richtext::get_property contents $content] \ + -format [template::util::richtext::get_property format $content] \ + -pretty_name $pretty_name ] + } - set new_element_id [ static_portal_content::add_to_portal \ - -portal_id $target_portal_id \ - -package_id $community_id \ - -content_id $element_content_id] + set new_element_id [ static_portal_content::add_to_portal \ + -portal_id $target_portal_id \ + -package_id $community_id \ + -content_id $element_content_id] - portal::set_element_param $new_element_id "package_id" $community_id - portal::set_element_param $new_element_id "content_id" $element_content_id - set element_id $element_content_id + portal::set_element_param $new_element_id "package_id" $community_id + portal::set_element_param $new_element_id "content_id" $element_content_id + set element_id $element_content_id + } else { - } else { + static_portal_content::update \ + -portal_id $target_portal_id \ + -content_id $element_content_id \ + -pretty_name $pretty_name \ + -content [template::util::richtext::get_property contents $content] \ + -format [template::util::richtext::get_property format $content] + } - static_portal_content::update \ - -portal_id $target_portal_id \ - -content_id $element_content_id \ - -pretty_name $pretty_name \ - -content [template::util::richtext::get_property contents $content] \ - -format [template::util::richtext::get_property format $content] - } - - if {$enforce_portlet == 0} { - db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :element_id } - } else { - db_dml hide_portlet { update portal_element_map set state = 'full' where element_id = :element_id } - } - + if {$enforce_portlet == 0} { + db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :element_id } + } else { + db_dml hide_portlet { update portal_element_map set state = 'full' where element_id = :element_id } + } } - + # redirect and abort ad_returnredirect $referer ad_script_abort @@ -238,18 +236,18 @@ {label "[_ static-portlet.File]"} } {content_format:text(select) - {label "Format"} - {options [template::util::richtext::format_options]} + {label "Format"} + {options [template::util::richtext::format_options]} {value "text/plain"} } } if {$type in $templates} { set elements [list \ - [list {enforce_portlet:text(select)} [list label [_ static-portlet.lt_Enforce_this_applet_t]] \ - [list help_text [_ static-portlet.lt_Enforce_True_means_th]] \ - [list options [list [list [_ static-portlet.True] 1] [list [_ static-portlet.False_0] 0]]] \ - [list value 0]]] + [list {enforce_portlet:text(select)} [list label [_ static-portlet.lt_Enforce_this_applet_t]] \ + [list help_text [_ static-portlet.lt_Enforce_True_means_th]] \ + [list options [list [list [_ static-portlet.True] 1] [list [_ static-portlet.False_0] 0]]] \ + [list value 0]]] ad_form -extend -name static_file -form $elements } @@ -283,8 +281,8 @@ set item_id [static_portal_content::new \ -package_id $package_id \ -content $content \ - -format $content_format \ - -pretty_name $pretty_name + -format $content_format \ + -pretty_name $pretty_name ] static_portal_content::add_to_portal \ @@ -298,48 +296,46 @@ # classes, etc. (roc) switch $type { - user { - set query "select portal_id as target_portal_id from dotlrn_users" - set community_id $package_id - set new_content_id $item_id - } - dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } - dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } - dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } - default { - ad_returnredirect $referer - ad_script_abort - } + user { + set query "select portal_id as target_portal_id from dotlrn_users" + set community_id $package_id + set new_content_id $item_id + } + dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } + dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } + dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } + default { + ad_returnredirect $referer + ad_script_abort + } } - + db_foreach dotlrn_type_portals "$query" { - if {$type ne "user" } { - # clone the template's content - set new_content_id [static_portal_content::new \ - -package_id $community_id \ - -content $content \ - -format $content_format \ - -pretty_name $pretty_name ] - } + if {$type ne "user" } { + # clone the template's content + set new_content_id [static_portal_content::new \ + -package_id $community_id \ + -content $content \ + -format $content_format \ + -pretty_name $pretty_name ] + } - set new_element_id [ static_portal_content::add_to_portal \ - -portal_id $target_portal_id \ - -package_id $community_id \ - -content_id $new_content_id] + set new_element_id [ static_portal_content::add_to_portal \ + -portal_id $target_portal_id \ + -package_id $community_id \ + -content_id $new_content_id] - portal::set_element_param $new_element_id "package_id" $community_id - portal::set_element_param $new_element_id "content_id" $new_content_id + portal::set_element_param $new_element_id "package_id" $community_id + portal::set_element_param $new_element_id "content_id" $new_content_id - if {$enforce_portlet == 0} { - db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :new_element_id } - } - + if {$enforce_portlet == 0} { + db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :new_element_id } + } } - # redirect and abort ad_returnredirect $referer ad_script_abort @@ -361,83 +357,80 @@ -portal_id $portal_id \ -content_id $file_content_id \ -pretty_name $pretty_name \ - -content $content \ - -format $content_format + -content $content \ + -format $content_format } switch $type { - user { - set query "select portal_id as target_portal_id from dotlrn_users" - set community_id $package_id - } - dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } - dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } - dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } - default { - ad_returnredirect $referer - ad_script_abort - } + user { + set query "select portal_id as target_portal_id from dotlrn_users" + set community_id $package_id + } + dotlrn_class_instance { set query "select portal_id as target_portal_id, community_id from dotlrn_class_instances_full" } + dotlrn_club { set query "select portal_id as target_portal_id, community_id from dotlrn_clubs_full" } + dotlrn_community { set query "select portal_id as target_portal_id, community_id from dotlrn_communities_full" } + default { + ad_returnredirect $referer + ad_script_abort + } } - + db_foreach dotlrn_type_portals "$query" { - if {$type ne "user" } { - catch { - set file_content_id [db_string get_content_id { - select content_id - from static_portal_content - where package_id = :community_id - and pretty_name = :pretty_name - }] - } errmsg2 - } + if {$type ne "user" } { + catch { + set file_content_id [db_string get_content_id { + select content_id + from static_portal_content + where package_id = :community_id + and pretty_name = :pretty_name + }] + } errmsg2 + } + set no_portlet [catch {set element_id [portal::get_element_id_from_unique_param -portal_id $target_portal_id -key content_id -value $file_content_id]} errmsg] - set no_portlet [catch {set element_id [portal::get_element_id_from_unique_param -portal_id $target_portal_id -key content_id -value $file_content_id]} errmsg] + if { $no_portlet } { - if { $no_portlet } { + # if we are here, means that the portlet do not exists + # for given portal_id, then instead of update, we'll + # create it - # if we are here, means that the portlet do not exists - # for given portal_id, then instead of update, we'll - # create it + if {$type ne "user" } { + # clone the template's content + set file_content_id [static_portal_content::new \ + -package_id $community_id \ + -content $content \ + -format $content_format \ + -pretty_name $pretty_name ] + } - if {$type ne "user" } { - # clone the template's content - set file_content_id [static_portal_content::new \ - -package_id $community_id \ - -content $content \ - -format $content_format \ - -pretty_name $pretty_name ] - } + set new_element_id [ static_portal_content::add_to_portal \ + -portal_id $target_portal_id \ + -package_id $community_id \ + -content_id $file_content_id] - set new_element_id [ static_portal_content::add_to_portal \ - -portal_id $target_portal_id \ - -package_id $community_id \ - -content_id $file_content_id] + portal::set_element_param $new_element_id "package_id" $community_id + portal::set_element_param $new_element_id "content_id" $file_content_id + set element_id $file_content_id - portal::set_element_param $new_element_id "package_id" $community_id - portal::set_element_param $new_element_id "content_id" $file_content_id - set element_id $file_content_id + } else { + static_portal_content::update \ + -portal_id $target_portal_id \ + -content_id $file_content_id \ + -pretty_name $pretty_name \ + -content $content \ + -format $content_format + } - } else { - - static_portal_content::update \ - -portal_id $target_portal_id \ - -content_id $file_content_id \ - -pretty_name $pretty_name \ - -content $content \ - -format $content_format - } + if {$enforce_portlet == 0} { + db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :element_id } + } else { + db_dml hide_portlet { update portal_element_map set state = 'full' where element_id = :element_id } + } + } - if {$enforce_portlet == 0} { - db_dml hide_portlet { update portal_element_map set state = 'hidden' where element_id = :element_id } - } else { - db_dml hide_portlet { update portal_element_map set state = 'full' where element_id = :element_id } - } - - } - # redirect and abort ad_returnredirect $referer ad_script_abort Index: openacs-4/packages/static-portlet/www/static-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-admin-portlet.tcl,v diff -u -r1.22 -r1.22.2.1 --- openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 7 Aug 2017 23:48:29 -0000 1.22 +++ openacs-4/packages/static-portlet/www/static-admin-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.22.2.1 @@ -16,10 +16,10 @@ ad_page_contract { The display logic for the static admin portlet - + @author arjun (arjun@openforce) @author Ben Adida (ben@openforce) - @cvs_id $Id$ + @cvs-id $Id$ } { {package_id:naturalnum,optional ""} {template_portal_id:naturalnum,optional ""} Index: openacs-4/packages/static-portlet/www/static-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-portlet.adp,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/static-portlet/www/static-portlet.adp 7 Aug 2017 23:48:29 -0000 1.11 +++ openacs-4/packages/static-portlet/www/static-portlet.adp 14 Feb 2019 16:15:01 -0000 1.11.2.1 @@ -18,11 +18,11 @@ %> - - -@content;noquote@ + + + @content;noquote@ + - #new-portal.when_portlet_shaded# Index: openacs-4/packages/static-portlet/www/static-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/static-portlet.tcl,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/static-portlet/www/static-portlet.tcl 7 Aug 2017 23:48:29 -0000 1.11 +++ openacs-4/packages/static-portlet/www/static-portlet.tcl 14 Feb 2019 16:15:01 -0000 1.11.2.1 @@ -16,34 +16,38 @@ ad_page_contract { The display logic for the STATIC portlet - + @author arjun (arjun@openforce) - @author Ben Adida (ben@openforce) - @cvs_id $Id$ -} + @author Ben Adida (ben@openforce) + @cvs-id $Id$ +} array set config $cf -# one piece of content only per portlet -set content_id $config(content_id) - set success_p 0 -set success_p [db_0or1row select_content { - select body, pretty_name, format - from static_portal_content - where content_id = :content_id -}] +if {!$config(shaded_p)} { + # one piece of content only per portlet + set content_id $config(content_id) + + set success_p [db_0or1row select_content { + select body, pretty_name, format + from static_portal_content + where content_id = :content_id + }] -# The pretty_name can be a message catalog key -set class_instances_pretty_name [_ dotlrn.class_instances_pretty_name] -set pretty_name [lang::util::localize $pretty_name] + if {$success_p} { + # The pretty_name can be a message catalog key + set class_instances_pretty_name [_ dotlrn.class_instances_pretty_name] + set pretty_name [lang::util::localize $pretty_name] + + set content_w [template::util::richtext::create $body $format] + set content [template::util::richtext::get_property html_value $content_w] + } +} -set content_w [template::util::richtext::create $body $format] -set content [template::util::richtext::get_property html_value $content_w] - # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/xowiki/resources/templates/oacs-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/oacs-view.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/oacs-view.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view2.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/oacs-view2.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/oacs-view2.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view3.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/oacs-view3.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/oacs-view3.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/view-book.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-book.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/view-book.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/view-book.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/view-default.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-default.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/view-default.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/view-default.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ Index: openacs-4/packages/xowiki/resources/templates/view-links.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-links.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/view-links.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/view-links.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - +
      Index: openacs-4/packages/xowiki/resources/templates/view-plain.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-plain.adp,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/xowiki/resources/templates/view-plain.adp 14 Mar 2018 15:40:49 -0000 1.5 +++ openacs-4/packages/xowiki/resources/templates/view-plain.adp 14 Feb 2019 16:15:01 -0000 1.5.2.1 @@ -1,4 +1,4 @@ - +