Index: openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 21 Feb 2007 16:34:26 -0000 1.22 +++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 2 Mar 2007 14:39:28 -0000 1.23 @@ -41,11 +41,9 @@ -user_id } { } { - if {![info exist user_id]} { set user_id [ad_conn user_id] } - set ifNodes [$condition selectNodes {*[local-name()='if']}] set thenNodes [$condition selectNodes {*[local-name()='then']}] set elseNodes [$condition selectNodes {*[local-name()='else']}] @@ -57,7 +55,7 @@ } else { foreach elseNode $elseNodes { #an else node may contain an expression or another if_then_else - +#prevent for empty else nodes if {[$elseNode hasChildNodes]} { if { [string eq [ [$elseNode selectNodes {*[position()=1] } ] localName] "if" ] } { imsld::condition::execute -run_id $run_id -condition $elseNode -user_id $user_id @@ -515,7 +513,7 @@ return $return_value } {not} { - return [expr ![imsld::expression::eval -run_id $run_id -expression [$expressionNode childNodes]]] + return [expr ![imsld::expression::eval -run_id $run_id -user_id $user_id -expression [$expressionNode childNodes]]] } {current-datetime} { return [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"] -gmt 1 } {datetime-activity-started} { @@ -542,69 +540,69 @@ } {less-than} { set childs [$expressionNode childNodes] - set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 < $propertyvalue1}] } {greater-than} { set childs [$expressionNode childNodes] - set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 > $propertyvalue1}] } {divide} { set childs [$expressionNode childNodes] - return [expr {[imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] / [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]]}] + return [expr {[imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] / [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]]}] } {multiply} { set childs [$expressionNode childNodes] set returnvalue 1 set count 0 foreach child $childs { - set returnvalue [expr {$returnvalue * [imsld::expression::eval -run_id $run_id -expression $child]}] + set returnvalue [expr {$returnvalue * [imsld::expression::eval -run_id $run_id -user_id $user_id -expression $child]}] incr count } set returnvalue [expr { [string eq 0 $count] ? 0 : $returnvalue }] return $returnvalue } {substract} { set childs [$expressionNode childNodes] - return [expr {[imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]]}] + return [expr {[imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]]}] } {sum} { set childs [$expressionNode childNodes] set returnvalue 0 foreach child $childs { - set returnvalue [expr {$returnvalue + [imsld::expression::eval -run_id $run_id -expression $child]}] + set returnvalue [expr {$returnvalue + [imsld::expression::eval -run_id $run_id -user_id $user_id -expression $child]}] } return $returnvalue } {or} { set childs [$expressionNode childNodes] set returnvalue 0 foreach child $childs { - set returnvalue [expr {$returnvalue || [imsld::expression::eval -run_id $run_id -expression $child]}] + set returnvalue [expr {$returnvalue || [imsld::expression::eval -run_id $run_id -user_id $user_id -expression $child]}] } return $returnvalue } {and} { set childs [$expressionNode childNodes] set returnvalue 1 foreach child $childs { - set returnvalue [expr {$returnvalue && [imsld::expression::eval -run_id $run_id -expression $child]}] + set returnvalue [expr {$returnvalue && [imsld::expression::eval -user_id $user_id -run_id $run_id -expression $child]}] } return $returnvalue } {is-not} { set childs [$expressionNode childNodes] - set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 != $propertyvalue1}] } {is} { set childs [$expressionNode childNodes] - set propertyvalue0 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 0]] - set propertyvalue1 [imsld::expression::eval -run_id $run_id -expression [lindex $childs 1]] + set propertyvalue0 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 0]] + set propertyvalue1 [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [lindex $childs 1]] return [expr {$propertyvalue0 == $propertyvalue1}] } {is-member-of-role} { @@ -728,7 +726,7 @@ {ELEMENT_NODE} { switch -- [$propertyvalueChildNode localName] { {calculate} { - set propertyValue [imsld::expression::eval -run_id $run_id -expression [$propertyvalueChildNode childNodes]] + set propertyValue [imsld::expression::eval -run_id $run_id -user_id $user_id -expression [$propertyvalueChildNode childNodes]] } {property-ref} { set propertyValue [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyvalueChildNode getAttribute {ref}]] Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 5 Feb 2007 16:14:31 -0000 1.14 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 2 Mar 2007 14:39:28 -0000 1.15 @@ -175,15 +175,27 @@ and ar.object_id_two = ici.item_id }] #property conditions - foreach condition_id $conditions_list { - set condition_xml [db_string get_xml_piece { - select condition_xml - from imsld_conditions - where condition_id=:condition_id - }] - dom parse $condition_xml document - $document documentElement condition_node - imsld::condition::execute -run_id $run_id -condition $condition_node + db_foreach user_in_run { + select gmm.member_id + from group_member_map gmm, + imsld_run_users_group_ext iruge, + acs_rels ar1 + where iruge.run_id=:run_id + and ar1.object_id_two=iruge.group_id + and ar1.object_id_one=gmm.group_id + group by member_id + + } { + foreach condition_id $conditions_list { + set condition_xml [db_string get_xml_piece { + select condition_xml + from imsld_conditions + where condition_id=:condition_id + }] + dom parse $condition_xml document + $document documentElement condition_node + imsld::condition::execute -run_id $run_id -user_id $member_id -condition $condition_node + } } # when-condition-true: Index: openacs-4/packages/imsld/www/activity-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/imsld/www/activity-frame.tcl 21 Dec 2006 15:20:47 -0000 1.14 +++ openacs-4/packages/imsld/www/activity-frame.tcl 2 Mar 2007 14:39:29 -0000 1.15 @@ -129,9 +129,7 @@ set resources_list [concat $resources_list [concat $prerequisites_list $objectives_list]] imsld::grant_permissions -resources_activities_list $resources_list -user_id $user_id -run_id $run_id } - set activities [$dom_root asXML] - } else { # a user has been selected to be supported # get the associated resource of the support activity Index: openacs-4/packages/imsld/www/imsld-content-serve.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-content-serve.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/imsld/www/imsld-content-serve.tcl 19 Dec 2006 10:35:20 -0000 1.18 +++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 2 Mar 2007 14:39:29 -0000 1.19 @@ -657,7 +657,6 @@ foreach class_node $class_nodes { # get requested info set class_name_list [split [$class_node getAttribute class] " "] - foreach class_name $class_name_list { # get class info if { [db_0or1row class_info {