Index: openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl,v diff -u -r1.13.2.3 -r1.13.2.4 --- openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 2 Nov 2004 08:22:24 -0000 1.13.2.3 +++ openacs-4/packages/ecommerce/tcl/ecommerce-utilities-procs.tcl 19 Dec 2004 12:02:32 -0000 1.13.2.4 @@ -307,7 +307,7 @@ set linked_thumbnail "" if { $border_p == "f" } { - set border_part_of_img_tag " border=0 " + set border_part_of_img_tag " border=\"0\" " } else { set border_part_of_img_tag "" } @@ -331,20 +331,14 @@ if { [file exists "$full_dirname/product.jpg"] } { set linked_thumbnail " - - \"Product - " + \"Product" } elseif { [file exists "$full_dirname/product.gif"] } { set linked_thumbnail " - - \"Product - " + \"Product" } } else { set linked_thumbnail " - - \"Product - " + \"Product" } } return $linked_thumbnail @@ -494,7 +488,7 @@ if { ![empty_string_p $user_id] } { set user_name [db_string get_user_name " - select first_names || ' ' || last_name + select first_names || ' ' || last_name from cc_users where user_id=:user_id"] return "Registered user: $user_name." @@ -1117,3 +1111,55 @@ } return $product_link } +ad_proc ec_capitalize_words { + string_of_words +} { + Capitalizes first letter of each word, makes rest lowercase +} { + set word_list [split $string_of_words] + set entitled_list "" + foreach word $word_list { + lappend entitled_list [string totitle $word] + } + set entitled_words [join $entitled_list] + return $entitled_words +} + +ad_proc ec_thumbnail_if_it_exists { + dirname + {border_p "t"} + {image_title "item view"} +} { + + This looks at dirname to see if the thumbnail is there and if + so returns an html fragment to show thumbnail + Otherwise it returns the empty string. + +} { + + set thumbnail "" + + if { $border_p == "f" } { + set border_part_of_img_tag " border=\"0\" " + } else { + set border_part_of_img_tag "" + } + + # See if there's an image file (and thumbnail) + # Get the directory where dirname is stored + + regsub -all {[a-zA-Z]} $dirname "" product_id + set subdirectory [ec_product_file_directory $product_id] + set file_path "$subdirectory/$dirname" + set product_data_directory "[ec_data_directory][ec_product_directory]" + + set full_dirname "$product_data_directory$file_path" + + if { [file exists "$full_dirname/product-thumbnail.jpg"] } { + set thumbnail_size [ns_jpegsize "$full_dirname/product-thumbnail.jpg"] + + set thumbnail "" + + } + return $thumbnail +}