Index: openacs-4/packages/file-storage/www/version-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/version-add.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/file-storage/www/version-add.adp 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/file-storage/www/version-add.adp 22 Sep 2001 05:58:13 -0000 1.2 @@ -1,14 +1,14 @@ -Upload New Version of @name@ +Upload New Version of @title@ @context_bar@
- + - + Index: openacs-4/packages/file-storage/www/version-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/version-add.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/file-storage/www/version-add.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/file-storage/www/version-add.tcl 22 Sep 2001 05:58:27 -0000 1.2 @@ -14,7 +14,7 @@ } } -properties { file_id:onevalue - name:onevalue + title:onevalue context_bar:onevalue } @@ -25,7 +25,7 @@ # set templating datasources db_1row file_name " -select title as name +select title from cr_revisions where revision_id = (select live_revision from cr_items Index: openacs-4/packages/file-storage/www/version-add.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/version-add.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/file-storage/www/version-add.xql 17 Aug 2001 01:25:24 -0000 1.1 +++ openacs-4/packages/file-storage/www/version-add.xql 22 Sep 2001 05:58:44 -0000 1.2 @@ -4,11 +4,9 @@ - select title as name - from cr_revisions - where revision_id = (select live_revision - from cr_items - where item_id = :file_id) + select name as title + from cr_items + where item_id = :file_id Index: openacs-4/packages/file-storage/www/version-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/version-delete.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/file-storage/www/version-delete.adp 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/file-storage/www/version-delete.adp 22 Sep 2001 05:59:32 -0000 1.2 @@ -6,7 +6,7 @@ -

Are you sure that you want to delete this version of "@version_name@"? +

Are you sure that you want to delete this version "@version_name@" of "@title@"? This action cannot be reversed.

Index: openacs-4/packages/file-storage/www/version-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/version-delete.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/version-delete.tcl 28 Aug 2001 03:49:01 -0000 1.3 +++ openacs-4/packages/file-storage/www/version-delete.tcl 22 Sep 2001 05:59:51 -0000 1.4 @@ -16,6 +16,7 @@ } -properties { version_id:onevalue version_name:onevalue + title:onevalue context_bar:onevalue } @@ -31,58 +32,39 @@ if {[string equal $confirmed_p "t"]} { # they have confirmed that they want to delete the version - db_exec_plsql version_delete " - begin + set parent_id [db_exec_plsql delete_version " + begin + :1 := file_storage.delete_version(:item_id,:version_id); - if :version_id = content_item.get_live_revision(:item_id) then - content_revision.delete (:version_id); - content_item.set_live_revision(content_item.get_latest_revision(:item_id)); - else - content_revision.delete (:version_id); - end if; + end;"] - end;" + if {$parent_id > 0} { - # JS: - # If the version is the last revision available, we also need to remove the - # item from cr_items! How come CR does not take care of this? (Note: CR merely - # sets live_revision in cr_items to null). The redirect should be to the parent - # folder if there are no more revisions, so we need to get the parent folder before we - # actually remove the entry in cr_items (I guess this is the reason why CR does not - # actually delete the item even if there are no more revisions for it). - if [db_string deleted_last_revision " - select (case when live_revision is null - then 1 - else 0 - end) - from cr_items - where item_id = :item_id"] { + # Delete the item if there is no more revision. We do this here only because of PostgreSQL's RI bug + db_exec_plsql delete_file " + begin + file_storage.delete_file(:item_id); + end;" - # Get the parent if we will be deleting the item - set parent_id [db_string parent_folder " - select parent_id from cr_items where item_id = :item_id"] + # Redirect to the folder, instead of the latest revision (which does not exist anymore) + ad_returnredirect "index?folder_id=$parent_id" - # Actually delete - db_exec_plsql delete_item " - begin - content_item.delete(:item_id); - end;" + } else { - # Redirect to the folder, instead of the latest revision (which does not exist anymore) - ad_returnredirect "?folder_id=$parent_id" + # Ok, we don't have to do anything fancy, just redirect to th last revision + ad_returnredirect "file?file_id=$item_id" - } else { + } - # Ok, we don't have to do anything fancy, just redirect to th last revision - ad_returnredirect "file?file_id=$item_id" - } - } else { # they still need to confirm - set version_name [db_string version_name " - select title from cr_revisions where revision_id = :version_id"] + db_1row version_name " + select i.name as title,r.title as version_name + from cr_items i,cr_revisions r + where i.item_id = r.item_id + and revision_id = :version_id" set context_bar [fs_context_bar_list -final "Delete Version" $item_id] ad_return_template Index: openacs-4/packages/file-storage/www/version-delete.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/version-delete.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/file-storage/www/version-delete.xql 28 Aug 2001 03:49:38 -0000 1.3 +++ openacs-4/packages/file-storage/www/version-delete.xql 22 Sep 2001 06:00:07 -0000 1.4 @@ -11,33 +11,13 @@ - - - - select (case when live_revision is null - then 1 - else 0 - end) - from cr_items - where item_id = :item_id - - - - - - - - select parent_id from cr_items where item_id = :item_id - - - - - select title - from cr_revisions - where revision_id = :version_id + select i.name as title, r.title as version_name + from cr_items i, cr_revisions r + where i.item_id = r.item_id + and r.revision_id = :version_id
Filename:Version filename: