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.413 -r1.414 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 1 Jul 2010 12:46:42 -0000 1.413 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 2 Jul 2010 10:03:22 -0000 1.414 @@ -866,6 +866,45 @@ Page instforward form_parameter {%my set package_id} %proc Page instforward exists_form_parameter {%my set package_id} %proc +# Page instproc init {} { +# my log "--W " +# ::xo::show_stack +# next +# } + +# Page instproc destroy {} { +# my log "--W " +# ::xo::show_stack +# next +# } + + # + # check certain properties of a page (is_* methods) + # + Page instproc is_folder_page {} { + #my msg "[my name] istype FormPage [my istype ::xowiki::FormPage]" + if {![my istype ::xowiki::FormPage]} {return 0} + #my msg "[my name] has template page [my page_template] [[my page_template] name]" + if {[[my page_template] name] eq "en:folder.form"} {return 1} + return 0 + } + + Page instproc is_form {} { + return 0 + } + + Form instproc is_form {} { + return 1 + } + + FormPage instproc is_form {} { + return [my exists_property form_constraints] + } + + # + # helper for nls and lang + # + Page instproc lang {} { return [string range [my nls_language] 0 1] } @@ -883,14 +922,6 @@ return "" } - Page instproc is_folder_page {} { - #my msg "[my name] istype FormPage [my istype ::xowiki::FormPage]" - if {![my istype ::xowiki::FormPage]} {return 0} - #my msg "[my name] has template page [my page_template] [[my page_template] name]" - if {[[my page_template] name] eq "en:folder.form"} {return 1} - return 0 - } - Page instproc build_name {{-nls_language ""}} { # # Build the name of the page, based on the provided nls_language @@ -919,6 +950,9 @@ return $name } + # + # context handling + # Page instproc set_resolve_context {-package_id:required -parent_id:required} { if {[my set parent_id] != $parent_id} { my set physical_parent_id [my set parent_id] @@ -947,6 +981,10 @@ return [my package_id] } } + + # + # folder handling + # Page instproc get_folder {-folder_form_ids:required} { set page [self] @@ -967,17 +1005,9 @@ return $page } -# Page instproc init {} { -# my log "--W " -# ::xo::show_stack -# next -# } - -# Page instproc destroy {} { -# my log "--W " -# ::xo::show_stack -# next -# } + # + # save / restore + # Page instproc save args { [my package_id] flush_page_fragment_cache @@ -995,13 +1025,21 @@ next } + # + # misc + # + Page instproc get_instance_attributes {} { if {[my exists instance_attributes]} { return [my set instance_attributes] } return "" } + # + # render and substitutions + # + Page instproc regsub_eval {{-noquote:boolean false} re string cmd {prefix ""}} { if {$noquote} { set map { \[ \\[ \] \\] \$ \\$ \\ \\\\} @@ -2303,8 +2341,8 @@ FormPage instproc get_form_constraints {{-trylocal false}} { # We define it as a method to ease overloading. - #my msg "is_form=[my isform]" - if {$trylocal && [my isform]} { + #my msg "is_form=[my is_form]" + if {$trylocal && [my is_form]} { return [my property form_constraints] } else { #my msg "get_form_constraints returns '[my get_from_template form_constraints]'" @@ -2525,37 +2563,7 @@ return [my form_constraints] } - # todo move me - Page instproc list {} { - # The following line is here to provide a short description for - # larger form-usages (a few MB) where otherwise - # "ad_html_text_convert" in Page.get_description tend to use forever - # (at least in Tcl 8.5) - my set description "form-usages for [my name] [my title]" - my view [my include [list form-usages -form_item_id [my item_id]]] - } - Page instproc csv-dump {} { - my instvar package_id - if {[my info class] ne "::xowiki::FormPage" && [my info class] ne "::xowiki::Form"} { - error "not called on a form" - } - set form_item_id [my item_id] - set items [::xowiki::FormPage get_form_entries \ - -base_item_ids $form_item_id -form_fields "" -initialize false \ - -publish_status all -package_id $package_id] - # collect all instances attributes of all items - foreach i [$items children] {array set vars [$i set instance_attributes]} - array set vars [list _name 1 _last_modified 1 _creation_user 1] - set attributes [lsort -dictionary [array names vars]] - # make sure, we the includelet honors the cvs generation - set includelet_key name:form-usages,form_item_ids:$form_item_id,field_names:[join $attributes " "], - ::xo::cc set queryparm(includelet_key) $includelet_key - # call the includelet - my view [my include [list form-usages -field_names $attributes \ - -extra_form_constraints _creation_user:numeric,format=%d \ - -form_item_id [my item_id] -generate csv]] - } Page instproc create_form_fields_from_form_constraints {form_constraints} { # @@ -2962,16 +2970,12 @@ my set publish_status $value } - FormPage instproc isform {} { - return [my exists_property form_constraints] - } - FormPage instproc footer {} { if {[my exists __no_form_page_footer]} { next } else { set is_form [my property is_form__ 0] - if {[my isform]} { + if {[my is_form]} { return [my include [list form-menu -form_item_id [my item_id] \ -buttons [list new answers [list form [my page_template]]]]] } else { 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.281 -r1.282 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 30 Jun 2010 12:38:58 -0000 1.281 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 2 Jul 2010 10:03:22 -0000 1.282 @@ -11,12 +11,12 @@ namespace eval ::xowiki { # - # This block contains the externally called methods. We use as + # This block contains the externally callable methods. We use as # naming convention dashes as separators. # # - # externally called method: clipboard-add + # externally callable method: clipboard-add # Page instproc clipboard-add {} { my instvar package_id @@ -35,7 +35,7 @@ } # - # externally called method: clipboard-clear + # externally callable method: clipboard-clear # Page instproc clipboard-clear {} { my instvar package_id @@ -44,7 +44,7 @@ } # - # externally called method: clipboard-content + # externally callable method: clipboard-content # Page instproc clipboard-content {} { my instvar package_id @@ -64,7 +64,7 @@ } # - # externally called method: clipboard-copy + # externally callable method: clipboard-copy # Page instproc clipboard-copy {} { my instvar package_id @@ -83,7 +83,7 @@ } # - # externally called method: clipboard-export + # externally callable method: clipboard-export # Page instproc clipboard-export {} { my instvar package_id @@ -95,7 +95,7 @@ # - # externally called method: create-new + # externally callable method: create-new # Page instproc create-new { @@ -218,7 +218,7 @@ } # - # externally called method: create-or-use + # externally callable method: create-or-use # Page instproc create-or-use { @@ -234,9 +234,34 @@ } # - # externally called method: delete + # externally callable method: csv-dump # + Page instproc csv-dump {} { + if {![my is_form]} { + error "not called on a form" + } + set form_item_id [my item_id] + set items [::xowiki::FormPage get_form_entries \ + -base_item_ids $form_item_id -form_fields "" -initialize false \ + -publish_status all -package_id [my package_id]] + # collect all instances attributes of all items + foreach i [$items children] {array set vars [$i set instance_attributes]} + array set vars [list _name 1 _last_modified 1 _creation_user 1] + set attributes [lsort -dictionary [array names vars]] + # make sure, we the includelet honors the cvs generation + set includelet_key name:form-usages,form_item_ids:$form_item_id,field_names:[join $attributes " "], + ::xo::cc set queryparm(includelet_key) $includelet_key + # call the includelet + my view [my include [list form-usages -field_names $attributes \ + -extra_form_constraints _creation_user:numeric,format=%d \ + -form_item_id [my item_id] -generate csv]] + } + + # + # externally callable method: delete + # + Page instproc delete {} { my instvar package_id item_id name # delete always via package @@ -260,7 +285,7 @@ } # - # externally called method: delete-revision + # externally callable method: delete-revision # Page instproc delete-revision {} { @@ -290,7 +315,7 @@ } # - # externally called method: diff + # externally callable method: diff # Page instproc diff {} { @@ -394,7 +419,7 @@ } # - # externally called method: download + # externally callable method: download # File instproc download {} { @@ -413,7 +438,7 @@ } # - # helper methods for externally called method: edit + # helper methods for externally callable method: edit # Page instproc edit_set_default_values {} { @@ -443,7 +468,7 @@ } # - # externally called method: edit + # externally callable method: edit # Page instproc edit { @@ -839,9 +864,29 @@ } # - # externally called method: make-live-revision + # externally callable method: list # + Page instproc list {} { + if {[my is_form]} { + # The following line is here to provide a short description for + # larger form-usages (a few MB) where otherwise + # "ad_html_text_convert" in Page.get_description tend to use forever + # (at least in Tcl 8.5) + my set description "form-usages for [my name] [my title]" + + return [my view [my include [list form-usages -form_item_id [my item_id]]]] + } + if {[my is_folder_page]} { + return [my view [my include [list child-resources]]] + } + #my msg "method list undefined for this kind of object" + [my package_id] returnredirect [::xo::cc url] + } + # + # externally callable method: make-live-revision + # + Page instproc make-live-revision {} { my instvar revision_id item_id package_id #my log "--M set_live_revision($revision_id)" @@ -853,7 +898,7 @@ } # - # externally called method: popular-tags + # externally callable method: popular-tags # Page instproc popular-tags {} { @@ -877,11 +922,11 @@ } # - # externally called method: save-attributes + # externally callable method: save-attributes # Page ad_instproc save-attributes {} { - The method save-attributes is typically called over the + The method save-attributes is typically callable over the REST interface. It allows to save attributes of a page without adding a new revision. } { @@ -950,7 +995,7 @@ } # - # externally called method: revisions + # externally callable method: revisions # Page instproc revisions {} { @@ -966,7 +1011,7 @@ } # - # externally called method: save-tags + # externally callable method: save-tags # Page instproc save-tags {} { @@ -983,7 +1028,7 @@ } # - # externally called method: validate-attribute + # externally callable method: validate-attribute # Page instproc validate-attribute {} { @@ -1013,7 +1058,7 @@ } # - # externally called method: view + # externally callable method: view # Page instproc view {{content ""}} { Index: openacs-4/packages/xowiki/www/prototypes/folder.form.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/Attic/folder.form.page,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/prototypes/folder.form.page 22 Jun 2010 07:35:55 -0000 1.3 +++ openacs-4/packages/xowiki/www/prototypes/folder.form.page 2 Jul 2010 10:03:29 -0000 1.4 @@ -3,7 +3,7 @@ -set name en:folder.form \ -title "Folder Form" \ -set anon_instances t \ - -set text {{{child_resources}}} \ + -set text {{{child-resources}}} \ -set form {
@extra_menu_entries@ @index@ @ParameterPages@
} \ -set form_constraints {extra_menu_entries:menuentries}