Index: openacs-4/packages/ecommerce/tcl/ec-style-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/Attic/ec-style-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/ecommerce/tcl/ec-style-procs.tcl 20 Apr 2001 20:51:13 -0000 1.1 +++ openacs-4/packages/ecommerce/tcl/ec-style-procs.tcl 18 Jul 2001 18:19:01 -0000 1.2 @@ -7,7 +7,7 @@ @author ported by Jerry Asher (jerry@theashergroup.com) } -proc_doc ec_register_styletag { +ad_proc ec_register_styletag { tagname tag_documentation proc_body } { @@ -20,14 +20,14 @@ ns_share ec_styletag ns_share ec_styletag_source_file set generated_proc_name "ec_style_$tagname" - proc_doc $generated_proc_name {{string ""} {tagset ""}} "Proc generated by ec_register_styletag to support the $tagname ADP tag." $proc_body + ad_proc $generated_proc_name {{string ""} {tagset ""}} "Proc generated by ec_register_styletag to support the $tagname ADP tag." $proc_body # let's register the ADP tag now ns_register_adptag $tagname "/$tagname" $generated_proc_name set ec_styletag($tagname) $tag_documentation set ec_styletag_source_file($tagname) [info script] } -proc ec_style_template_root_internal {} { +ad_proc ec_style_template_root_internal {} { returns template root } { set templateroot [util_memoize {ad_parameter -package_id [ec_id] TemplateRoot "style"} [ec_cache_refresh]] if {[empty_string_p $templateroot]} { return [ec_url_concat [ec_pageroot] templates] @@ -41,13 +41,13 @@ } } -proc ec_style_template_root {} { +ad_proc ec_style_template_root {} { caches template root } { return [util_memoize {ec_style_template_root_internal} [ec_cache_refresh]] } # per /doc/style.html we standardize on "language_preference" # and "prefer_text_only_p" as the names of the cookies -proc ec_style_language_from_cookie {} { +ad_proc ec_style_language_from_cookie {} { returns language preference from cookie } { set headers [ns_conn headers] set cookie [ns_set get $headers Cookie] if { [regexp {language_preference=([^;]+)} $cookie {} language_preference] } { @@ -57,7 +57,7 @@ } } -proc ec_style_plain_fancy_from_cookie {} { +ad_proc ec_style_plain_fancy_from_cookie {} { returns fancy or text only preference from cookie } { set headers [ns_conn headers] set cookie [ns_set get $headers Cookie] if { [regexp {prefer_text_only_p=([^;]+)} $cookie {} prefer_text_only_p] } { @@ -72,7 +72,7 @@ } } -proc_doc ec_style_user_preferences_from_db {user_id} { +ad_proc ec_style_user_preferences_from_db {user_id} { Returns a list of prefer_text_only_p and language_preference from the user_preferences table; probably you should call this within a util_memoize so that you aren't kicking the stuffing out of Oracle. @@ -89,16 +89,17 @@ return $result_list } -# takes list of raw filenames and returns a list of lists -# (each sublist is score then filename) -# we give a template scores as follows: -# 2000 for having the user's preferred language -# 1000 for having the site's default language -# 200 for having the user's default plain/fanciness -# 100 for having the site's default plain/fanciness -# subtract the length of the filename so that shorter ones have precedence -# (note that language outweighs graphical fanciness) -proc ec_style_score_templates {template_filename_list} { +ad_proc ec_style_score_templates {template_filename_list} { +takes list of raw filenames and returns a list of lists + (each sublist is score then filename) + we give a template scores as follows: + 2000 for having the user's preferred language + 1000 for having the site's default language + 200 for having the user's default plain/fanciness + 100 for having the site's default plain/fanciness + subtract the length of the filename so that shorter ones have precedence + (note that language outweighs graphical fanciness) + } { # set defaults set user_preferred_language "" set user_preferred_plain_fancy "" @@ -149,7 +150,7 @@ return $result_list } -proc ec_style_sort_by_score {l1 l2} { +ad_proc ec_style_sort_by_score {l1 l2} { sorts by score } { if { [lindex $l1 0] < [lindex $l2 0] } { return -1 } elseif { [lindex $l1 0] == [lindex $l2 0] } { @@ -159,7 +160,7 @@ } } -proc_doc ec_return_template { +ad_proc ec_return_template { { file_name "" } { cache_p 1 } } {