Index: openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml,v
diff -u -r1.28 -r1.29
--- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 29 Jul 2007 21:31:53 -0000 1.28
+++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 30 Jul 2007 10:58:06 -0000 1.29
@@ -9,7 +9,7 @@
Edit
edit tags
Entries for form %form%
- This page is still used by %count% entries. Please delete these first before deleting this page.
+ This form is still used by %count% entries. Please delete these first before deleting this page.
Form constraint contains invalid characters
From field '%name%' has unknown attribute '%entry%'
Unknown editor %editor%. Possible values are: %editors%
Index: openacs-4/packages/xowiki/tcl/package-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v
diff -u -r1.76 -r1.77
--- openacs-4/packages/xowiki/tcl/package-procs.tcl 29 Jul 2007 20:17:01 -0000 1.76
+++ openacs-4/packages/xowiki/tcl/package-procs.tcl 30 Jul 2007 10:58:06 -0000 1.77
@@ -359,32 +359,66 @@
return $page
}
}
+ set page [my import_prototype_page $stripped_object]
+ if {$page eq ""} {
+ my log "no prototype for '$object' found"
+ }
+ return $page
+ }
- set fn [get_server_root]/packages/[my package_key]/www/prototypes/$stripped_object.page
+ Package instproc import_prototype_page {{prototype_name ""}} {
+ set page ""
+ if {$prototype_name eq ""} {
+ set prototype_name [my query_parameter import_prototype_page ""]
+ set via_url 1
+ }
+ if {$prototype_name eq ""} {
+ error "No name for prototype given"
+ }
+ set fn [get_server_root]/packages/[my package_key]/www/prototypes/$prototype_name.page
#my log "--W check $fn"
if {[file readable $fn]} {
- # create from default page
- my log "--sourcing page definition $fn, using name '$standard_page'"
+ my instvar folder_id id
+ # We have the file. We try to create an item or revision from
+ # definition in the file system.
+ if {[regexp {^(..):(.*)$} $prototype_name _ lang local_name]} {
+ set name $prototype_name
+ } else {
+ set name en:$prototype_name
+ }
+ #my log "--sourcing page definition $fn, using name '$name'"
set page [source $fn]
- $page configure -name $standard_page \
+ $page configure -name $name \
-parent_id $folder_id -package_id $id
if {![$page exists title]} {
$page set title $object
}
$page destroy_on_cleanup
$page set_content [string trim [$page text] " \n"]
$page initialize_loaded_object
- $page save_new
- return $page
- } else {
- my log "no prototype for '$object' found"
- return ""
+ set item_id [::Generic::CrItem lookup -name $name -parent_id $folder_id]
+ if {$item_id == 0} {
+ $page save_new
+ } else {
+ # get the page from the CR with all variables
+ set p [::Generic::CrItem instantiate -item_id $item_id]
+ $p destroy_on_cleanup
+ # copy all variables from the prototype page
+ # into the instantiated page
+ foreach v [$page info vars] {$p set $v [$page set $v]}
+ $p save
+ set page $p
+ }
}
+ if {[info exists via_url] && [my exists_query_parameter "return_url"]} {
+ my returnredirect [my query_parameter "return_url" [my package_url]]
+ }
+ return $page
}
Package instproc call {object method} {
my instvar policy
- my log "--call enforce_permissions $object $method -> [$policy enforce_permissions $object $method]"
+ #my log "--call enforce_permissions $object $method -> [$policy enforce_permissions $object $method]"
if {[$policy enforce_permissions $object $method]} {
#my log "--p calling $object ([$object info class]) '$method'"
$object $method
@@ -877,6 +911,7 @@
Class Package -array set require_permission {
reindex swa
+ import_prototype_page swa
rss none
google-sitemap none
google-sitemapindex none
Index: openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/Attic/xowiki-portlet-procs.tcl,v
diff -u -r1.78 -r1.79
--- openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 25 Jul 2007 23:59:24 -0000 1.78
+++ openacs-4/packages/xowiki/tcl/xowiki-portlet-procs.tcl 30 Jul 2007 10:58:06 -0000 1.79
@@ -2147,6 +2147,7 @@
{-form_item_id:integer}
{-form}
{-orderby "_last_modified,desc"}
+ {-all:boolean false}
{-field_names}
}}
}
@@ -2253,13 +2254,14 @@
# build SQL query and iterate over the results
# maybe this could be slightly faster by using instantiate_objects
#
+ set publish_status_clause [expr {$all ? "" : " and ci.publish_status <> 'production' "}]
set items [::xowiki::FormPage instantiate_all \
-select_attributes $sql_atts \
-from_clause ", xowiki_form_pagex p" \
-with_subtypes false \
-where_clause " p.page_template = $form_item_id \
and p.xowiki_form_page_id = cr.revision_id \
- and ci.publish_status <> 'production' " \
+ $publish_status_clause" \
-folder_id [$package_id folder_id]]
$items destroy_on_cleanup
Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v
diff -u -r1.157 -r1.158
--- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 26 Jul 2007 17:37:39 -0000 1.157
+++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 30 Jul 2007 10:58:06 -0000 1.158
@@ -1002,15 +1002,16 @@
PageTemplate parameter {
{render_adp 0}
}
- PageTemplate instproc count_usages {} {
- return [::xowiki::PageTemplate count_usages -item_id [my item_id]]
+ PageTemplate instproc count_usages {{-all false}} {
+ return [::xowiki::PageTemplate count_usages -item_id [my item_id] -all $all]
}
- PageTemplate proc count_usages {-item_id:required} {
+ PageTemplate proc count_usages {-item_id:required {-all:boolean false}} {
+ set publish_status_clause [expr {$all ? "" : " and i.publish_status <> 'production' "}]
set count [db_string [my qn count_usages] \
"select count(page_instance_id) from xowiki_page_instance, cr_items i \
where page_template = $item_id \
- and i.publish_status <> 'production' \
+ $publish_status_clause \
and page_instance_id = coalesce(i.live_revision,i.latest_revision)"]
return $count
}
Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v
diff -u -r1.94 -r1.95
--- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 26 Jul 2007 17:48:49 -0000 1.94
+++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 30 Jul 2007 10:58:06 -0000 1.95
@@ -1025,10 +1025,15 @@
PageTemplate instproc delete {} {
my instvar package_id item_id name
- set count [my count_entries]
- my msg count=$count
+ set count [my count_usages -all true]
+ #my msg count=$count
if {$count > 0} {
- $package_id error_msg [_ xowiki.error-delete_entries_first [list count $count]]
+ append error_msg \
+ [_ xowiki.error-delete_entries_first [list count $count]] \
+
\
+ [my include_portlet [list form-usages -all true -form_item_id [my item_id]]] \
+
+ $package_id error_msg $error_msg
} else {
next
}
Index: openacs-4/packages/xowiki/www/prototypes/news-item.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/news-item.page,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/xowiki/www/prototypes/news-item.page 30 Jul 2007 10:58:07 -0000 1.1
@@ -0,0 +1,17 @@
+# -*- tcl-*-
+# $Id: news-item.page,v 1.1 2007/07/30 10:58:07 gustafn Exp $
+::xowiki::Form new \
+ -set name en:news-item \
+ -title "News Item" \
+ -set anon_instances t \
+ -set form {{} text/html} \
+ -set text {@_description@
@detail_link@
} \
+ -set form_constraints {
+ _page_order:hidden
+ _creator:hidden
+ _title:text,label=#acs-kernel.common_Title#
+ {detail_link:detail_link,label=Detail URL}
+ }
+
+
+