Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.180.2.43 -r1.180.2.44 --- openacs-4/packages/xowiki/xowiki.info 4 Aug 2020 15:37:16 -0000 1.180.2.43 +++ openacs-4/packages/xowiki/xowiki.info 26 Aug 2020 11:16:11 -0000 1.180.2.44 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2017-08-06 @@ -55,7 +55,7 @@ BSD-Style 2 - + 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.71.2.18 -r1.71.2.19 --- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 4 Aug 2020 15:37:16 -0000 1.71.2.18 +++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 26 Aug 2020 11:16:11 -0000 1.71.2.19 @@ -156,7 +156,7 @@ Admin Import Archive Import Dump - Notifications + Manage Notifications Startpage Subscribe Table of Contents Index: openacs-4/packages/xowiki/resources/templates/oacs-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/oacs-view.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/oacs-view.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -48,8 +48,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view2.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/oacs-view2.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/oacs-view2.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -54,8 +54,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/oacs-view3-bootstrap3.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -54,8 +54,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/oacs-view3.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/oacs-view3.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/oacs-view3.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/oacs-view3.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -77,8 +77,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/view-book-no-ajax.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -78,7 +78,7 @@ &="per_object_categories_with_links" &="digg_link" &="delicious_link" &="my_yahoo_link" &="gc_link" &="gc_comments" &="notification_subscribe_link" &="notification_image" - &="top_includelets" &="folderhtml" &="page" &="doc" &="body"> + &="top_includelets" &="page" &="doc" &="body"> Index: openacs-4/packages/xowiki/resources/templates/view-book.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-book.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/view-book.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/view-book.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -78,7 +78,7 @@ &="per_object_categories_with_links" &="digg_link" &="delicious_link" &="my_yahoo_link" &="gc_link" &="gc_comments" &="notification_subscribe_link" &="notification_image" - &="top_includelets" &="folderhtml" &="page" &="doc" &="body"> + &="top_includelets" &="page" &="doc" &="body"> Index: openacs-4/packages/xowiki/resources/templates/view-default.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-default.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/view-default.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/view-default.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -36,8 +36,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/view-links.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-links.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/view-links.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/view-links.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - +
@@ -30,8 +30,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/view-plain-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-plain-master.adp,v diff -u -r1.1.2.5 -r1.1.2.6 --- openacs-4/packages/xowiki/resources/templates/view-plain-master.adp 13 Jul 2020 12:02:33 -0000 1.1.2.5 +++ openacs-4/packages/xowiki/resources/templates/view-plain-master.adp 26 Aug 2020 11:16:11 -0000 1.1.2.6 @@ -1,4 +1,4 @@ - + @context;literal@ @item_id;literal@ @@ -13,8 +13,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/resources/templates/view-plain.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/resources/templates/view-plain.adp,v diff -u -r1.5.2.6 -r1.5.2.7 --- openacs-4/packages/xowiki/resources/templates/view-plain.adp 13 Jul 2020 12:02:33 -0000 1.5.2.6 +++ openacs-4/packages/xowiki/resources/templates/view-plain.adp 26 Aug 2020 11:16:11 -0000 1.5.2.7 @@ -1,4 +1,4 @@ - +
@@ -7,8 +7,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ Index: openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl,v diff -u -r1.51.2.4 -r1.51.2.5 --- openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 13 Jul 2020 12:02:33 -0000 1.51.2.4 +++ openacs-4/packages/xowiki/tcl/adp-generator-procs.tcl 26 Aug 2020 11:16:11 -0000 1.51.2.5 @@ -72,8 +72,8 @@
@body.menubarHTML;noquote@
\n\

@body.title@ (@page_context@)

\n\

@body.title@

\n\ - \n\ -
@folderhtml;noquote@
\n\ + \n\ +
@body.folderHTML;noquote@
\n\
@content;noquote@
\n\
@content;noquote@" @@ -323,8 +323,8 @@
@body.menubarHTML;noquote@

@body.title@ (@page_context@)

@body.title@

- -
@folderhtml;noquote@
+ +
@body.folderHTML;noquote@
@content;noquote@
@content;noquote@ @@ -458,7 +458,7 @@ &="per_object_categories_with_links" &="digg_link" &="delicious_link" &="my_yahoo_link" &="gc_link" &="gc_comments" &="notification_subscribe_link" &="notification_image" - &="top_includelets" &="folderhtml" &="page" &="doc" &="body"> + &="top_includelets" &="page" &="doc" &="body">
}} 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.55.2.40 -r1.55.2.41 --- openacs-4/packages/xowiki/tcl/folder-procs.tcl 24 Aug 2020 11:56:01 -0000 1.55.2.40 +++ openacs-4/packages/xowiki/tcl/folder-procs.tcl 26 Aug 2020 11:16:11 -0000 1.55.2.41 @@ -247,11 +247,8 @@ set page [$page set __link_source] } set package_id [::xo::cc package_id] - set with_links [::$package_id get_parameter "MenuBarSymLinks" 0] - #:ds [::xo::cc serialize] set lang [::xo::cc lang] - #set lang en set return_url [::xo::cc url] set nls_language [$page get_nls_language_from_lang $lang] @@ -266,139 +263,118 @@ #:msg "FOLDERS [$page name] package_id $package_id current_folder ${:current_folder} [${:current_folder} name]" - # Start with the "package's folder" as root folder - set root_folder [::xo::db::CrClass get_instance_from_db \ - -item_id [::$package_id folder_id]] + if {[::$package_id get_parameter "MenuBar" 0]} { - set mb [info commands ::__xowiki__MenuBar] - if {$mb ne ""} { # - # We have a menubar. Add folder-specific content to the menubar. + # We want a menubar. Create a menubar object, which might be + # configured via the menu_entries property in the current + # folder. # - if {[${:current_folder_id} is_package_root_folder]} { + set menu_entries [list \ + {*}[::$package_id get_parameter ExtraMenuEntries {}] \ + {*}[${:current_folder} property extra_menu_entries]] + set have_config [lsearch -index 0 $menu_entries config] + + if {$have_config > -1} { # - # We do not want to see parent_ids in the links of the root - # folder. When we insert to the root folder, set opt_parent_id - # to empty to make argument passing easy. "make_link" just - # checks for the existence of the variable, so we unset - # parent_id in this case. + # We have a special configuration for the menubar, probably + # consisting of a default setup and/or a menubar class. The + # entry should be of the form: # + # {config -use xxxx -class MenuBar} + # + set properties [lrange [lindex $menu_entries $have_config] 1 end] + if {[dict exists $properties -class]} { + set p_class [dict get $properties -class] + } + foreach p {-class -use} { + if {[dict exists $properties $p]} { + set p$p [dict get $properties $p] + } + } + } + set class ::xowiki::MenuBar + if {[info exists p-class] + && [info commands ::xowiki::${p-class}] + && [::xowiki::${p-class} istype ::xowiki::MenuBar] + } { + set class ::xowiki::${p-class} + } else { + set class ::xowiki::MenuBar + } + set mb [$class create ::__xowiki__MenuBar -id menubar] + + if {[info exists p-use] + && [$mb procsearch config=${p-use}] ne "" + } { + set config ${p-use} + } else { + set config default + } + + # + # Now we have a menubar $mb. Add folder-specific content to it. + # + # "bind_vars" will contain the variables used by "make_link" to + # set the query parameters. We do not want to see parent_ids in + # the links of the root folder. When we insert to the root + # folder, set opt_parent_id to empty to make argument passing + # easy. "make_link" just checks for the existence of the + # variable, so no add "parent_id" to the "bind_vars". + # + + if {[${:current_folder_id} is_package_root_folder]} { set opt_parent_id "" set folder_link [::$package_id package_url] - if {[info exists parent_id]} { - unset parent_id - } + set bind_vars {} + #:msg "use instance name as title to [::$package_id instance_name]" + ${:current_folder} title [::$package_id instance_name] } else { set parent_id ${:current_folder_id} set opt_parent_id $parent_id ::xo::db::CrClass get_instance_from_db -item_id $parent_id set folder_link [${:current_folder} pretty_link] + set bind_vars [list parent_id $parent_id opt_parent_id $parent_id] } - set return_url [::xo::cc url] - set new_folder_link [::$package_id make_form_link -form en:folder.form \ - -parent_id $opt_parent_id \ - -return_url $return_url] - if {$with_links} { - set new_sym_link [::$package_id make_form_link -form en:link.form \ - -parent_id $opt_parent_id \ - -nls_language $nls_language -return_url $return_url] - } + lappend bind_vars nls_language $nls_language - set new_page_link [::$package_id make_form_link -form en:page.form \ - -parent_id $opt_parent_id \ - -return_url $return_url] - set new_file_link [::$package_id make_link \ - ::$package_id edit-new \ - {object_type ::xowiki::File} \ - parent_id return_url autoname template_file] - set new_form_link [::$package_id make_link \ - ::$package_id edit-new \ - {object_type ::xowiki::Form} \ - parent_id return_url autoname template_file] - set import_link [::$package_id make_link -privilege admin \ - -link "admin/import" \ - ::$package_id {} parent_id return_url] - set import_archive_link [::$package_id make_form_link -form en:import-archive.form \ - -parent_id $opt_parent_id] - - set index_link [::$package_id make_link -link $folder_link ${:current_folder} list] - - $mb add_menu_item -name Package.Startpage -item [list url $folder_link] - $mb add_menu_item -name Package.Toc -item [list url $index_link] - - $mb add_menu_item -name New.Page -item [list url $new_page_link] - $mb add_menu_item -name New.File -item [list url $new_file_link] - $mb add_menu_item -name New.Folder -item [list url $new_folder_link] - if {$with_links} { - $mb add_menu_item -name New.SymLink -item [list url $new_sym_link] - } - $mb add_menu_item -name New.Form -item [list url $new_form_link] - - $mb add_menu_item -name Package.ImportDump -item [list url $import_link] - $mb add_menu_item -name Package.ImportArchive -item [list url $import_archive_link] - - if {[::xowiki::clipboard is_empty]} { - set clipboard_copy_link "" - set clipboard_export_link "" - set clipboard_content_link "" - set clipboard_clear_link "" - } else { - # todo: check, whether the use is allowed to insert into the current folder - set clipboard_copy_link $folder_link?m=clipboard-copy - set clipboard_export_link $folder_link?m=clipboard-export - set clipboard_content_link $folder_link?m=clipboard-content - set clipboard_clear_link $folder_link?m=clipboard-clear - } - # todo: we should check either, whether to user is allowed to - # copy-to-clipboard from the current folder, and/or the user is - # allowed to do this with certain items.... (the latter in - # clipboard-add) - $mb add_menu_item -name Clipboard.Add \ - -item [list url \# listener [list click acs_ListBulkActionMultiFormClick("objects","$folder_link?m=clipboard-add&return_url=$return_url")]] - $mb add_menu_item -name Clipboard.Content -item [list url $clipboard_content_link] - $mb add_menu_item -name Clipboard.Clear -item [list url $clipboard_clear_link] - $mb add_menu_item -name Clipboard.Use.Copy -item [list url $clipboard_copy_link] - $mb add_menu_item -name Clipboard.Use.Export -item [list url $clipboard_export_link] - - set uploader_link [::$package_id make_link ${:current_folder} file-upload] - $mb add_extra_item -name dropzone1 -type DropZone \ - -item [list url $uploader_link label DropZone uploader File] - - #set modestate [::xowiki::mode::admin get] - #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] - + set return_url [::xo::cc url] + $mb current_folder ${:current_folder} + $mb parent_id $opt_parent_id + #:log "folders: call update_items with config '$config' bind_vars=$bind_vars" $mb update_items \ + -bind_vars $bind_vars \ + -config $config \ + -current_page $page \ + -folder_link $folder_link \ -package_id $package_id \ - -parent_id $opt_parent_id \ - -return_url $return_url \ - -nls_language $nls_language \ - [list \ - {*}[::$package_id get_parameter ExtraMenuEntries {}] \ - {*}[${:current_folder} property extra_menu_entries]] + -return_url $return_url } - set top_folder_of_tree $root_folder + # Start with the "package's folder" as root folder + set root_folder [::xo::db::CrClass get_instance_from_db \ + -item_id [::$package_id folder_id]] + # # Check, if the optional context tree view is activated # + set top_folder_of_tree $root_folder if {$context_tree_view || [::$package_id get_parameter FolderContextTreeView false]} { set parent_id [${:current_folder} parent_id] if {$parent_id ne -100} { set top_folder_of_tree $parent_id #:msg top_folder_of_tree=$top_folder_of_tree } } - - set parent_folder [$top_folder_of_tree parent_id] - - if {$top_folder_of_tree eq $root_folder || $parent_folder eq "-100"} { - set href [::$package_id package_url] - set label [::$package_id instance_name] - #:msg "use instance name" + + if {$top_folder_of_tree eq $root_folder + || [$top_folder_of_tree parent_id] eq "-100" + } { + set href [::$package_id package_url] + set label [::$package_id instance_name] + #:msg "use instance name in tree display" } else { - set href [$top_folder_of_tree pretty_link] + set href [$top_folder_of_tree pretty_link] set label "[$top_folder_of_tree title] ..." } @@ -612,7 +588,9 @@ # # We have to use the global variable for the time being due to # scoping in "-columns" - set ::__xowiki_with_publish_status [expr {$publish_status ne "ready" || "publish_status" in $columns}] + set ::__xowiki_with_publish_status [expr { + $publish_status ne "ready" + || "publish_status" in $columns}] # unexisting csrf token usually means we are outside a connection thread set csrf [expr {[info exists ::__csrf_token] ? [list __csrf_token $::__csrf_token] : ""}] @@ -628,8 +606,11 @@ -columns { BulkAction create objects -id ID -hide $::hidden(objects) -actions { if {$::__xowiki_folder_link ne ""} { - Action bulk-delete -label [_ xowiki.delete] -tooltip [_ xowiki.Delete_selected] \ - -url $::__xowiki_folder_link -confirm_message [_ xowiki.delete_confirm] + Action bulk-delete \ + -label [_ xowiki.delete] \ + -tooltip [_ xowiki.Delete_selected] \ + -url $::__xowiki_folder_link \ + -confirm_message [_ xowiki.delete_confirm] } } @@ -680,9 +661,9 @@ # Update the title to a language-specific value # $current_folder update_langstring_property _title $lang + :msg "$current_folder update_langstring_property _title $lang -> [$current_folder title]" } - - :log "child-resources of folder_id ${:current_folder_id}" + #:log "child-resources of folder_id ${:current_folder_id}" set items [::xowiki::FormPage get_all_children \ -folder_id ${:current_folder_id} \ -publish_status $publish_status \ @@ -763,35 +744,39 @@ util_user_message -message "Ignore invalid sorting criterion '$att'" } - if {$menubar ne ""} { - set mb [::xowiki::MenuBar new -id submenubar] - # for now, just the first group - lassign $menubar Menu entries - $mb add_menu -name $Menu - set menuEntries {} - foreach e $entries { - switch -- $e { - ::xowiki::File { - lappend menuEntries {entry -name New.File -label File -object_type ::xowiki::File} - } - default {ns_log notice "can't handle $e in submenubar so far"} - } - } - $mb update_items \ - -package_id $package_id \ - -parent_id ${:current_folder_id} \ - -return_url $return_url \ - -nls_language [$current_folder get_nls_language_from_lang [::xo::cc lang]] \ - $menuEntries - - set menubar [$mb render-preferred] - } - set viewers [util_coalesce [$current_folder property viewers] [$current_folder get_parameter viewers]] + # if {$menubar ne ""} { + # set mb [::xowiki::MenuBar new -id submenubar] + # # for now, just the first group + # lassign $menubar Menu entries + # $mb add_menu -name $Menu + # set menuEntries {} + # foreach e $entries { + # switch -- $e { + # ::xowiki::File { + # lappend menuEntries {entry -name New.File -label File -object_type ::xowiki::File} + # } + # default {ns_log notice "can't handle $e in submenubar so far"} + # } + # } + # ns_log notice "================= 2nd call update_items" + # $mb update_items \ + # -package_id $package_id \ + # -parent_id ${:current_folder_id} \ + # -return_url $return_url \ + # -nls_language [$current_folder get_nls_language_from_lang [::xo::cc lang]] + # set menubar [$mb render-preferred] + # } + ns_log notice "sub-menubar: 2nd update_items needed? menubar <$menubar>" + set viewers [util_coalesce \ + [$current_folder property viewers] \ + [$current_folder get_parameter viewers]] set viewer_links "" foreach v $viewers { set wf_link "${v}?p.folder=[$current_folder name]" append wf_link "&m=create-or-use" - append viewer_links [subst -nocommands -nobackslashes {
  • view with $v
  • }] + append viewer_links [subst -nocommands -nobackslashes { +
  • view with $v
  • + }] } return "$menubar
      $viewer_links
    [$t asHTML]" Index: openacs-4/packages/xowiki/tcl/menu-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/menu-procs.tcl,v diff -u -r1.19.2.8 -r1.19.2.9 --- openacs-4/packages/xowiki/tcl/menu-procs.tcl 24 Aug 2020 23:33:41 -0000 1.19.2.8 +++ openacs-4/packages/xowiki/tcl/menu-procs.tcl 26 Aug 2020 11:16:11 -0000 1.19.2.9 @@ -130,6 +130,7 @@ Class create ::xowiki::MenuBar -parameter { id {dropzone:boolean true} + {current_folder:object} {parent_id ""} } @@ -164,26 +165,9 @@ } ::xowiki::MenuBar instproc clear_menu {-menu:required} { - set :Menu($menu) [list label [dict get $:Menu($menu) label]] + set :Menu($menu) [list label [dict get [set :Menu($menu)] label]] } - ::xowiki::MenuBar instproc current_folder {} { - if {${:parent_id} ne ""} { - return ${:parent_id} - } else { - # - # If the current object is the package, use the root folder as - # current_folder; else use the parent of the current object. - # - set object [::xo::cc invoke_object] - if {[$object is_folder_page]} { - return $object - } else { - return [$object parent_id] - } - } - } - ::xowiki::MenuBar instproc add_menu_item { -name:required -item:required @@ -248,36 +232,264 @@ } - ::xowiki::MenuBar instproc update_items { + ::xowiki::MenuBar instproc config_menu=Package { + -folder_link:required + -return_url_required -package_id:required - -nls_language:required - -parent_id:required + {-bind_vars {}} + } { + + set index_link [::$package_id make_link \ + -link $folder_link \ + ${:current_folder} list] + + set admin_link [::$package_id make_link -privilege admin \ + -link admin/ ::$package_id] + dict with bind_vars { + set import_link \ + [::$package_id make_link -privilege admin \ + -link "admin/import" \ + ::$package_id {} parent_id return_url] + + set import_archive_link \ + [::$package_id make_form_link -form en:import-archive.form \ + -parent_id ${:parent_id}] + } + + :add_menu_item -name Package.Startpage -item [list url $folder_link] + :add_menu_item -name Package.Toc -item [list url $index_link] + + if {[::$package_id get_parameter "with_notifications" 1]} { + if {[::xo::cc user_id] != 0} { + # + # notifications require login + # + set notifications_return_url [expr {[info exists return_url] ? $return_url : [ad_return_url]}] + set notification_type [notification::type::get_type_id -short_name xowiki_notif] + set notification_text "Subscribe to [::$package_id instance_name]" + set notification_subscribe_link \ + [export_vars -base /notifications/request-new \ + {{return_url $notifications_return_url} + {pretty_name $notification_text} + {type_id $notification_type} + {object_id $package_id}}] + :add_menu_item -name Package.Notifications \ + -item [list url /notifications/manage] + } + } + + :add_menu_item -name Package.Admin \ + -item [list text #xowiki.admin# url $admin_link] + :add_menu_item -name Package.ImportDump -item [list url $import_link] + :add_menu_item -name Package.ImportArchive -item [list url $import_archive_link] + } + + ::xowiki::MenuBar instproc config_menu=New { + -folder_link:required + -return_url:required + -package_id:required + {-bind_vars {}} + } { + + dict with bind_vars { + + set new_folder_link \ + [::$package_id make_form_link -form en:folder.form \ + -parent_id ${:parent_id} \ + -return_url $return_url] + + set new_page_link \ + [::$package_id make_form_link -form en:page.form \ + -parent_id ${:parent_id} \ + -return_url $return_url] + # + # Two old style links for xowiki::File and xowiki::Form + # + set new_file_link \ + [::$package_id make_link \ + ::$package_id edit-new \ + {object_type ::xowiki::File} \ + parent_id return_url autoname template_file] + + set new_form_link \ + [::$package_id make_link \ + ::$package_id edit-new \ + {object_type ::xowiki::Form} \ + parent_id return_url autoname template_file] + } + + :add_menu_item -name New.Page -item [list url $new_page_link] + :add_menu_item -name New.File -item [list url $new_file_link] + :add_menu_item -name New.Folder -item [list url $new_folder_link] + + if {[::$package_id get_parameter "MenuBarSymLinks" 0]} { + # + # Symlinks are configured + # + dict with bind_vars { + set new_sym_link [::$package_id make_form_link -form en:link.form \ + -parent_id ${:parent_id} \ + -nls_language $nls_language -return_url $return_url] + } + :add_menu_item -name New.SymLink -item [list url $new_sym_link] + } + :add_menu_item -name New.Form -item [list url $new_form_link] + } + + ::xowiki::MenuBar instproc config_menu=Clipboard { + -folder_link:required + -return_url:required + } { + if {[::xowiki::clipboard is_empty]} { + set clipboard_copy_link "" + set clipboard_export_link "" + set clipboard_content_link "" + set clipboard_clear_link "" + } else { + set clipboard_copy_link $folder_link?m=clipboard-copy + set clipboard_export_link $folder_link?m=clipboard-export + set clipboard_content_link $folder_link?m=clipboard-content + set clipboard_clear_link $folder_link?m=clipboard-clear + } + + # TODO: we should check either, whether to user is allowed to + # copy-to-clipboard from the current folder, and/or the user is + # allowed to do this with certain items.... (the latter in + # clipboard-add) + :add_menu_item -name Clipboard.Add \ + -item [list url \# listener [list click acs_ListBulkActionMultiFormClick("objects","$folder_link?m=clipboard-add&return_url=$return_url")]] + :add_menu_item -name Clipboard.Content -item [list url $clipboard_content_link] + :add_menu_item -name Clipboard.Clear -item [list url $clipboard_clear_link] + :add_menu_item -name Clipboard.Use.Copy -item [list url $clipboard_copy_link] + :add_menu_item -name Clipboard.Use.Export -item [list url $clipboard_export_link] + } + + ::xowiki::MenuBar instproc config_menu=Page { + -folder_link:required + -return_url:required + -current_page:required + } { + set package_id [$current_page package_id] + + set edit_link [::$package_id make_link $current_page edit return_url] + set view_link [::$package_id make_link $current_page view return_url] + set delete_link [::$package_id make_link $current_page delete return_url] + set rev_link [::$package_id make_link $current_page revisions] + + :add_menu_item -name Page.Edit \ + -item [list text #xowiki.edit# url $edit_link] + :add_menu_item -name Page.View \ + -item [list text #xowiki.menu-Page-View# url $view_link] + :add_menu_item -name Page.Delete \ + -item [list text #xowiki.delete# url $delete_link] + :add_menu_item -name Page.Revisions \ + -item [list text #xowiki.revisions# url $rev_link] + if {[acs_user::site_wide_admin_p]} { + set page_show_link [::$package_id make_link -privilege admin \ + $current_page show-object return_url] + :add_menu_item -name Page.Show \ + -item [list text "Show Object" url $page_show_link] + } + } + + + ::xowiki::MenuBar instproc config=default { + {-bind_vars {}} + -current_page:required + -package_id:required + -folder_link:required -return_url + } { + + #:log folder_link=$folder_link + #:log parent_id=${:parent_id} + + # + # Define standard xowiki menubar + # + set clipboard_size [::xowiki::clipboard size] + set clipboard_label [expr {$clipboard_size ? "Clipboard ($clipboard_size)" : "Clipboard"}] + + :add_menu -name Package -label [::$package_id instance_name] + :add_menu -name New -label [_ xowiki.menu-New] + :add_menu -name Clipboard -label $clipboard_label + :add_menu -name Page -label [_ xowiki.menu-Page] + + :config_menu=Package \ + -folder_link $folder_link \ + -return_url $return_url \ + -package_id $package_id \ + -bind_vars $bind_vars + + :config_menu=New \ + -folder_link $folder_link \ + -return_url $return_url \ + -package_id $package_id \ + -bind_vars $bind_vars + + :config_menu=Clipboard \ + -folder_link $folder_link \ + -return_url $return_url + + :config_menu=Page \ + -folder_link $folder_link \ + -return_url $return_url \ + -current_page $current_page + + + set uploader_link [::$package_id make_link ${:current_folder} file-upload] + :add_extra_item -name dropzone1 -type DropZone \ + -item [list url $uploader_link label DropZone uploader File] + + #set modestate [::xowiki::mode::admin get] + #set modebutton_link [::$package_id make_link ${:current_folder} toggle-modebutton] + #:add_extra_item -name admin -type ModeButton \ + # -item [list url $modebutton_link on $modestate label admin] + return {} + } + + ::xowiki::MenuBar instproc update_items { -autoname + {-bind_vars ""} + -current_page:required + {-config default} + -folder_link:required + -package_id:required + -return_url:required -template_file - items } { # A folder page can contain extra menu entries (sample # below). Iterate of the extra_menu property and add according # menu entries. Sample: # - # {clear_menu -menu New} - # {entry -name New.Page -label #xowiki.new# -form en:page.form} - # {entry -name New.File -label File -object_type ::xowiki::File} - # {dropzone -name DropZone -label DropZone -uploader File} - # {modebutton -name Admin -label admin -button admin} + # {clear_menu -menu New} + # {entry -name New.Page -label #xowiki.new# -form en:page.form} + # {entry -name New.File -label File -object_type ::xowiki::File} + # {dropzone -name DropZone -label DropZone -uploader File} + # {modebutton -name Admin -label admin -button admin} + set config_items [:config=$config \ + -package_id $package_id \ + -current_page $current_page \ + -folder_link $folder_link \ + -bind_vars $bind_vars \ + -return_url $return_url] - set :parent_id $parent_id + set menu_entries [list \ + {*}[::$package_id get_parameter ExtraMenuEntries {}] \ + {*}$config_items \ + {*}[${:current_folder} property extra_menu_entries]] - foreach me $items { - array unset "" + :log "config=$config DONE menu_entries=$menu_entries" + + foreach me $menu_entries { set kind [lindex $me 0] if {[string index $kind 0] eq "#"} continue + #:log notice "menu_entry <$kind> full <$me>" set properties [lrange $me 1 end] - + switch -- $kind { - + clear_menu { :clear_menu -menu [dict get $properties -menu] } @@ -290,11 +502,14 @@ } if {[dict exists $properties -form]} { set q [expr {[dict exists $properties -query] ? "-query [dict get $properties -query]" : ""}] - set link [::$package_id make_form_link \ - -form [dict get $properties -form] \ - -parent_id $parent_id \ - -nls_language $nls_language \ - -return_url $return_url {*}$q] + dict with bind_vars { + set link [::$package_id make_form_link \ + -form [dict get $properties -form] \ + -parent_id ${:parent_id} \ + -nls_language $nls_language \ + -return_url $return_url \ + {*}$q] + } } elseif {[dict exists $properties -object_type]} { set link [::$package_id make_link \ $package_id edit-new \ @@ -314,7 +529,7 @@ # set locale [::xo::cc locale] set dname [string map {. -} [dict get $properties -name]] - + foreach message_key [list xowiki.menu-$dname xowf.menu-$dname] { if {[lang::message::message_exists_p en_US $message_key]} { lappend item label [lang::message::lookup $locale $message_key] @@ -325,7 +540,7 @@ :add_menu_item -name [dict get $properties -name] -item $item } - "dropzone" { + dropzone { foreach {var default} { name dropzone uploader File @@ -337,12 +552,12 @@ } } - set link [::$package_id make_link $parent_id file-upload] + set link [::$package_id make_link ${:parent_id} file-upload] :add_extra_item -name $name -type DropZone \ -item [list url $link uploader $uploader label $label] } - "modebutton" { + modebutton { foreach {var default} { name modebutton button admin @@ -355,11 +570,11 @@ } if {$label eq ""} {set label $button} set state [::xowiki::mode::$button get] - set link [::$package_id make_link $parent_id toggle-modebutton] + set link [::$package_id make_link ${:parent_id} toggle-modebutton] :add_extra_item -name $name -type ModeButton \ -item [list url $link on $state label $label] } - + config {} default { error "unknown kind of menu entry: $kind" } @@ -385,52 +600,20 @@ } ::xowiki::MenuBar instproc render-preferred {} { - switch [parameter::get_global_value -package_key xowiki -parameter PreferredCSSToolkit -default bootstrap] { + switch [parameter::get_global_value \ + -package_key xowiki \ + -parameter PreferredCSSToolkit \ + -default bootstrap] { bootstrap {set menuBarRenderer render-bootstrap} default {set menuBarRenderer render-yui} } - my $menuBarRenderer + :$menuBarRenderer } - - - # ::xo::tdom::Class create MenuDropZone \ - # -superclass MenuComponent \ - # -parameter { - # text - # href - # title - # {id "[:html_id]"} - # CSSclass - # } - - - # MenuDropZone instproc init args { - # next - # # Use computed default values when not specified - # if {![info exists :title]} { - # # set the mouseover-title to the "MenuItem-Label" - # # TODO: Do we really want "text" to be required ? - # :title [:text] - # } - - # if {![info exists :href] || [:href] eq ""} { - # append :CSSclass " " [string tolower [namespace tail [:info class]]]-disabled - # } - # } - - # MenuDropZone instproc render {} { - # html::li [:get_attributes id {CSSclass class}] { - # html::a [:get_attributes title href target] { - # html::t [:text] - # } - # } - # } - - namespace export Menu - # end of namespace + # end of namespace ::xowiki } + ::xo::library source_dependent # 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.368.2.69 -r1.368.2.70 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 24 Aug 2020 23:51:52 -0000 1.368.2.69 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 26 Aug 2020 11:16:11 -0000 1.368.2.70 @@ -1869,14 +1869,14 @@ set admin_link [::$context_package_id make_link -privilege admin -link admin/ ::$context_package_id] set index_link [::$context_package_id make_link -privilege public ::$context_package_id] - set toc_link [::$context_package_id make_link -privilege public ::$folder_id list] - set import_link [::$context_package_id make_link -privilege admin -link admin/import $context_package_id] - set page_show_link [::$page_package_id make_link -privilege admin [self] show-object return_url] set view_link [::$page_package_id make_link [self] view return_url] set notification_subscribe_link "" if {[::$context_package_id get_parameter "with_notifications" 1]} { - if {[::xo::cc user_id] != 0} { ;# notifications require login + if {[::xo::cc user_id] != 0} { + # + # notifications require login + # set notifications_return_url [expr {[info exists return_url] ? $return_url : [ad_return_url]}] set notification_type [notification::type::get_type_id -short_name xowiki_notif] set notification_text "Subscribe to [::$context_package_id instance_name]" @@ -1893,52 +1893,6 @@ } # - # The menubar is work in progress - # - set mb [::$context_package_id get_parameter "MenuBar" 0] - if {$mb ne "0" && [nsf::is object ::xowiki::MenuBar]} { - - set clipboard_size [::xowiki::clipboard size] - set clipboard_label [expr {$clipboard_size ? "Clipboard ($clipboard_size)" : "Clipboard"}] - - # - # Define standard xowiki menubar - # - set mb [::xowiki::MenuBar create ::__xowiki__MenuBar -id menubar] - $mb add_menu -name Package -label [::$context_package_id instance_name] - $mb add_menu -name New -label [_ xowiki.menu-New] - $mb add_menu -name Clipboard -label $clipboard_label - $mb add_menu -name Page -label [_ xowiki.menu-Page] - $mb add_menu_item -name Package.Startpage -item [list url $index_link] - $mb add_menu_item -name Package.Toc -item [list url $toc_link] - - $mb add_menu_item -name Package.Subscribe \ - -item [list text #xowiki.subscribe# url $notification_subscribe_link] - $mb add_menu_item -name Package.Notifications \ - -item [list text #xowiki.notifications# url /notifications/manage] - $mb add_menu_item -name Package.Admin \ - -item [list text #xowiki.admin# url $admin_link] - $mb add_menu_item -name Package.ImportDump \ - -item [list url $import_link] - - $mb add_menu_item -name New.Page \ - -item [list text #xowiki.new# url $new_link] - - $mb add_menu_item -name Page.Edit \ - -item [list text #xowiki.edit# url $edit_link] - $mb add_menu_item -name Page.View \ - -item [list text #xowiki.menu-Page-View# url $view_link] - $mb add_menu_item -name Page.Delete \ - -item [list text #xowiki.delete# url $delete_link] - $mb add_menu_item -name Page.Revisions \ - -item [list text #xowiki.revisions# url $rev_link] - if {[acs_user::site_wide_admin_p]} { - $mb add_menu_item -name Page.Show \ - -item [list text "Show Object" url $page_show_link] - } - } - - # # The content may be passed by other methods (e.g. edit) to # make use of the same templating machinery below. # @@ -1963,23 +1917,30 @@ set top_includelets [:include $vp] } - if {$mb ne "0"} { + if {[::$context_package_id get_parameter "MenuBar" 0]} { # # The following block should not be here, but in the templates. # - set showFolders [::$context_package_id get_parameter "MenuBarWithFolder" 1] - if {$showFolders} { - set folderhtml [:include {folders -style folders}] - } else { - set folderhtml "" - } + #set showFolders [::$context_package_id get_parameter "MenuBarWithFolder" 1] + #if {$showFolders} { + # set folderhtml [:include {folders -style folders}] + #} else { + # set folderhtml "" + #} + set folderhtml [:include {folders -style folders}] + ::xo::Page set_property body folderHTML $folderhtml + # TODO: there should be no need to pass manually folderhtml, + # use the property instead + # # At this place, the menu should be complete, we can render it. # - set mbHTML [$mb render-preferred] - #append top_includelets \n "
    " $mbHTML - ::xo::Page set_property body menubarHTML $mbHTML + set mb [::xowiki::MenuBar info instances -closure] + if {$mb ne ""} { + set mbHTML [$mb render-preferred] + ::xo::Page set_property body menubarHTML $mbHTML + } } if {[::$context_package_id get_parameter "with_user_tracking" 1]} { @@ -2181,7 +2142,6 @@ rev_link edit_link delete_link new_link admin_link index_link view_link notification_subscribe_link notification_image top_includelets page views_data body doc - folderhtml } } } else { Index: openacs-4/packages/xowiki/www/resources/xowiki.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/xowiki.css,v diff -u -r1.64.2.10 -r1.64.2.11 --- openacs-4/packages/xowiki/www/resources/xowiki.css 26 May 2020 22:22:05 -0000 1.64.2.10 +++ openacs-4/packages/xowiki/www/resources/xowiki.css 26 Aug 2020 11:16:11 -0000 1.64.2.11 @@ -414,7 +414,7 @@ font-size: 90%; } div.xowiki-content .content-with-folders { - float: left; width: 70%; + padding-left: 1em; float: left; width: 70%; } /*div.xowiki-content .content-with-folders div.form-label { width: 9em;