Index: openacs-4/packages/cms/tcl/form-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-oracle.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cms/tcl/form-procs-oracle.xql	4 Jul 2001 17:20:54 -0000	1.1
@@ -0,0 +1,173 @@
+<?xml version="1.0"?>
+<queryset>
+
+<partialquery name="attributes_query_1">      
+	<querytext>
+		
+    select
+      attributes.attribute_id, attribute_name, 
+      attributes.table_name,
+      attribute_label, type_label, object_type as subtype, datatype, 
+      params.is_html, params.is_required,
+      widget, param,
+      nvl( (select param_type from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 'literal' ) param_type, 
+      nvl( (select param_source from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 
+           'onevalue' ) param_source, 
+      nvl( (select value from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 
+           params.default_value ) value
+    from
+      (
+        select
+          aw.attribute_id, fwp.param,
+          aw.widget, decode(aw.is_required,'t','t',fwp.is_required) is_required,
+          fwp.param_id, fwp.default_value, fwp.is_html
+        from
+          cm_form_widget_params fwp, cm_attribute_widgets aw
+        where
+          fwp.widget = aw.widget
+      ) params,
+      (
+        select
+          attr.attribute_id, attribute_name, sort_order, 
+          attr.pretty_name as attribute_label, attr.datatype, 
+          types.object_type, types.pretty_name as type_label, 
+          tree_level, types.table_name
+        from
+          acs_attributes attr,
+          (
+            select 
+              object_type, pretty_name, level as tree_level,
+              table_name
+            from 
+              acs_object_types
+            where 
+              object_type ^= 'acs_object'
+            connect by 
+              prior supertype = object_type
+            start with 
+              object_type = :content_type
+          ) types
+        where
+          attr.object_type = types.object_type
+      ) attributes
+    where
+      attributes.attribute_id = params.attribute_id
+
+	</querytext>
+</partialquery>
+
+<partialquery name="attributes_query_extra_where">
+	<querytext>
+
+	 and $extra_where
+
+	</querytext>
+</partialquery>
+
+<fullquery name="get_revision_id">
+	<querytext>
+	select content_item.get_latest_revision(:item_id) from dual
+	</querytext>
+</fullquery>
+
+<partialquery name="get_enum_1">
+	<querytext>
+	select nvl(pretty_name,enum_value), enum_value
+	from acs_enum_values
+	where attribute_id = :attribute_id
+	order by sort_order
+	</querytext>
+</partialquery>
+
+<fullquery name="new_content_revision">
+	<querytext>
+             begin
+	     :revision_id := content_revision.new(
+                 title         => :title,
+                 description   => :description,
+                 mime_type     => :mime_type,
+                 text          => ' ',
+                 item_id       => content_symlink.resolve(:item_id),
+                 creation_ip   => '[ns_conn peeraddr]',
+                 creation_user => [User::getID]
+             );
+             end;
+	</querytext>
+</fullquery>
+
+<fullquery name="get_extended_attributes">
+	<querytext>
+
+	  select 
+            types.table_name, types.id_column, attr.attribute_name,
+            attr.datatype
+          from 
+            acs_attributes attr,
+            ( select 
+                object_type, table_name, id_column, level as inherit_level
+              from 
+                acs_object_types
+              where 
+                object_type <> 'acs_object'
+              and
+                object_type <> 'content_revision'
+              connect by 
+                prior supertype = object_type
+              start with 
+                object_type = :content_type) types        
+          where 
+            attr.object_type (+) = types.object_type
+          order by 
+            types.inherit_level desc
+
+	</querytext>
+</fullquery>
+
+<partialquery name="ied_get_objects_tree">
+	<querytext>
+
+          select 
+            types.table_name, types.id_column, attr.attribute_name,
+            attr.datatype
+          from 
+            acs_attributes attr,
+            ( select 
+                object_type, table_name, id_column, level as inherit_level
+              from 
+                acs_object_types
+              where 
+                object_type not in ($sql_exclusion)
+              connect by 
+                prior supertype = object_type
+              start with 
+                object_type = :content_type) types        
+          where 
+            attr.object_type (+) = types.object_type
+
+	</querytext>
+</partialquery>
+
+<partialquery name="ied_get_objects_tree_extra_where">
+	<querytext>
+
+	 and $extra_where
+
+	</querytext>
+</partialquery>
+
+<partialquery name="ied_get_objects_tree_order_by">
+	<querytext>
+
+          order by 
+            types.inherit_level desc
+
+	</querytext>
+</partialquery>
+
+</queryset>
\ No newline at end of file
Index: openacs-4/packages/cms/tcl/form-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cms/tcl/form-procs-postgresql.xql	4 Jul 2001 17:20:54 -0000	1.1
@@ -0,0 +1,165 @@
+<?xml version="1.0"?>
+<queryset>
+<rdbms><type>postgresql</type><version>7.1</version></rdbms>
+
+<fullquery name="">      
+	<querytext>
+		
+    select
+      attributes.attribute_id, attribute_name, 
+      attributes.table_name,
+      attribute_label, type_label, object_type as subtype, datatype, 
+      params.is_html, params.is_required,
+      widget, param,
+      nvl( (select param_type from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 'literal' ) param_type, 
+      nvl( (select param_source from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 
+           'onevalue' ) param_source, 
+      nvl( (select value from cm_attribute_widget_params
+            where attribute_id = attributes.attribute_id
+            and param_id = params.param_id), 
+           params.default_value ) value
+    from
+      (
+        select
+          aw.attribute_id, fwp.param,
+          aw.widget, decode(aw.is_required,'t','t',fwp.is_required) is_required,
+          fwp.param_id, fwp.default_value, fwp.is_html
+        from
+          cm_form_widget_params fwp, cm_attribute_widgets aw
+        where
+          fwp.widget = aw.widget
+      ) params,
+      (
+        select
+          attr.attribute_id, attribute_name, sort_order, 
+          attr.pretty_name as attribute_label, attr.datatype, 
+          types.object_type, types.pretty_name as type_label, 
+          tree_level, types.table_name
+        from
+          acs_attributes attr,
+          (
+            select 
+              object_type, pretty_name, level as tree_level,
+              table_name
+            from 
+              acs_object_types
+            where 
+              object_type ^= 'acs_object'
+            connect by 
+              prior supertype = object_type
+            start with 
+              object_type = :content_type
+          ) types
+        where
+          attr.object_type = types.object_type
+      ) attributes
+    where
+      attributes.attribute_id = params.attribute_id
+	</querytext>
+</fullquery>
+
+<fullquery name="get_revision_id">
+	<querytext>
+	select content_item__get_latest_revision(:item_id)
+	</querytext>
+</fullquery>
+
+<partialquery name="get_enum_1">
+	<querytext>
+	select nvl(pretty_name,enum_value), enum_value
+	from acs_enum_values
+	where attribute_id = :attribute_id
+	order by sort_order
+	</querytext>
+</partialquery>
+
+<fullquery name="new_content_revision">
+	<querytext>
+	     :revision_id := select content_revision__new(:title,:description,:mime_type,' ',content_symlink__resolve(:item_id),'[ns_conn peeraddr]',[User::getID]
+
+	</querytext>
+</fullquery>
+
+<fullquery name="get_extended_attributes">
+	<querytext>
+	  select 
+            types.table_name, types.id_column, attr.attribute_name,
+            attr.datatype
+          from 
+            acs_attributes attr PIGHT OUTER JOIN
+            ( select 
+                o2.object_type, o2.table_name, o2.id_column,
+		tree_level(o2.tree_sortkey) as inherit_level
+              from
+		( SELECT *
+		  FROM acs_object_types
+		  WHERE object_type = :content_type
+		) o1,
+                acs_object_types o2
+              where
+		o2.object_type <> 'acs_object'
+	      AND
+		o2.object_type <> 'content_revision'
+	      AND
+		o2.tree_sortkey <= o1.tree_sortkey
+	      AND
+		o1.tree_sortkey like (o2.tree_sortkey || '%')
+
+	    ) types USING (object_type)
+          order by 
+            types.inherit_level desc
+	</querytext>
+
+</fullquery>
+
+<partialquery name="ied_get_objects_tree">
+	<querytext>
+
+          select 
+            types.table_name, types.id_column, attr.attribute_name,
+            attr.datatype
+          from 
+            acs_attributes attr,
+            ( select 
+                o2.object_type, o2.table_name, o2.id_column,
+		tree_level(o2.tree_sortkey) as inherit_level
+              from
+		( SELECT *
+		  FROM acs_object_types
+		  WHERE object_type = :content_type
+		) o1,
+		acs_object_types o2
+              where 
+                object_type not in ($sql_exclusion)
+	      and
+		o2.tree_sortkey <= o1.tree_sortkey
+	      and
+		o1.tree_sortkey like (o2.tree_sortkey || '%')
+
+	    ) types USING (object_type)
+
+</querytext>
+</partialquery>
+
+<partialquery name="ied_get_objects_tree_extra_where">
+	<querytext>
+
+	 and $extra_where
+
+	</querytext>
+</partialquery>
+
+<partialquery name="ied_get_objects_tree_order_by">
+	<querytext>
+
+          order by 
+            types.inherit_level desc
+
+	</querytext>
+</partialquery>
+
+</queryset>
Index: openacs-4/packages/cms/tcl/form-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cms/tcl/form-procs.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/cms/tcl/form-procs.xql	4 Jul 2001 17:20:54 -0000	1.1
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<queryset>
+
+<fullquery name="get_content_type">      
+	<querytext>
+	select content_type from cr_items i, cr_revisions r
+	where r.item_id = i.item_id
+	and   r.revision_id = :revision_id
+	</querytext>
+
+</fulllquery>
+
+<fullquery name="get_element_value">      
+	<querytext>
+	select $what from ${table_name}x where revision_id = :revision_id
+	</querytext>
+</fullquery>
+
+<fullquery name="insert_revision_form">
+	<querytext>
+              insert into $last_table (
+                [join $columns ", "]
+              ) values (
+                [join $values ", "]
+              )"
+	</querytext>
+</fullquery>
+
+<fullquery name="process_insert_statement">
+	<querytext>
+              insert into $last_table (
+                [join $columns ", "]
+              ) values (
+                [join $values ", "]
+              )"
+	</querytext>
+</fullquery>
+
+</queryset>
\ No newline at end of file