Index: openacs-4/contrib/packages/simulation/lib/object-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/lib/Attic/object-display.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/contrib/packages/simulation/lib/object-display.tcl 29 Oct 2003 18:48:09 -0000 1.7
+++ openacs-4/contrib/packages/simulation/lib/object-display.tcl 3 Nov 2003 14:13:42 -0000 1.8
@@ -28,10 +28,20 @@
-revision_id $item(revision_id) \
-array content
+#file delete /web/lars/www/picture.jpg
+
+#error [publish::handle::image 580 -html {} -revision_id 581]
+
+#error [publish::render_subitem 586 relation image 1 f {refresh 1}]
+
if { [info exists content(text)] } {
switch $content(mime_type) {
text/enhanced - text/plain - text/fixed-width - text/html {
- set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)]
+ publish::push_id $item(item_id)
+ set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)]
+ set code [template::adp_compile -string $content_html]
+ set content_html [template::adp_eval code]
+ publish::pop_id
}
default {
set content_html [ad_quotehtml $content(text)]
@@ -72,7 +82,7 @@
}
-if { [permission::write_permission_p -object_id $item(item_id)] } {
+if { [permission::write_permission_p -object_id $item(item_id) -party_id [ad_conn untrusted_user_id]] } {
set edit_url [export_vars -base [ad_conn package_url]object-edit { { item_id $item(item_id) } }]
set delete_url [export_vars -base [ad_conn package_url]object-delete { { item_id $item(item_id) } }]
}
Index: openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/tcl/Attic/simulation-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 31 Oct 2003 10:56:40 -0000 1.5
+++ openacs-4/contrib/packages/simulation/tcl/simulation-procs.tcl 3 Nov 2003 14:13:43 -0000 1.6
@@ -125,3 +125,7 @@
# no special error handling because the delete is pretty safe
}
+
+template_tag relation { params } {
+ publish::process_tag relation $params
+}
Index: openacs-4/contrib/packages/simulation/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/index.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/contrib/packages/simulation/www/index.tcl 27 Oct 2003 07:31:55 -0000 1.4
+++ openacs-4/contrib/packages/simulation/www/index.tcl 3 Nov 2003 14:13:43 -0000 1.5
@@ -32,6 +32,7 @@
task_count {
label "Tasks"
orderby task_count
+ html { align right }
}
}
@@ -71,6 +72,7 @@
count {
label "Count"
link_url_col view_url
+ html { align right }
}
}
Index: openacs-4/contrib/packages/simulation/www/object-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-edit.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/contrib/packages/simulation/www/object-edit.adp 29 Oct 2003 15:29:08 -0000 1.2
+++ openacs-4/contrib/packages/simulation/www/object-edit.adp 3 Nov 2003 14:13:43 -0000 1.3
@@ -12,7 +12,41 @@
document.forms[form_name].elements["__refreshing_p"].value = 1;
document.forms[form_name].submit();
}
+ function CopyText(text) {
+ if (document.all) {
+ holdtext.innerText = text;
+ Copied = holdtext.createTextRange();
+ Copied.execCommand("Copy");
+ } else if (window.netscape) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+
+ var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
+ if (!clip) return;
+
+ var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
+ if (!trans) return;
+
+ trans.addDataFlavor('text/unicode');
+
+ var str = new Object();
+ var len = new Object();
+
+ var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
+
+ var copytext = text;
+
+ str.data = copytext;
+
+ trans.setTransferData("text/unicode", str, copytext. length*2);
+
+ var clipid = Components.interfaces.nsIClipboard;
+ if (!clipid) return false;
+
+ clip.setData(trans, null, clipid. kGlobalClipboard);
+ }
+ }
+
Index: openacs-4/contrib/packages/simulation/www/object-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/simulation/www/Attic/object-edit.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/contrib/packages/simulation/www/object-edit.tcl 31 Oct 2003 10:56:40 -0000 1.15
+++ openacs-4/contrib/packages/simulation/www/object-edit.tcl 3 Nov 2003 14:13:43 -0000 1.16
@@ -161,6 +161,14 @@
}
image {
content_method upload
+ attributes {
+ width {
+ widget hidden
+ }
+ height {
+ widget hidden
+ }
+ }
}
}
@@ -426,10 +434,21 @@
lappend attr_names $attribute_name
set elm_name attr__${content_type}__${attribute_name}
set elm_datatype $form_datatype($datatype)
- set elm_widget $form_widget($datatype)
- # LARS TODO: This needs to be specifiable in the attribute declaration
- set elm_optional_p 1
+
+ set elm_widget [get_metadata_property \
+ -content_type $content_type \
+ -entry_type attributes \
+ -entry $attribute_name \
+ -property widget \
+ -default $form_widget($datatype)]
+ set elm_required_p [get_metadata_property \
+ -content_type $content_type \
+ -entry_type attributes \
+ -entry $attribute_name \
+ -property required_p \
+ -default 0]
+
set extra $form_extra($datatype)
set elm_ref_type [get_metadata_property -content_type $content_type -entry_type attributes -entry $attribute_name -property references]
if { ![empty_string_p $elm_ref_type] } {
@@ -439,7 +458,7 @@
}
set elm_decl "${elm_name}:${elm_datatype}($elm_widget)"
- if { $elm_optional_p } {
+ if { !$elm_required_p } {
append elm_decl ",optional"
}
@@ -460,7 +479,7 @@
max_n
from cr_type_relations
where content_type = :content_type
- order by relation_tag
+ order by max_n asc, relation_tag
} {
set label [get_metadata_property -content_type $content_type -entry_type relations -entry $relation_tag -property label]
set section [get_metadata_property -content_type $content_type -entry_type relations -entry $relation_tag -property section]
@@ -472,7 +491,12 @@
for { set counter 1 } { $counter <= $max_n } { incr counter } {
set elm_name "rel__${relation_tag}__$counter"
lappend rel_elements $elm_name
- set elm_label "$label $counter"
+
+ if { $min_n == 1 && $max_n == 1 } {
+ set elm_label $label
+ } else {
+ set elm_label "$label $counter"
+ }
ad_form -extend -name object -form \
[list \
@@ -488,7 +512,7 @@
#---------------------------------------------------------------------
-# Define the form
+# Add handlers to the form definition
#---------------------------------------------------------------------
ad_form -extend -name object -new_request {
@@ -590,7 +614,7 @@
if { ![empty_string_p $related_object_id] } {
bcms::item::relate_item \
- -relation_type $relation_tag \
+ -relation_tag $relation_tag \
-item_id $item_id \
-related_object_id $related_object_id \
-order_n $order_n
@@ -675,7 +699,7 @@
if { ![empty_string_p $related_object_id] } {
bcms::item::relate_item \
- -relation_type $relation_tag \
+ -relation_tag $relation_tag \
-item_id $item_id \
-related_object_id $related_object_id \
-order_n $order_n
@@ -694,7 +718,12 @@
foreach elm $rel_elements {
set elm_before_html {}
+ set elm_after_html {}
+ # LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form
+ regexp {__(.+)__} $elm match relation_tag
+ regexp {__.+__(.+)$} $elm match order_n
+
if { [exists_and_not_null $elm] } {
set related_object_id [set $elm]
@@ -703,14 +732,25 @@
set thumb_url [export_vars -base "object-content/$rel_obj_name"]
append elm_before_html {}
append elm_before_html { }
- append elm_before_html {}
+ append elm_before_html {}
+ append elm_before_html {}
+ append elm_before_html {"]
+ append elm_before_html {');" title="}
+ append elm_before_html [ad_quotehtml "Copy a tag for this $relation_tag to the clipboard"]
+ append elm_before_html {">}
}
+
} else {
append elm_before_html {}
append elm_before_html { }
- append elm_before_html {}
+ append elm_before_html {}
}
append elm_before_html { Choose:}
- element set_properties object $elm -before_html $elm_before_html
+ element set_properties object $elm -before_html $elm_before_html -after_html $elm_after_html
}
Index: openacs-4/packages/simulation/lib/object-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/lib/object-display.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/simulation/lib/object-display.tcl 29 Oct 2003 18:48:09 -0000 1.7
+++ openacs-4/packages/simulation/lib/object-display.tcl 3 Nov 2003 14:13:42 -0000 1.8
@@ -28,10 +28,20 @@
-revision_id $item(revision_id) \
-array content
+#file delete /web/lars/www/picture.jpg
+
+#error [publish::handle::image 580 -html {} -revision_id 581]
+
+#error [publish::render_subitem 586 relation image 1 f {refresh 1}]
+
if { [info exists content(text)] } {
switch $content(mime_type) {
text/enhanced - text/plain - text/fixed-width - text/html {
- set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)]
+ publish::push_id $item(item_id)
+ set content_html [ad_html_text_convert -from $content(mime_type) -to "text/html" -- $content(text)]
+ set code [template::adp_compile -string $content_html]
+ set content_html [template::adp_eval code]
+ publish::pop_id
}
default {
set content_html [ad_quotehtml $content(text)]
@@ -72,7 +82,7 @@
}
-if { [permission::write_permission_p -object_id $item(item_id)] } {
+if { [permission::write_permission_p -object_id $item(item_id) -party_id [ad_conn untrusted_user_id]] } {
set edit_url [export_vars -base [ad_conn package_url]object-edit { { item_id $item(item_id) } }]
set delete_url [export_vars -base [ad_conn package_url]object-delete { { item_id $item(item_id) } }]
}
Index: openacs-4/packages/simulation/tcl/simulation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/tcl/simulation-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/simulation/tcl/simulation-procs.tcl 31 Oct 2003 10:56:40 -0000 1.5
+++ openacs-4/packages/simulation/tcl/simulation-procs.tcl 3 Nov 2003 14:13:43 -0000 1.6
@@ -125,3 +125,7 @@
# no special error handling because the delete is pretty safe
}
+
+template_tag relation { params } {
+ publish::process_tag relation $params
+}
Index: openacs-4/packages/simulation/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/index.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/simulation/www/index.tcl 27 Oct 2003 07:31:55 -0000 1.4
+++ openacs-4/packages/simulation/www/index.tcl 3 Nov 2003 14:13:43 -0000 1.5
@@ -32,6 +32,7 @@
task_count {
label "Tasks"
orderby task_count
+ html { align right }
}
}
@@ -71,6 +72,7 @@
count {
label "Count"
link_url_col view_url
+ html { align right }
}
}
Index: openacs-4/packages/simulation/www/object-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-edit.adp,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/simulation/www/object-edit.adp 29 Oct 2003 15:29:08 -0000 1.2
+++ openacs-4/packages/simulation/www/object-edit.adp 3 Nov 2003 14:13:43 -0000 1.3
@@ -12,7 +12,41 @@
document.forms[form_name].elements["__refreshing_p"].value = 1;
document.forms[form_name].submit();
}
+ function CopyText(text) {
+ if (document.all) {
+ holdtext.innerText = text;
+ Copied = holdtext.createTextRange();
+ Copied.execCommand("Copy");
+ } else if (window.netscape) {
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+
+ var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
+ if (!clip) return;
+
+ var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
+ if (!trans) return;
+
+ trans.addDataFlavor('text/unicode');
+
+ var str = new Object();
+ var len = new Object();
+
+ var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
+
+ var copytext = text;
+
+ str.data = copytext;
+
+ trans.setTransferData("text/unicode", str, copytext. length*2);
+
+ var clipid = Components.interfaces.nsIClipboard;
+ if (!clipid) return false;
+
+ clip.setData(trans, null, clipid. kGlobalClipboard);
+ }
+ }
+
Index: openacs-4/packages/simulation/www/object-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-edit.tcl,v
diff -u -r1.15 -r1.16
--- openacs-4/packages/simulation/www/object-edit.tcl 31 Oct 2003 10:56:40 -0000 1.15
+++ openacs-4/packages/simulation/www/object-edit.tcl 3 Nov 2003 14:13:43 -0000 1.16
@@ -161,6 +161,14 @@
}
image {
content_method upload
+ attributes {
+ width {
+ widget hidden
+ }
+ height {
+ widget hidden
+ }
+ }
}
}
@@ -426,10 +434,21 @@
lappend attr_names $attribute_name
set elm_name attr__${content_type}__${attribute_name}
set elm_datatype $form_datatype($datatype)
- set elm_widget $form_widget($datatype)
- # LARS TODO: This needs to be specifiable in the attribute declaration
- set elm_optional_p 1
+
+ set elm_widget [get_metadata_property \
+ -content_type $content_type \
+ -entry_type attributes \
+ -entry $attribute_name \
+ -property widget \
+ -default $form_widget($datatype)]
+ set elm_required_p [get_metadata_property \
+ -content_type $content_type \
+ -entry_type attributes \
+ -entry $attribute_name \
+ -property required_p \
+ -default 0]
+
set extra $form_extra($datatype)
set elm_ref_type [get_metadata_property -content_type $content_type -entry_type attributes -entry $attribute_name -property references]
if { ![empty_string_p $elm_ref_type] } {
@@ -439,7 +458,7 @@
}
set elm_decl "${elm_name}:${elm_datatype}($elm_widget)"
- if { $elm_optional_p } {
+ if { !$elm_required_p } {
append elm_decl ",optional"
}
@@ -460,7 +479,7 @@
max_n
from cr_type_relations
where content_type = :content_type
- order by relation_tag
+ order by max_n asc, relation_tag
} {
set label [get_metadata_property -content_type $content_type -entry_type relations -entry $relation_tag -property label]
set section [get_metadata_property -content_type $content_type -entry_type relations -entry $relation_tag -property section]
@@ -472,7 +491,12 @@
for { set counter 1 } { $counter <= $max_n } { incr counter } {
set elm_name "rel__${relation_tag}__$counter"
lappend rel_elements $elm_name
- set elm_label "$label $counter"
+
+ if { $min_n == 1 && $max_n == 1 } {
+ set elm_label $label
+ } else {
+ set elm_label "$label $counter"
+ }
ad_form -extend -name object -form \
[list \
@@ -488,7 +512,7 @@
#---------------------------------------------------------------------
-# Define the form
+# Add handlers to the form definition
#---------------------------------------------------------------------
ad_form -extend -name object -new_request {
@@ -590,7 +614,7 @@
if { ![empty_string_p $related_object_id] } {
bcms::item::relate_item \
- -relation_type $relation_tag \
+ -relation_tag $relation_tag \
-item_id $item_id \
-related_object_id $related_object_id \
-order_n $order_n
@@ -675,7 +699,7 @@
if { ![empty_string_p $related_object_id] } {
bcms::item::relate_item \
- -relation_type $relation_tag \
+ -relation_tag $relation_tag \
-item_id $item_id \
-related_object_id $related_object_id \
-order_n $order_n
@@ -694,7 +718,12 @@
foreach elm $rel_elements {
set elm_before_html {}
+ set elm_after_html {}
+ # LARS HACK ALERT: This isn't a particularly pretty way to find all the related objects in the form
+ regexp {__(.+)__} $elm match relation_tag
+ regexp {__.+__(.+)$} $elm match order_n
+
if { [exists_and_not_null $elm] } {
set related_object_id [set $elm]
@@ -703,14 +732,25 @@
set thumb_url [export_vars -base "object-content/$rel_obj_name"]
append elm_before_html {}
append elm_before_html { }
- append elm_before_html {}
+ append elm_before_html {}
+ append elm_before_html {}
+ append elm_before_html {"]
+ append elm_before_html {');" title="}
+ append elm_before_html [ad_quotehtml "Copy a tag for this $relation_tag to the clipboard"]
+ append elm_before_html {">}
}
+
} else {
append elm_before_html {}
append elm_before_html { }
- append elm_before_html {}
+ append elm_before_html {}
}
append elm_before_html { Choose:}
- element set_properties object $elm -before_html $elm_before_html
+ element set_properties object $elm -before_html $elm_before_html -after_html $elm_after_html
}