Index: openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp 30 Mar 2006 16:01:45 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp 31 May 2006 16:20:54 -0000 1.2 @@ -1,6 +1,13 @@ + + + - + - +
@@ -12,10 +19,14 @@
+ + Index: openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl 16 May 2006 09:24:35 -0000 1.2 +++ openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl 31 May 2006 16:20:54 -0000 1.3 @@ -12,12 +12,23 @@ members_list:optional } +#check if the run is waiting +if { [db_0or1row get_run_status { + select run_id + from imsld_runs + where run_id=:run_id and status='active' +}] } { + ad_returnredirect . +} + + db_1row get_imsld_info { select imsld_id from imsld_runs where run_id = :run_id } + #get roles list set roles_list [imsld::roles::get_list_of_roles -imsld_id $imsld_id] set roles_list_names [imsld::roles::get_roles_names -roles_list $roles_list] @@ -31,12 +42,14 @@ lappend lista $lista_item } -ad_form -name choose_role -action imsld-admin-roles -export {imsld_id run_id} -form { - {role:integer(select) {label "Select a role"} - {options "$lista"} +ad_form -name choose_role -action imsld-admin-roles -export {imsld_id run_id} -show_required_p {0} -form { + {role:integer(select) + {label "Select a role"} + {options "$lista"} + {html {onChange confirmValue(this.form)}} } } -on_request { - if {[info exists role]} { + if {[info exists role]} { set role $role } } Index: openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 31 May 2006 16:20:54 -0000 1.1 @@ -0,0 +1,16 @@ +ad_page_contract { + Confirm changes and set a run as activeAsign users assigned to an specified group + + @author lfuente@it.uc3m.es + @creation-date May 2006 +} { + imsld_id + run_id +} +#ojo!!!! poner aqu� tema de permisos!!! +set conditions 1 +if {$conditions == 1} { + db_dml set_run_active { update imsld_runs set status='active' where run_id=:run_id and imsld_id=:imsld_id} +} + +ad_returnredirect .. Index: openacs-4/packages/imsld/www/admin/imsld-finish.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-finish.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/imsld-finish.adp 31 May 2006 16:20:54 -0000 1.1 @@ -0,0 +1,22 @@ + + + +

Some warnings has been found

+

@warnings@

+ + + +

Some errors has been found

+

@errors@

+ Go back + + + +


+

Are all the students asigned to the proper roles? If you confirm now, no more changes will be acepted later.

+ +

If you are not sure that everything is OK, please go back

+

Otherwise, if everthing is OK and you are sure, please Confirm.

+ + + Index: openacs-4/packages/imsld/www/admin/imsld-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-finish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/www/admin/imsld-finish.tcl 31 May 2006 16:20:54 -0000 1.1 @@ -0,0 +1,81 @@ +ad_page_contract { + Confirm changes and set a run as activeAsign users assigned to an specified group + + @author lfuente@it.uc3m.es + @creation-date May 2006 +} { + imsld_id + run_id +} +#aqui tengo que poner la comprobaci�n de que todo sea correcto (errores y warnings) + +set roles_list_depth [imsld::roles::get_list_of_roles -imsld_id $imsld_id] + + +set roles_list [list] +foreach role $roles_list_depth { + lappend roles_list [lindex $role 0] +} + +set warnings [list] +set errors [list] +#para cada role, compruebo todas las condiciones +foreach role $roles_list { + set role_info [imsld::roles::get_role_info -role_id $role] + set max_persons [lindex $role_info 0] + set min_persons [lindex $role_info 1] + set match_persons_p [lindex $role_info 3] + + #para cada instancia del role, el maximo, minimo y demas es para cada grupo + set role_groups [db_list get_groups_in_run { + + select ar1.object_id_two as groups + from acs_rels ar1, + acs_rels ar2, + imsld_rolesi iri, + imsld_run_users_group_ext iruge2 + where ar1.rel_type='imsld_role_group_rel' + and ar1.object_id_one=iri.item_id + and iri.role_id=:role + and ar2.object_id_one=ar1.object_id_two + and ar2.rel_type='imsld_roleinstance_run_rel' + and ar2.object_id_two=iruge2.group_id + and iruge2.run_id=:run_id + }] + if {![llength $role_groups]} { + #warning, there's a role without instances + lappend warnings "[llength $role_groups]WARNING: Role $role has no groups. Having a group is not mandatory, but may be you forgot assigning one...\" + set warning_flag 1 + } else { + + foreach group $role_groups { + set members_list [db_list get_members_list {select member_id from group_member_map where group_id=:group group by member_id}] + + if {[llength $members_list] == 0} { + lappend warnings "WARNING: Group $group in role $role has no members. A empty group is not forbiden, but may be you forgot assigning members...\" + set warning_flag 1 + } + #numero maximo + if {![string eq "" $max_persons] && ([llength $members_list] > $max_persons)} { + #error porque hay demasiada gente + lappend errors "ERROR: Group $group in role $role has too much members. Is must have no more than $max_persons. \Please go back and modify this.\" + set error_flag 1 + + } + + #numero minimo + if { ![string eq "" $min_persons] && ([llength $members_list] < $min_persons)} { + #error porque no hay gente suficiente en el grupo + lappend errors "ERROR: Group $group in role $role has too much members. Is must have at least $min_persons. \Please go back and modify this.\" + set error_flag 1 + } + #match person + if {[string eq "t" $match_persons_p]} { + #FIX ME: TERMINAR ESTA CONDICION + } + } + } + +} +set back [export_vars -base imsld-admin-roles {run_id}] +set confirm [export_vars -base imsld-confirm-finish {imsld_id run_id}] Index: openacs-4/packages/imsld/www/admin/imsld-role-members.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-members.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/imsld-role-members.adp 30 Mar 2006 16:01:46 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/imsld-role-members.adp 31 May 2006 16:20:54 -0000 1.2 @@ -1,15 +1,26 @@ + +

@group_title@

+ +
    +
  • Max. number of students per group: @max_persons@
  • +
  • Min. number of students per group: @min_persons@
  • +
+ + + -

Not members

+

Not members

-

Group members

+

Group members

- +
+ + - Index: openacs-4/packages/imsld/www/admin/imsld-role-members.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-members.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/imsld-role-members.tcl 16 May 2006 09:24:36 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/imsld-role-members.tcl 31 May 2006 16:20:54 -0000 1.5 @@ -15,6 +15,13 @@ #check conditions and set the database set role_info [imsld::roles::get_role_info -role_id $role] + +set max_persons [lindex $role_info 0] +if {[string eq "" $max_persons]} {set max_persons "No restricition"} + +set min_persons [lindex $role_info 1] +if {[string eq "" $min_persons]} {set min_persons "No restricition"} + set match_persons_p [lindex $role_info 3] set not_allowed [db_list other_subroles_members {}] @@ -25,6 +32,7 @@ set not_allowed [list 0 0] } +set group_title [group::title -group_id $group_instance] if {![string eq $group_instance "0"] && [db_0or1row has_role_parent_p {}]} { if {![info exist members_list]} { @@ -110,4 +118,19 @@ db_multirow asign_members get_users_list {} db_multirow asign_not_members get_not_users_list {} -ad_form -name confirm -action imsld-role-confirm -export {imsld_id run_id role group_instance members_list} +ad_form -name confirm \ + -form { + {submit:text(submit) {label "Confirm this changes"}} + } \ + -action imsld-role-confirm \ + -export {imsld_id run_id role group_instance members_list} + +ad_form -name finish_management \ + -form { + {submit:text(submit) {label "Finish role management"}} + } \ + -action imsld-finish \ + -export {imsld_id run_id} + + + Index: openacs-4/packages/imsld/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/imsld/www/admin/index.tcl 29 May 2006 15:10:53 -0000 1.7 +++ openacs-4/packages/imsld/www/admin/index.tcl 31 May 2006 16:20:54 -0000 1.8 @@ -137,7 +137,7 @@ db_multirow -extend { manage delete_template } imsld_runs get_runs { *SQL* } { - if { [string eq $status "deleted"] } { + if { [string eq $status "deleted"] || [string eq $status active]} { set delete_template "[_ imsld.Deleted] [_ imsld.Make_it_live]" set manage "" } else {