Index: openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl,v diff -u -N -r1.18 -r1.19 --- openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl 25 Jul 2018 18:17:51 -0000 1.18 +++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl 25 Jul 2018 18:21:18 -0000 1.19 @@ -1,7 +1,7 @@ ad_library { - + Procs of application data linking - + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-05-23 } @@ -23,23 +23,23 @@ @param relation_tag Relationship identifier } { if { [catch { - application_data_link::new_from \ - -object_id $this_object_id \ - -to_object_id $target_object_id \ - -relation_tag $relation_tag - - application_data_link::new_to \ - -object_id $this_object_id \ - -from_object_id $target_object_id \ - -relation_tag $relation_tag - + application_data_link::new_from \ + -object_id $this_object_id \ + -to_object_id $target_object_id \ + -relation_tag $relation_tag + + application_data_link::new_to \ + -object_id $this_object_id \ + -from_object_id $target_object_id \ + -relation_tag $relation_tag + }]} { - # check if error occurred because of existing link - if { [application_data_link::exist_link -object_id $this_object_id -target_object_id $target_object_id -relation_tag $relation_tag] eq "1" } { - ns_log Debug "application_data_link::new: link already exists" - } else { - ns_log Error "application_data_link::new: link creation failure" - } + # check if error occurred because of existing link + if { [application_data_link::exist_link -object_id $this_object_id -target_object_id $target_object_id -relation_tag $relation_tag] eq "1" } { + ns_log Debug "application_data_link::new: link already exists" + } else { + ns_log Error "application_data_link::new: link creation failure" + } } } @@ -125,7 +125,7 @@ set rel_ids [db_list linked_objects {}] foreach rel_id $rel_ids { - db_dml delete_link {} + db_dml delete_link {} } } @@ -144,7 +144,7 @@ @creation-date 2006-08-31 } { if {[llength $link_object_id_list]} { - db_dml delete_links "" + db_dml delete_links "" } } @@ -235,7 +235,7 @@ } { Get a list of objects that are linked from an object, possible using the relation_tag. - If to_type is a subtype of content_revision, we lookup + If to_type is a subtype of content_revision, we lookup content_items that have that content_type @param object_id object_id one, get objects linked from this object @@ -245,11 +245,11 @@ set content_type_from_clause "" if {[info exists to_type] && $to_type ne ""} { - set to_type_clause [db_map to_type_where_clause] - if {[content::type::is_content_type -object_type $to_type]} { - set to_type_clause [db_map content_type_where_clause] - set content_type_from_clause [db_map content_type_from_clause] - } + set to_type_clause [db_map to_type_where_clause] + if {[content::type::is_content_type -object_type $to_type]} { + set to_type_clause [db_map content_type_where_clause] + set content_type_from_clause [db_map content_type_from_clause] + } } return [db_list links_from {}] } @@ -261,7 +261,7 @@ } { Get a list of objects that are linked to an object, possible using the relation_tag. - If from_type is a subtype of content_revision, we lookup + If from_type is a subtype of content_revision, we lookup content_items that have that content_type @param object_id object_id two, get objects linked to this object @@ -271,11 +271,11 @@ set content_type_from_clause "" if {[info exists from_type] && $from_type ne ""} { - set from_type_clause [db_map from_type_where_clause] - if {[content::type::is_content_type -content_type $from_type]} { - set from_type_clause [db_map content_type_where_clause] - set content_type_from_clause [db_map content_type_from_clause] - } + set from_type_clause [db_map from_type_where_clause] + if {[content::type::is_content_type -content_type $from_type]} { + set from_type_clause [db_map content_type_where_clause] + set content_type_from_clause [db_map content_type_from_clause] + } } return [db_list links_to {}] } @@ -286,7 +286,7 @@ Search for object references within text Supports /o/ /file/ /image/ object URL formats - @param text Text to scan for object links + @param text Text to scan for object links @return List of linked object_ids @@ -301,9 +301,9 @@ set ref_data [regexp -inline -all $re $text] foreach {discard ref} $ref_data { lappend refs $ref - } + } if {[llength $refs]} { - set refs [db_list confirm_object_ids {}] + set refs [db_list confirm_object_ids {}] } return $refs } @@ -328,34 +328,34 @@ @creation-date 2006-08-31 } { set old_links [application_data_link::get_links_from \ - -object_id $object_id \ - -relation_tag $relation_tag] + -object_id $object_id \ + -relation_tag $relation_tag] if {![llength $link_object_ids]} { - set link_object_ids [application_data_link::scan_for_links -text $text] + set link_object_ids [application_data_link::scan_for_links -text $text] } set delete_ids [list] foreach old_link $old_links { - if {$old_link ni $link_object_ids} { - lappend delete_ids $old_link - } + if {$old_link ni $link_object_ids} { + lappend delete_ids $old_link + } } application_data_link::delete_from_list \ - -object_id $object_id \ - -link_object_id_list $delete_ids \ - -relation_tag $relation_tag + -object_id $object_id \ + -link_object_id_list $delete_ids \ + -relation_tag $relation_tag foreach new_link $link_object_ids { - if {![application_data_link::link_exists \ - -from_object_id $object_id \ - -to_object_id $new_link \ - -relation_tag $relation_tag] - } { - application_data_link::new_from \ - -object_id $object_id \ - -to_object_id $new_link \ - -relation_tag $relation_tag - } + if {![application_data_link::link_exists \ + -from_object_id $object_id \ + -to_object_id $new_link \ + -relation_tag $relation_tag] + } { + application_data_link::new_from \ + -object_id $object_id \ + -to_object_id $new_link \ + -relation_tag $relation_tag + } } } @@ -370,7 +370,7 @@ @param from_object_id @param to_object_id @param relation_tag - + @return 0 or 1 @author Dave Bauer (dave@solutiongrove.com) @@ -384,7 +384,7 @@ } { Utility proc to return relation tag where clause fragment. We show all object links regardless of tag if relation_tag is empty string. - + @param relation_tag Relationship identifier } { if {$relation_tag eq ""} { Index: openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl 25 Jul 2018 18:17:51 -0000 1.8 +++ openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl 25 Jul 2018 18:21:18 -0000 1.9 @@ -1,7 +1,7 @@ ad_library { - + Procs of application linking - + @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-05-23 } @@ -19,11 +19,11 @@ @param target_package_id The ID of the target package. } { if {[catch {ad_conn user_id} user_id]} { - set user_id 0 + set user_id 0 } - + if {[catch {ad_conn peeraddr} id_addr]} { - set id_addr 127.0.0.1 + set id_addr 127.0.0.1 } set result [db_exec_plsql create_forward_link {}] @@ -44,7 +44,7 @@ set rel_ids [db_list linked_packages {}] foreach rel_id $rel_ids { - relation_remove $rel_id + relation_remove $rel_id } } @@ -113,7 +113,7 @@ set link_id [application_link::new -this_package_id $this_package_id \ -target_package_id $target_package_id] - + if {![string is space $id]} { set ::install::xml::ids($id) $link_id } 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 -N -r1.35 -r1.36 --- openacs-4/packages/categories/tcl/categories-procs.tcl 25 Jul 2018 18:28:36 -0000 1.35 +++ openacs-4/packages/categories/tcl/categories-procs.tcl 25 Jul 2018 18:30:12 -0000 1.36 @@ -34,7 +34,7 @@ @option parent_id id of the parent category. "" if top level category. @option user_id user that adds the category. [ad_conn user_id] used by default. @option creation_ip ip-address of the user that adds the category. [ad_conn peeraddr] used by default. - @option noflush defer calling category_tree::flush_cache (which if adding multiple categories to + @option noflush defer calling category_tree::flush_cache (which if adding multiple categories to a large tree can be very expensive). note that if you set this flag you must call category_tree::flush_cache once the adds are complete. @return category_id @@ -71,7 +71,7 @@ -category_id:required {-locale ""} } { - + Get name and description for a category_id in the given or connection's locale. If for the combination of category and locale no entry in category_translations exists, then empty is returned. @@ -83,7 +83,7 @@ if {$locale eq ""} { set locale [ad_conn locale] } - + if {[db_0or1row category_get { select name, description from category_translations @@ -127,9 +127,9 @@ } db_transaction { if {![db_0or1row check_category_existence ""]} { - db_exec_plsql insert_category_translation "" + db_exec_plsql insert_category_translation "" } else { - db_exec_plsql update_category_translation "" + db_exec_plsql update_category_translation "" } flush_translation_cache $category_id } @@ -215,25 +215,25 @@ db_transaction { # Remove any already mapped categories if we are updating if { $remove_old_p } { - db_dml remove_mapped_categories "" + db_dml remove_mapped_categories "" } foreach category_id $category_id_list { - if {$category_id ne ""} { - db_dml insert_mapped_categories "" - } + if {$category_id ne ""} { + db_dml insert_mapped_categories "" + } } - # Adds categorizations to linked categories - db_dml insert_linked_categories "" + # Adds categorizations to linked categories + db_dml insert_linked_categories "" } } -ad_proc -public category::get_mapped_categories { +ad_proc -public category::get_mapped_categories { {-tree_id {}} - object_id + object_id } { - Gets the list of categories mapped to an object. If tree_id is provided + Gets the list of categories mapped to an object. If tree_id is provided return only the categories mapped from the given tree. @param object_id object of which we want to know the mapped categories. @@ -248,12 +248,12 @@ return $result } -ad_proc -public category::get_mapped_categories_multirow { +ad_proc -public category::get_mapped_categories_multirow { {-locale ""} {-multirow mapped_categories} - object_id + object_id } { - Returns multirow with: tree_id, tree_name, category_id, category_name + Returns multirow with: tree_id, tree_name, category_id, category_name @param object_id object of which we want to know the mapped categories. @return multirow with tree and category information @@ -264,7 +264,7 @@ db_multirow mapped_categories select {} } -ad_proc -public category::get_id { +ad_proc -public category::get_id { name {locale en_US} } { @@ -287,11 +287,11 @@ set tree_id_old 0 db_foreach reset_translation_cache "" { if {$category_id != $category_id_old && $category_id_old != 0} { - nsv_set categories $category_id_old [list $tree_id_old [array get cat_lang]] - unset cat_lang + nsv_set categories $category_id_old [list $tree_id_old [array get cat_lang]] + unset cat_lang } set category_id_old $category_id - set tree_id_old $tree_id + set tree_id_old $tree_id set cat_lang($locale) $name } if {$category_id_old != 0} { @@ -322,7 +322,7 @@ Gets the category name in the specified language, if available. Use default language otherwise. - @param category_id category_id or list of category_id's for which to get the name. + @param category_id category_id or list of category_id's 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) @@ -345,7 +345,7 @@ # exact match: found name for this default language locale return $name } - + # Trying system locale for package (or site-wide) set locale [lang::system::locale] if { ![catch { set name $cat_lang($locale) }] } { @@ -361,7 +361,7 @@ # Resort to en_US if { ![catch { set name $cat_lang([parameter::get -parameter DefaultLocale -default en_US]) }] } { return $name - } + } # tried default locale, but nothing found return {} @@ -374,7 +374,7 @@ Gets the category name in the specified language, if available. Use default language otherwise. - @param category_ids category_id or list of category_id's for which to get the name. + @param category_ids category_id or list of category_id's 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) @@ -390,12 +390,12 @@ } { Returns the category ids of the direct children of the given category - @param category_id category_id + @param category_id category_id @return list of category ids of the children of the supplied category_id @author Peter Kreuzinger (peter.kreuzinger@wu-wien.ac.at) } { return [db_list get_children_ids ""] -} +} ad_proc -public category::count_children { {-category_id:required} @@ -408,21 +408,21 @@ where parent_id=:category_id }] } - + ad_proc -public category::get_parent { -category_id:required } { Returns the category id of the parent category - @param category_id category_id + @param category_id category_id @return category id of the parent category @author Peter Kreuzinger (peter.kreuzinger@wu-wien.ac.at) } { set result [db_list get_parent_id ""] if {$result eq "{}"} {set result 0} return $result -} - +} + ad_proc -public category::get_tree { category_id } { @@ -433,7 +433,7 @@ @author Timo Hentschel (timo@timohentschel.de) } { if { [catch { set tree_id [lindex [nsv_get categories $category_id] 0] }] } { - # category not found + # category not found return {} } return $tree_id @@ -453,25 +453,25 @@ } { set tree_id [category::get_tree $category_id] if {$tree_id eq ""} { - # category not found - return + # category not found + return } return [list $category_id [category::get_name $category_id $locale] $tree_id [category_tree::get_name $tree_id $locale]] } -ad_proc -public category::get_objects { +ad_proc -public category::get_objects { -category_id {-object_type ""} {-content_type ""} {-include_children:boolean} } { Returns a list of objects which are mapped to this category_id - + @param category_id CategoryID of the category we want to get the objects for @param object_type Limit the search for objects of this object type @param content_type Limit the search for objects of this content_type @param include_children Include child categories' objects as well. Not yet implemented - + @author malte () @creation-date Wed May 30 06:28:25 CEST 2007 } { @@ -482,23 +482,23 @@ set where_clause "and i.item_id = com.object_id and i.content_type = :content_type" } elseif {$object_type ne ""} { set join_clause ", acs_objects o" - set where_clause "and o.object_id = com.object_id and o.object_type = :object_type" + set where_clause "and o.object_id = com.object_id and o.object_type = :object_type" } return [db_list get_objects {}] } ad_proc -public category::get_id_by_object_title { - title + title } { Gets the id of a category given an object title (object_type=category). This is highly useful as the category object title will not change if you change the name (label) of the category, so you can access the category even if the label has changed - + @param title object title of the category to retrieve @return the category id or empty string it no category was found - @author Peter Kreuzinger (peter.kreuzinger@wu-wien.ac.at) + @author Peter Kreuzinger (peter.kreuzinger@wu-wien.ac.at) } { - return [db_string get_category_id {} -default ""] + return [db_string get_category_id {} -default ""] } ad_proc -public category::get_object_context { object_id } { @@ -536,9 +536,9 @@ } { if {$ctx_id eq ""} {unset ctx_id} if {$object_id ne ""} { - set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base object-map {locale object_id ctx_id}] [_ categories.cadmin]]] + set context_bar [list [category::get_object_context $object_id] [list [export_vars -no_empty -base object-map {locale object_id ctx_id}] [_ categories.cadmin]]] } else { - set context_bar [list [list [export_vars -base . -no_empty {locale ctx_id}] [_ categories.cadmin]]] + set context_bar [list [list [export_vars -base . -no_empty {locale ctx_id}] [_ categories.cadmin]]] } lappend context_bar [list [export_vars -no_empty -base tree-view {tree_id locale object_id ctx_id}] [category_tree::get_name $tree_id $locale]]