Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26452/WEB-INF/maple/aim
Modified Files:
Tag: aim-xml
Register.mpl Student.mpl
Log Message:
Added support for tutorial groups
Index: Register.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Register.mpl,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -C2 -d -r1.3 -r1.3.6.1
*** Register.mpl 25 Aug 2003 21:47:19 -0000 1.3
--- Register.mpl 7 Oct 2004 11:51:30 -0000 1.3.6.1
***************
*** 58,61 ****
--- 58,131 ----
],
+ ['Field','UseGroups'::boolean = false,
+ "@True@ if the class is divided into groups
+ "
+ ],
+
+ ['Field','GroupTable'::table,
+ "The table of #`aim/Register/Group`# objects containing
+ information about the groups (indexed by group ID's)
+ "
+ ],
+
+ ['Method','GroupIDs'::list(string),
+ "The list of IDs of the groups",
+ proc(this)
+ map(op,[indices(this['GroupTable'])]);
+ end
+ ],
+
+ ['Method','GetGroup'::`aim/Register/Group`,
+ "Return the #`aim/Register/Group`# objects containing
+ information about the group with the specified ID.
+ ",
+ proc(this,id::string)
+ local gt,gp;
+ if this['UseGroups'] <> true then
+ error(__("Register does not use groups"));
+ fi;
+ gt := eval(this['GroupTable']);
+ if not type([gt],[table]) then
+ error(__("Malformed group table"));
+ fi;
+ gp := eval(gt[id]);
+ if not(type([`aim/Register/Group`],[gp])) then
+ error(sprintf(__("Invalid group ID: %s"),id));
+ fi;
+ eval(gp);
+ end
+ ],
+
+ ['Method','AddGroup'::'void',
+ "Add the specified #`aim/Register/Group`# object to the group
+ table. If there is already a group with the specified ID,
+ then the details are overwritten.
+ ",
+ proc(this,g::`aim/Register/Group`)
+ local id,gt;
+ id := g['ID'];
+ gt := eval(this['GroupTable']);
+ if not(type([gt],[table])) then
+ gt := table([]);
+ this['GroupTable'] := eval(gt);
+ fi;
+ gt[id] := eval(g);
+ this['UseGroups'] := true;
+ NULL;
+ end
+ ],
+
+ ['Method','GroupMembers'::list(`aim/Student`),
+ "Return the list of members of the group with the specified ID.
+ ",
+ proc(this,id::string)
+ if this['UseGroups'] <> true then
+ error(__("Register does not use groups"));
+ fi;
+
+ select(s -> evalb(s['Group'] = id), this['List']);
+ end
+ ],
+
['Method','List'::list(`aim/Student`),
"The list of Student objects, unsorted",
***************
*** 112,115 ****
--- 182,200 ----
",
proc(this,student::`aim/Student`)
+ local gp;
+
+ if this['UseGroups'] then
+ gp := student['Group'];
+ if not(type([gp],[string])) then
+ gp := "";
+ student['Group'] := "";
+ fi;
+ if gp <> "" and not(member(gp,this['GroupIDs'])) then
+ error(__("For student %s: group %s is invalid."),
+ student['ID'],gp);
+ fi;
+ else
+ student['Group'] := "";
+ fi;
this['IDTable'][student['ID']] := eval(student);
NULL;
***************
*** 481,484 ****
--- 566,602 ----
):
+ `Class/Declare`(
+ `aim/Register/Group`,
+ "An object of this class represents a group of students in the
+ register. Typically this will be used when a course has
+ lectures given by a primary lecturer, with a number of different
+ tutorial groups led by different teaching assistants.
+ ",
+ ['Field','ID'::string,
+ "An identifier for the group. It should be unique within this
+ register.
+ "
+ ],
+
+ ['Field','MeetingTime'::string,
+ "Time(s) when the group meets.
+ "
+ ],
+
+ ['Field','MeetingPlace'::string,
+ "Place(s) where the group meets.
+ "
+ ],
+
+ ['Field','Teacher'::string,
+ "The name of the teacher who teaches the group.
+ "
+ ],
+
+ ['Field','TeacherEmail'::string,
+ "The email address of the teacher.
+ "
+ ]
+ ):
EndPackage():
Index: Student.mpl
===================================================================
RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Student.mpl,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -C2 -d -r1.4 -r1.4.4.1
*** Student.mpl 26 Aug 2003 20:34:59 -0000 1.4
--- Student.mpl 7 Oct 2004 11:51:30 -0000 1.4.4.1
***************
*** 28,32 ****
surname_::string,
email_::string,
! password_::string)
if nargs > 1 then
this['ID'] := sprintf("%A",id_);
--- 28,33 ----
surname_::string,
email_::string,
! password_::string,
! group_::string)
if nargs > 1 then
this['ID'] := sprintf("%A",id_);
***************
*** 68,71 ****
--- 69,78 ----
# student or assigned by the teacher.
+ ['Field','Group'::string,
+ "This field can be used to identify the tutorial group to which the
+ student belongs, if the class is divided into groups.
+ "
+ ],
+
['Method','Name'::string,
"First name followed by surname.",
***************
*** 143,149 ****
['Method','GeneratePassword'::'void',
! "Give this student a randomly generated password.",
proc(this)
! this['Password'] := `aim/RandomPassword`();
NULL;
end
--- 150,160 ----
['Method','GeneratePassword'::'void',
! "Give this student a randomly generated password. This will not
! overwrite a nonempty password that has already been set.
! ",
proc(this)
! if this['Password'] = "" then
! this['Password'] := `aim/RandomPassword`();
! fi;
NULL;
end
|