Index: openacs-4/packages/news/tcl/news-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-callback-procs.tcl,v
diff -u -r1.1.2.3 -r1.1.2.4
--- openacs-4/packages/news/tcl/news-callback-procs.tcl 20 Jul 2005 15:47:29 -0000 1.1.2.3
+++ openacs-4/packages/news/tcl/news-callback-procs.tcl 23 Sep 2005 14:50:47 -0000 1.1.2.4
@@ -51,3 +51,57 @@
db_dml update_news_acs_objects_1 {}
db_dml update_news_acs_objects_2 {}
}
+
+ad_proc -public -callback datamanager::copy_new -impl datamanager {
+ -object_id:required
+ -selected_community:required
+} {
+ Copy a new to another class or community
+} {
+#get environment data
+ db_1row get_news_package_id {}
+
+#get the revision's data
+
+ set news_revisions_list [db_list_of_lists get_news_revisions_data {}]
+ set news_revisions_number [llength $news_revisions_list]
+
+#do the first revision
+ set present_object_id [lindex [lindex $news_revisions_list 1] 0]
+ db_1row get_news_data {}
+ set publish_date_ansi [lindex [lindex $news_revisions_list 1] 1]
+ set publish_body [lindex [lindex $news_revisions_list 1] 2]
+ set mime_type [lindex [lindex $news_revisions_list 1] 3]
+ set publish_title [lindex [lindex $news_revisions_list 1] 4]
+
+
+ set live_revision_p "t"
+
+#create the new
+ set news_id [db_exec_plsql create_news_item {}]
+
+#if there are revisions, they are included here
+ for {set i 2} {$i < $news_revisions_number} {incr i} {
+
+ set present_object_id [lindex [lindex $news_revisions_list $i] 0]
+ db_1row get_news_data {}
+ db_1row get_present_new_item {}
+
+ set publish_date_ansi [lindex [lindex $news_revisions_list $i] 1]
+ set publish_body [lindex [lindex $news_revisions_list $i] 2]
+ set mime_type [lindex [lindex $news_revisions_list $i] 3]
+ set publish_title [lindex [lindex $news_revisions_list $i] 4]
+ set revision_log [lindex [lindex $news_revisions_list $i] 5]
+# db_1row get_live_revision {}
+# if {$live_revision == $present_object_id} {
+# set active_revision_p "t"
+# } else {
+# set active_revision_p "f"
+# }
+set active_revision_p "t"
+
+ db_exec_plsql create_news_item_revision {}
+ }
+#does the new includes images?
+}
+
Index: openacs-4/packages/news/tcl/news-callback-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-callback-procs.xql,v
diff -u -r1.1.2.2 -r1.1.2.3
--- openacs-4/packages/news/tcl/news-callback-procs.xql 20 Jul 2005 15:47:29 -0000 1.1.2.2
+++ openacs-4/packages/news/tcl/news-callback-procs.xql 23 Sep 2005 14:50:47 -0000 1.1.2.3
@@ -49,4 +49,110 @@
+
+
+ SELECT b.object_id as package_id
+ FROM acs_objects as a,acs_objects as b
+ WHERE a.context_id=:selected_community and a.object_type='apm_package' and a.object_id=b.context_id and b.title='News';
+
+
+
+
+
+ SELECT a.archive_date as archive_date_ansi,
+ a.approval_user,
+ a.approval_date,
+ a.approval_ip,
+ a.lead as publish_lead,
+ b.creation_user as user_id,
+ b.creation_ip,
+ b.creation_date
+ FROM cr_news as a, acs_objects as b
+ WHERE a.news_id=:present_object_id and b.object_id=:present_object_id
+
+
+
+
+
+SELECT context_id as new_item_id
+FROM acs_objects
+WHERE object_id=:news_id
+
+
+
+
+
+SELECT a.live_revision
+FROM cr_items as a,
+ acs_objects as b
+WHERE b.object_id=:present_object_id and a.item_id=b.context_id
+
+
+
+
+
+
+SELECT a.revision_id,
+ a.publish_date,
+ a.content as publish_body,
+ a.mime_type,
+ a.title as publish_title,
+ a.description as revision_log
+FROM cr_revisions as a,cr_revisions as b
+WHERE b.revision_id=:object_id and b.item_id=a.item_id
+ORDER BY a.revision_id
+
+
+
+
+
+
+ select news__new(
+ null, -- p_item_id
+ null, -- p_locale
+ :publish_date_ansi, -- p_publish_date
+ :publish_body, -- p_text
+ null, -- p_nls_language
+ :publish_title, -- p_title
+ :mime_type, -- p_mime_type
+ :package_id, -- p_package_id
+ :archive_date_ansi, -- p_archive_date
+ :approval_user, -- p_approval_user
+ :approval_date, -- p_approval_date
+ :approval_ip, -- p_approval_ip
+ null, -- p_relation_tag
+ :creation_ip, -- p_creation_ip
+ :user_id, -- p_creation_user
+ :live_revision_p, -- p_is_live_p
+ :publish_lead -- p_lead
+ );
+
+
+
+
+
+
+ select news__revision_new(
+ :new_item_id, -- p_item_id
+ :publish_date_ansi, -- p_publish_date
+ :publish_body, -- p_text
+ :publish_title, -- p_title
+ :revision_log, -- p_description
+ :mime_type, -- p_mime_type
+ :package_id, -- p_package_id
+ :archive_date_ansi, -- p_archive_date
+ :approval_user, -- p_approval_user
+ :approval_date, -- p_approval_date
+ :approval_ip, -- p_approval_ip
+ current_timestamp, -- p_creation_date
+ :creation_ip, -- p_creation_ip
+ :user_id, -- p_creation_user
+ :active_revision_p, -- p_make_active_revision_p
+ :publish_lead -- p_lead
+ );
+
+
+
+
+