Index: openacs-4/contrib/packages/classified-ads/classified-ads.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/classified-ads.info,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/classified-ads/classified-ads.info	25 Jul 2003 23:53:19 -0000	1.3
+++ openacs-4/contrib/packages/classified-ads/classified-ads.info	21 Aug 2003 02:02:51 -0000	1.4
@@ -7,11 +7,11 @@
     f
     f
     
-    
+    
         Roberto Mello
         Deds Castillo
         Classified Ads Package
-        2003-07-17
+        2003-08-08
         Infiniteinfo
         This package implements a generic classified ads module using the content repository. It features categorization, adding of custom fields, etc.
 
Index: openacs-4/contrib/packages/classified-ads/sql/postgresql/attributes-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/sql/postgresql/attributes-create.sql,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/classified-ads/sql/postgresql/attributes-create.sql	31 Jul 2003 09:31:00 -0000	1.5
+++ openacs-4/contrib/packages/classified-ads/sql/postgresql/attributes-create.sql	21 Aug 2003 02:02:51 -0000	1.6
@@ -30,6 +30,9 @@
 CREATE INDEX ca_attributes_keyword_id_idx 
 ON ca_attributes( keyword_id );
 
+--
+-- RBM: Shouldn't attr_value be NOT NULL?
+--
 create table ca_attribute_values (
     object_id           integer
                         constraint cav_object_id_fk
@@ -59,24 +62,16 @@
                         primary key
                         constraint ca_attribute_widget_values_fk
                         references acs_attributes,
+                        constraint ca_awv_attrbute_id_nn
+                        not null,
     widget	            varchar(100)
                         constraint ca_awv_widget_fk
                         references ca_attribute_widgets
                         constraint ca_awv_widget_nn
                         not null,
     label               varchar(200),
+    html_options        text,
     --
-    -- RBM: We have keyword_id here so we can have per-category
-    --      custom fields. Selling books requires ISBN, but motorcycles
-    --      requires something else.
-    --
-    keyword_id		integer
-    			constraint ca_awv_keyword_id_fk
-			references cr_keywords(keyword_id)
-			constraint ca_awv_keyword_id_nn
-			not null,
-    html_options        varchar(400),
-    --
     -- RBM: extra fomr builder options like help, help_text, etc.
     -- We give the admin a nice UI to abstract this.
     --
Index: openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs-postgresql.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs-postgresql.xql	31 Jul 2003 09:31:00 -0000	1.6
+++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs-postgresql.xql	21 Aug 2003 02:02:51 -0000	1.7
@@ -247,8 +247,8 @@
         
 
 		SELECT ca_attributes__register_widget (
-			:attribute_id,                  -- attribute_name
-			:widget  ,                      -- widget
+			:attribute_id,                  -- attribute_id
+			:widget,                        -- widget
 			:pretty_name,                   -- label
 			:html_options,                  -- html_options
 			:extra_options,                 -- extra_options
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.13 -r1.14
--- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl	31 Jul 2003 09:31:00 -0000	1.13
+++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-procs.tcl	21 Aug 2003 02:02:51 -0000	1.14
@@ -115,7 +115,7 @@
 					}
 					"price" {
 						set attribute_name "price"
-						set datatype "integer"
+						set datatype "string"
 						set pretty_name "Price"
 						set pretty_plural "Prices"
 						set default_value 0
@@ -124,7 +124,7 @@
 						set html_options ""
 						set extra_options ""
 						set select_options ""
-						set validate "{ price { [expr \$value < 0] } { \"Price has to be positive.\" }}"
+						set validate "{ price { \[expr \$value < 0\] } { \"Price has to be positive.\" }}"
 						set optional_p "f"
 						set enabled_p "t"
 					}
Index: openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl	17 Jul 2003 23:11:35 -0000	1.2
+++ openacs-4/contrib/packages/classified-ads/www/admin/category-new.tcl	21 Aug 2003 02:02:51 -0000	1.3
@@ -19,9 +19,8 @@
 					{value $return_url} }
 	{heading:text(text)		{label "Category"}
 					{html {size 60} {maxlength 6000}} }
-	{description:text(textarea)	{label "Description"}
-					{optional}
-					{html {cols 60 rows 10 wrap soft}} }
+	{description:text(textarea),optional	{label "Description"}
+						{html {cols 60 rows 10 wrap soft}} }
 } -new_data {
 	if {[catch {set keyword_id \
 			[classified-ads::categories::new -keyword_id $keyword_id \
Index: openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.xql	29 Jul 2003 09:10:42 -0000	1.3
+++ openacs-4/contrib/packages/classified-ads/www/admin/field-addedit.xql	21 Aug 2003 02:02:51 -0000	1.4
@@ -2,14 +2,24 @@
 
     
         
-	    select aa.attribute_id, coalesce(aa.column_name, aa.attribute_name) as column_name, aa.default_value, coalesce(aa.table_name,at.table_name) as table_name, aa.storage, aa.datatype, aa.sort_order, aa.attribute_name, aa.pretty_name, aa.pretty_plural
-	    from acs_attributes aa,
-	    ca_attributes ca, acs_object_types at
-	    where aa.attribute_id = :attribute_id
-	    and aa.attribute_id = ca.attribute_id
-	    and (ca.package_id = :package_id or ca.sitewide_p = 't')
-	    and aa.object_type = :content_type
-	    and at.object_type = :content_type
+	    SELECT 
+                   aa.attribute_id, 
+                   coalesce(aa.column_name, aa.attribute_name) AS column_name, 
+                   aa.default_value, 
+                   coalesce(aa.table_name,at.table_name) AS table_name, 
+                   aa.storage, aa.datatype, aa.sort_order, aa.attribute_name, 
+                   aa.pretty_name, aa.pretty_plural
+	      FROM 
+                   acs_attributes aa,
+	           ca_attributes ca, acs_object_types at
+	     WHERE 
+                   aa.attribute_id = :attribute_id
+	       AND
+                   aa.attribute_id = ca.attribute_id
+	       AND 
+                   aa.object_type = :content_type
+	       AND 
+                   at.object_type = :content_type
         
     
 
Index: openacs-4/contrib/packages/classified-ads/www/admin/field-delete.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/www/admin/field-delete.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/packages/classified-ads/www/admin/field-delete.xql	16 Jul 2003 04:52:32 -0000	1.1
+++ openacs-4/contrib/packages/classified-ads/www/admin/field-delete.xql	21 Aug 2003 02:02:51 -0000	1.2
@@ -2,15 +2,26 @@
 
     
         
-	    select aa.attribute_id, coalesce(aa.column_name, aa.attribute_name) as column_name, aa.default_value, coalesce(aa.table_name,at.table_name) as table_name, aa.storage, aa.datatype, aa.sort_order, aa.attribute_name, aa.pretty_name, aa.pretty_plural
-	    from acs_attributes aa,
-	    ca_attributes ca, acs_object_types at
-	    where aa.attribute_id = $attribute_id
-	    and aa.attribute_id = ca.attribute_id
-	    and (ca.package_id = :package_id or ca.sitewide_p = 't')
-	    and aa.object_type = :content_type
-	    and at.object_type = :content_type
-	    order by sort_order
+	    SELECT 
+                   aa.attribute_id, 
+                   coalesce(aa.column_name, aa.attribute_name) AS column_name, 
+                   aa.default_value, 
+                   coalesce(aa.table_name,at.table_name) AS table_name, 
+                   aa.storage, aa.datatype, aa.sort_order, aa.attribute_name, 
+                   aa.pretty_name, aa.pretty_plural
+	      FROM 
+                   acs_attributes aa,
+	           ca_attributes ca, acs_object_types at
+	     WHERE 
+                   aa.attribute_id = :attribute_id
+	       AND
+                   aa.attribute_id = ca.attribute_id
+	       AND 
+                   aa.object_type = :content_type
+	       AND 
+                   at.object_type = :content_type
+	   ORDER BY
+	           sort_order