Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -r1.180.2.93 -r1.180.2.94 --- openacs-4/packages/xowiki/xowiki.info 1 Apr 2022 13:47:51 -0000 1.180.2.93 +++ openacs-4/packages/xowiki/xowiki.info 3 Apr 2022 14:42:49 -0000 1.180.2.94 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2021-09-15 @@ -55,7 +55,7 @@ BSD-Style 2 - + Index: openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl,v diff -u -r1.11.2.23 -r1.11.2.24 --- openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 1 Apr 2022 13:47:51 -0000 1.11.2.23 +++ openacs-4/packages/xowiki/tcl/bootstrap-procs.tcl 3 Apr 2022 14:42:50 -0000 1.11.2.24 @@ -294,7 +294,7 @@ } } - BootstrapNavbarModeButton ad_instproc render {} {doku} { + BootstrapNavbarModeButton instproc render {} { html::li { html::form -class "form" -method "POST" -action ${:href} { html::div -class "checkbox ${:CSSclass}" { @@ -318,7 +318,7 @@ {label:required} } - BootstrapCollapseButton instproc init {} { + BootstrapCollapseButton instproc render {} { switch [::xowiki::CSS toolkit] { "bootstrap" { template::add_script -src urn:ad:js:bootstrap3 @@ -599,6 +599,132 @@ Class create BootstrapTableRenderer::BulkAction -superclass TABLE::BulkAction } +namespace eval ::xowiki::bootstrap { + + ad_proc ::xowiki::bootstrap::card { + -title:required + -body:required + } { + } { + return [ns_trim -delimiter | [subst { + |
+ |
$title
+ |
$body
+ |
+ }]] + } + + ad_proc ::xowiki::bootstrap::icon { + -name:required + -style + -CSSclass + } { + } { + # + set name [xowiki::CSS class $name] + set styleAtt [expr {[info exists style] ? "style='$style'" : ""}] + set CSSclass [expr {[info exists CSSclass] ? " $CSSclass" : ""}] + switch [::xowiki::CSS toolkit] { + "bootstrap" { + return [subst {}] + } + default { + return [subst {}] + } + } + } + + + ad_proc ::xowiki::bootstrap::modal_dialog { + -id:required + -title:required + {-subtitle ""} + -body:required + } { + Generic modal dialog wrapper. + @param id + @param title HTML markup for the modal title (can contain tags) + @param subtitle HTML markup for the modal subtitle (can contain tags) + @param body HTML markup for the modal body (can contain tags) + + @return HTML markup + } { + if {$subtitle ne ""} { + set subtitle [subst {}] + } + if {[::xowiki::CSS toolkit] eq "bootstrap5"} { + set data_attribute "data-bs" + ::security::csp::require img-src data: + set close_button_label "" + set before_close "" + set after_close "" + } else { + set data_attribute "data" + set close_button_label {} + set before_close "" + set after_close "" + } + + return [ns_trim -delimiter | [subst { + | + }]] + } + + + + ad_proc ::xowiki::bootstrap::modal_dialog_popup_button { + -target:required + -label:required + {-title ""} + {-CSSclass ""} + } { + Generic modal dialog wrapper. + @param target ID of the target modal dialog + @param title title for the anchor (help popup), plain text + @param label HTML markup for the modal popup label (can contain tags) + + @return HTML markup + } { + if {[::xowiki::CSS toolkit] eq "bootstrap5"} { + set data_attribute "data-bs" + } else { + set data_attribute "data" + } + return [ns_trim -delimiter | [subst { + | + | $label + | + }]] + } +} + + + ::xo::library source_dependent # 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.213 -r1.284.2.214 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 1 Apr 2022 13:47:51 -0000 1.284.2.213 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 3 Apr 2022 14:42:50 -0000 1.284.2.214 @@ -648,15 +648,20 @@ FormField instproc render_form_widget {} { # This method provides the form-widget wrapper - set CSSclass [expr {[info exists :form_widget_CSSclass] ? ${:form_widget_CSSclass} : ""}] - if {${:error_msg} ne ""} { - append CSSclass " form-widget-error" + if {0} { + # no wrapper for form-widget (label + input) + :render_input + } else { + set CSSclass [expr {[info exists :form_widget_CSSclass] ? ${:form_widget_CSSclass} : ""}] + if {${:error_msg} ne ""} { + append CSSclass " form-widget-error" + } + set atts [list class $CSSclass] + if {${:inline}} { + lappend atts style "display: inline;" + } + ::html::div $atts { :render_input } } - set atts [list class $CSSclass] - if {${:inline}} { - lappend atts style "display: inline;" - } - ::html::div $atts { :render_input } } FormField instproc booleanAttributes {args} { @@ -762,15 +767,26 @@ } else { set CSSclass form-label } - ::html::div -class $CSSclass { - ::html::label -class [lindex [split ${:name} .] end] -for ${:id} { + if {[::xowiki::CSS toolkit] eq "bootstrap5"} { + ::html::label -class "${:form_label_CSSclass} [lindex [split ${:name} .] end]" -for ${:id} { ::html::t ${:label} } if {${:required} && ${:mode} eq "edit"} { ::html::div -class form-required-mark { ::html::t " (#acs-templating.required#)" } } + } else { + ::html::div -class $CSSclass { + ::html::label -class "${:form_label_CSSclass} [lindex [split ${:name} .] end]" -for ${:id} { + ::html::t ${:label} + } + if {${:required} && ${:mode} eq "edit"} { + ::html::div -class form-required-mark { + ::html::t " (#acs-templating.required#)" + } + } + } } :render_form_widget :render_help_text @@ -791,11 +807,10 @@ } FormField instproc render_help_text {} { - set text ${:help_text} - if {$text ne ""} { + if {${:help_text} ne ""} { html::div -class [:form_help_text_CSSclass] { html::span -class "info-sign" { } - html::t $text + html::t ${:help_text} } } } @@ -1796,6 +1811,7 @@ # Render content within in a fieldset, but with labels etc. # :CSSclass_list_add CSSclass [namespace tail [:info class]] + :CSSclass_list_add CSSclass "input-group align-items-center" html::fieldset [:get_attributes id {CSSclass class}] { foreach c ${:components} { $c render } } 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.112 -r1.332.2.113 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 1 Apr 2022 13:47:51 -0000 1.332.2.112 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 3 Apr 2022 14:42:50 -0000 1.332.2.113 @@ -94,38 +94,52 @@ 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 bulk-action "btn btn-default" + form-action "btn btn-default" + action "btn btn-default" margin-form "" + card "panel panel-default" + card-header panel-heading + card-body panel-body } - } elseif {${:preferredCSSToolkit} eq "bootstrap5"} { - ::xowiki::formfield::FormField parameter { + ::xowiki::formfield::FormField parameter [subst { {CSSclass form-control} {form_item_wrapper_CSSclass form-group} + {form_label_CSSclass ""} {form_widget_CSSclass ""} - {form_button_CSSclass "btn btn-outline-secondary btn-sm"} + {form_button_CSSclass "[xowiki::CSS class form-action]"} {form_button_wrapper_CSSclass ""} {form_help_text_CSSclass help-block} - } + }] + } elseif {${:preferredCSSToolkit} eq "bootstrap5"} { set :cssClasses { btn-default btn-outline-secondary bulk-action "btn btn-outline-secondary btn-sm" + form-action "btn btn-outline-secondary btn-sm m-1" + action "btn btn-outline-secondary btn-sm m-1" navbar-default navbar-light navbar-right ms-auto margin-form "" + cog gear + print printer + close btn-close + warn exclamation-triangle-fill } + ::xowiki::formfield::FormField parameter [subst { + {CSSclass form-control} + {form_item_wrapper_CSSclass mb-3} + {form_label_CSSclass "form-label me-1"} + {form_widget_CSSclass ""} + {form_button_CSSclass "[xowiki::CSS class form-action]"} + {form_button_wrapper_CSSclass ""} + {form_help_text_CSSclass form-text} + }] } else { ::xowiki::formfield::FormField parameter { {CSSclass} + {form_label_CSSclass ""} {form_widget_CSSclass form-widget} {form_item_wrapper_CSSclass form-item-wrapper} {form_button_CSSclass ""}