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.5 -r1.1.2.6 --- openacs-4/packages/xowf/lib/inclass-exam-answer.wf 22 Mar 2020 18:18:49 -0000 1.1.2.5 +++ openacs-4/packages/xowf/lib/inclass-exam-answer.wf 23 Mar 2020 16:54:47 -0000 1.1.2.6 @@ -172,7 +172,7 @@ # Field-renaming form loader # proc working_form_loader {ctx form_name} { - ns_log notice "============ working_form_loader" + #ns_log notice "============ working_form_loader" set obj [$ctx object] # @@ -183,6 +183,7 @@ if {[$obj exists online-exam-userName]} { return [done_form_loader $ctx $form_name] } + set item_nr [$obj property position] set parent_id [$obj parent_id] @@ -197,7 +198,7 @@ set position [::xowf::test_item::question_manager shuffled_index \ -shuffle_id $shuffle_id \ $parent_obj $item_nr] - ns_log notice "============ working_form_loader load form on pos $position" + #ns_log notice "============ working_form_loader load form on pos $position" # # Load the form. # @@ -277,8 +278,11 @@ #ns_log notice "SETTING $obj title [join $title { · }]" $obj title [join $title " · "] + set target_time [::xowf::test_item::question_manager exam_target_time -manager $parent_obj -instance $obj] + #:msg set_title-set_parameter-MenuBar-[$obj state] ::xo::cc set_parameter MenuBar 0 + ::xo::cc set_parameter top_includelet [list countdown-timer -target_time $target_time] ::xo::cc set_parameter template_file view-plain-master } 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.39 -r1.7.2.40 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 23 Mar 2020 15:36:58 -0000 1.7.2.39 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 23 Mar 2020 16:54:47 -0000 1.7.2.40 @@ -1790,6 +1790,7 @@ # - question_names # - question_property # - total_minutes + # - exam_target_time # :public method goto_page {obj:object position} { $obj set_property position $position @@ -1974,6 +1975,15 @@ return $minutes } + :public method exam_target_time {-manager:object -instance:object} { + set combined_form_info [:combined_question_form $manager] + set total_minutes [::xowf::test_item::question_manager total_minutes $combined_form_info] + set creation_time [::xo::db::tcl_date [$instance creation_date] tz] + set target_time [clock format [expr {[clock scan $creation_time] + $total_minutes*60}] \ + -format %Y-%m-%dT%H:%M:%S] + return $target_time + } + :public method current_question_form { {-with_numbers:switch false} {-with_title:switch false} Index: openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl 8 May 2019 14:38:41 -0000 1.4.2.1 +++ openacs-4/packages/xowf/tcl/xowf-includelet-procs.tcl 23 Mar 2020 16:54:47 -0000 1.4.2.2 @@ -18,7 +18,7 @@ } # - # Create an includelet called wf-todo, which lists the todo items + # Create an includelet called wf-todo, which lists the todo items # for a user_id from a single or multiple worflows) # ::xowiki::IncludeletClass create wf-todo \ @@ -41,10 +41,10 @@ select assignee,xowiki_form_page_id,state,i.publish_status,page_template, p.creation_date, p.last_modified, p,description, i2.name as wf_name,p.title,i.name,i.parent_id,o.package_id as pid - from xowiki_form_pagei p,cr_items i, cr_items i2, acs_objects o + from xowiki_form_pagei p,cr_items i, cr_items i2, acs_objects o where (assignee = :user_id or acs_group__member_p(:user_id,assignee, 'f')) - and i.live_revision = xowiki_form_page_id - and p.page_template = i2.item_id + and i.live_revision = xowiki_form_page_id + and p.page_template = i2.item_id and o.object_id = xowiki_form_page_id } if {$workflow ne ""} { @@ -101,7 +101,7 @@ -description "Workflow instance of workflow $wf_name $description" } ${:items} mixin ::xo::ical::VCALENDAR - ${:items} configure -prodid "-//WU Wien//NONSGML XoWiki Content Flow//EN" + ${:items} configure -prodid "-//WU Wien//NONSGML XoWiki Content Flow//EN" set text [${:items} as_ical] #:log "--ical sending $text" #ns_return 200 text/calendar $text @@ -136,6 +136,29 @@ } +namespace eval ::xowiki::includelet { + # + # countdown-timer based on answer_manager.countdown_timer + # + Class create countdown-timer -superclass ::xowiki::Includelet \ + -parameter { + {__decoration plain} + {parameter_declaration { + {-target_time ""} + }} + } -ad_doc { + Countdown timer + + @param target_time + } + + countdown-timer instproc render {} { + :get_parameters + return [xowf::test_item::answer_manager countdown_timer \ + -target_time $target_time -id [::xowiki::Includelet html_id [self]]] + } + +} # # Local variables: # mode: tcl 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.18 -r1.1.2.19 --- openacs-4/packages/xowf/www/resources/test-item.css 22 Mar 2020 17:11:25 -0000 1.1.2.18 +++ openacs-4/packages/xowf/www/resources/test-item.css 23 Mar 2020 16:54:47 -0000 1.1.2.19 @@ -219,3 +219,11 @@ font-size: 24px; } +/* + * user count-down timer styling + */ +div.xowiki-content div.countdown-timer { + float: right; +} + +