Index: openacs-4/packages/ec-serial-numbers/catalog/ec-serial-numbers.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ec-serial-numbers/catalog/ec-serial-numbers.en_US.ISO-8859-1.xml,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ec-serial-numbers/catalog/ec-serial-numbers.en_US.ISO-8859-1.xml 23 Aug 2005 06:14:25 -0000 1.1 +++ openacs-4/packages/ec-serial-numbers/catalog/ec-serial-numbers.en_US.ISO-8859-1.xml 23 Aug 2005 10:49:28 -0000 1.2 @@ -5,9 +5,13 @@ Cancel and Return Continue with Delete Delete + Download installer Ecommerce Serial Number Trackings Edit None + Send mail + Send mail to owners + Serial Number Serial Number Serial Numbers Add Serial Number @@ -22,6 +26,4 @@ Start Date Order Number View Serial Number - - Index: openacs-4/packages/ec-serial-numbers/templates/install.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ec-serial-numbers/templates/install.sh,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ec-serial-numbers/templates/install.sh 23 Aug 2005 06:14:25 -0000 1.1 +++ openacs-4/packages/ec-serial-numbers/templates/install.sh 23 Aug 2005 10:49:28 -0000 1.2 @@ -8,8 +8,8 @@ LANG= export LANG -SERIAL=$SERIAL -KEY=$KEY +SERIAL=@SERIAL@ +KEY=@KEY@ VER=2.74 arch=i386 # XXX need to detect x86_64 Index: openacs-4/packages/ec-serial-numbers/www/download.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ec-serial-numbers/www/download.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ec-serial-numbers/www/download.tcl 23 Aug 2005 06:14:25 -0000 1.1 +++ openacs-4/packages/ec-serial-numbers/www/download.tcl 23 Aug 2005 10:49:28 -0000 1.2 @@ -5,7 +5,7 @@ @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-08-18 } { - serial_id:required + serial_id software_id:optional } -properties { context_bar:onevalue @@ -16,32 +16,39 @@ set context_bar [ad_context_bar $page_title] set package_id [ad_conn package_id] -if {[exists_and_not_null software_id]} { +# If we have a software_id (which corresponds to the product_id of the ecommerce produkt +# that resembles the software), look if we have a special installer file for that product. +# Otherwise use the default installer file. You could use any other file as well. + +set path "/web/devel/packages/ec-serial-numbers/templates" +if {[exists_and_not_null software_id] && [file exists "$path/install-${software_id}.sh"]} { set file_name "/web/devel/packages/ec-serial-numbers/templates/install-${software_id}.sh" } else { set file_name "/web/devel/packages/ec-serial-numbers/templates/install.sh" } -set file [open $file_name] -fconfigure $file -translation binary -set __the_body__ [read $file] -set __the_body__ [encoding convertfrom utf-8 $__the_body__] -close $file - # Admins can get license keys from any user. set user_id [ad_conn user_id] set admin_p [acs_user::site_wide_admin_p -user_id $user_id] if {$admin_p} { set user_where_clause "" } else { - set user_where_clause "and user_id = :user_id" + set user_where_clause "and owner_id = :user_id" } -if {[db_0or1row get_key "select license_key from ec_serial_numbers where serial_id = : serial_id $user_where_clause"]} { - +if {[db_0or1row get_key "select license_key from ec_serial_numbers esn, cr_items ci where ci.item_id = :serial_id and ci.latest_revision = esn.serial_id $user_where_clause"]} { + + set file [open $file_name] + fconfigure $file -translation binary + set __the_body__ [read $file] + set __the_body__ [encoding convertfrom utf-8 $__the_body__] + close $file + + regsub {@KEY@} $__the_body__ $license_key body + regsub {@SERIAL@} $body $serial_id body ns_set put [ad_conn outputheaders] Content-Disposition "attachment;filename=install.sh" - ns_return 200 "text/plain" "$csv_text" + ns_return 200 "text/plain" "$body" } else { ad_return_error "No such serial number" "We are sorry but we don't have the serial number on record" } \ No newline at end of file Index: openacs-4/packages/ec-serial-numbers/www/serial-number-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ec-serial-numbers/www/serial-number-list.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ec-serial-numbers/www/serial-number-list.tcl 23 Aug 2005 06:14:25 -0000 1.1 +++ openacs-4/packages/ec-serial-numbers/www/serial-number-list.tcl 23 Aug 2005 10:49:28 -0000 1.2 @@ -15,6 +15,14 @@ page_title:onevalue } +# Admins can get license keys from any user. +set user_id [ad_conn user_id] +set admin_p [acs_user::site_wide_admin_p -user_id $user_id] +if {!$admin_p} { + set owner_id $user_id +} + + set page_title "[_ ec-serial-numbers.serial_number_2]" set context_bar [ad_context_bar $page_title] set package_id [ad_conn package_id] @@ -62,7 +70,7 @@ label {[_ ec-serial-numbers.serial_number_Title]} link_url_eval {[export_vars -base "serial-number-ae" {{serial_id $item_id} {mode display}}]} } - serial_id { + item_id { label {[_ ec-serial-numbers.serial_number]} } license_key { @@ -80,16 +88,21 @@ product_name { label {[_ ec-serial-numbers.serial_number_software_id]} } + download { + label {[_ ec-serial-numbers.download_installer]} + display_template {[_ acs-kernel.common_Download]} + } } -actions $actions \ -orderby $orderbys \ -filters $filters \ -page_size $page_size \ -page_flush_p 0 \ -page_query_name serial_number_pagination -db_multirow -extend {edit_link delete_link owner_name product_name} serial_number serial_number {} { +db_multirow -extend {edit_link delete_link owner_name product_name download_link} serial_number serial_number {} { set edit_link [export_vars -base "serial-number-ae" {{serial_id $item_id}}] set delete_link [export_vars -base "serial-number-delete" {{serial_id $item_id}}] + set download_link [export_vars -base "download" {{serial_id $item_id} software_id}] set owner_name "$first_names $last_name" if {[exists_and_not_null software_id]} { set product_name [ec_product_name $software_id]