Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -r1.12.2.31 -r1.12.2.32 --- openacs-4/packages/xowf/xowf.info 29 Mar 2021 09:04:00 -0000 1.12.2.31 +++ openacs-4/packages/xowf/xowf.info 5 Apr 2021 18:02:55 -0000 1.12.2.32 @@ -10,16 +10,16 @@ t xowf - + Gustaf Neumann XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms 2017-08-06 WU Vienna BSD-Style 2 - - + + Index: openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml,v diff -u -r1.2.2.46 -r1.2.2.47 --- openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 26 Feb 2021 11:37:22 -0000 1.2.2.46 +++ openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 5 Apr 2021 18:02:55 -0000 1.2.2.47 @@ -209,4 +209,8 @@ Optionen f�r Online-Beaufsichtigung Detailangaben, welche Funktionen der Online-Beaufsichtigung genutzt werden sollen Vorschau + + Frage markieren + Makierung l�schen + Index: openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml,v diff -u -r1.2.2.46 -r1.2.2.47 --- openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 29 Mar 2021 09:08:27 -0000 1.2.2.46 +++ openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 5 Apr 2021 18:02:55 -0000 1.2.2.47 @@ -228,4 +228,7 @@ Proctoring Options Options to tailor proctoring behavior Preview + + Flag this Question + Remove Flag Index: openacs-4/packages/xowf/lib/inclass-exam-answer.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/inclass-exam-answer.wf,v diff -u -r1.1.2.34 -r1.1.2.35 --- openacs-4/packages/xowf/lib/inclass-exam-answer.wf 3 Apr 2021 18:12:50 -0000 1.1.2.34 +++ openacs-4/packages/xowf/lib/inclass-exam-answer.wf 5 Apr 2021 18:02:55 -0000 1.1.2.35 @@ -97,7 +97,7 @@ :set_property position $position } Action instproc set_page {obj increment} { - set parent_obj [::xo::db::CrClass get_instance_from_db -item_id [$obj parent_id]] + set parent_obj [::xo::db::CrClass get_instance_from_db -item_id [$obj parent_id]] set pages [:{$QM} question_names $parent_obj] set position [:property position 0] incr position $increment @@ -109,7 +109,7 @@ :goto_page $position } -Action create prevQuestion \ +Action create previousQuestion \ -state_safe true \ -next_state working \ -label #xowf.previous_question# \ @@ -132,6 +132,23 @@ -state_safe true \ -label #xowf.online-exam-save# +Action create flag \ + -state_safe true \ + -proc activate {obj} { + # + # In case, the current question is flagged, remove flag, + # otherwise add flag. + # + set flagged [:property flagged {}] + set i [lsearch $flagged [:property position 0]] + if {$i > -1} { + set flagged [lreplace $flagged $i $i] + } else { + lappend flagged $position + } + $obj set_property -new 1 flagged $flagged + } + Action create logout \ -state_safe true \ -next_state done \ @@ -466,33 +483,27 @@ # questions due to shuffling. # set current_position [:property position] - set actions {} - #if {$current_position > 0 && ${:state} eq "working"} { - # lappend actions prevQuestion - #} - if {${:state} ne "done"} { - if {$question_count > 1} { - for {set count 1} {$count <= $question_count} {incr count} { - ${container}::Action create ${container}::q.$count \ - -label "$count" \ - -state_safe true \ - -next_state working \ - -extra_css_class [expr {$current_position == $count - 1 ? "current" : ""}] \ - -proc activate {obj} [subst { - next - :goto_page [expr {$count -1}] - }] - lappend actions q.$count - } + if {${:state} ne "done"} { + set revision_sets [expr {[info exists :item_id] ? [:get_revision_sets -with_instance_attributes] : ""}] + set positions {} + foreach revision_set $revision_sets { + dict set positions [dict get [ns_set get $revision_set instance_attributes] position] 1 } - if { ${:state} in {initial working} - && [${:QM} more_ahead -position $current_position $parent_obj] - } { - lappend actions nextQuestion - } + set pagination [${:QM} pagination_actions \ + -container $container \ + -visited [dict keys $positions] \ + -flagged [:property flagged {}] \ + -question_count $question_count \ + -current_position $current_position \ + ] + + set actions $pagination if {${:state} in {initial working} } { + if {$question_count > 1} { + lappend actions flag + } lappend actions save } lappend actions logout Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v diff -u -r1.7.2.120 -r1.7.2.121 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 1 Apr 2021 17:24:57 -0000 1.7.2.120 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 5 Apr 2021 18:02:55 -0000 1.7.2.121 @@ -710,8 +710,11 @@ "{#xowiki.multiple_lines# multiple_lines}" "{#xowiki.file_upload# file_upload}" } " "] + # + # The options field is made "required" to avoid deselecting. + # set textEntryConfigSpec [subst { - {options {radio,horizontal=true,form_item_wrapper_CSSclass=form-inline,options=$render_hints,default=single_word,label=#xowf.answer#}} + {options {radio,horizontal=true,form_item_wrapper_CSSclass=form-inline,options=$render_hints,default=single_word,required,label=#xowf.answer#}} {lines {number,form_item_wrapper_CSSclass=form-inline,default=1,min=1,label=#xowf.lines#}} }] @@ -2784,6 +2787,7 @@ # # - goto_page # - more_ahead + # - pagination_actions # # - current_question_form # - current_question_obj @@ -2823,6 +2827,81 @@ return [expr {$position + 1 < [:question_count $obj]}] } + :method pagination_button_css { + {-CSSclass "btn-sm"} + {-cond:boolean,required} + {-extra ""} + } { + if {$cond} { + append CSSclass " " $extra + } + return $CSSclass + } + + :public method pagination_actions { + -container:object + -question_count:integer + {-visited:integer,0..n {}} + {-flagged:integer,0..n {}} + -current_position:integer + {-CSSclass "btn-sm"} + } { + # + # Create actions used for pagination. + # + set actions "" + + if {$question_count > 1} { + set extra_css [:pagination_button_css \ + -CSSclass $CSSclass \ + -cond [expr {$current_position == 0}] \ + -extra "disabled"] + ${container}::previousQuestion configure \ + -extra_css_class $extra_css \ + -label "«" \ + -label_noquote true \ + -wrapper_CSSclass "pagination" + lappend actions previousQuestion + + for {set count 1} {$count <= $question_count} {incr count} { + set visited_css [expr {($count - 1) in $visited ? "visited" : ""}] + set flag_label [expr {($count - 1) in $flagged + ? " " : ""}] + set extra_css [:pagination_button_css \ + -CSSclass "$CSSclass $visited_css" \ + -cond [expr {$current_position == $count - 1 }] \ + -extra "active current"] + ${container}::Action create ${container}::q.$count \ + -label "$count$flag_label" \ + -label_noquote true \ + -state_safe true \ + -next_state working \ + -wrapper_CSSclass "pagination" \ + -extra_css_class $extra_css \ + -proc activate {obj} [subst { + next + :goto_page [expr {$count - 1}] + }] + lappend actions q.$count + } + set extra_css [:pagination_button_css \ + -CSSclass $CSSclass \ + -cond [expr {$current_position+2 > $question_count}] \ + -extra "disabled"] + ${container}::nextQuestion configure \ + -extra_css_class $extra_css \ + -label "»" \ + -label_noquote true \ + -wrapper_CSSclass "pagination" + + set flag_state [expr {$current_position in $flagged ? "delete" : "set"}] + ${container}::flag label "#xowf.flag_$flag_state#" + + lappend actions nextQuestion + } + return $actions + } + :method load_question_objs {obj:object names} { # # Load the question objects for the provided question names and Index: openacs-4/packages/xowf/tcl/xowf-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-procs.tcl,v diff -u -r1.28.2.50 -r1.28.2.51 --- openacs-4/packages/xowf/tcl/xowf-procs.tcl 29 Mar 2021 09:01:04 -0000 1.28.2.50 +++ openacs-4/packages/xowf/tcl/xowf-procs.tcl 5 Apr 2021 18:02:55 -0000 1.28.2.51 @@ -69,7 +69,7 @@ quiz-select_question.form select_question.form select-topics.form - select-group-members.form + select-group-members.form } Package default_package_parameters { @@ -579,7 +579,7 @@ -form_constraints ""] } - set :form_obj $form_object + set :form_obj $form_object return $form_object } ::nsf::method::property Context form_object returns object @@ -1194,6 +1194,8 @@ {roles all} {state_safe false} {extra_css_class ""} + {wrapper_CSSclass ""} + {label_noquote false} {title} } Action instproc activate {obj} {;} @@ -1390,13 +1392,27 @@ } { if {[llength $buttons] > 0} { # - # Take the form_button_wrapper_CSSclass from the first button. + # Build button groups based on "form_button_wrapper_CSSclass". # - set wrapper_CSSclass [[lindex $buttons 0] form_button_wrapper_CSSclass] + set previous_wrapper_class "NONE" + set wrapper_groups {} + set group_num 0 + foreach f $buttons { + set wrapper_class [$f form_button_wrapper_CSSclass] + if {$wrapper_class eq $previous_wrapper_class} { + dict lappend wrapper_groups [list $wrapper_class $group_num] $f + continue + } + incr group_num + dict lappend wrapper_groups [list $wrapper_class $group_num] $f + set previous_wrapper_class $wrapper_class + } - ::html::div -class $wrapper_CSSclass { - foreach f $buttons { - $f render_input + foreach wrapper_group [dict keys $wrapper_groups] { + ::html::div -class [lindex $wrapper_group 0] { + foreach f [dict get $wrapper_groups $wrapper_group] { + $f render_input + } } } } @@ -1421,9 +1437,13 @@ if {$success} { set f [$formfieldButtonClass new -destroy_on_cleanup \ -name __action_[namespace tail $action] \ - -CSSclass $CSSclass] + -form_button_wrapper_CSSclass [$action wrapper_CSSclass] \ + -label_noquote [$action label_noquote] \ + -CSSclass $CSSclass \ + ] if {[$action extra_css_class] ne ""} { - $f append form_button_CSSclass " " [$action extra_css_class] + #$f append form_button_CSSclass " " [$action extra_css_class] + $f CSSclass_list_add form_button_CSSclass [$action extra_css_class] } #ns_log notice "RENDER BUTTON has CSSclass [$f CSSclass] // [$f form_button_CSSclass]" if {[$action exists title]} { @@ -2326,10 +2346,10 @@ } WorkflowPage ad_instproc schedule_job {-time:required -party_id cmd} { - + Schedule the specified Tcl command for the current package instance at the given time. - + } { :log "-at $time" set j [::xowf::atjob new \ @@ -2357,7 +2377,7 @@ lassign $atts state assignee instance_attributes xowiki_form_page_id if {[dict exists $instance_attributes wf_current_state] && [dict get $instance_attributes wf_current_state] ne $state} { - + #Object msg "must update state $state for $xowiki_form_page_id to [dict get $instance_attributes wf_current_state]" xo::db dml update_state "update xowiki_form_page \ Index: openacs-4/packages/xowf/www/resources/test-item.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/www/resources/test-item.css,v diff -u -r1.1.2.32 -r1.1.2.33 --- openacs-4/packages/xowf/www/resources/test-item.css 1 Apr 2021 17:24:57 -0000 1.1.2.32 +++ openacs-4/packages/xowf/www/resources/test-item.css 5 Apr 2021 18:02:55 -0000 1.1.2.33 @@ -41,30 +41,30 @@ opacity: 0.6; } -@media print{ +@media print{ div { - font-size: 11px; + font-size: 11px; } div.single_exam { - page-break-after: always; + page-break-after: always; } div.single_exam h2 { - font-size: 12px; + font-size: 12px; } div.single_exam h3 { - font-size: 12px; + font-size: 12px; } div.single_exam div.form-label { - display: none; + display: none; } div.xowiki-content a.btn { - display: none; + display: none; } div.header { - display: none; + display: none; } #print-button { - display: none; + display: none; } } @@ -114,7 +114,7 @@ div.sc_interaction label { font-weight: normal; /*margin: 0px 0px 10px 0px;*/ - padding: 0px 0px 4px 0px; + padding: 0px 0px 4px 0px; } label div.richtext-label { /*display: inline-block;*/ @@ -242,7 +242,20 @@ border-bottom: 2px solid #999; border-style: groove; } +form div.pagination button.visited { + background-color: #E6F4D6; +} +form div.pagination button span.text-danger { + color: #a94442; + background-color: transparent; +} +/*form div.pagination button.bookmark::after { + font-family: 'Glyphicons Halflings'; + content: "\e034"; +}*/ + + /* * Attachments styling */ @@ -264,7 +277,7 @@ div.short_text_interaction .modal.fade.in, div.text_interaction .modal.fade.in { - height: auto; /* let the content decide it */ + height: auto; /* let the content decide it */ } @@ -279,7 +292,7 @@ float: right; margin-top: 10px; margin-bottom: 10px; - vertical-align: text-bottom; + vertical-align: text-bottom; } div.xowiki-content div.countdown-timer span.glyphicon-volume-off { color: red;