Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.180.2.65 -r1.180.2.66 --- openacs-4/packages/xowiki/xowiki.info 2 Aug 2021 21:23:19 -0000 1.180.2.65 +++ openacs-4/packages/xowiki/xowiki.info 2 Sep 2021 13:24:26 -0000 1.180.2.66 @@ -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/lib/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/lib/view.tcl,v diff -u -r1.14.2.4 -r1.14.2.5 --- openacs-4/packages/xowiki/lib/view.tcl 25 Apr 2021 17:33:17 -0000 1.14.2.4 +++ openacs-4/packages/xowiki/lib/view.tcl 2 Sep 2021 13:24:28 -0000 1.14.2.5 @@ -36,7 +36,7 @@ } template::head::add_css \ - -href urn:ad:css:xowiki-[::xowiki::Package preferredCSSToolkit] + -href urn:ad:css:xowiki-[::xowiki::CSS toolkit] set html [::$package_id invoke -method $m] Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.284.2.169 -r1.284.2.170 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 7 Aug 2021 09:43:41 -0000 1.284.2.169 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 2 Sep 2021 13:24:28 -0000 1.284.2.170 @@ -2054,11 +2054,11 @@ # append :CSSclass -file #} # - # The following snippet is Bootstrap-only and requires in - # non-bootstrap cases styling. + # The following snippet for file-label tailoring is Bootstrap-only + # and requires in non-bootstrap cases styling. # #if {[info exists :choose_file_label]} { - # ::html::label -for ${:id} -class "btn btn-default" { + # ::html::label -for ${:id} -class "btn [::xowiki::CSS class btn-default]" { # ::html::span -class upload-btn-label { # ::html::t ${:choose_file_label} # } @@ -6389,8 +6389,12 @@ } } +# +# Make sure, when we reload the form-fields to reset the +# toolkit-specific form-field parameter as well. +# +::xowiki::CSS clear - ::xo::library source_dependent # Index: openacs-4/packages/xowiki/tcl/link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/link-procs.tcl,v diff -u -r1.106.2.16 -r1.106.2.17 --- openacs-4/packages/xowiki/tcl/link-procs.tcl 30 Mar 2021 09:01:21 -0000 1.106.2.16 +++ openacs-4/packages/xowiki/tcl/link-procs.tcl 2 Sep 2021 13:24:28 -0000 1.106.2.17 @@ -262,7 +262,7 @@ $content @@ -286,7 +286,7 @@ $content Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.332.2.88 -r1.332.2.89 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 9 Aug 2021 09:55:57 -0000 1.332.2.88 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 2 Sep 2021 13:24:28 -0000 1.332.2.89 @@ -9,7 +9,98 @@ ::xo::library require -package xotcl-core 06-package-procs namespace eval ::xowiki { + nx::Object create ::xowiki::CSS { + :public object method clear {} { + # + # Clear the cached toolkit name, such that it is reloads the + # settings on the next initialize call. + # + unset -nocomplain :preferredCSSToolkit + } + :public object method toolkit {} { + # + # Return the preferred CSS toolkit + # + return ${:preferredCSSToolkit} + } + :public object method initialize {} { + # + # Initialize tailorization for CSS tooklits. The function reads + # the global apm package parameter and sets/resets accordingly + # (a) the default values (actially parameters) for the form + # field and (b) defines the toolkit specific CSS class name + # mapping. + # + # + set paramValue [parameter::get_global_value -package_key xowiki \ + -parameter PreferredCSSToolkit \ + -default bootstrap] + if {[info exists :preferredCSSToolkit] + && ${:preferredCSSToolkit} eq $paramValue + } { + return + } + set :preferredCSSToolkit $paramValue + + if {${:preferredCSSToolkit} eq "bootstrap"} { + ::xowiki::formfield::FormField parameter { + {CSSclass form-control} + {form_item_wrapper_CSSclass form-group} + {form_widget_CSSclass ""} + {form_button_CSSclass "btn btn-default"} + {form_button_wrapper_CSSclass ""} + {form_help_text_CSSclass help-block} + } + set :cssClasses { + btn-default btn-default + margin-form "" + } + } elseif {${:preferredCSSToolkit} eq "bootstrap5"} { + ::xowiki::formfield::FormField parameter { + {CSSclass form-control} + {form_item_wrapper_CSSclass form-group} + {form_widget_CSSclass ""} + {form_button_CSSclass "btn btn-secondary"} + {form_button_wrapper_CSSclass ""} + {form_help_text_CSSclass help-block} + } + set :cssClasses { + btn-default btn-secondary + margin-form "" + } + } else { + ::xowiki::formfield::FormField parameter { + {CSSclass} + {form_widget_CSSclass form-widget} + {form_item_wrapper_CSSclass form-item-wrapper} + {form_button_CSSclass ""} + {form_button_wrapper_CSSclass form-button} + {form_help_text_CSSclass form-help-text} + } + set :cssClasses { + btn-default "" + margin-form margin-form + } + ::xowiki::Form requireFormCSS + } + } + + :public object method class {name} { + # + # In case, a mapping for CSS classes is defined, return the + # mapping for the provided class name. Otherwise return the + # provided class name. + # + if {[dict exists ${:cssClasses} $name]} { + return [dict get ${:cssClasses} $name] + } else { + return $name + } + } + } +} +namespace eval ::xowiki { ::xo::PackageMgr create ::xowiki::Package \ -superclass ::xo::Package \ -pretty_name "XoWiki" \ @@ -647,8 +738,9 @@ Package instproc init {} { #:log "--R creating + folder_object" next - :require_folder_object + :require_folder_object set :policy [:get_parameter -check_query_parameter false security_policy ::xowiki::policy1] + ::xowiki::CSS initialize # :proc destroy {} {:log "--P "; next} } @@ -1194,7 +1286,7 @@ } set top_includelets ""; set content $error_msg; set folderhtml "" ::xo::cc set status_code $status_code - ::xo::Page requireCSS urn:ad:css:xowiki-[::xowiki::Package preferredCSSToolkit] + ::xo::Page requireCSS urn:ad:css:xowiki-[::xowiki::CSS toolkit] ${:id} return_page -adp $template_file -variables { context title index_link back_link header_stuff error_msg top_includelets content folderhtml @@ -2226,12 +2318,10 @@ :fix_site_wide_package_ids } - Package proc preferredCSSToolkit {} { - return [parameter::get_global_value -package_key xowiki \ - -parameter PreferredCSSToolkit \ - -default bootstrap] + Package proc -deprecated preferredCSSToolkit {} { + return [::xowiki::CSS toolkit] } - + Package instproc call {object method options} { set allowed [${:policy} enforce_permissions \ -package_id ${:id} -user_id [::xo::cc user_id] \ Index: openacs-4/packages/xowiki/tcl/personal-notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/Attic/personal-notification-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/xowiki/tcl/personal-notification-procs.tcl 7 Jun 2021 07:09:29 -0000 1.1.2.3 +++ openacs-4/packages/xowiki/tcl/personal-notification-procs.tcl 2 Sep 2021 13:24:29 -0000 1.1.2.4 @@ -117,7 +117,7 @@ foreach to_user_id $to_user_id { append input_fields [subst {}] } - + set btnDefault [::xowiki::CSS class btn-default] return [list link [subst { @@ -149,8 +149,8 @@ $input_fields 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.542.2.110 -r1.542.2.111 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 29 Aug 2021 15:00:08 -0000 1.542.2.110 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 2 Sep 2021 13:24:29 -0000 1.542.2.111 @@ -3735,17 +3735,16 @@ } Page instproc css_class_name {{-margin_form:boolean true}} { + # # Determine the CSS class name for xowiki forms # - # We need this actually only for PageTemplate and FormPage, but - # aliases will require XOTcl 2.0.... so we define it for the time - # being on ::xowiki::Page - if {[::xowiki::Package preferredCSSToolkit] ne "bootstrap"} { - set name [expr {$margin_form ? "margin-form " : ""}] - } else { - set name "" + set name "" + if {$margin_form} { + set css [::xowiki::CSS class margin-form] + if {$css ne ""} { + set name "$css " + } } - return [append name [::xowiki::utility formCSSclass ${:name}]] } @@ -4099,8 +4098,9 @@ $doc documentElement root :dom_disable_input_fields -with_submit $with_submit $root set form [lindex [$root selectNodes //form] 0] - if {[::xowiki::Package preferredCSSToolkit] ne "bootstrap"} { - Form add_dom_attribute_value $form class "margin-form" + set marginForm [::xowiki::CSS class "margin-form"] + if {$marginForm ne ""} { + Form add_dom_attribute_value $form class $marginForm } return [$root asHTML] } @@ -4993,10 +4993,10 @@ # Fall back to the form, fill it out and compute HTML from this. # set form [:get_form] - if {$form eq ""} {return ""} + if {$form eq ""} { + return "" + } - :setCSSDefaults - lassign [:field_names_from_form -form $form] form_vars field_names set :__field_in_form "" if {$form_vars} { 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.96 -r1.368.2.97 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 7 Aug 2021 09:43:42 -0000 1.368.2.96 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 2 Sep 2021 13:24:29 -0000 1.368.2.97 @@ -590,7 +590,7 @@ if {$compare_id == 0} { return "" } - ::xo::Page requireCSS urn:ad:css:xowiki-[::xowiki::Package preferredCSSToolkit] + ::xo::Page requireCSS urn:ad:css:xowiki-[::xowiki::CSS toolkit] set my_page [::xowiki::Package instantiate_page_from_id -revision_id ${:revision_id}] @@ -967,29 +967,8 @@ return $html } - FormPage instproc setCSSDefaults {} { - #:log setCSSDefaults - # check empty - if {[::xowiki::Package preferredCSSToolkit] eq "bootstrap"} { - ::xowiki::formfield::FormField parameter { - {CSSclass form-control} - {form_item_wrapper_CSSclass form-group} - {form_widget_CSSclass ""} - {form_button_CSSclass "btn btn-default"} - {form_button_wrapper_CSSclass ""} - {form_help_text_CSSclass help-block} - } - } else { - ::xowiki::formfield::FormField parameter { - {CSSclass} - {form_widget_CSSclass form-widget} - {form_item_wrapper_CSSclass form-item-wrapper} - {form_button_CSSclass ""} - {form_button_wrapper_CSSclass form-button} - {form_help_text_CSSclass form-help-text} - } - ::xowiki::Form requireFormCSS - } + FormPage instproc -deprecated setCSSDefaults {} { + ad_log warning "deprecated method setCSSDefaults was called. The call should be removed" } FormPage instproc action_url {} { @@ -1026,7 +1005,6 @@ } { #:log "edit [self args]" - :setCSSDefaults :include_header_info -prefix form_edit if {[::xo::cc mobile]} { :include_header_info -prefix mobile @@ -2046,7 +2024,7 @@ # requireCSS are typically loaded later than those from the theme. template::head::add_css \ - -href urn:ad:css:xowiki-[::xowiki::Package preferredCSSToolkit] \ + -href urn:ad:css:xowiki-[::xowiki::CSS toolkit] \ -order 0 #