Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.93 -r1.94 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 29 Mar 2002 19:14:45 -0000 1.93 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 2 Apr 2002 06:13:47 -0000 1.94 @@ -619,6 +619,7 @@ applets_dispatch -community_id $community_id \ -op AddUserToCommunity \ + -reorder_hack_p 1 \ -list_args [list $community_id $user_id] } } @@ -1245,16 +1246,40 @@ {-community_id ""} {-op:required} {-list_args {}} + {-reorder_hack_p ""} } { Dispatch an operation to every applet, either in one communtiy or on all the active dotlrn applets } { + set list_of_applets [list_active_applets -community_id $community_id] - ns_log notice "aks 20 debug applets_dispatch called with comm_id = $community_id, op $op, - list args $list_args length is [llength $list_args]" + if {![empty_string_p $reorder_hack_p]} { + ns_log notice "aks1: applets_dispatch: reorder hack!" - set list_of_applets [list_active_applets -community_id $community_id] + set reorder_applets_string [ad_parameter user_wsp_applet_ordering "dotlrn" "dotlrn_news,dotlrn_bboard,dotlrn_survey,dotlrn_faq"] + set reorder_applets_list [string trim [split $reorder_applets_string {,}]] + + # check if the applet is both in the reorder list and the applet list + # if so, put it into the right place in the result list + # if not, skip it + set result_list [list] + foreach applet $reorder_applets_list { + set index [lsearch -exact $list_of_applets $applet] + + if {$index != -1 } { + ns_log notice "aks2: reorder HIT with '$applet' against '$list_of_applets' // $index" + set list_of_applets [lreplace $list_of_applets $index $index] + lappend result_list $applet + } else { + ns_log notice "aks3: reorder MISS with '$applet' against '$list_of_applets'" + } + } + + set list_of_applets [concat $result_list $list_of_applets] + } + + foreach applet $list_of_applets { # Callback on applet applet_call $applet $op $list_args