Index: openacs-4/packages/new-portal/sql/oracle/api-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/api-create.sql,v diff -u -r1.24 -r1.25 --- openacs-4/packages/new-portal/sql/oracle/api-create.sql 26 Nov 2001 19:20:12 -0000 1.24 +++ openacs-4/packages/new-portal/sql/oracle/api-create.sql 28 Nov 2001 22:33:37 -0000 1.25 @@ -65,22 +65,30 @@ ); - select max(theme_id) into v_theme_id from portal_element_themes; - select min(layout_id) into v_layout_id from portal_layouts; - insert into portals (portal_id, - name, - layout_id, - theme_id, - portal_template_p, - template_id) - values (v_portal_id, - name, - v_layout_id, - v_theme_id, - portal_template_p, - template_id); + -- if we don't have a template_id this is a stand-alone portal + if template_id is null then + select max(theme_id) into v_theme_id from portal_element_themes; + select min(layout_id) into v_layout_id from portal_layouts; + insert into portals + (portal_id, name, layout_id, theme_id) + values (v_portal_id, name, v_layout_id, v_theme_id); + + else + -- we have to copy things like the template, theme form the template + -- portal_template_p is false. no chained templates yet + select theme_id, layout_id into v_theme_id, v_layout_id + from portals where portal_id = portal.new.template_id; + + insert into portals + (portal_id, name, layout_id, theme_id, portal_template_p, template_id) + values (v_portal_id, name, v_layout_id, v_theme_id, 'f', portal.new.template_id); + + + + end if; + return v_portal_id; end new;