Index: openacs-4/packages/xowiki/xowiki.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v
diff -u -r1.87 -r1.88
--- openacs-4/packages/xowiki/xowiki.info 25 Aug 2008 11:33:56 -0000 1.87
+++ openacs-4/packages/xowiki/xowiki.info 28 Aug 2008 12:36:09 -0000 1.88
@@ -8,7 +8,7 @@
f
xowiki
-
+
Gustaf Neumann
A more generic xotcl-based wikis example with object types
and subtypes based on the content repository (with category support)
@@ -54,12 +54,12 @@
BSD-Style
0
-
+
-
+
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.41 -r1.42
--- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 27 Aug 2008 23:12:20 -0000 1.41
+++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 28 Aug 2008 12:36:09 -0000 1.42
@@ -38,6 +38,7 @@
Start of Lecture
Title of Lecture
Can be obtained from the name of the uploaded file
+ Created form
Form
Form Constraints
Entries for this form
@@ -47,6 +48,7 @@
Instances of %form_name%
OK
Template
+ Updated form
%errorMsg%
Assignee
State
Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v
diff -u -r1.42 -r1.43
--- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 4 Jul 2008 10:57:45 -0000 1.42
+++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 28 Aug 2008 12:36:09 -0000 1.43
@@ -2672,8 +2672,10 @@
{-category_id}
{-unless}
{-where}
- {-csv true}
{-with_categories}
+ {-csv true}
+ {-voting_form}
+ {-generate}
}}
}
@@ -2698,7 +2700,10 @@
-name @table \
-form_constraints $form_constraints]
set field_names [split $fn ,]
+ } elseif {[string match "*,*" $field_names] } {
+ set field_names [split $field_names ,]
}
+
if {$field_names eq ""} {
set field_names {_name _last_modified _creation_user}
}
@@ -2714,14 +2719,14 @@
if {[info exists __ff(_creation_user)]} {$__ff(_creation_user) label "By User"}
set cols ""
- append cols {ImageField_EditIcon edit -label "" -html {style "padding: 2px;"}} \n
+ append cols {ImageField_EditIcon edit -label "" -html {style "padding: 2px;"} -no_csv 1} \n
foreach fn $field_names {
append cols [list AnchorField $fn \
-label [$__ff($fn) label] \
-richtext [$__ff($fn) istype ::xowiki::formfield::richtext] \
-orderby $fn] \n
}
- append cols [list ImageField_DeleteIcon delete -label "" ] \n
+ append cols [list ImageField_DeleteIcon delete -label "" -no_csv 1] \n
TableWidget t1 -volatile -columns $cols
#
@@ -2812,6 +2817,11 @@
}
}
+ #
+ # If there are multiple includelets on a single page,
+ # we have to identify the right one for e.g. producing the
+ # csv table. Therefore, we compute an includelet_key
+ #
my instvar name
set includelet_key ""
foreach var {name form_item_id form publish_states field_names unless} {
@@ -2820,21 +2830,30 @@
set given_includelet_key [::xo::cc query_parameter includelet_key ""]
if {$given_includelet_key ne ""} {
- if {$given_includelet_key eq $includelet_key} {
- return [t1 write_csv]
- } else {
- return ""
+ if {$given_includelet_key eq $includelet_key && [info exists generate]} {
+ if {$generate eq "csv"} {
+ return [t1 write_csv]
+ } elseif {$generate eq "voting_form"} {
+ return [my generate_voting_form $voting_form t1 $field_names]
+ }
}
+ return ""
}
+ set links [list]
set base [$package_id pretty_link [$form_item name]]
set label [$form_item name]
append html [_ xowiki.entries_using_form [list form "$label"]]
append html [t1 asHTML]
if {$csv} {
- set csv_href "[::xo::cc url]?[::xo::cc actual_query]&includelet_key=[ns_urlencode $includelet_key]"
- append html "csv"
+ set csv_href "[::xo::cc url]?[::xo::cc actual_query]&includelet_key=[ns_urlencode $includelet_key]&generate=csv"
+ lappend links "csv"
}
+ if {[info exists voting_form]} {
+ set href "[::xo::cc url]?[::xo::cc actual_query]&includelet_key=[ns_urlencode $includelet_key]&generate=voting_form"
+ lappend links " Generate Voting Form $voting_form"
+ }
+ append html [join $links ,]
my log "render done"
if {[info exists with_categories]} {
@@ -2844,5 +2863,55 @@
}
return $html
}
+
+ form-usages instproc generate_voting_form {form_name t1 field_names} {
+ set form "\n"
+ lappend table_field_names _last_modified _creation_user
+
+ set item_id [::xo::db::CrClass lookup -name $form_name -parent_id [[my package_id] folder_id]]
+ if {$item_id == 0} {
+ set f [::xowiki::Form new \
+ -package_id [my package_id] \
+ -parent_id [[my package_id] folder_id] \
+ -name $form_name \
+ -anon_instances t \
+ -form [list $form text/html] \
+ -form_constraints "@fields:scale,n=7,inline=true @cr_fields:hidden @categories:off\n\
+ @table:[join $table_field_names ,]" \
+ ]
+ $f save_new
+ $f destroy
+ set action created
+ } else {
+ ::xowiki::Form get_instance_from_db -item_id $item_id
+ $item_id form [list $form text/html]
+ $item_id save
+ set action updated
+ }
+ return "#xowiki.form-$action# $form_name"
+ }
}
\ No newline at end of file