Gustaf Neumann
XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms
2017-08-06
WU Vienna
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 -N -r1.2.2.32 -r1.2.2.33
--- openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 14 Jun 2020 20:26:29 -0000 1.2.2.32
+++ openacs-4/packages/xowf/catalog/xowf.de_DE.ISO-8859-1.xml 17 Jun 2020 21:59:50 -0000 1.2.2.33
@@ -158,11 +158,15 @@
Beschr�nkte Fragenzahl
Beschr�nke die Zahl der Fragen auf
- diesen Wert. Sinnvoll in Kombination mit radomisierter Fragenfolge. Einschr�nkung: Alle Fragen m�ssen gleiche Dauer haben,
+ diesen Wert. Sinnvoll in Kombination mit randomisierter Fragenfolge, jeder Student sieht potentiell andere X von Y Fragen. Einschr�nkung: Alle Fragen m�ssen gleiche Dauer haben,
Beschr�nkung auf %n% Fragen ok, zeige Studierenden %n% von
Beschr�nkung auf %n% Fragen NICHT ok (unterschiedliche Dauer),
Beschr�nkung auf %n% Fragen NICHT ok (Fragenanzahl zu gering),
-
+
+ Automatische Freischaltung der Pr�fung von %from% bis %to%
+ Zeitfenster f�r Pr�fung
+ Optionales automatisches Freischalten/Schlie�en der Pr�fung. Auch wenn das Zeitfenster aktiviert ist, kann die Pr�fung manuell freigeschalten/geschlossen werden.
+
Ver�ffentlichung der Pr�fung
seit der Ver�ffentlichung
Erreichte Punkte
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 -N -r1.2.2.29 -r1.2.2.30
--- openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 14 Jun 2020 20:26:29 -0000 1.2.2.29
+++ openacs-4/packages/xowf/catalog/xowf.en_US.ISO-8859-1.xml 17 Jun 2020 21:59:50 -0000 1.2.2.30
@@ -183,6 +183,10 @@
Item Restriction to %n% items NOT ok (duration varies),
Item Restriction to %n% items NOT ok (not enough test items),
+ Automatically published from %from% to %to%
+ Exam Time Window
+ Optional time window for automatically open/close exam. When these values are set, manual opening and closing of the exam is still possible.
+
Is the student allow to use cut and paste in multiline text fields?
Cut and Paste is allowed in multi-line text fields
Cut and Paste is not allowed in multi-line text fields
Index: openacs-4/packages/xowf/lib/inclass-exam.wf
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/Attic/inclass-exam.wf,v
diff -u -N -r1.1.2.35 -r1.1.2.36
--- openacs-4/packages/xowf/lib/inclass-exam.wf 14 Jun 2020 20:26:29 -0000 1.1.2.35
+++ openacs-4/packages/xowf/lib/inclass-exam.wf 17 Jun 2020 21:59:50 -0000 1.1.2.36
@@ -114,10 +114,21 @@
:unpublish_link $obj
}
+########################################################################
+# When the user restarts an exam, make sure, that already scheduled
+# atjobs are removed.
+#
+restart proc activate {obj} {
+ xowf::test_item::answer_manager delete_scheduled_atjobs $obj
+}
+
+########################################################################
+# When the user opens the submission review, offer a link.
+#
open_submission_review proc activate {obj} {
set aLink [$obj pretty_link -query m=view-my-exam]
- util_user_message -html \
- -message "[$obj name] exam review is available as [ns_quotehtml $aLink]"
+ $obj util_user_message -html -message \
+ "[$obj name] exam review is available as [ns_quotehtml $aLink]"$msg
}
########################################################################
@@ -126,7 +137,7 @@
#
Action instproc publish_link {obj} {
set aLink [$obj pretty_link -query m=answer]
- util_user_message -html \
+ $obj util_user_message -html \
-message "[$obj name] is available as [ns_quotehtml $aLink]"
# TODO: make it happen in the LMS
}
@@ -135,7 +146,7 @@
# group
#
Action instproc unpublish_link {obj} {
- util_user_message -html -message "[$obj name] is closed"
+ $obj util_user_message -html -message "[$obj name] is closed"
# TODO: make it happen in the LMS
}
@@ -159,6 +170,7 @@
set synchronized [$obj property synchronized 0]
set allow_paste [$obj property allow_paste 1]
set max_items [$obj property max_items ""]
+ set time_window [$obj property time_window ""]
append text [subst {
[expr {$synchronized ? "" : "Non-"}]Synchronized Exam
@@ -186,6 +198,18 @@
set max_items_msg [_ xowf.Max_items_ok [list n $max_items]]
}
}
+
+ set time_window_msg ""
+ if {$time_window ne ""} {
+ set dtstart [dict get $time_window time_window.dtstart]
+ if {$dtstart ne ""} {
+ regsub -all T $dtstart " " dtstart
+ set dtend [dict get $time_window time_window.dtend]
+ set time_window_msg
[_ xowf.Automatically_published_from_to [list from $dtstart to $dtend]]
+ set time_window_msg "
Automatische Freischaltung der Prüfung von $dtstart bis $dtend"
+ }
+ }
+
append text [subst {
[expr {$max_items_msg ne "" ? "$max_items_msg" : ""}]
@@ -194,6 +218,7 @@
[expr {$autograde ? "#xowf.exam_review_possible#" : "#xowf.exam_review_not_possible#"}]
[expr {$randomizationOk ? "#xowf.randomization_for_exam_ok#" : "#xowf.randomization_for_exam_not_ok#"}]
[expr {$allow_paste ? "#xowf.Cut_and_paste_allowed#" : "#xowf.Cut_and_paste_not_allowed#"}]
+ $time_window_msg
[expr {[llength $published_periods] > 0 ? "
#xowf.inclass-exam-open#: [join $published_periods {, }]
" : ""}]
[expr {[llength $review_periods] > 0 ? "#xowf.inclass-exam-review#: [join $review_periods {, }]
" : ""}]
@@ -259,7 +284,7 @@
"published" {
#
# In inclass cases, never show all questions on screen, since
- # the teacher might have the screen on the projector.
+ # the lecturer might have the screen on the projector.
#
template::add_script -src urn:ad:js:bootstrap3
set fullQuestionForm [subst {
@@ -737,7 +762,7 @@
# state different to "published".
#
if {[:property _state] ne "published"} {
- util_user_message -html -message "Cannot start answer workflow in this state"
+ $obj util_user_message -html -message "Cannot start answer workflow in this state"
} else {
set wf [xowf::test_item::answer_manager get_answer_wf [self]]
set proctoring [:property proctoring]
@@ -753,7 +778,7 @@
}
:proc www-proctor-answer {} {
if {[:property _state] ne "published"} {
- util_user_message -html -message "Cannot start answer workflow in this state"
+ $obj util_user_message -html -message "Cannot start answer workflow in this state"
} else {
set wf [xowf::test_item::answer_manager get_answer_wf [self]]
$wf www-create-or-use -parent_id [:item_id]
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 -N -r1.7.2.68 -r1.7.2.69
--- openacs-4/packages/xowf/tcl/test-item-procs.tcl 14 Jun 2020 20:26:29 -0000 1.7.2.68
+++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 17 Jun 2020 21:59:50 -0000 1.7.2.69
@@ -1236,10 +1236,81 @@
$wf save_new
#ns_log notice "create_answer_workflow $wf DONE [$wf pretty_link] IA <[$wf instance_attributes]>"
#ns_log notice "create_answer_workflow parent $parentObj IA <[$parentObj instance_attributes]>"
+
+ set time_window [$parentObj property time_window]
+ if {$time_window ne ""} {
+ :time_window_setup $parentObj -time_window $time_window
+ }
}
########################################################################
+ :method time_window_setup {parentObj:object {-time_window:required}} {
+ #
+ # Check the provided time_window values, adjust it if necessary,
+ # and make sure, accoding atjobs are provided.
+ #
+ set dtstart [dict get $time_window time_window.dtstart]
+ set dtend [dict get $time_window time_window.dtend]
+
+ if {$dtstart ne ""} {
+ set total_minutes [xowf::test_item::question_manager total_minutes_for_exam -manager $parentObj]
+ ns_log notice "#### create_workflows: atjobs for time_window <$time_window> total-mins $total_minutes"
+ set start_clock [clock scan $dtstart -format %Y-%m-%dT%H:%M]
+
+ if {$dtend eq ""} {
+ #
+ # No end given. set it to start + exam time + 5 minutes
+ #
+ set end_clock [expr {$start_clock + ($total_minutes + 5)*60}]
+ set new_dtend [clock format $end_clock -format %H:%M]
+ ns_log notice "#### no dtend given. set it from $dtend to $new_dtend"
+
+ } else {
+ set end_date [clock format $start_clock -format %Y-%m-%d]T$dtend
+ set end_clock [clock scan $end_date -format %Y-%m-%dT%H:%M]
+ if {($end_clock - $start_clock) < ($total_minutes*60)} {
+ #
+ # The specified end time is too early. Set it to start +
+ # exam time + 5 minutes
+ #
+ set end_clock [expr {$start_clock + ($total_minutes + 5)*60}]
+ set new_dtend [clock format $end_clock -format %H:%M]
+ ns_log notice "#### dtend is too early. Move it from $dtend to $new_dtend"
+
+ } else {
+ set new_dtend $dtend
+ }
+ }
+
+ if {$new_dtend ne $dtend} {
+ ns_log notice "#### create_workflows: must change dtend from <$dtend> to <$new_dtend>"
+ set ia [$parentObj instance_attributes]
+ dict set time_window time_window.dtend $new_dtend
+ dict set ia time_window $time_window
+ #ns_log notice "SAVE updated ia <${:instance_attributes}>"
+ $parentObj update_attribute_from_slot [$parentObj find_slot instance_attributes] $ia
+ }
+
+ #
+ # Delete previously scheduled atjobs
+ #
+ :delete_scheduled_atjobs $parentObj
+
+ #
+ # Schedule new atjobs
+ #
+ $parentObj schedule_action \
+ -time [clock format $start_clock -format "%Y-%m-%d %H:%M:%S"] \
+ -action publish
+ $parentObj schedule_action \
+ -time [clock format $end_clock -format "%Y-%m-%d %H:%M:%S"] \
+ -action unpublish
+ }
+ }
+
+ ########################################################################
+
:public method delete_all_answer_data {obj:object} {
#
# Delete all instances of the answer workflow
@@ -1252,7 +1323,30 @@
return $wf
}
+ ########################################################################
+ :public method delete_scheduled_atjobs {obj:object} {
+ #
+ # Delete previously scheduled atjobs
+ #
+ ns_log notice "#### delete_scheduled_atjobs"
+ set item_id [$obj item_id]
+ set atjob_form_id [::xowf::atjob form_id -parent_id $item_id -package_id [ad_conn package_id]]
+
+ set to_delete [xo::dc list get_children {
+ select item_id from xowiki_form_instance_item_index
+ where parent_id = :item_id
+ and page_template = :atjob_form_id
+ }]
+
+ foreach id $to_delete {
+ ns_log notice "#### xo::db::sql::content_item proc delete -item_id $id"
+ xo::db::sql::content_item delete -item_id $id
+ }
+ }
+
+
+
########################################################################
:public method get_answer_wf {obj:object} {
@@ -2232,8 +2326,13 @@
window.addEventListener('load', audioContext_onload);
}]
- set alarmState [ns_getcookie $audio_alarm_cookie "inactive"]
- set glypphIcon [expr {$alarmState eq "inactive" ? "glyphicon-volume-off":"glyphicon-volume-up"}]
+ if {[ns_conn isconnected]} {
+ set alarmState [ns_getcookie $audio_alarm_cookie "inactive"]
+ set glypphIcon [expr {$alarmState eq "inactive" ? "glyphicon-volume-off":"glyphicon-volume-up"}]
+ } else {
+ set alarmState "inactive"
+ set glypphIcon "glyphicon-volume-off"
+ }
#ns_log notice "C=$alarmState"
return [subst {
@@ -2279,6 +2378,7 @@
# - question_property
# - add_seeds
# - total_minutes
+ # - total_minutes_for_exam
# - exam_target_time
#
:public method goto_page {obj:object position} {
@@ -2583,6 +2683,14 @@
return $minutes
}
+ :public method total_minutes_for_exam {-manager:object} {
+ set max_items [$manager property max_items ""]
+ set combined_form_info [:combined_question_form $manager]
+ set total_minutes [:total_minutes \
+ -max_items $max_items \
+ $combined_form_info]
+ }
+
:public method exam_target_time {-manager:object -base_time} {
#
# Calculate the exam target time (finishing time) based on the
@@ -2592,11 +2700,7 @@
# @param manager exam workflow
# @param base_time time in SQL format
#
- set max_items [$manager property max_items ""]
- set combined_form_info [:combined_question_form $manager]
- set total_minutes [::xowf::test_item::question_manager total_minutes \
- -max_items $max_items \
- $combined_form_info]
+ set total_minutes [:total_minutes_for_exam -manager $manager]
# Use "try" for backward compatibility, versions before
# factional seconds. TODO: remove me.
Index: openacs-4/packages/xowf/www/prototypes/select_question.form.page
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/www/prototypes/Attic/select_question.form.page,v
diff -u -N -r1.1.2.7 -r1.1.2.8
--- openacs-4/packages/xowf/www/prototypes/select_question.form.page 14 Jun 2020 20:26:29 -0000 1.1.2.7
+++ openacs-4/packages/xowf/www/prototypes/select_question.form.page 17 Jun 2020 21:59:50 -0000 1.1.2.8
@@ -4,15 +4,16 @@
-title "Select Question" \
-anon_instances f \
-text {} \
- -form {{} text/html} \
+ -form {{} text/html} \
-form_constraints {
@cr_fields:hidden
{_title:text,label=#xowf.online-exam-name#,default=#xowf.online-exam-default_name#}
{question:form_page,multiple=true,form=en:TestItemText.form|en:TestItemShortText.form|en:TestItemMC.form|en:TestItemSC.form|en:TestItemUpload.form|en:TestItemReorder.form,required,help_text=#xowf.select_question_help_text#,label=#xowiki.questions#}
{shuffle_items:boolean,horizontal=true,label=#xowf.randomized_items#,help_text=#xowf.randomized_items_help_text#}
{max_items:number,min=1,label=#xowf.Max_items#,help_text=#xowf.Max_items_help_text#}
{allow_paste:boolean,horizontal=true,default=t,label=#xowf.Allow_paste#,help_text=#xowf.Allow_paste_help_text#}
- {synchronized:boolean,horizontal=true,default=f,label=#xowf.Synchronized#,help_text=#xowf.Synchronized_help_text#}
+ {synchronized:boolean,horizontal=true,default=f,label=#xowf.Synchronized#,help_text=#xowf.Synchronized_help_text#}
+ {time_window:time_span,label=#xowf.Exam_time_window#,help_text=#xowf.Exam_time_window_help_text#}
{signature:boolean,horizontal=true,default=f,label=#xowf.Signature#,help_text=#xowf.Signature_help_text#}
{proctoring:boolean,horizontal=true,default=f,label=#xowf.Proctoring#,help_text=#xowf.Proctoring_help_text#}
_description:omit _page_order:omit
Index: openacs-4/packages/xowf/www/resources/test-item.css
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/www/resources/Attic/test-item.css,v
diff -u -N -r1.1.2.26 -r1.1.2.27
--- openacs-4/packages/xowf/www/resources/test-item.css 11 Jun 2020 19:36:40 -0000 1.1.2.26
+++ openacs-4/packages/xowf/www/resources/test-item.css 17 Jun 2020 21:59:50 -0000 1.1.2.27
@@ -201,6 +201,15 @@
background-color: #fafafa;
}
+.xowiki-content div.form-inline div {
+ display: inline-block;
+ padding-left: 10px;
+}
+.xowiki-content div.form-inline {
+ display: inline-block;
+}
+
+
/*
* Action button styling
*/