Index: openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl 16 Jul 2003 04:52:32 -0000 1.1
+++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl 17 Jul 2003 21:30:13 -0000 1.2
@@ -244,13 +244,8 @@
set object_id [db_exec_plsql insert_content_item {}]
set cr_item_id $object_id
- ns_log Warning "item_id IS: $cr_item_id"
-
if {$cr_subclass_p} {
set object_id [db_exec_plsql insert_content_revision {}]
- set foobar [db_1row ct "SELECT count(*) from cr_items where latest_revision = $cr_item_id"]
-
- ns_log Warning "object_id NOW IS (revision): $object_id. In cr_items? $foobar"
}
# RBM: If a category was passed, assign the ad to it.
@@ -746,5 +741,35 @@
return [ad_context_bar_html [concat $context $args]]
}
+ ad_proc validate_isbn { isbn } {
+ Does a simple check-digit verigication of isbn.
+ @author Ben Bytheway
+ } {
+ set isbn [string trim $isbn]
+ regsub -all {(\D&^Xi&^x)} $isbn "" isbn
+
+ if {![regexp {^(\d|X|x){10}$} $isbn]} {
+ return 1
+ }
+
+ set check 0
+ set test_isbn [split $isbn ""]
+
+ if {[lindex $test_isbn end] == "x" || [lindex $test_isbn end] == "X"} {
+ set test_isbn [lreplace $test_isbn end end 10 ]
+ }
+
+ for {set i 0} {$i <= 9} {incr i} {
+ set digit [lindex $test_isbn $i]
+ set check [expr ($digit * (10 - $i)) + $check]
+ }
+ set check [expr $check % 11]
+
+ if { !$check && [string index $isbn 0] != 6} {
+ return 0
+ } else {
+ return 1
+ }
+ }
}
Index: openacs-4/contrib/packages/classified-ads/www/categories.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/categories.adp,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/classified-ads/www/categories.adp 16 Jul 2003 04:52:32 -0000 1.1
+++ openacs-4/contrib/packages/classified-ads/www/categories.adp 17 Jul 2003 21:30:13 -0000 1.2
@@ -2,51 +2,57 @@
-
+ No categories have been defined.
+
+ Categories
-
-
+
+
+
+
- Place a new ad under this category. + Place a new ad under this category.
-
Validiate (experts only) — A list of custom validation blocks in the form { name { expression } { message } name { expression } { message } ...} where name is a unique identifier for the validation step, expression is a block to Tcl code that evaluates to 1 or 0, and message is to be displayed to the user when the validation step fails.
+
Validate (experts only) — A list of custom validation blocks in the form { name { expression } { message } name { expression } { message } ...} where name is a unique identifier for the validation step, expression is a block to Tcl code that evaluates to 1 or 0, and message is to be displayed to the user when the validation step fails. Use the special variable $value to refer to the value entered by the user in that field.
Optional — The user is not required to use this field.