Index: openacs-4/packages/xowiki/tcl/folder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/folder-procs.tcl,v diff -u -r1.51 -r1.52 --- openacs-4/packages/xowiki/tcl/folder-procs.tcl 19 Jan 2019 08:52:56 -0000 1.51 +++ openacs-4/packages/xowiki/tcl/folder-procs.tcl 27 Jan 2019 17:07:55 -0000 1.52 @@ -1,4 +1,4 @@ -::xo::library doc { +::xo::library doc { This is an experimental implementation for folders based on xowiki form pages. In particular, this file provides @@ -44,15 +44,15 @@ folders instproc render {} { :get_parameters - + set tree [:build_tree] switch [${:package_id} get_parameter PreferredCSSToolkit bootstrap] { yui { set js " var [:js_name]; YAHOO.util.Event.onDOMReady(function() { - [:js_name] = new YAHOO.widget.TreeView('foldertree_[:id]'); - [:js_name].subscribe('clickEvent',function(oArgs) { + [:js_name] = new YAHOO.widget.TreeView('foldertree_[:id]'); + [:js_name].subscribe('clickEvent',function(oArgs) { var m = /href=\"(\[^\"\]+)\"/.exec(oArgs.node.html); return false; }); @@ -124,10 +124,10 @@ left join acs_objects o on (o.object_id = ci.live_revision) left join xowiki_page on (o.object_id = xowiki_page.page_id) left join xowiki_page_instance on (o.object_id = xowiki_page_instance.page_instance_id) - left join xowiki_form_page on (o.object_id = xowiki_form_page.xowiki_form_page_id) + left join xowiki_form_page on (o.object_id = xowiki_form_page.xowiki_form_page_id) }] } - + folders instproc collect_folders { -package_id:required -folder_form_id:required @@ -162,7 +162,7 @@ set links [::xowiki::FormPage instantiate_objects -sql $sql \ -named_objects true -object_named_after "item_id" \ -object_class ::xowiki::FormPage -initialize true] - + #my msg "[llength [$links children]] links" set folders [$folder_pages children] @@ -194,7 +194,7 @@ #my msg "1 found child [$f name] and reset parent_id from [$f parent_id] to [$l item_id], package_id [$l package_id]" # # reset the current_folder if necessary - # + # if {${:current_folder_id} eq [$f parent_id]} { set :current_folder_id [$l item_id] } @@ -261,7 +261,7 @@ if {$mb ne ""} { # # We have a menubar. Add folder-specific content to the - # menubar. + # menubar. # if {$root_folder_is_current} { # @@ -357,7 +357,7 @@ #set modebutton_link [$package_id make_link ${:current_folder} toggle-modebutton] #$mb add_extra_item -name admin -type ModeButton \ # -item [list url $modebutton_link on $modestate label admin] - + $mb update_items \ -package_id $package_id \ -parent_id $opt_parent_id \ @@ -413,7 +413,7 @@ return $t } - folders instproc build_sub_tree { + folders instproc build_sub_tree { {-node} {-folders} @@ -424,7 +424,7 @@ set current_item_id [$current_object item_id] set sub_folders [list] set remaining_folders [list] - + foreach f $folders { if {[$f parent_id] ne $current_item_id} { lappend remaining_folders $f @@ -456,7 +456,7 @@ if {$is_current} { $node open_tree - if {[info commands ::__xowiki__MenuBar] ne "" + if {[info commands ::__xowiki__MenuBar] ne "" && [::__xowiki__MenuBar exists submenu_pages(folder)]} { set owner [::__xowiki__MenuBar set submenu_owner(folder)] $subnode add_pages -full true \ @@ -498,7 +498,7 @@ } } } - + child-resources instproc types_to_show {} { :get_parameters foreach type [split $show_types ,] {set ($type) 1} @@ -564,7 +564,7 @@ # scoping in "-columns" set ::__xowiki_with_publish_status [expr {$publish_status ne "ready"}] set ::__xowiki_folder_link [$package_id make_link $current_folder bulk-delete {__csrf_token [::security::csrf::token]}] - + switch [$package_id get_parameter PreferredCSSToolkit bootstrap] { bootstrap {set tableWidgetClass ::xowiki::BootstrapTable} default {set tableWidgetClass ::xowiki::YUIDataTable} @@ -579,7 +579,7 @@ } } # The "-html" options are currently ignored in the YUI - # DataTable. Not sure, it can be integrated in the traditional way. + # DataTable. Not sure, it can be integrated in the traditional way. # HiddenField create ID AnchorField create edit -CSSclass edit-item-button -label "" \ @@ -592,10 +592,10 @@ Field create object_type -label [_ xowiki.page_kind] -orderby object_type -richtext false \ -hide $::hidden(object_type) AnchorField create name -label [_ xowiki.Page-name] -orderby name \ - -hide $::hidden(name) + -hide $::hidden(name) Field create last_modified -label [_ xowiki.Page-last_modified] -orderby last_modified \ - -hide $::hidden(last_modified) - Field create mod_user -label [_ xowiki.By_user] -orderby mod_user -hide $::hidden(mod_user) + -hide $::hidden(last_modified) + Field create mod_user -label [_ xowiki.By_user] -orderby mod_user -hide $::hidden(mod_user) AnchorField create delete -CSSclass delete-item-button \ -hide $::hidden(delete) \ -label "" @@ -610,7 +610,7 @@ -publish_status $publish_status \ -object_types [:types_to_show] \ -extra_where_clause $extra_where_clause] - + set package_id [::xo::cc package_id] set pkg ::$package_id set url [::xo::cc url] @@ -627,7 +627,7 @@ -path_encode false \ $name] array set icon [$c render_icon] - + ad_try { set prettyName [$c pretty_name] } on error {errorMsg} { @@ -663,15 +663,14 @@ set revision_id [$c set revision_id] [$t last_child] set publish_status.src /resources/xowiki/$image [$t last_child] set publish_status.href \ - [export_vars -base [$package_id package_url]admin/set-publish-state \ - {state revision_id return_url}] + [export_vars -base $page_link {{m toggle-publish-status} return_url}] } } lassign [split $orderby ,] att order $t orderby -order [expr {$order eq "asc" ? "increasing" : "decreasing"}] $att set resources_list "[$t asHTML]" - + if {$menubar ne ""} { set mb [::xowiki::MenuBar new -id submenubar] # for now, just the first group @@ -726,7 +725,7 @@ } -::xo::library source_dependent +::xo::library source_dependent # # Local variables: 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.541 -r1.542 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 21 Jan 2019 19:19:31 -0000 1.541 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 27 Jan 2019 17:07:55 -0000 1.542 @@ -1839,6 +1839,36 @@ return "" } + Page instproc update_publish_status {new_publish_status} { + # + # The publish_status of xowiki is used for "advertising" + # pages. When the publish_status is e.g. "production", users can + # access this object when they know obout its existence + # (e.g. workflow assignments), but it is excluded from listings, + # which contain - per default - only elements in publish_status + # "ready". + # + # This proc can be used to change the publish status of a page and + # handle visibility via syndication. + # + if {$new_publish_status ne ${:publish_status}} { + :set_live_revision \ + -revision_id ${:revision_id} \ + -publish_status $new_publish_status + + ::xo::xotcl_object_cache flush ${:revision_id} + ::xo::xotcl_object_cache flush ${:item_id} + + if {$new_publish_status ne "production"} { + ::xowiki::notification::do_notifications -revision_id ${:revision_id} + ::xowiki::datasource -nocleanup ${:revision_id} + } else { + set revision_id ${:revision_id} + db_dml flush_syndication {delete from syndication where object_id = :revision_id} + } + } + } + # # render and substitutions # Index: openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl,v diff -u -r1.49 -r1.50 --- openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 19 Jan 2019 08:46:58 -0000 1.49 +++ openacs-4/packages/xowiki/tcl/xowiki-sc-procs.tcl 27 Jan 2019 17:07:55 -0000 1.50 @@ -8,13 +8,12 @@ namespace eval ::xowiki {} -ad_proc -private ::xowiki::datasource { revision_id } { +ad_proc -private ::xowiki::datasource { -nocleanup:boolean revision_id } { @param revision_id returns a datasource for the search package } { #ns_log notice "--sc ::xowiki::datasource called with revision_id = $revision_id" - set page [::xowiki::Package instantiate_page_from_id -revision_id $revision_id -user_id 0] #ns_log notice "--sc ::xowiki::datasource $page [$page set publish_status]" @@ -117,7 +116,7 @@ guid "$item_id" \ pubDate $pubDate] \ ] - if {[catch {::xo::at_cleanup} errorMsg]} { + if {!$nocleanup_p && [catch {::xo::at_cleanup} errorMsg]} { ns_log notice "cleanup in ::xowiki::datasource returned $errorMsg" } return $result 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.363 -r1.364 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 4 Jan 2019 13:27:34 -0000 1.363 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 27 Jan 2019 17:07:55 -0000 1.364 @@ -1221,7 +1221,6 @@ # Page instproc www-make-live-revision {} { - set package_id ${:package_id} set page_id [:query_parameter "revision_id"] if {[string is integer -strict $page_id]} { set revision_id $page_id @@ -1230,11 +1229,28 @@ } #:log "--M set_live_revision $revision_id" :set_live_revision -revision_id $revision_id - ::$package_id returnredirect [:query_parameter "return_url" \ - [export_vars -base [$package_id url] {{m revisions}}]] + ${:package_id} returnredirect [:query_parameter "return_url" \ + [export_vars -base [${:package_id} url] {{m revisions}}]] } # + # Externally callable method: toggle-publish-status + # + # Toggle from arbitrary states to "ready" and from "ready" to + # "production". + # + + Page instproc www-toggle-publish-status {} { + if {${:publish_status} ne "ready"} { + set new_publish_status "ready" + } else { + set new_publish_status "production" + } + :update_publish_status $new_publish_status + ${:package_id} returnredirect [:query_parameter "return_url" [ad_return_url]] + } + + # # Externally callable method: popular-tags # Index: openacs-4/packages/xowiki/www/admin/set-publish-state.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/set-publish-state.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/xowiki/www/admin/set-publish-state.tcl 11 Jul 2018 12:33:22 -0000 1.15 +++ openacs-4/packages/xowiki/www/admin/set-publish-state.tcl 27 Jan 2019 17:07:55 -0000 1.16 @@ -5,7 +5,7 @@ @creation-date Nov 16, 2006 @cvs-id $Id$ - @param object_type + @param object_type @param query } -parameter { {-state:required} @@ -14,19 +14,8 @@ } set page [::xo::db::CrClass get_instance_from_db -revision_id $revision_id] -$page set_live_revision \ - -revision_id $revision_id \ - -publish_status $state +$page update_publish_status $state -::xo::xotcl_object_cache flush $revision_id - -if {$state ne "production"} { - ::xowiki::notification::do_notifications -revision_id $revision_id - ::xowiki::datasource $revision_id -} else { - db_dml flush_syndication {delete from syndication where object_id = :revision_id} -} - ad_returnredirect $return_url ad_script_abort