Index: openacs.org-dev/packages/wp-slim/sql/postgresql/wp-slim-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs.org-dev/packages/wp-slim/sql/postgresql/wp-slim-create.sql,v diff -u -r1.1.1.1 -r1.1.1.2 --- openacs.org-dev/packages/wp-slim/sql/postgresql/wp-slim-create.sql 9 Jul 2002 17:35:19 -0000 1.1.1.1 +++ openacs.org-dev/packages/wp-slim/sql/postgresql/wp-slim-create.sql 8 Oct 2002 15:47:45 -0000 1.1.1.2 @@ -678,7 +678,7 @@ null, null ); - + return 0; end;' language 'plpgsql'; select inline_10 (); @@ -910,14 +910,14 @@ ) returns integer as' declare - audience_item_id alias $1; + audience_item_id alias for $1; begin delete from cr_wp_presentations_aud where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_aud.id and item_id = audience_item_id); delete from cr_item_publish_audit where item_id = audience_item_id; - content_item__delete(audience_item_id); + PERFORM content_item__delete(audience_item_id); return 0; end;' language 'plpgsql'; @@ -926,14 +926,14 @@ ) returns integer as' declare - background_item_id alias $1; + background_item_id alias for $1; begin delete from cr_wp_presentations_back where exists (select 1 from cr_revisions where revision_id = cr_wp_presentations_back.id and item_id = background_item_id); delete from cr_item_publish_audit where item_id = background_item_id; - content_item__delete(background_item_id); + PERFORM content_item__delete(background_item_id); return 0; end;' language 'plpgsql'; @@ -942,7 +942,7 @@ ) returns integer as' declare - pres_item_id alias $1; + pres_item_id alias for $1; v_audience_item_id cr_items.item_id%TYPE; v_background_item_id cr_items.item_id%TYPE; del_rec record; @@ -952,27 +952,27 @@ where content_type = ''cr_wp_slide'' and parent_id = pres_item_id loop - wp_slide__delete(del_rec.slide_item_id); + PERFORM wp_slide__delete(del_rec.slide_item_id); end loop; select item_id into v_audience_item_id from cr_items where content_type = ''cr_wp_presentation_aud'' and parent_id = pres_item_id; - delete_aud(v_audience_item_id); + PERFORM wp_presentation__delete_audience(v_audience_item_id); select item_id into v_background_item_id from cr_items where content_type = ''cr_wp_presentation_back'' and parent_id = pres_item_id; - delete_back(v_background_item_id); + PERFORM wp_presentation__delete_background(v_background_item_id); delete from acs_permissions where object_id = pres_item_id; - update acs_objects set context_id=null where context_id = pres_item_id; - delete from cr_wp_presentations where exists (select 1 from cr_revisions wh$ere cr_revisions__revision_id = cr_wp_presentations__presentation_id and cr_revisions__item_id = pres_item_id); - content_item__delete(pres_item_id); + -- update acs_objects set context_id=null where context_id = pres_item_id; + delete from cr_wp_presentations where exists (select 1 from cr_revisions where cr_revisions.revision_id = cr_wp_presentations.presentation_id and cr_revisions.item_id = pres_item_id); + PERFORM content_item__delete(pres_item_id); return 0; end;' language 'plpgsql'; @@ -1243,7 +1243,7 @@ PERFORM content_item__set_live_revision(v_revision_id); update cr_wp_slides - set sort_key = p_sort_key + 1 + set sort_key = sort_key + 1 where sort_key >= p_sort_key and exists (select 1 from cr_items, cr_revisions where parent_id = p_pres_item_id and cr_items.item_id = cr_revisions.item_id @@ -1412,7 +1412,7 @@ begin delete from cr_wp_slides_preamble where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_preamble__id + cr_wp_slides_preamble.id and item_id = delete_preamble__preamble_item_id); delete from cr_item_publish_audit @@ -1430,7 +1430,7 @@ begin delete from cr_wp_slides_postamble where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_postamble__id + cr_wp_slides_postamble.id and item_id = delete_postamble__postamble_item_id); delete from cr_item_publish_audit @@ -1448,13 +1448,13 @@ begin delete from cr_wp_slides_bullet_items where exists (select 1 from cr_revisions where revision_id = - cr_wp_slides_bullet_items__id + cr_wp_slides_bullet_items.id and item_id = delete_bullet_items__bullet_items_item_id); delete from cr_item_publish_audit where item_id = delete_bullet_items__bullet_items_item_id; - PERFORM content_item__delete(bullet_items_item_id); + PERFORM content_item__delete(delete_bullet_items__bullet_items_item_id); return 0; end;' language 'plpgsql'; @@ -1463,7 +1463,7 @@ ) returns integer as' declare del_rec record; - delete__slide_item_id alias for $1; + slide_item_id alias for $1; v_sort_key cr_wp_slides.sort_key%TYPE; v_pres_item_id cr_items.item_id%TYPE; v_preamble_item_id cr_items.item_id%TYPE; @@ -1483,49 +1483,42 @@ where content_type = ''cr_wp_slide_preamble'' and parent_id = slide_item_id; - PERFORM delete_preamble(v_preamble_item_id); + PERFORM wp_slide__delete_preamble(v_preamble_item_id); select item_id into v_postamble_item_id from cr_items where content_type = ''cr_wp_slide_postamble'' and parent_id = slide_item_id; - PERFORM delete_preamble(v_preamble_item_id); + PERFORM wp_slide__delete_postamble(v_postamble_item_id); - select item_id into v_postamble_item_id - from cr_items - where content_type = ''cr_wp_slide_postamble'' - and parent_id = slide_item_id; - - PERFORM delete_postamble(v_postamble_item_id); - select item_id into v_bullet_items_item_id from cr_items where content_type = ''cr_wp_slide_bullet_items'' and parent_id = slide_item_id; - PERFORM delete_bullet_items(v_bullet_items_item_id); + PERFORM wp_slide__delete_bullet_items(v_bullet_items_item_id); -- sort_key of all revisions should be the same - select max(s__sort_key), max(i__parent_id) into v_sort_key, + select max(s.sort_key), max(i.parent_id) into v_sort_key, v_pres_item_id from cr_wp_slides s, cr_revisions r, cr_items i - where r__item_id = slide_item_id - and r__revision_id = s__slide_id - and i__item_id = r__item_id; + where r.item_id = slide_item_id + and r.revision_id = s.slide_id + and i.item_id = r.item_id; delete from cr_wp_slides where exists (select 1 from cr_revisions - where cr_revisions.revision_id = cr_wp_slides__slide_id - and cr_revisions__item_id = slide_item_id); + where cr_revisions.revision_id = cr_wp_slides.slide_id + and cr_revisions.item_id = slide_item_id); update cr_wp_slides set sort_key = sort_key - 1 where sort_key > v_sort_key and exists (select 1 from cr_revisions r, cr_items i where i.parent_id = v_pres_item_id and i.item_id = r.item_id and r.revision_id = cr_wp_slides.slide_id); - update acs_objects set context_id=null - where context_id = slide_item_id; +-- update acs_objects set context_id=null +-- where context_id = slide_item_id; delete from cr_item_publish_audit where item_id = slide_item_id; @@ -1804,6 +1797,9 @@ return 0; end; 'language 'plpgsql'; + + + create function wp_presentation__set_live_revision(integer) returns integer as ' declare p_revision_id alias for $1; @@ -1826,3 +1822,4 @@ end;' language 'plpgsql'; +