Index: openacs-4/packages/acs-content-repository/www/doc/guide/revisions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/www/doc/guide/revisions.adp,v diff -u -r1.4.2.2 -r1.4.2.3 --- openacs-4/packages/acs-content-repository/www/doc/guide/revisions.adp 13 Jul 2023 12:47:28 -0000 1.4.2.2 +++ openacs-4/packages/acs-content-repository/www/doc/guide/revisions.adp 2 Sep 2024 09:40:20 -0000 1.4.2.3 @@ -4,6 +4,10 @@ Content Repository Developer Guide: Creating Content Revisions +

Creating Content Revisions

ACS Documentation : Content Repository : Developer Guide @@ -25,14 +29,12 @@ content_revision.new function. The only parameters required to create the revision are a title, a content item ID, and some text:

-
-revision_id := content_revision.new( 
+
revision_id := content_revision.new( 
     title   => 'A Revision',
     item_id => :item_id,
     text    => 'Once upon a time Goldilocks crossed the street.
                 Here comes a car...uh oh!  The End'
-);
-
+);

The item_id parameter is ID of the content item with which the revision is associated.

The content_item.new function accepts a number of @@ -43,8 +45,7 @@ Instead of the text parameter, this function can be called with a data parameter, in which data is a blob:

-
-revision_id := content_revision.new(
+
revision_id := content_revision.new(
     title         => 'A Revision',
     description   => 'A Description of a revision',
     mime_type     => 'text/html',
@@ -54,8 +55,7 @@
     creation_date => sysdate,
     creation_user => :user_id,
     creation_ip   => :ip_address
-);
-
+);

Insert additional attributes

Given that there is no way (AFAIK) to pass variable parameters to a PL/SQL function, there is no way to make @@ -82,42 +82,34 @@ content_type.create_attribute. The trigger makes it possible to create complete revisions with a single insert statement:

-
-insert into cr_revisionsx (
+
insert into cr_revisionsx (
   item_id, revision_id, title
 ) values (
   18, 19, 'All About Revisions'
-);
-
+);

Because a special trigger is generated for each content type that includes insert statements for all inherited tables, revisions with extended attributes may be created in the same fashion:

-
-insert into cr_imagesx (
+
insert into cr_imagesx (
   item_id, revision_id, title, height, width
 ) values (
   18, 19, 'A Nice Drawing', 300, 400
-);
-
+);

Inserting content via file or text upload

Selecting a live revision

The live revision of a content item can be obtained with the content_item.get_live_revision function:

-
-live_revision_id := content_item.get_live_revision(
+
live_revision_id := content_item.get_live_revision(
     item_id => :item_id
-);
-
+);

The item_id identifies the content item with which the revision is associated.

Likewise, the most recent revision of a content item can be obtained with the content_item.get_latest_revision function:

-
-latest_revision_id := content_item.get_latest_revision(
+
latest_revision_id := content_item.get_latest_revision(
     item_id => :item_id
-);
-
+);

karlg\@arsdigita.com

Last Modified: $‌Id: revisions.html,v 1.2 2017/08/07 23:47:47