· 8 years ago · Jul 20, 2018, 07:10 AM
1### Eclipse Workspace Patch 1.0
2#P pingpong
3Index: src/webroot/pp/iup/adminGradings.jsp
4===================================================================
5--- src/webroot/pp/iup/adminGradings.jsp (revision 44545)
6+++ src/webroot/pp/iup/adminGradings.jsp (working copy)
7@@ -18,12 +18,12 @@
8 <h:confirmMessage />
9
10 <h:table id="iupGradings" data="${gradingsList}" boxTable="true">
11- <h:tableCol attribute="seq"><bean:message key="general.priority.short" /></h:tableCol>
12+ <h:tableCol attribute="name"><bean:message key="general.name" /></h:tableCol>
13 <h:tableCol attribute="groupName"><bean:message key="general.group" /></h:tableCol>
14 <h:tableCol attribute="description" formatter="HtmlFormatter"><bean:message key="iup.gradings.short" /></h:tableCol>
15 <h:tableCol formatter="FunctionFormatter" styleClass="nowrap"
16 formatterAttributes="
17- paramId=groupId;
18+ paramId=gradeId;
19 editAction=/iupAdminGradingsEdit;
20 editTextKey=general.button.edit;
21 removeAction=/iupAdminGradingsRemove;
22Index: src/java/net/pingpong/iup/struts/IupAdminGradingsRemoveAction.java
23===================================================================
24--- src/java/net/pingpong/iup/struts/IupAdminGradingsRemoveAction.java (revision 44545)
25+++ src/java/net/pingpong/iup/struts/IupAdminGradingsRemoveAction.java (working copy)
26@@ -12,13 +12,11 @@
27
28 import net.pingpong.core.exception.ActionException;
29 import net.pingpong.core.exception.BusinessLogicException;
30-import net.pingpong.core.handler.GroupHandler;
31-import net.pingpong.core.model.Group;
32 import net.pingpong.core.model.Person;
33 import net.pingpong.core.model.User;
34 import net.pingpong.iup.handler.IupHandler;
35 import net.pingpong.iup.model.IPPRole;
36-import net.pingpong.iup.model.IupGroupSettings;
37+import net.pingpong.iup.model.IupGradings;
38
39 import org.apache.struts.action.ActionForm;
40 import org.apache.struts.action.ActionForward;
41@@ -46,22 +44,15 @@
42 HttpServletRequest request, HttpServletResponse response) throws ActionException, BusinessLogicException,
43 Exception {
44
45- IupRestrictedActionForm iupRestrictedActionForm = (IupRestrictedActionForm) actionForm;
46-
47- GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
48- Group group = groupHandler.getGroup(iupRestrictedActionForm.getGroupId());
49-
50- if (group != null) {
51- IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
52- IupGroupSettings groupSettings = iupHandler.getGroupSettings(group);
53- if (groupSettings != null) {
54- groupSettings.setGradingType(null);
55- groupSettings.setGradingDescription(null);
56- groupSettings.setGradings(null);
57- iupHandler.save(groupSettings);
58- iupHandler.deleteOrKeepGroupSettings(groupSettings);
59- }
60- request.setAttribute("group", group);
61+ // check this with original, is it ok?
62+ IupAdminGradingsForm iupRestrictedActionForm = (IupAdminGradingsForm) actionForm;
63+
64+ IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
65+ IupGradings ig = iupHandler.getGradings(iupRestrictedActionForm.getGradeId());
66+
67+ if (ig != null) {
68+ iupHandler.remove(ig);
69+ iupHandler.flush();
70 }
71
72 return mapping.findForward(SUCCESS);
73Index: src/java/net/pingpong/iup/struts/IupAdminWriteIupPrintAction.java
74===================================================================
75--- src/java/net/pingpong/iup/struts/IupAdminWriteIupPrintAction.java (revision 44545)
76+++ src/java/net/pingpong/iup/struts/IupAdminWriteIupPrintAction.java (working copy)
77@@ -26,7 +26,7 @@
78 import net.pingpong.iup.model.IPPRole;
79 import net.pingpong.iup.model.Iup;
80 import net.pingpong.iup.model.IupGroupSettings;
81-import net.pingpong.iup.model.IupSelectedGrading;
82+import net.pingpong.iup.model.IupSelectedLockedGrading;
83 import net.pingpong.iup.model.IupSubject;
84 import net.pingpong.iup.model.IupSubjectComment;
85 import net.pingpong.iup.model.IupSubjectGoal;
86@@ -76,7 +76,7 @@
87 request.setAttribute("iupPerson", iupPerson);
88 request.setAttribute("iupUser", iupPerson);
89
90- List<IupSubject> subjects = activeIup.getSubjects();
91+ List<IupSubject> subjects = activeIup.getOriginalSubjects();
92 request.setAttribute("iupSubjects", subjects);
93
94 // -------------------------------------------------------------------
95@@ -185,26 +185,27 @@
96 // -------------------------------------------------------------------
97 boolean showAssessmentGradings = iupAdminPrintForm.getShowAssessmentGradings();
98
99- if (showAssessmentGradings && activeIup.usesGradings()) {
100+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
101+ for (IupSubject subject : subjects) {
102+ if(subject.getGradings() != null){
103+ subjectsWithGradings.add(subject.getId());
104+ }
105+ }
106
107+ if (showAssessmentGradings && subjectsWithGradings.size() > 0) {
108 request.setAttribute("useGradings", Boolean.TRUE);
109-
110- Set<Integer> subjectsWithGradings = activeIup.getSubjectsWithGradings();
111 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
112- request.setAttribute("gradingDescription", activeIup.getGradingDescription());
113- request.setAttribute("gradingType", activeIup.getGradingType());
114- request.setAttribute("gradingScale", activeIup.getGradingScale());
115+
116+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
117
118- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
119-
120- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(activeIup)) {
121+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(activeIup)) {
122
123 Integer subjectId = selectedGrading.getSubject().getId();
124 if (subjectsToShow == null || subjectsToShow.contains(subjectId)) {
125
126- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
127+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
128 if (listOfSelectedGradings == null) {
129- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
130+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
131 }
132 listOfSelectedGradings.add(selectedGrading);
133
134Index: src/java/net/pingpong/iup/struts/IupAdminCommentPrintAction.java
135===================================================================
136--- src/java/net/pingpong/iup/struts/IupAdminCommentPrintAction.java (revision 44545)
137+++ src/java/net/pingpong/iup/struts/IupAdminCommentPrintAction.java (working copy)
138@@ -23,7 +23,8 @@
139 import net.pingpong.iup.model.IPPRole;
140 import net.pingpong.iup.model.Iup;
141 import net.pingpong.iup.model.IupGroupSettings;
142-import net.pingpong.iup.model.IupSelectedGrading;
143+import net.pingpong.iup.model.IupLockedSubject;
144+import net.pingpong.iup.model.IupSelectedLockedGrading;
145 import net.pingpong.iup.model.IupSubject;
146 import net.pingpong.iup.model.IupSubjectComment;
147 import net.pingpong.iup.model.ProgramOfMeasures;
148@@ -116,12 +117,12 @@
149 List<Person> personsWithoutSelectedGradingByUser = new ArrayList<Person>(
150 personsWithAssessmentGradingsEnabled);
151
152- for (IupSelectedGrading selectedGrading : iupHandler.getPublishedGradingsForSubject(subject, group)) {
153+ for (IupSelectedLockedGrading selectedLockedGrading : iupHandler.getPublishedGradingsForLockedSubject(subject.getId(), group)) {
154 IupSelectedGradingPerUserGUI iupSelectedGradingPerUserGUI = new IupSelectedGradingPerUserGUI();
155
156- Person gradingUser = selectedGrading.getCreatedBy();
157+ Person gradingUser = selectedLockedGrading.getCreatedBy();
158
159- Iup iup = selectedGrading.getIup();
160+ Iup iup = selectedLockedGrading.getIup();
161 Person gradedUser = iup.getPerson();
162
163 if (gradingUser.equals(person)) {
164@@ -133,12 +134,13 @@
165 continue;
166 }
167
168- iupSelectedGradingPerUserGUI.setSelectedGrading(selectedGrading);
169+ IupLockedSubject lockedSubject = iup.getLockedSubjectWithOriginalId(subject.getId());
170
171- iupSelectedGradingPerUserGUI.setGradingDescription(iup.getGradingDescription());
172- iupSelectedGradingPerUserGUI.setGradingType(iup.getGradingType());
173- iupSelectedGradingPerUserGUI.setGradingScale(iup.getGradingScale());
174-
175+ iupSelectedGradingPerUserGUI.setSelectedLockedGrading(selectedLockedGrading);
176+ iupSelectedGradingPerUserGUI.setGradingDescription(lockedSubject.getLockedGradings().getDescription());
177+ iupSelectedGradingPerUserGUI.setGradingType(lockedSubject.getLockedGradings().getType());
178+ iupSelectedGradingPerUserGUI.setGradingScale(lockedSubject.getLockedGradings().getLockedGradingsScale());
179+
180 List<IupSelectedGradingPerUserGUI> listOfSelectedGradings = selectedGradings
181 .get(gradedUser.getUserid());
182 if (listOfSelectedGradings == null) {
183Index: src/java/net/pingpong/iup/model/IupSelectedLockedGrading.java
184===================================================================
185--- src/java/net/pingpong/iup/model/IupSelectedLockedGrading.java (revision 0)
186+++ src/java/net/pingpong/iup/model/IupSelectedLockedGrading.java (revision 0)
187@@ -0,0 +1,153 @@
188+/**
189+ *
190+ */
191+package net.pingpong.iup.model;
192+
193+import java.io.Serializable;
194+import java.util.Date;
195+import net.pingpong.core.model.Person;
196+
197+/**
198+ * @author ulf
199+ * @author mango
200+ *
201+ */
202+public class IupSelectedLockedGrading implements Serializable {
203+
204+ private IPPRole creatorRole;
205+ private Person createdBy;
206+ private String comment;
207+ private IupLockedSubject lockedSubject;
208+ private Iup iup;
209+ private Date changed;
210+ private boolean published;
211+
212+ private int selectedLockedGrading;
213+
214+
215+ public IupSubject getSubject(){
216+ return lockedSubject.getOriginalSubject();
217+ }
218+
219+ @Override
220+ public boolean equals(Object obj) {
221+ if (this == obj) {
222+ return true;
223+ }
224+ if (!(obj instanceof IupSelectedLockedGrading)) {
225+ return false;
226+ }
227+ IupSelectedLockedGrading other = (IupSelectedLockedGrading) obj;
228+ boolean equals = true;
229+ equals &= (this.iup == null ? other.iup == null : (other.iup != null ? this.iup.getId().equals(
230+ other.iup.getId()) : false));
231+ equals &= (this.createdBy == null ? other.createdBy == null : (other.createdBy != null ? this.createdBy.getId()
232+ .equals(other.createdBy.getId()) : false));
233+ equals &= (this.lockedSubject == null ? other.lockedSubject == null : (other.lockedSubject != null ? this.lockedSubject.getLockedSubjectId().equals(
234+ other.lockedSubject.getLockedSubjectId()) : false));
235+ equals &= (this.published ? other.published : !other.published);
236+ return equals;
237+ }
238+
239+
240+ @Override
241+ public int hashCode() {
242+ int createdByHash = (createdBy == null ? 0 : createdBy.getId().hashCode());
243+ int iupHash = (iup == null ? 0 : iup.getId().hashCode());
244+ int subjectHash = (lockedSubject == null ? 0 : lockedSubject.getLockedSubjectId().hashCode());
245+ int publishedHash = new Boolean(published).hashCode();
246+
247+ return ((createdByHash * 31 + iupHash) * 31 + subjectHash) * 31 + publishedHash;
248+ }
249+
250+
251+ public IPPRole getCreatorRole() {
252+ return creatorRole;
253+ }
254+
255+
256+ public void setCreatorRole(IPPRole creatorRole) {
257+ this.creatorRole = creatorRole;
258+ }
259+
260+
261+ public Integer getCreatorRoleAsOrdinal() {
262+ return creatorRole.ordinal();
263+ }
264+
265+
266+ public void setCreatorRoleAsOrdinal(Integer ordinal) {
267+ this.creatorRole = IPPRole.fromOrdinal(ordinal);
268+ }
269+
270+
271+ public Person getCreatedBy() {
272+ return createdBy;
273+ }
274+
275+
276+ public void setCreatedBy(Person createdBy) {
277+ this.createdBy = createdBy;
278+ }
279+
280+
281+ public int getSelectedLockedGrading() {
282+ return selectedLockedGrading;
283+ }
284+
285+
286+ public void setSelectedLockedGrading(int selectedLockedGrading) {
287+ this.selectedLockedGrading = selectedLockedGrading;
288+ }
289+
290+
291+ public String getComment() {
292+ return comment;
293+ }
294+
295+
296+ public void setComment(String comment) {
297+ this.comment = comment;
298+ }
299+
300+
301+ public Iup getIup() {
302+ return iup;
303+ }
304+
305+
306+ public void setIup(Iup iup) {
307+ this.iup = iup;
308+ }
309+
310+
311+ public Date getChanged() {
312+ return changed;
313+ }
314+
315+
316+ public void setChanged(Date changed) {
317+ this.changed = changed;
318+ }
319+
320+
321+ public IupLockedSubject getLockedSubject() {
322+ return lockedSubject;
323+ }
324+
325+
326+ public void setLockedSubject(IupLockedSubject lockedSubject) {
327+ this.lockedSubject = lockedSubject;
328+ }
329+
330+
331+ public boolean isPublished() {
332+ return published;
333+ }
334+
335+
336+ public void setPublished(boolean published) {
337+ this.published = published;
338+ }
339+
340+}
341Index: src/java/net/pingpong/iup/model/Iup.java
342===================================================================
343--- src/java/net/pingpong/iup/model/Iup.java (revision 44545)
344+++ src/java/net/pingpong/iup/model/Iup.java (working copy)
345@@ -9,6 +9,7 @@
346 import java.util.Collections;
347 import java.util.Date;
348 import java.util.HashSet;
349+import java.util.Iterator;
350 import java.util.List;
351 import java.util.Set;
352
353@@ -57,7 +58,7 @@
354 private Integer id;
355 private String name;
356 private Person person;
357- private List<IupSubject> subjects;
358+ private List<IupLockedSubject> lockedSubjects;
359 private Date created;
360 private Person createdBy;
361 private Date signedByMentor;
362@@ -92,17 +93,6 @@
363
364 private boolean active;
365
366- private String gradingDescription;
367- private GradingType gradingType;
368- private List<String> gradingScale;
369-
370- /**
371- * Contains the id:s of all subjects that had gradings enabled at the time
372- * the iup was created.
373- */
374- private Set<Integer> subjectsWithGradings;
375-
376-
377 public int compareTo(Iup other) {
378 if (created == null || other.getCreated() == null) {
379 return 0;
380@@ -164,20 +154,90 @@
381 /**
382 * @return Returns a list containing the IupSubjects.
383 */
384- public List<IupSubject> getSubjects() {
385- return subjects;
386+ public List<IupLockedSubject> getLockedSubjects() {
387+ return lockedSubjects;
388 }
389
390+ public List<IupSubject> getOriginalSubjects(){
391+ ArrayList<IupSubject> subjects = new ArrayList<IupSubject>();
392+ for(IupLockedSubject lockedSubject : getLockedSubjects()){
393+ IupSubject subject = lockedSubject.getOriginalSubject();
394+ lockedSubject.copyToIupSubject(subject);
395+ subjects.add(subject);
396+ }
397+ return subjects;
398+ }
399+
400+ public IupLockedSubject getLockedSubjectWithOriginalId(int originalSubjectId){
401+ for(IupLockedSubject lockedSubject : getLockedSubjects()){
402+ if(lockedSubject.getOriginalSubject().getId().equals(originalSubjectId)){
403+ return lockedSubject;
404+ }
405+ }
406+ return null;
407+ }
408
409+ public IupLockedSubject getLockedSubjectWithId(int lockedSubjectId){
410+ for(IupLockedSubject lockedSubject : getLockedSubjects()){
411+ if(lockedSubject.getLockedSubjectId().equals(lockedSubjectId)){
412+ return lockedSubject;
413+ }
414+ }
415+ return null;
416+ }
417+
418+
419+
420 /**
421 * @param subjects
422 * The subjects to set.
423 */
424- public void setSubjects(List<IupSubject> subjects) {
425- this.subjects = subjects;
426+ public void setLockedSubjects(List<IupLockedSubject> subjects) {
427+ this.lockedSubjects = subjects;
428 }
429
430+ public void mergeLockedSubjects(List<IupLockedSubject> newLockedSubjects){
431+ if(getLockedSubjects() != null){
432+
433+ Iterator<IupLockedSubject> it = getLockedSubjects().iterator();
434
435+ // remove
436+ while(it.hasNext()){
437+ IupLockedSubject existingLockedSubject = it.next();
438+ boolean keepLockedSubject = false;
439+ for(IupLockedSubject newLockedSubject : newLockedSubjects){
440+ if(existingLockedSubject.getOriginalSubject().getId().equals(newLockedSubject.getOriginalSubject().getId())){
441+ keepLockedSubject = true;
442+ }
443+ }
444+ if(!keepLockedSubject){
445+ it.remove();
446+ }
447+ }
448+
449+ // add new
450+ int pos = 0;
451+ for(IupLockedSubject newLockedSubject : newLockedSubjects){
452+ boolean addLockedSubject = true;
453+ for(IupLockedSubject existingLockedSubject : getLockedSubjects()){
454+ if(newLockedSubject.getOriginalSubject().getId().equals(existingLockedSubject.getOriginalSubject().getId())){
455+ addLockedSubject = false;
456+ existingLockedSubject.setPos(pos);
457+ }
458+ }
459+ if(addLockedSubject){
460+ newLockedSubject.setPos(pos);
461+ getLockedSubjects().add(newLockedSubject);
462+ }
463+ pos++;
464+ }
465+ Collections.sort(getLockedSubjects(), new IupLockedSubjectSortbyPos());
466+ } else{
467+ setLockedSubjects(newLockedSubjects);
468+ }
469+ }
470+
471+
472 public Date getCreated() {
473 return created;
474 }
475@@ -473,65 +533,7 @@
476 public void setActive(boolean active) {
477 this.active = active;
478 }
479-
480-
481- public boolean usesGradings() {
482- return gradingType != null;
483- }
484-
485-
486- public String getGradingDescription() {
487- return gradingDescription;
488- }
489-
490-
491- public void setGradingDescription(String gradingDescription) {
492- this.gradingDescription = gradingDescription;
493- }
494-
495-
496- public GradingType getGradingType() {
497- return gradingType;
498- }
499-
500-
501- public void setGradingType(GradingType gradingType) {
502- this.gradingType = gradingType;
503- }
504-
505-
506- // For Hibernate.
507- public Integer getGradingTypeAsOrdinal() {
508- return gradingType == null ? null : gradingType.ordinal();
509- }
510-
511-
512- // For Hibernate.
513- public void setGradingTypeAsOrdinal(Integer gradingTypeOrdinal) {
514- gradingType = gradingTypeOrdinal == null ? null : GradingType.fromOrdinal(gradingTypeOrdinal);
515- }
516-
517-
518- public List<String> getGradingScale() {
519- return gradingScale;
520- }
521-
522-
523- public void setGradingScale(List<String> gradingScale) {
524- this.gradingScale = gradingScale;
525- }
526-
527-
528- public Set<Integer> getSubjectsWithGradings() {
529- return subjectsWithGradings;
530- }
531-
532-
533- public void setSubjectsWithGradings(Set<Integer> subjectsWithGradings) {
534- this.subjectsWithGradings = subjectsWithGradings;
535- }
536-
537-
538+
539 /**
540 * Get the date of the last signing by anyone, or null if no-one signed it
541 * yet.
542@@ -657,5 +659,19 @@
543 return signedByMentor != null
544 && (closedByMentor != null || ((!requireParentSignature || !parentSignatures.isEmpty()) && (!requireStudentSignature || signedByUser != null)));
545 }
546-
547 }
548+
549+ class IupLockedSubjectSortbyPos implements java.util.Comparator<IupLockedSubject> {
550+ public int compare(IupLockedSubject subject1, IupLockedSubject subject2) {
551+ int result = 1;
552+ if(subject1.getPos() > subject2.getPos()){
553+ result = 1;
554+ }
555+ else if(subject1.getPos() < subject2.getPos()){
556+ result = -1;
557+ }else {
558+ result = 0;
559+ }
560+ return result;
561+ }
562+ }
563\ No newline at end of file
564Index: src/java/net/pingpong/mappings/iup.hbm.xml
565===================================================================
566--- src/java/net/pingpong/mappings/iup.hbm.xml (revision 44545)
567+++ src/java/net/pingpong/mappings/iup.hbm.xml (working copy)
568@@ -19,9 +19,11 @@
569 <property column="description" name="description" type="string" />
570 <property column="link_url" name="url" type="string" />
571 <property column="deleted" name="deleted" type="boolean" />
572-
573 <property column="use_measures" name="useMeasures" type="boolean" />
574- <property column="use_gradings" name="useGradings" type="boolean" />
575+
576+ <many-to-one class="net.pingpong.iup.model.IupGradings" name="gradings">
577+ <column name="gradings_id" />
578+ </many-to-one>
579
580 <set name="groups" table="iup_subject_group">
581 <key column="iup_subject_id" />
582@@ -29,9 +31,27 @@
583 </set>
584
585 <many-to-one class="net.pingpong.core.model.Group" name="userGroup" column="user_group_id" />
586-
587 </class>
588
589+ <class name="IupLockedSubject" table="iup_locked_subject">
590+ <cache usage="read-write" />
591+ <id column="locked_subject_id" name="lockedSubjectId" type="integer">
592+ <generator class="sequence" />
593+ </id>
594+ <property column="name" name="name" not-null="true" type="string" />
595+ <property column="description" name="description" type="string" />
596+ <property column="link_url" name="url" type="string" />
597+ <property column="use_measures" name="useMeasures" type="boolean" />
598+
599+ <many-to-one class="net.pingpong.iup.model.IupSubject" name="originalSubject">
600+ <column name="original_subject_id" />
601+ </many-to-one>
602+
603+ <many-to-one class="net.pingpong.iup.model.IupLockedGradings" name="lockedGradings" cascade="all">
604+ <column name="locked_gradings_id" />
605+ </many-to-one>
606+ </class>
607+
608 <class name="IupTemplate" table="iup_template">
609 <id column="id" name="id" type="integer">
610 <generator class="native"><param name="sequence">iup_template_id_seq</param></generator>
611@@ -73,10 +93,10 @@
612
613 <property column="name" name="name" not-null="true" type="string" />
614
615- <list name="subjects" table="iup_subjects">
616+ <list name="lockedSubjects" table="iup_locked_subjects" cascade="all-delete-orphan">
617 <key column="iup_id" />
618 <list-index column="seq" />
619- <many-to-many class="IupSubject" column="iup_subject_id" />
620+ <many-to-many class="IupLockedSubject" column="locked_subject_id"/>
621 </list>
622
623 <property name="created" column="created" type="timestamp" insert="false" update="false" />
624@@ -124,23 +144,6 @@
625 <property name="active" not-null="true" type="boolean" />
626
627 <many-to-one class="net.pingpong.core.model.Person" name="measuresChangedBy" column="measures_changed_by"/>
628-
629- <property column="grading_description" name="gradingDescription" type="string" />
630- <property column="grading_type" name="gradingTypeAsOrdinal" type="integer" />
631-
632- <list name="gradingScale" table="iup_document_gradings">
633- <cache usage="read-write" />
634- <key column="iup_id" not-null="true"/>
635- <list-index column="seq"/>
636- <element column="content" type="string" />
637- </list>
638-
639- <set name="subjectsWithGradings" table="iup_subjects_with_gradings">
640- <cache usage="read-write" />
641- <key column="iup_id" not-null="true" />
642- <element column="subject_id" type="integer"/>
643- </set>
644-
645 </class>
646
647 <class name="IupSelectedGrading" table="iup_selected_gradings">
648@@ -157,6 +160,20 @@
649 <property name="changed" column="changed" type="timestamp" />
650 </class>
651
652+ <class name="IupSelectedLockedGrading" table="iup_selected_locked_gradings">
653+ <composite-id>
654+ <key-many-to-one class="Iup" name="iup" column="iup_id" />
655+ <key-many-to-one class="net.pingpong.core.model.Person" name="createdBy" column="created_by" />
656+ <key-many-to-one class="IupLockedSubject" name="lockedSubject" column="locked_subject_id" />
657+ <key-property name="published" />
658+ </composite-id>
659+
660+ <property name="creatorRoleAsOrdinal" column="creator_role" type="integer" />
661+ <property name="selectedLockedGrading" column="seq" type="integer" />
662+ <property name="comment" column="comment" type="string" />
663+ <property name="changed" column="changed" type="timestamp" />
664+ </class>
665+
666 <class name="IupSubjectGoal" table="iup_subject_goal">
667 <composite-id name="entryId" class="IupSubjectGoal$EntryId">
668 <key-many-to-one name="iup" column="iup_id" class="net.pingpong.iup.model.Iup" />
669@@ -237,6 +254,46 @@
670 </list>
671 </class>
672
673+ <class name="IupGradings" table="iup_gradings">
674+ <cache usage="read-write"/>
675+ <id name="gradingsId" column="gradings_id" type="integer">
676+ <generator class="sequence" />
677+ </id>
678+ <property name="typeAsNum" column="type" type="integer" />
679+ <property name="groupId" column="group_id" type="integer" />
680+ <property name="giver" column="giver" type="string" />
681+ <property name="description" column="description" type="string" />
682+ <property name="name" column="name" type="string" />
683+
684+ <list name="gradingsScale" table="iup_gradings_scale">
685+ <cache usage="read-write" />
686+ <key column="gradings_id" not-null="true"/>
687+ <list-index column="seq"/>
688+ <element column="content" type="string" />
689+ </list>
690+ </class>
691+
692+ <class name="IupLockedGradings" table="iup_locked_gradings">
693+ <cache usage="read-write"/>
694+ <id name="lockedGradingsId" column="locked_gradings_id" type="integer">
695+ <generator class="sequence" />
696+ </id>
697+ <property name="typeAsNum" column="type" type="integer" />
698+ <property name="description" column="description" type="string" />
699+ <property name="name" column="name" type="string" />
700+
701+ <list name="lockedGradingsScale" table="iup_locked_gradings_scale">
702+ <cache usage="read-write" />
703+ <key column="locked_gradings_id" not-null="true" />
704+ <list-index column="seq"/>
705+ <element column="content" type="string" />
706+ </list>
707+
708+ <many-to-one name="originalGradings" class="IupGradings" not-null="true">
709+ <column name="original_gradings_id" />
710+ </many-to-one>
711+ </class>
712+
713 <class name="IupPersonalCommentFolderRow" table="person_iup_comment_folder">
714 <id name="userid"/>
715 <property name="folderId" column="folder_id"/>
716Index: src/java/net/pingpong/iup/struts/IupAdminEditIupAction.java
717===================================================================
718--- src/java/net/pingpong/iup/struts/IupAdminEditIupAction.java (revision 44545)
719+++ src/java/net/pingpong/iup/struts/IupAdminEditIupAction.java (working copy)
720@@ -30,6 +30,7 @@
721 import net.pingpong.iup.model.IPPRole;
722 import net.pingpong.iup.model.Iup;
723 import net.pingpong.iup.model.IupGroupSettings;
724+import net.pingpong.iup.model.IupLockedSubject;
725 import net.pingpong.iup.model.IupSubject;
726 import net.pingpong.iup.model.IupTemplate;
727
728@@ -81,7 +82,6 @@
729
730 // Contains subject ids
731 List<Integer> addedSubjects = form.getAddedSubjects();
732-
733 IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
734
735 DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
736@@ -101,11 +101,10 @@
737 activeIup = iupHandler.getActiveIup(iupPerson);
738
739 if (activeIup != null && !form.isCreateNew()) {
740-
741 form.setName(activeIup.getName());
742
743- for (IupSubject subject : activeIup.getSubjects()) {
744- addedSubjects.add(subject.getId());
745+ for (IupLockedSubject lockedSubject : activeIup.getLockedSubjects()) {
746+ addedSubjects.add(lockedSubject.getOriginalSubject().getId());
747 }
748
749 form.setAddedSubjects(addedSubjects);
750@@ -209,8 +208,22 @@
751
752 // Prepare a display list of added subjects
753 List<IupSubject> listSubjects = new ArrayList<IupSubject>();
754- for (Integer subjectId : addedSubjects) {
755- listSubjects.add(iupHandler.getSubject(subjectId));
756+ if (activeIup != null && !form.isCreateNew()) {
757+ for (Integer subjectId : addedSubjects) {
758+ IupSubject is = iupHandler.getSubject(subjectId);
759+ for(IupLockedSubject ils : activeIup.getLockedSubjects()){
760+ if(is != null && is.getId().equals(ils.getOriginalSubject().getId())){
761+ //write locked fields to subject
762+ ils.copyToIupSubject(is);
763+ }
764+ }
765+
766+ listSubjects.add(is);
767+ }
768+ }else{
769+ for (Integer subjectId : addedSubjects) {
770+ listSubjects.add(iupHandler.getSubject(subjectId));
771+ }
772 }
773 request.setAttribute("listSubjects", listSubjects);
774
775Index: src/java/net/pingpong/iup/struts/IupAdminGradingsForm.java
776===================================================================
777--- src/java/net/pingpong/iup/struts/IupAdminGradingsForm.java (revision 44545)
778+++ src/java/net/pingpong/iup/struts/IupAdminGradingsForm.java (working copy)
779@@ -10,8 +10,14 @@
780 import java.util.Arrays;
781 import java.util.List;
782
783+import javax.servlet.http.HttpServletRequest;
784+
785 import net.pingpong.iup.model.GradingType;
786
787+import org.apache.struts.action.ActionErrors;
788+import org.apache.struts.action.ActionMapping;
789+import org.apache.struts.action.ActionMessage;
790+
791 /**
792 * @author ulf
793 */
794@@ -20,11 +26,35 @@
795 private String description;
796 private GradingType gradingType;
797 private List<String> gradings;
798-
799+ private Integer gradeId = null;
800+ private String name;
801+
802 // Will differ from gradings.size() when you want to change the number of
803 // gradings.
804 private Integer numberOfGradings;
805
806+ @Override
807+ public ActionErrors validate(ActionMapping arg0, HttpServletRequest arg1) {
808+ ActionErrors errors = new ActionErrors();
809+
810+ if (name == null || name.trim().length() == 0){
811+ errors.add("name", new ActionMessage("iup.gradings.error.name-is-required"));
812+ }
813+
814+ return errors;
815+ }
816+
817+ @Override
818+ public void reset(ActionMapping mapping, HttpServletRequest request) {
819+ super.reset(mapping, request);
820+ setName(null);
821+ setDescription(null);
822+ setGradeId(null);
823+ setGradings(null);
824+
825+ setEventGroups(null);
826+ setUserGroup(null);
827+ }
828
829 public String getDescription() {
830 return description;
831@@ -59,7 +89,11 @@
832 // }
833
834 public void setGradings(String[] gradings) {
835- this.gradings = Arrays.asList(gradings);
836+ if(gradings != null){
837+ this.gradings = Arrays.asList(gradings);
838+ }else{
839+ this.gradings = null;
840+ }
841 }
842
843
844@@ -85,4 +119,22 @@
845 this.numberOfGradings = numberOfGradings;
846 }
847
848+
849+ public Integer getGradeId() {
850+ return gradeId;
851+ }
852+
853+
854+ public void setGradeId(Integer gradeId) {
855+ this.gradeId = gradeId;
856+ }
857+
858+ public String getName() {
859+ return name;
860+ }
861+
862+ public void setName(String name) {
863+ this.name = name;
864+ }
865+
866 }
867Index: src/java/net/pingpong/iup/struts/IupAdminSaveIupAction.java
868===================================================================
869--- src/java/net/pingpong/iup/struts/IupAdminSaveIupAction.java (revision 44545)
870+++ src/java/net/pingpong/iup/struts/IupAdminSaveIupAction.java (working copy)
871@@ -26,7 +26,7 @@
872 import net.pingpong.iup.handler.IupHandler;
873 import net.pingpong.iup.model.IPPRole;
874 import net.pingpong.iup.model.Iup;
875-import net.pingpong.iup.model.IupGroupSettings;
876+import net.pingpong.iup.model.IupLockedSubject;
877 import net.pingpong.iup.model.IupSubject;
878
879 import org.apache.struts.action.ActionForm;
880@@ -95,14 +95,17 @@
881 // With correct order now
882 form.getAddedSubjects().addAll(0, newSubjectOrderList);
883
884- List<IupSubject> subjects = new ArrayList<IupSubject>();
885- Set<Integer> subjectsWhichUseGradings = new HashSet<Integer>();
886+ List<IupLockedSubject> lockedSubjects = new ArrayList<IupLockedSubject>();
887+ //Set<Integer> subjectsWhichUseGradings = new HashSet<Integer>();
888 for (Integer subjectId : form.getAddedSubjects()) {
889 IupSubject subject = iupHandler.getSubject(subjectId);
890- if (subject.isUseGradings()) {
891- subjectsWhichUseGradings.add(subjectId);
892- }
893- subjects.add(subject);
894+ // if (subject.getGradings() != null) {
895+ // subjectsWhichUseGradings.add(subjectId);
896+ // }
897+ IupLockedSubject lockedSubject = new IupLockedSubject();
898+ lockedSubject.copyFromIupSubject(subject);
899+
900+ lockedSubjects.add(lockedSubject);
901 }
902
903 if (form.getGroupId() != null && form.getGroupId() != 0) {
904@@ -133,17 +136,7 @@
905 iup.setAttendanceViewingEnd(attendanceViewingEnd);
906 }
907
908- iup.setSubjects(new ArrayList<IupSubject>(subjects));
909-
910- if (subjectsWhichUseGradings.size() > 0) {
911- iup.setSubjectsWithGradings(new HashSet<Integer>(subjectsWhichUseGradings));
912- IupGroupSettings groupSettings = iupHandler.getGroupSettingsForAssessementGradings(p);
913- if (groupSettings != null) {
914- iup.setGradingType(groupSettings.getGradingType());
915- iup.setGradingDescription(groupSettings.getGradingDescription());
916- iup.setGradingScale(new ArrayList<String>(groupSettings.getGradings()));
917- }
918- }
919+ iup.setLockedSubjects(new ArrayList<IupLockedSubject>(lockedSubjects));
920
921 iupHandler.setActiveIup(iup);
922 iupHandler.evict(p);
923@@ -165,17 +158,6 @@
924 iup.setPerson(iupPerson);
925 iup.setCreatedBy(person);
926
927- if (subjectsWhichUseGradings.size() > 0) {
928- iup.setSubjectsWithGradings(new HashSet<Integer>(subjectsWhichUseGradings));
929-
930- IupGroupSettings groupSettings = iupHandler.getGroupSettingsForAssessementGradings(iupPerson);
931- if (groupSettings != null) {
932- iup.setGradingType(groupSettings.getGradingType());
933- iup.setGradingDescription(groupSettings.getGradingDescription());
934- iup.setGradingScale(new ArrayList<String>(groupSettings.getGradings()));
935- }
936- }
937-
938 newIup = true;
939 } else {
940 iup = iupHandler.getIup(form.getId());
941@@ -195,7 +177,7 @@
942 iup.setAttendanceViewingEnd(attendanceViewingEnd);
943 }
944
945- iup.setSubjects(new ArrayList<IupSubject>(subjects));
946+ iup.mergeLockedSubjects(lockedSubjects);
947
948 if (newIup) {
949 iupHandler.setActiveIup(iup);
950@@ -214,5 +196,4 @@
951
952 return mapping.findForward(SUCCESS);
953 }
954-
955 }
956Index: src/webroot/pp/iup/adminGradingsEdit.jsp
957===================================================================
958--- src/webroot/pp/iup/adminGradingsEdit.jsp (revision 44545)
959+++ src/webroot/pp/iup/adminGradingsEdit.jsp (working copy)
960@@ -13,7 +13,7 @@
961
962 <h:confirmMessage />
963
964- <c:if test="${mode == 'groups'}">
965+ <c:if test="${mode == 'newGrade'}">
966 <h:form action="/iupAdminGradingsEdit">
967 <p><bean:message key="iup.admin.gradings.edit.select-group" /></p>
968 <h:selectionListBox captionKey="general.groups" id="iupAdminGroups"
969@@ -25,14 +25,17 @@
970 </h:form>
971 </c:if>
972
973- <c:if test="${mode == 'groupSettings'}">
974- <h2><bean:write name="groupName" /></h2>
975+ <c:if test="${mode == 'editGrade'}">
976 <h:form action="/iupAdminGradingsSave" styleId="gradingsForm">
977+ <h:hidden property="gradeId"/>
978 <h:hidden property="groupId"/>
979-
980- <br />
981- <h:box>
982- <div class="section">
983+
984+ <h:box captionKey="iup.admin.menu.gradings">
985+ <h2><bean:write name="groupName" /></h2>
986+ <h:errors />
987+ <div class="section">
988+ <p><h:label forId="name" mandatory="true"><bean:message key="iup.gradings.name" /></h:label></p>
989+ <p><h:text property="name"/></p>
990 <p><b><h:label forId="description"><bean:message key="iup.gradings.description" /></h:label></b></p>
991 <p><h:htmlEditor editorType="IupGradingsDescription"
992 id="description" styleClass="full-width" rows="6"
993Index: src/java/net/pingpong/iup/struts/IupAdminSubjectsForm.java
994===================================================================
995--- src/java/net/pingpong/iup/struts/IupAdminSubjectsForm.java (revision 44545)
996+++ src/java/net/pingpong/iup/struts/IupAdminSubjectsForm.java (working copy)
997@@ -26,7 +26,8 @@
998
999 private boolean useMeasures;
1000 private boolean useGradings;
1001-
1002+ private Integer gradeId;
1003+ private boolean editGradings;
1004
1005 /**
1006 * @return Returns the link.
1007@@ -72,6 +73,9 @@
1008 if (getUserGroup() == null || getUserGroup().length == 0 || getUserGroup().length >= 2)
1009 errors.add("userGroup", new ActionMessage("iup.new-subject.error.user-group-is-required"));
1010
1011+ if(getGradeId() == null){
1012+ errors.add("grades", new ActionMessage("iup.new-subject.error.user-grade-is-required"));
1013+ }
1014 return errors;
1015 }
1016
1017@@ -85,6 +89,7 @@
1018 setUserGroup(null);
1019 setUseMeasures(false);
1020 setUseGradings(false);
1021+ setGradeId(null);
1022 }
1023
1024
1025@@ -116,5 +121,26 @@
1026 public void setUseGradings(boolean useGradings) {
1027 this.useGradings = useGradings;
1028 }
1029+
1030+
1031+ public Integer getGradeId() {
1032+ return gradeId;
1033+ }
1034
1035+
1036+ public void setGradeId(Integer gradeId) {
1037+ this.gradeId = gradeId;
1038+ }
1039+
1040+
1041+
1042+ public boolean isEditGradings() {
1043+ return editGradings;
1044+ }
1045+
1046+
1047+
1048+ public void setEditGradings(boolean editGradings) {
1049+ this.editGradings = editGradings;
1050+ }
1051 }
1052Index: src/java/net/pingpong/iup/model/IupLockedGradings.java
1053===================================================================
1054--- src/java/net/pingpong/iup/model/IupLockedGradings.java (revision 0)
1055+++ src/java/net/pingpong/iup/model/IupLockedGradings.java (revision 0)
1056@@ -0,0 +1,107 @@
1057+package net.pingpong.iup.model;
1058+
1059+import java.util.ArrayList;
1060+import java.util.List;
1061+
1062+public class IupLockedGradings{
1063+
1064+ private Integer lockedGradingsId;
1065+ private List<String> lockedGradingsScale;
1066+ private IupGradings originalGradings;
1067+ private GradingType type;
1068+ private String description;
1069+ private String name;
1070+
1071+ public void copyFromGradings(IupGradings ig){
1072+ setDescription(ig.getDescription());
1073+ setType(ig.getType());
1074+ setTypeAsNum(ig.getTypeAsNum());
1075+ setName(ig.getName());
1076+ setOriginalGradings(ig);
1077+ copyGradingsScale(ig.getGradingsScale());
1078+ }
1079+
1080+ private void copyGradingsScale(List<String> l){
1081+ lockedGradingsScale = new ArrayList<String>();
1082+ for(String s : l){
1083+ lockedGradingsScale.add(s);
1084+ }
1085+ }
1086+
1087+ public void copyToGradings(IupGradings ig){
1088+ ig.setDescription(getDescription());
1089+ ig.setType(getType());
1090+ ig.setTypeAsNum(getTypeAsNum());
1091+ ig.setName(getName());
1092+ copyGradingsScaleTo(ig);
1093+ }
1094+
1095+ private void copyGradingsScaleTo(IupGradings ig){
1096+ List<String> scale = new ArrayList<String>();
1097+ for(String s : lockedGradingsScale){
1098+ scale.add(s);
1099+ }
1100+ ig.setGradingsScale(scale);
1101+ }
1102+
1103+ public Integer getLockedGradingsId() {
1104+ return lockedGradingsId;
1105+ }
1106+
1107+ public void setLockedGradingsId(Integer lockedGradingsId) {
1108+ this.lockedGradingsId = lockedGradingsId;
1109+ }
1110+
1111+ public List<String> getLockedGradingsScale() {
1112+ return lockedGradingsScale;
1113+ }
1114+
1115+ public void setLockedGradingsScale(List<String> lockedGradingsScale) {
1116+ this.lockedGradingsScale = lockedGradingsScale;
1117+ }
1118+
1119+ public IupGradings getOriginalGradings() {
1120+ return originalGradings;
1121+ }
1122+
1123+ public void setOriginalGradings(IupGradings originalGradings) {
1124+ this.originalGradings = originalGradings;
1125+ }
1126+
1127+ public GradingType getType() {
1128+ return type;
1129+ }
1130+
1131+ public int getTypeAsNum() {
1132+ return type.getNum();
1133+ }
1134+
1135+ public void setType(GradingType type) {
1136+ this.type = type;
1137+ }
1138+
1139+ public void setTypeAsNum(Integer num) {
1140+ this.type = num == null ? null : GradingType.fromOrdinal(num);
1141+ }
1142+
1143+
1144+ public String getDescription() {
1145+ return description;
1146+ }
1147+
1148+
1149+ public void setDescription(String description) {
1150+ this.description = description;
1151+ }
1152+
1153+
1154+ public String getName() {
1155+ return name;
1156+ }
1157+
1158+
1159+ public void setName(String name) {
1160+ this.name = name;
1161+ }
1162+
1163+}
1164Index: src/webroot/WEB-INF/tags/iup/assessmentGrading.tag
1165===================================================================
1166--- src/webroot/WEB-INF/tags/iup/assessmentGrading.tag (revision 44545)
1167+++ src/webroot/WEB-INF/tags/iup/assessmentGrading.tag (working copy)
1168@@ -1,5 +1,5 @@
1169 <%@ tag body-content="empty" %>
1170-<%@ attribute name="gradingForSubject" type="net.pingpong.iup.model.IupSelectedGrading" required="true" %>
1171+<%@ attribute name="gradingForSubject" type="net.pingpong.iup.model.IupSelectedLockedGrading" required="true" %>
1172 <%@ attribute name="gradingType" required="true" %>
1173 <%@ attribute name="gradingScale" type="java.util.List" required="true" %>
1174 <%@ attribute name="isoDate" type="java.lang.Boolean" %>
1175@@ -49,7 +49,7 @@
1176 <c:forEach items="${gradingScale}" var="gradingScaleStep"
1177 varStatus="counter">
1178 <td
1179- class="${gradingForSubject.selectedGrading == counter.index ? "iupGrading-selected" : "iupGrading-unselected"}">
1180+ class="${gradingForSubject.selectedLockedGrading == counter.index ? "iupGrading-selected" : "iupGrading-unselected"}">
1181 <c:if test="${gradingType == 'WYSIWYG' || gradingType == 'NUMERIC_SCALE'}">
1182 ${gradingScaleStep}
1183 </c:if>
1184Index: src/java/net/pingpong/iup/struts/IupAdminGradingsEditAction.java
1185===================================================================
1186--- src/java/net/pingpong/iup/struts/IupAdminGradingsEditAction.java (revision 44545)
1187+++ src/java/net/pingpong/iup/struts/IupAdminGradingsEditAction.java (working copy)
1188@@ -21,7 +21,7 @@
1189 import net.pingpong.iup.handler.IupHandler;
1190 import net.pingpong.iup.model.GradingType;
1191 import net.pingpong.iup.model.IPPRole;
1192-import net.pingpong.iup.model.IupGroupSettings;
1193+import net.pingpong.iup.model.IupGradings;
1194
1195 import org.apache.struts.action.ActionForm;
1196 import org.apache.struts.action.ActionForward;
1197@@ -47,41 +47,63 @@
1198 HttpServletRequest request, HttpServletResponse response) throws ActionException, BusinessLogicException,
1199 Exception {
1200
1201+ boolean returningFromFailedValidation = isReturnedFromValidation(request);
1202 IupAdminGradingsForm form = (IupAdminGradingsForm) actionForm;
1203
1204 GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
1205
1206+ IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
1207+
1208+ Integer gradeId = form.getGradeId();
1209 Integer groupId = form.getGroupId();
1210+
1211+ IupGradings ig = iupHandler.getGradings(gradeId);
1212+
1213+ // try to get the group id from the grade if not included
1214+ if(groupId == null){
1215+ if(ig != null && ig.getGroupId() >= 0){
1216+ groupId = ig.getGroupId();
1217+ }
1218+ }
1219+
1220 if (groupId != null) {
1221 Group group = groupHandler.getGroup(groupId);
1222
1223- form.setGroupId(group.getId());
1224- IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
1225- IupGroupSettings groupSettings = iupHandler.getGroupSettings(group);
1226- if (groupSettings != null && groupSettings.getGradingType() != null) {
1227- form.setDescription(groupSettings.getGradingDescription());
1228- form.setGradingType(groupSettings.getGradingType().toString());
1229- List<String> gradings = groupSettings.getGradings();
1230- // form.setGradings(gradings);
1231+ form.setGroupId(groupId);
1232+ form.setGradeId(gradeId);
1233+
1234+ if (ig != null && ig.getType() != null) {
1235+ form.setName(ig.getName());
1236+ form.setDescription(ig.getDescription());
1237+ form.setGradingType(ig.getType().toString());
1238+ List<String> gradings = ig.getGradingsScale();
1239 for (int i = 0; i < gradings.size(); ++i) {
1240 form.setGradingsFromIdx(i, gradings.get(i));
1241 }
1242 form.setNumberOfGradings(gradings.size());
1243- } else {
1244+ } else if(!returningFromFailedValidation){
1245 form.setGradingType(GradingType.NUMERIC_SCALE.toString());
1246 form.setNumberOfGradings(2);
1247 }
1248- request.setAttribute("mode", "groupSettings");
1249- request.setAttribute("groupName", group.getName(user.getLocale().getLanguage()).getName());
1250- request.setAttribute("group", group);
1251
1252+// request.setAttribute("mode", "groupSettings");
1253+// request.setAttribute("groupName", group.getName(user.getLocale().getLanguage()).getName());
1254+// request.setAttribute("group", group);
1255+
1256+ request.setAttribute("mode", "editGrade");
1257+
1258+ String groupName = group.getName(user.getLocale().getLanguage()).getName();
1259+ request.setAttribute("groupName", groupName);
1260+
1261+ request.setAttribute("gradeId", gradeId);
1262+
1263 } else {
1264
1265 RoleHandler roleHandler = (RoleHandler) getBean(RoleHandler.BEAN_ID);
1266 List<Group> groups = roleHandler.getTopGroups(User.ROLE_IUP, person);
1267 request.setAttribute("allGroups", groups);
1268
1269- request.setAttribute("mode", "groups");
1270+ request.setAttribute("mode", "newGrade");
1271 }
1272
1273 return mapping.findForward(SUCCESS);
1274Index: src/java/net/pingpong/at/EnrollHandler.java
1275===================================================================
1276--- src/java/net/pingpong/at/EnrollHandler.java (revision 44545)
1277+++ src/java/net/pingpong/at/EnrollHandler.java (working copy)
1278@@ -105,10 +105,12 @@
1279 PreparedStatement ps = con.prepareStatement(query);
1280 ps.setString(1, userid);
1281 ps.setInt(2, courseId);
1282+ log.info("userEnroll: " +query);
1283 ResultSet res = ps.executeQuery();
1284 if (!res.next()) {
1285 ps.close();
1286 query = "insert into ent_course_enroll_person (userid, course_id) values (?, ?)";
1287+ log.info("userEnroll: " +query);
1288 ps = con.prepareStatement(query);
1289 ps.setString(1, userid);
1290 ps.setInt(2, courseId);
1291@@ -117,6 +119,7 @@
1292 ps.close();
1293
1294 query = "select enrolled_group_id from course where id = ?";
1295+ log.info("userEnroll: " +query);
1296 ps = con.prepareStatement(query);
1297 ps.setInt(1, courseId);
1298 res = ps.executeQuery();
1299@@ -144,6 +147,7 @@
1300 public void userEnroll(Course course, Group timeLimitGroup, Person applicant, String lang, boolean sendMail) {
1301 try {
1302 String query = "select 1 from ent_course_enroll_person where userid = ? and course_id = ? and time_limit_group_id = ?";
1303+ log.info("userEnroll2: " +query);
1304 PreparedStatement ps = con.prepareStatement(query);
1305 ps.setString(1, applicant.getUserid());
1306 ps.setInt(2, course.getId());
1307@@ -152,6 +156,7 @@
1308 if (!res.next()) {
1309 ps.close();
1310 query = "insert into ent_course_enroll_person (userid, course_id, time_limit_group_id) values (?, ?, ?)";
1311+ log.info("userEnroll2: " +query);
1312 ps = con.prepareStatement(query);
1313 ps.setString(1, applicant.getUserid());
1314 ps.setInt(2, course.getId());
1315@@ -210,7 +215,9 @@
1316 public void userUnregister(int courseId, PPPerson curUser, String lang) {
1317 String userid = curUser.getUserid();
1318 try {
1319- String query = "delete from ent_course_enroll_person where userid = ? and course_id = ? and time_limit_group_id is null";
1320+ String query = "delete from ent_course_enroll_person where userid = ? and course_id = ?";
1321+
1322+ log.info("userUnregister: " +query);
1323 PreparedStatement ps = con.prepareStatement(query);
1324 ps.setString(1, userid);
1325 ps.setInt(2, courseId);
1326@@ -218,6 +225,7 @@
1327 ps.close();
1328
1329 query = "select enrolled_group_id, accepted_group_id from course where id = ?";
1330+ log.info("userUnregister: " +query);
1331 ps = con.prepareStatement(query);
1332 ps.setInt(1, courseId);
1333 ResultSet res = ps.executeQuery();
1334@@ -233,6 +241,7 @@
1335 groupHandler.removeItemFromGroup(userid, enrolledGroupId);
1336
1337 query = "select 1 from ent_course_accepted_person where userid = ? and course_id = ? and time_limit_group_id is null";
1338+ log.info("userUnregister: " +query);
1339 ps = con.prepareStatement(query);
1340 ps.setString(1, userid);
1341 ps.setInt(2, courseId);
1342@@ -241,7 +250,8 @@
1343 ps.close();
1344
1345 if (isAccepted) {
1346- query = "delete from ent_course_accepted_person where userid = ? and course_id = ? and time_limit_group_id is null";
1347+ query = "delete from ent_course_accepted_person where userid = ? and course_id = ?";
1348+ log.info("userUnregister: " +query);
1349 ps = con.prepareStatement(query);
1350 ps.setString(1, userid);
1351 ps.setInt(2, courseId);
1352@@ -288,9 +298,11 @@
1353 // XXX: Maybe we should check maxParticipants here?
1354 String nextInLineUserid = pgs.getItem();
1355 if ("accepted".equals(atUnregisterMoveNextPersonTo)) {
1356+ log.info("userUnregister: move to accepted");
1357 moveToAccepted(courseId, nextInLineUserid, nextInLineUserid);
1358 } else if ("active".equals(atUnregisterMoveNextPersonTo)) {
1359 moveToActive(courseId, nextInLineUserid, nextInLineUserid);
1360+ log.info("userUnregister: move to active");
1361 PPPerson person = new PPPerson(nextInLineUserid);
1362 person.setConnection(con);
1363 userEnrollMail("movedToActive", courseId, person, lang, null);
1364@@ -522,6 +534,7 @@
1365
1366
1367 public void removeFromInactive(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1368+ log.info("removeFromInactive");
1369 net.pingpong.core.handler.GroupHandler groupHandler = BaseAction
1370 .getBean(net.pingpong.core.handler.GroupHandler.class);
1371 PersonHandler personHandler = BaseAction.getBean(PersonHandler.class);
1372@@ -549,10 +562,12 @@
1373 action = ACTION_REMOVE_FROM_TIME_LIMIT_ACCEPTED;
1374 }
1375 }
1376+ log.info("remove: \naction: " + action +" \ngroup: "+ group +" \nqueue: "+ queue +"\nuserid: "+ userid +"\ncourseId: " +courseId);
1377 try {
1378 String query = "delete from ent_course_enroll_person where userid = ? and course_id = ?"
1379 + " and time_limit_group_id"
1380 + (timeLimitGroupId != null ? " = ?" : " is null");
1381+ log.info("remove: " + query);
1382 PreparedStatement ps = con.prepareStatement(query);
1383 ps.setString(1, userid);
1384 ps.setInt(2, courseId);
1385@@ -565,6 +580,7 @@
1386 query = "delete from ent_course_accepted_person where userid = ? and course_id = ?"
1387 + " and time_limit_group_id"
1388 + (timeLimitGroupId != null ? " = ?" : " is null");
1389+ log.info("remove: " +query);
1390 ps = con.prepareStatement(query);
1391 ps.setString(1, userid);
1392 ps.setInt(2, courseId);
1393@@ -579,6 +595,7 @@
1394 + " and group_id = (select "
1395 + group
1396 + " from course where id = ?)";
1397+ log.info("remove: " +query);
1398 ps = con.prepareStatement(query);
1399 ps.setString(1, userid);
1400 ps.setInt(2, courseId);
1401@@ -614,6 +631,7 @@
1402
1403
1404 public void addToInactive(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1405+ log.info("add to inactive");
1406 net.pingpong.core.handler.GroupHandler groupHandler = BaseAction
1407 .getBean(net.pingpong.core.handler.GroupHandler.class);
1408 PersonHandler personHandler = BaseAction.getBean(PersonHandler.class);
1409@@ -646,12 +664,14 @@
1410 if (queue.equals(QUEUE_ACCEPTED)) {
1411 group = "accepted_group_id";
1412 }
1413+ log.info("add: \naction: " + action +" \ngroup: "+ group +" \nqueue: "+ queue +"\naddTabe: "+ addTable +"\ndeleteTable: "+ deleteTable +"\nuserid: "+ userid +"\ncourseId: " +courseId);
1414 try {
1415 String query = "select 1 from "
1416 + addTable
1417 + " where userid = ? and course_id = ?"
1418 + " and time_limit_group_id"
1419 + (timeLimitGroupId != null ? " = ?" : " is null");
1420+ log.info("add: " + query);
1421 PreparedStatement ps = con.prepareStatement(query);
1422 ps.setString(1, userid);
1423 ps.setInt(2, courseId);
1424@@ -668,6 +688,7 @@
1425 + ") values (?, ?"
1426 + (timeLimitGroupId != null ? ", ?" : "")
1427 + ")";
1428+ log.info("add: " + query);
1429 ps = con.prepareStatement(query);
1430 ps.setString(1, userid);
1431 ps.setInt(2, courseId);
1432@@ -683,6 +704,7 @@
1433 + " where userid = ? and course_id = ?"
1434 + " and time_limit_group_id"
1435 + (timeLimitGroupId != null ? " = ?" : " is null");
1436+ log.info("add: " + query);
1437 ps = con.prepareStatement(query);
1438 ps.setString(1, userid);
1439 ps.setInt(2, courseId);
1440@@ -698,6 +720,11 @@
1441 + " and group_id = (select "
1442 + group
1443 + " from course where id = ?)";
1444+ log.info("add: " + query);
1445+ String sql = query.replaceFirst("\\?", userid);
1446+ sql = sql.replaceFirst("\\?", String.valueOf(courseId));
1447+ log.info("add full sql: " +sql);
1448+
1449 ps = con.prepareStatement(query);
1450 ps.setString(1, userid);
1451 ps.setInt(2, courseId);
1452@@ -706,6 +733,11 @@
1453
1454 // FIXME: kudo - handler, handler, handler
1455 query = "insert into group_leaf (group_id, userid) select " + group + ", ? from course where id = ?";
1456+ log.info("add: " + query);
1457+ sql = query.replaceFirst("\\?", userid);
1458+ sql = sql.replaceFirst("\\?", String.valueOf(courseId));
1459+ log.info("add full sql: " +sql);
1460+
1461 ps = con.prepareStatement(query);
1462 ps.setString(1, userid);
1463 ps.setInt(2, courseId);
1464@@ -735,6 +767,7 @@
1465
1466
1467 public void moveToAccepted(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1468+ log.info("moveToAccepted");
1469 moveTo("ent_course_accepted_person", "ent_course_enroll_person", "accepted_group_id", courseId, userid,
1470 timeLimitGroupId);
1471
1472@@ -753,6 +786,7 @@
1473
1474
1475 public void moveToInactive(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1476+ log.info("moveToInactive");
1477 PersonHandler personHandler = BaseAction.getBean(PersonHandler.class);
1478 Person person = personHandler.getPerson(userid);
1479 net.pingpong.core.handler.GroupHandler groupHandler = BaseAction
1480@@ -776,6 +810,7 @@
1481
1482
1483 public void moveToEnrolled(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1484+ log.info("moveToEnrolled");
1485 moveTo("ent_course_enroll_person", "ent_course_accepted_person", "enrolled_group_id", courseId, userid,
1486 timeLimitGroupId);
1487 checkForMaxReached(courseId);
1488@@ -801,6 +836,7 @@
1489
1490
1491 public void moveToActiveTimeLimitGroup(int courseId, String userid, String adminUserid, int timeLimitGroupId) {
1492+ log.info("moveToActiveTimeLimitGroup");
1493 PersonHandler personHandler = BaseAction.getBean(PersonHandler.class);
1494 Person person = personHandler.getPerson(userid);
1495 net.pingpong.core.handler.GroupHandler groupHandler = BaseAction
1496@@ -827,6 +863,7 @@
1497
1498 private void moveTo(String addTable, String deleteTable, String group, int courseId, String userid,
1499 Integer timeLimitGroupId) {
1500+ log.info("moveTo: \naddTable: "+ addTable +"\ndeleteTable"+ deleteTable +"\ngroup: "+ group +"\ncourseId"+ courseId +"\nuserid: "+ userid +"\ntimeLimitGroupId: "+ timeLimitGroupId);
1501 try {
1502 if (addTable != null) {
1503 String query = "select 1 from "
1504@@ -834,6 +871,7 @@
1505 + " where userid = ? and course_id = ?"
1506 + " and time_limit_group_id"
1507 + (timeLimitGroupId != null ? " = ?" : " is null");
1508+ log.info("moveTo: " +query);
1509 PreparedStatement ps = con.prepareStatement(query);
1510 ps.setString(1, userid);
1511 ps.setInt(2, courseId);
1512@@ -851,6 +889,7 @@
1513 + (timeLimitGroupId != null ? ", ?" : "")
1514 + ")";
1515 ps = con.prepareStatement(query);
1516+ log.info("moveTo: " +query);
1517 ps.setString(1, userid);
1518 ps.setInt(2, courseId);
1519 if (timeLimitGroupId != null) {
1520@@ -867,6 +906,7 @@
1521 + " where userid = ? and course_id = ?"
1522 + " and time_limit_group_id"
1523 + (timeLimitGroupId != null ? " = ?" : " is null");
1524+ log.info("moveTo: " +query);
1525 PreparedStatement ps = con.prepareStatement(query);
1526 ps.setString(1, userid);
1527 ps.setInt(2, courseId);
1528@@ -882,6 +922,7 @@
1529 // FIXME: kudo - handler, handler, handler
1530 String query = "delete from group_leaf where userid = ?"
1531 + " and group_id = (select enrolled_group_id from course where id = ?)";
1532+ log.info("moveTo: " +query);
1533 PreparedStatement ps = con.prepareStatement(query);
1534 ps.setString(1, userid);
1535 ps.setInt(2, courseId);
1536@@ -891,6 +932,7 @@
1537 // FIXME: kudo - handler, handler, handler
1538 query = "delete from group_leaf where userid = ?"
1539 + " and group_id = (select accepted_group_id from course where id = ?)";
1540+ log.info("moveTo: " +query);
1541 ps = con.prepareStatement(query);
1542 ps.setString(1, userid);
1543 ps.setInt(2, courseId);
1544@@ -899,6 +941,7 @@
1545
1546 // FIXME: kudo - handler, handler, handler
1547 query = "insert into group_leaf (group_id, userid) select " + group + ", ? from course where id = ?";
1548+ log.info("moveTo: " +query);
1549 ps = con.prepareStatement(query);
1550 ps.setString(1, userid);
1551 ps.setInt(2, courseId);
1552@@ -935,6 +978,19 @@
1553 ps.setInt(seq++, groupId);
1554 }
1555 ps.setString(seq++, userid);
1556+
1557+ String q = query.replaceFirst("\\?", String.valueOf(courseId));
1558+ q = q.replaceFirst("\\?", queue);
1559+ q = q.replaceFirst("\\?", action);
1560+ q = q.replaceFirst("\\?", userid);
1561+ q = q.replaceFirst("\\?", adminUserid);
1562+ if (groupId != null) {
1563+ q = q.replaceFirst("\\?", String.valueOf(groupId));
1564+ }
1565+ q = q.replaceFirst("\\?", userid);
1566+
1567+ log.info("this is query: " + q);
1568+
1569 ps.executeUpdate();
1570 ps.close();
1571 } catch (SQLException e) {
1572Index: src/java/net/pingpong/resources/ApplicationResources_sv_SE.properties
1573===================================================================
1574--- src/java/net/pingpong/resources/ApplicationResources_sv_SE.properties (revision 44624)
1575+++ src/java/net/pingpong/resources/ApplicationResources_sv_SE.properties (working copy)
1576@@ -735,6 +735,9 @@
1577 at.events.choose-groups-alert.jsalert=Du m�ste placera aktiviteten i en grupp. Om du inte har tillg�ng till n�gon grupp, skapa d� grupper under Aktivitetsgrupper.
1578 at.events.content-lang=Inneh�llsspr�k:
1579 at.events.copy-done.jsalert=F�r att avsluta kopieringen, klicka Spara!
1580+at.events.copy-done.nodefiles-not-copied.info-plural=Dessa filer kunde ej kopieras, eftersom de ej �gdes av aktiviteten:
1581+at.events.copy-done.nodefiles-not-copied.info-plural.show-files={0} filer
1582+at.events.copy-done.nodefiles-not-copied.info-singular=Denna fil kunde ej kopieras, eftersom den ej �gdes av aktiviteten:
1583 at.events.copy-event=Kopiera aktivitet
1584 at.events.copy-event-info=Denna funktion �r flyttad. S�k ist�llet upp den aktivitet du vill kopiera och klicka p� knappen Kopiera.
1585 at.events.create-event-info=<table cellpadding=8 cellspacing=0><tr><td class=atHeader>Skapa och redigera aktiviteter</td></tr><tr><td>H�r skapar du och redigerar aktiviteter. F�r att skapa en ny aktivitet, klicka <i>Ny aktivitet</i> nedan.</td></tr><tr><td>F�r att s�ka fram en aktivitet, anv�nd n�got av fyra s�ks�tt till v�nster eller kombinera s�ks�tten.</td></tr><tr><td>1. I rullisten �verst listas alla grupper av aktiviteter som du har tillg�ng till. N�r du v�ljer en grupp listas gruppens inneh�ll l�ngst ner.</td></tr><tr><td>2. S�k fram en aktivitet genom att skriva b�rjan p� namnet i s�kf�ltet. Alla tr�ffar visas l�ngst ner. Du kan �ven s�ka p� ett gruppnamn.</td></tr><tr><td>3. Klicka p� den bokstav som �nskad aktivitets namn b�rjar med. Alla tr�ffar listas l�ngst ner.</td></tr><tr><td><table border=0 cellpadding=2 cellspacing=0><tr><td colspan=2>4. Du kan s�ka dig fram i grupphierarkin genom symbolerna ovanf�r den nedre listen:</td></tr><tr><td width=30 align=center>{0}</td><td>G� tillbaka till f�reg�ende niv� efter att ha �ppnat en grupp.</td></tr><tr><td width=30 align=center>{1}</td><td>�ppna den grupp du har markerad f�r att se dess inneh�ll.</td></tr><tr><td width=30 align=center>{2}</td><td>Visa alla grupper och aktiviteter i den markerade gruppens alla underliggande niv�er.</td></tr><tr><td width=30 align=center>{3}</td><td>Visa information om markerad aktivitet eller grupp.</td></tr></table></td></tr><tr><td>N�r den aktivitet du s�ker syns i nedre listan kan du markera namnet och klicka <i>Redigera</i> f�r att granska aktiviteten.</td></tr></table>
1586@@ -5873,6 +5876,7 @@
1587 iup.admin.info=H�r hanterar du IUP:er.
1588 iup.admin.info.heading=<h4>Att arbeta med IUP</h4>
1589 iup.admin.iup.add=Skapa en IUP f�r personen
1590+iup.admin.iup.already-exists=OBS! Anv�ndaren hade redan en IUP. Att du ser detta meddelande kan bero p� att du klickat flera g�nger p� Spara-knappen.
1591 iup.admin.iup.confirm-remove=Vill du verkligen ta bort IUP:n?
1592 iup.admin.iup.create-for-all-in-group=Skapa IUP:er f�r alla medlemmar i {0}
1593 iup.admin.iup.edit.attendance=N�rvaro
1594@@ -5956,6 +5960,7 @@
1595 iup.admin.store-iup.error.name-is-required=Namn saknas.
1596 iup.admin.subject.gradings=Bed�mningsgraderingar
1597 iup.admin.subject.gradings.use=�mnet kan ha bed�mningsgraderingar.
1598+iup.admin.subject.gradings.none=Ingen
1599 iup.admin.subjects.edit.info=H�r redigerar du ett �mne/fr�gest�llning som kan anv�ndas i IUP:er. Om du anger en l�nk kommer man vid �mnet/fr�gest�llningen f� en informationssymbol som leder till l�nken. Om du v�ljer en aktivitetsgrupp kan bara anv�ndare som �r l�rare f�r en aktivitet i gruppen skriva kommentarer f�r �mnet/fr�gest�llningen.
1600 iup.admin.subjects.edit.page-title=Redigera �mne/fr�gest�llning
1601 iup.admin.subjects.info=H�r hanterar du �mnen/fr�gest�llningar. En IUP byggs upp av �mnen/fr�gest�llningar. Du kan kommentera �mnena/fr�gest�llningarna i en persons IUP och skriva in <i>M�l</i> och <i>V�g</i> f�r �mnet/fr�gest�llningen. Om du kopplar �mnet/fr�gest�llningen till en aktivitetsgrupp kan bara anv�ndare som �r l�rare f�r en aktivitet i gruppen skriva kommentarer f�r �mnet/fr�gest�llningen.
1602@@ -6035,6 +6040,7 @@
1603 iup.gradings.comment=Kommentar:
1604 iup.gradings.short=Bed�mningsgradering
1605 iup.gradings.description=Beskrivning
1606+iup.gradings.name=Namn
1607 iup.gradings.grading-type=Inst�llningar f�r skala
1608 iup.gradings.gradings.steps=Antal skalsteg
1609 iup.gradings.grading-type.numbers=Siffror
1610@@ -6045,6 +6051,7 @@
1611 iup.gradings.change-type.jsalert=Den nuvarande typen av bed�mningar kan inte konverteras till den valda typen. Vill du forts�tta �nd�?
1612 iup.gradings.no-gradings=Inga bed�mningsgraderingar skapade.
1613 iup.gradings.step-number=Steg {0}
1614+iup.gradings.error.name-is-required=Namn saknas.
1615 resourcebank.rootitem.iupgradingimage.caption.image=Bilder i bed�mningsgraderingar
1616 resourcebank.rootitem.objectives.caption=M�l
1617 resourcebank.rootitem.uploadnow.caption=Ladda upp
1618@@ -6077,6 +6084,7 @@
1619 iup.new-subject.confirm-message.subject-created=�mnet/fr�gest�llningen har skapats.
1620 iup.new-subject.error.name-is-required=Namn saknas.
1621 iup.new-subject.error.user-group-is-required=Anv�ndargrupp saknas.
1622+iup.new-subject.error.user-grade-is-required=Betygskala saknas.
1623 iup.parent-have-read=V�rdnadshavare {0} har tagit del av inneh�llet {1}
1624 iup.personal.active-iup.can-comment=IUP:n kan kommenteras.
1625 iup.personal.active-iup.can-sign=IUP-dokumentet kan signeras.
1626@@ -6446,7 +6454,9 @@
1627 library.menu.button.copy=Kopiera
1628 library.menu.button.move=Flytta
1629 library.menu.destination=Destination
1630-library.menu.jsalert.confirm-remove=�r du s�ker p� att du vill radera de markerade filerna?
1631+library.menu.disabled-reason.select-exactly-1=Markera endast ett dokument/mapp f�r denna operation
1632+library.menu.disabled-reason.select-minimum-1=Markera minst ett dokument/mapp f�r denna operation
1633+library.menu.jsalert.confirm-remove=�r du s�ker p� att du vill ta bort de markerade filerna?
1634 library.menu.jsalert.no-selection=Markera endast ett dokument/mapp att redigera.
1635 library.menu.link.comment=Kommentera
1636 library.menu.link.download=Ladda ner
1637@@ -8448,9 +8458,8 @@
1638 portlet.google.hitta=Hitta.se
1639 portlet.google.lexin=Lexin
1640 portlet.google.calculator=Google Minir�knare
1641-portlet.skolplatsen=N�rvaro
1642-portlet.skolplatsen.student=N�rvaro
1643-portlet.skolplatsen.teacher=N�rvaroadministration
1644+portlet.skolplatsen.student=N�rvaro f�r elev
1645+portlet.skolplatsen.teacher=N�rvaroadministration f�r l�rare
1646 portlet.skolplatsen.parent=N�rvaro f�r mina barn
1647 portlet.sl=SL
1648 portlet.vasttrafik=V�sttrafik
1649@@ -11033,6 +11042,9 @@
1650 wysiwyg.i18n.variables.groupname=Gruppen namn
1651 yyyy-MM-dd=����-mm-dd
1652
1653+system.overload.heading=Systemets belastning �r h�g f�r tillf�llet
1654+system.overload.info=Just nu �r det h�gt tryck p� servern. Vi r�knar med att belastningen minskar strax och du kan hj�lpa till genom att v�nta ett par minuter innan du anv�nder systemet igen.
1655+
1656 maxonlinereached.title=M�nga anv�ndare inloggade
1657 maxonlinereached.wait-minutes=10
1658 maxonlinereached.h1=Det �r m�nga inloggade p� servern
1659Index: src/java/net/pingpong/iup/struts/IupAdminTemplatesPreviewAction.java
1660===================================================================
1661--- src/java/net/pingpong/iup/struts/IupAdminTemplatesPreviewAction.java (revision 44545)
1662+++ src/java/net/pingpong/iup/struts/IupAdminTemplatesPreviewAction.java (working copy)
1663@@ -25,7 +25,7 @@
1664 import net.pingpong.iup.model.GradingType;
1665 import net.pingpong.iup.model.IPPRole;
1666 import net.pingpong.iup.model.Iup;
1667-import net.pingpong.iup.model.IupSelectedGrading;
1668+import net.pingpong.iup.model.IupSelectedLockedGrading;
1669 import net.pingpong.iup.model.IupSubject;
1670 import net.pingpong.iup.model.IupSubjectComment;
1671 import net.pingpong.iup.model.ProgramOfMeasures;
1672@@ -75,20 +75,20 @@
1673 subjects.add(subject);
1674
1675 // Gradings
1676- if (subject.isUseGradings()) {
1677+ if (subject.getGradings() != null) {
1678 request.setAttribute("useGradings", Boolean.TRUE);
1679 subjectsWithGradings.add(subject.getId());
1680
1681 List<IupSelectedGradingGUI> listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
1682 IupSelectedGradingGUI gradingGui = new IupSelectedGradingGUI();
1683 gradingGui.setCanEditSelection(false);
1684- IupSelectedGrading selected = new IupSelectedGrading();
1685- selected.setComment(getRandomLoremIpsum());
1686- selected.setChanged(new Date());
1687- selected.setCreatedBy(person);
1688- selected.setSelectedGrading(3);
1689- selected.setCreatorRole(IPPRole.TEACHER);
1690- gradingGui.setSelectedGrading(selected);
1691+ IupSelectedLockedGrading selectedLockedGrading = new IupSelectedLockedGrading();
1692+ selectedLockedGrading.setComment(getRandomLoremIpsum());
1693+ selectedLockedGrading.setChanged(new Date());
1694+ selectedLockedGrading.setCreatedBy(person);
1695+ selectedLockedGrading.setSelectedLockedGrading(3);
1696+ selectedLockedGrading.setCreatorRole(IPPRole.TEACHER);
1697+ gradingGui.setSelectedLockedGrading(selectedLockedGrading);
1698 listOfSelectedGradings.add(gradingGui);
1699 selectedGradings.put(subject.getId(), listOfSelectedGradings);
1700 }
1701Index: src/java/net/pingpong/iup/struts/IupAdminGradingsAction.java
1702===================================================================
1703--- src/java/net/pingpong/iup/struts/IupAdminGradingsAction.java (revision 44545)
1704+++ src/java/net/pingpong/iup/struts/IupAdminGradingsAction.java (working copy)
1705@@ -14,11 +14,13 @@
1706
1707 import net.pingpong.core.exception.ActionException;
1708 import net.pingpong.core.exception.BusinessLogicException;
1709+import net.pingpong.core.handler.GroupHandler;
1710+import net.pingpong.core.model.Group;
1711 import net.pingpong.core.model.Person;
1712 import net.pingpong.core.model.User;
1713 import net.pingpong.iup.handler.IupHandler;
1714 import net.pingpong.iup.model.IPPRole;
1715-import net.pingpong.iup.model.IupGroupSettings;
1716+import net.pingpong.iup.model.IupGradings;
1717
1718 import org.apache.struts.action.ActionForm;
1719 import org.apache.struts.action.ActionForward;
1720@@ -45,22 +47,27 @@
1721 Exception {
1722
1723 IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
1724- List<IupGroupSettings> groups = iupHandler.getGroupSettings(person);
1725+ GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
1726+
1727+ List<IupGradings> igs = iupHandler.getGradings(person);
1728+
1729 List<AssessmentGradingBean> guides = new ArrayList<AssessmentGradingBean>();
1730- int seq = 1;
1731- for (IupGroupSettings groupSetting : groups) {
1732+
1733+ for (IupGradings ig : igs) {
1734 // Check that the group has guides
1735- if (groupSetting.getGradingType() != null) {
1736+ if (ig.getType() != null) {
1737 AssessmentGradingBean bean = new AssessmentGradingBean();
1738- bean.setId(groupSetting.getGroup().getId());
1739- bean.setSeq(seq++);
1740- bean.setGroupName(groupSetting.getGroup().getName(user.getLocale().getLanguage()).getName());
1741-
1742- bean.setDescription(groupSetting.getGradingDescription());
1743-
1744+ bean.setId(ig.getGradingsId());
1745+ Group group = groupHandler.getGroup(ig.getGroupId());
1746+ String groupName = group.getName(user.getLocale().getLanguage()).getName();
1747+
1748+ bean.setGroupName(groupName);
1749+ bean.setName(ig.getName());
1750+ bean.setDescription(ig.getDescription());
1751 guides.add(bean);
1752 }
1753 }
1754+
1755 request.setAttribute("gradingsList", guides);
1756
1757 return mapping.findForward(SUCCESS);
1758@@ -71,6 +78,7 @@
1759 private Integer id;
1760 private Integer seq;
1761 private String groupName;
1762+ private String name;
1763
1764 private String description;
1765
1766@@ -114,5 +122,17 @@
1767 this.description = description;
1768 }
1769
1770+
1771+
1772+ public String getName() {
1773+ return name;
1774+ }
1775+
1776+
1777+
1778+ public void setName(String name) {
1779+ this.name = name;
1780+ }
1781+
1782 }
1783 }
1784Index: src/webroot/pp/iup/adminSubjectsNew.jsp
1785===================================================================
1786--- src/webroot/pp/iup/adminSubjectsNew.jsp (revision 44545)
1787+++ src/webroot/pp/iup/adminSubjectsNew.jsp (working copy)
1788@@ -1,17 +1,19 @@
1789 <%@ include file="/include.jsp" %>
1790
1791-<c:if test="${iupAdminSubjectsForm.subjectId != null}">
1792- <bean:define id="pageTitle"> <bean:message key="iup.admin.subjects.edit.page-title" /></bean:define>
1793+<% //TODO Title is wrong for edit in bread crumbs and browser title page. probably cause edit and new is the same page%>
1794+<c:if test="${not empty subjectId}">
1795+ <c:set var="pageTitle" scope="page"><bean:message key="iup.admin.subjects.edit.page-title" /></c:set>
1796+ <bean:define id="pageTitle"><bean:message key="iup.admin.subjects.edit.page-title" /></bean:define>
1797 <bean:define id="action">/iupAdminSubjectsEdit</bean:define>
1798 </c:if>
1799-<c:if test="${iupAdminSubjectsForm.subjectId == null}">
1800- <bean:define id="pageTitle"><bean:message key="iup.admin.subjects.new.page-title" /> </bean:define>
1801+<c:if test="${empty subjectId}">
1802+ <c:set var="pageTitle" scope="page"><bean:message key="iup.admin.subjects.new.page-title" /></c:set>
1803+ <bean:define id="pageTitle"><bean:message key="iup.admin.subjects.new.page-title" /></bean:define>
1804 <bean:define id="action">/iupAdminSubjectsNew</bean:define>
1805 </c:if>
1806
1807 <div class="page-content">
1808-
1809- <h:heading level="1" imageId="icon-files" imageSize="large"><h:pageTitle /></h:heading>
1810+ <h:heading imageId="icon-files" imageSize="large"level="1" ><c:out value="${pageTitle}" /></h:heading>
1811
1812 <p><bean:message key="iup.admin.subjects.edit.info" /></p>
1813
1814@@ -52,12 +54,24 @@
1815 <bean:message key="iup.admin.subject.gradings" />
1816 </h4>
1817 <p>
1818- <h:checkbox property="useGradings">
1819+
1820+ <c:if test="${editGradings}">
1821 <bean:message key="iup.admin.subject.gradings.use" />
1822- </h:checkbox>
1823+ <h:select property="gradeId">
1824+ <h:option value="${noGradeId} }"><bean:message key="iup.admin.subject.gradings.none" /></h:option>
1825+ <logic:iterate name="gradeList" id="grade">
1826+ <h:option value="${grade.id}">${grade.name} : ${grade.groupName}</h:option>
1827+ </logic:iterate>
1828+ </h:select>
1829+ </c:if>
1830+ <c:if test="${not editGradings}">
1831+ <h:hidden property="gradeId"/>
1832+ ${selectedGradings.name}
1833+ ${selectedGradings.groupName}
1834+ </c:if>
1835 </p>
1836 </div>
1837-
1838+
1839 <div class="button-set">
1840 <h:submit><bean:message key="general.button.save" /></h:submit>
1841 <h:cancel><bean:message key="general.button.cancel" /></h:cancel>
1842Index: src/java/net/pingpong/iup/struts/IupAdminSubjectsAction.java
1843===================================================================
1844--- src/java/net/pingpong/iup/struts/IupAdminSubjectsAction.java (revision 44545)
1845+++ src/java/net/pingpong/iup/struts/IupAdminSubjectsAction.java (working copy)
1846@@ -46,6 +46,10 @@
1847 Exception {
1848 IupHandler handler = (IupHandler) getBean(IupHandler.BEAN_ID);
1849 Collection<IupSubject> subjects = handler.getSubjectsForIUPAdminUser(person.getGiver(), person);
1850+ for(IupSubject subject : subjects){
1851+ handler.refresh(subject);
1852+ }
1853+
1854 request.setAttribute("subjects", subjects);
1855 return mapping.findForward(SUCCESS);
1856 }
1857Index: src/java/net/pingpong/iup/dao/IupDAO.java
1858===================================================================
1859--- src/java/net/pingpong/iup/dao/IupDAO.java (revision 44545)
1860+++ src/java/net/pingpong/iup/dao/IupDAO.java (working copy)
1861@@ -40,11 +40,14 @@
1862 import net.pingpong.iup.handler.IupHandler;
1863 import net.pingpong.iup.model.IPPRole;
1864 import net.pingpong.iup.model.Iup;
1865+import net.pingpong.iup.model.Iup.ParentSignature;
1866 import net.pingpong.iup.model.IupField;
1867 import net.pingpong.iup.model.IupFieldContent;
1868+import net.pingpong.iup.model.IupGradings;
1869 import net.pingpong.iup.model.IupGroupSettings;
1870+import net.pingpong.iup.model.IupLockedSubject;
1871 import net.pingpong.iup.model.IupPersonalCommentFolderRow;
1872-import net.pingpong.iup.model.IupSelectedGrading;
1873+import net.pingpong.iup.model.IupSelectedLockedGrading;
1874 import net.pingpong.iup.model.IupSubject;
1875 import net.pingpong.iup.model.IupSubjectComment;
1876 import net.pingpong.iup.model.IupSubjectCommentAttachedLogBookEntry;
1877@@ -52,7 +55,6 @@
1878 import net.pingpong.iup.model.IupSubjectGoal;
1879 import net.pingpong.iup.model.IupTemplate;
1880 import net.pingpong.iup.model.ProgramOfMeasures;
1881-import net.pingpong.iup.model.Iup.ParentSignature;
1882 import net.pingpong.node.dao.NodeDAO;
1883 import net.pingpong.node.handler.NodeHandler;
1884
1885@@ -153,6 +155,9 @@
1886 return (IupSubject) getSession().get(IupSubject.class, id);
1887 }
1888
1889+ public IupLockedSubject getLockedSubject(Integer id) {
1890+ return (IupLockedSubject) getSession().get(IupLockedSubject.class, id);
1891+ }
1892
1893 public Collection<IupTemplate> getTemplates(Provider giver) {
1894 Query query = getSession().createQuery("select t from IupTemplate t where t.giver = :giver order by t.name");
1895@@ -703,16 +708,16 @@
1896 Query query;
1897
1898 if (filterGroup != null) {
1899- String queryString = "select p from GroupData gd join gd.descendantPersons p join p.iups iup join iup.subjects subject"
1900- + " where subject.id = :subjectId"
1901+ String queryString = "select p from GroupData gd join gd.descendantPersons p join p.iups iup join iup.lockedSubjects subject"
1902+ + " where subject.originalSubject.id = :subjectId"
1903 + " and gd.id = :groupId"
1904 + " and iup.active=true";
1905 query = getSession().createQuery(queryString);
1906 query.setParameter("subjectId", subject.getId());
1907 query.setParameter("groupId", filterGroup.getId());
1908 } else {
1909- String queryString = "select p from Person p join p.iups iup join iup.subjects subject"
1910- + " where subject.id = :subjectId"
1911+ String queryString = "select p from Person p join p.iups iup join iup.lockedSubjects subject"
1912+ + " where subject.originalSubject.id = :subjectId"
1913 + " and iup.active=true";
1914 query = getSession().createQuery(queryString);
1915 query.setParameter("subjectId", subject.getId());
1916@@ -749,12 +754,33 @@
1917 return uncheckedList(query, IupGroupSettings.class);
1918 }
1919
1920+ public List<IupGradings> getGradings(Person adminPerson) {
1921+ List<Group> topGroups = roleDAO.getTopGroups(User.ROLE_IUP, adminPerson);
1922+ if (topGroups.isEmpty()) return new ArrayList<IupGradings>();
1923+ List<Integer> topGroupIds = new ArrayList<Integer>();
1924+ for (Group g : topGroups) {
1925+ topGroupIds.add(g.getId());
1926+ }
1927+
1928+ Query query = getSession().createQuery(
1929+ "select s from IupGradings s where giver = :giver"
1930+ + " and (s.groupId in ("
1931+ + " select gdr.groupId from GroupGroupRow gdr where gdr.thisGroupId in (:topGroupIds)"
1932+ + " ) or s.groupId in (:topGroupIds))"
1933+ + " order by group_id, name asc");
1934+ query.setEntity("giver", adminPerson.getGiver());
1935+ query.setParameterList("topGroupIds", topGroupIds);
1936+ return uncheckedList(query, IupGradings.class);
1937+ }
1938
1939+ public IupGradings getGradings(Integer gradeId) {
1940+ return (IupGradings) getSession().get(IupGradings.class, gradeId);
1941+ }
1942+
1943 public IupGroupSettings getGroupSettings(Group group) {
1944 return (IupGroupSettings) getSession().get(IupGroupSettings.class, group.getId());
1945 }
1946
1947-
1948 public Integer getNextGroupSettingsSeq(Provider provider) {
1949 Query query = getSession().createQuery("select max(seq) from IupGroupSettings where provider = :provider");
1950 query.setEntity("provider", provider);
1951@@ -1218,13 +1244,13 @@
1952 *
1953 * @see IupHandler#getSelectedGradings(Iup)
1954 */
1955- public List<IupSelectedGrading> getSelectedPublishedGradings(Iup iup) {
1956+ public List<IupSelectedLockedGrading> getSelectedPublishedLockedGradings(Iup iup) {
1957 Query query = getSession().createQuery(
1958- "select igs from IupSelectedGrading igs where iup = :iup"
1959+ "select igs from IupSelectedLockedGrading igs where iup = :iup"
1960 + " and published = true"
1961 + " order by changed");
1962 query.setEntity("iup", iup);
1963- return uncheckedList(query, IupSelectedGrading.class);
1964+ return uncheckedList(query, IupSelectedLockedGrading.class);
1965 }
1966
1967
1968@@ -1233,13 +1259,13 @@
1969 *
1970 * @see IupHandler#getSelectedGradings(Iup)
1971 */
1972- public List<IupSelectedGrading> getSelectedUnpublishedGradings(Iup iup) {
1973+ public List<IupSelectedLockedGrading> getSelectedUnpublishedLockedGradings(Iup iup) {
1974 Query query = getSession().createQuery(
1975- "select igs from IupSelectedGrading igs where iup = :iup"
1976+ "select igs from IupSelectedLockedGrading igs where iup = :iup"
1977 + " and published = false"
1978 + " order by changed");
1979 query.setEntity("iup", iup);
1980- return uncheckedList(query, IupSelectedGrading.class);
1981+ return uncheckedList(query, IupSelectedLockedGrading.class);
1982 }
1983
1984
1985@@ -1253,27 +1279,26 @@
1986 * If published or unpublished gradings are returned
1987 * @return a map from iup:ids IupSubjectPesonGradings.
1988 */
1989- public List<IupSelectedGrading> getGradingsForSubject(IupSubject subject, Group group, boolean published) {
1990-
1991+ public List<IupSelectedLockedGrading> getGradingsForLockedSubject(Integer subjectId, Group group, boolean published) {
1992 SQLQuery query = getSession().createSQLQuery(
1993 " SELECT DISTINCT {isg.*} "
1994 + " FROM "
1995- + " iup_selected_gradings isg "
1996+ + " iup_locked_selected_gradings isg "
1997 + " JOIN iup ON (isg.iup_id = iup.id) "
1998 + " JOIN group_data gd ON (iup.userid = gd.item_text) "
1999 + " WHERE "
2000- + " isg.subject_id = :subject_id "
2001+ + " isg.locked_subject_id = (select locked_subject_id from iup_locked_subject where original_subject_id = :subject_id) "
2002 + " AND gd.this_group_id = :group_id "
2003 + " AND iup.active "
2004 + " AND isg.published = :published"
2005 + " ORDER BY isg.changed ");
2006
2007- query.addEntity("isg", IupSelectedGrading.class);
2008- query.setParameter("subject_id", subject.getId());
2009+ query.addEntity("isg", IupSelectedLockedGrading.class);
2010+ query.setParameter("subject_id", subjectId);
2011 query.setParameter("group_id", group.getId());
2012 query.setParameter("published", published);
2013
2014- return uncheckedList(query, IupSelectedGrading.class);
2015+ return uncheckedList(query, IupSelectedLockedGrading.class);
2016 }
2017
2018
2019@@ -1302,17 +1327,17 @@
2020 public void saveGrading(Person person, IPPRole creatorRole, Integer iupId, Integer subjectId,
2021 Integer selectedGrading, String comment, boolean publish) {
2022
2023- // Always handle un-published state
2024+ // Always handle un-published stateiup_selected_locked_gradings
2025 List<Integer> queryForList = jdbcTemplate
2026 .queryForList(
2027- "SELECT iup_id FROM iup_selected_gradings WHERE iup_id = ? AND subject_id = ? AND created_by = ? AND published = false",
2028+ "SELECT iup_id FROM iup_selected_locked_gradings WHERE iup_id = ? AND locked_subject_id = ? AND created_by = ? AND published = false",
2029 new Object[] {
2030 iupId, subjectId, person.getUserid()
2031 });
2032 if (queryForList.size() == 0) {
2033
2034 jdbcTemplate.update(
2035- "INSERT INTO iup_selected_gradings (iup_id, seq, subject_id, created_by, creator_role, comment, changed, published)"
2036+ "INSERT INTO iup_selected_locked_gradings (iup_id, seq, locked_subject_id, created_by, creator_role, comment, changed, published)"
2037 + " VALUES (?,?,?,?,?,?,?,false)", new Object[] {
2038 iupId,
2039 selectedGrading,
2040@@ -1323,8 +1348,8 @@
2041 new Date()
2042 });
2043 } else {
2044- jdbcTemplate.update("UPDATE iup_selected_gradings SET seq=?, comment=?, changed=?"
2045- + " WHERE iup_id=? AND subject_id=? AND created_by =? AND published = false", new Object[] {
2046+ jdbcTemplate.update("UPDATE iup_selected_locked_gradings SET seq=?, comment=?, changed=?"
2047+ + " WHERE iup_id=? AND locked_subject_id=? AND created_by =? AND published = false", new Object[] {
2048 selectedGrading, comment, new Date(), iupId, subjectId, person.getId()
2049 });
2050 }
2051@@ -1333,14 +1358,14 @@
2052 if (publish) {
2053 queryForList = jdbcTemplate
2054 .queryForList(
2055- "SELECT iup_id FROM iup_selected_gradings WHERE iup_id = ? AND subject_id = ? AND created_by = ? AND published = true",
2056+ "SELECT iup_id FROM iup_selected_locked_gradings WHERE iup_id = ? AND locked_subject_id = ? AND created_by = ? AND published = true",
2057 new Object[] {
2058 iupId, subjectId, person.getUserid()
2059 });
2060 if (queryForList.size() == 0) {
2061
2062 jdbcTemplate.update(
2063- "INSERT INTO iup_selected_gradings (iup_id, seq, subject_id, created_by, creator_role, comment, changed, published)"
2064+ "INSERT INTO iup_selected_locked_gradings (iup_id, seq, locked_subject_id, created_by, creator_role, comment, changed, published)"
2065 + " VALUES (?,?,?,?,?,?,?, true)", new Object[] {
2066 iupId,
2067 selectedGrading,
2068@@ -1351,11 +1376,10 @@
2069 new Date()
2070 });
2071 } else {
2072- jdbcTemplate.update("UPDATE iup_selected_gradings SET seq=?, comment=?, changed=?"
2073- + " WHERE iup_id=? AND subject_id=? AND created_by =? AND published = true", new Object[] {
2074+ jdbcTemplate.update("UPDATE iup_selected_locked_gradings SET seq=?, comment=?, changed=?"
2075+ + " WHERE iup_id=? AND locked_subject_id=? AND created_by =? AND published = true", new Object[] {
2076 selectedGrading, comment, new Date(), iupId, subjectId, person.getId()
2077 });
2078-
2079 }
2080 }
2081 }
2082@@ -1363,7 +1387,7 @@
2083
2084 public void removeGrading(Person person, Integer iupId, Integer subjectId) {
2085 // Remove both published and un-published
2086- jdbcTemplate.update("DELETE FROM iup_selected_gradings"
2087+ jdbcTemplate.update("DELETE FROM iup_selected_locked_gradings"
2088 + " WHERE iup_id = ? AND subject_id = ? AND created_by = ?", new Object[] {
2089 iupId, subjectId, person.getId()
2090 });
2091Index: src/java/net/pingpong/iup/struts/IupAdminCommentPerSubjectAction.java
2092===================================================================
2093--- src/java/net/pingpong/iup/struts/IupAdminCommentPerSubjectAction.java (revision 44545)
2094+++ src/java/net/pingpong/iup/struts/IupAdminCommentPerSubjectAction.java (working copy)
2095@@ -32,7 +32,8 @@
2096 import net.pingpong.iup.model.IPPRole;
2097 import net.pingpong.iup.model.Iup;
2098 import net.pingpong.iup.model.IupGroupSettings;
2099-import net.pingpong.iup.model.IupSelectedGrading;
2100+import net.pingpong.iup.model.IupSelectedLockedGrading;
2101+import net.pingpong.iup.model.IupLockedSubject;
2102 import net.pingpong.iup.model.IupSubject;
2103 import net.pingpong.iup.model.IupSubjectComment;
2104 import net.pingpong.iup.model.ProgramOfMeasures;
2105@@ -70,7 +71,7 @@
2106 /**
2107 * Can be null if the user haven't made a selection yet.
2108 */
2109- private IupSelectedGrading selectedGrading;
2110+ private IupSelectedLockedGrading selectedLockedGrading;
2111
2112 /**
2113 * Different users can be members of different groups and therefore have
2114@@ -91,13 +92,13 @@
2115 }
2116
2117
2118- public IupSelectedGrading getSelectedGrading() {
2119- return selectedGrading;
2120+ public IupSelectedLockedGrading getSelectedLockedGrading() {
2121+ return selectedLockedGrading;
2122 }
2123
2124
2125- public void setSelectedGrading(IupSelectedGrading selectedGrading) {
2126- this.selectedGrading = selectedGrading;
2127+ public void setSelectedLockedGrading(IupSelectedLockedGrading selectedLockedGrading) {
2128+ this.selectedLockedGrading = selectedLockedGrading;
2129 }
2130
2131
2132@@ -192,6 +193,13 @@
2133 } catch (Exception e) {
2134 }
2135 }
2136+
2137+ // save the comment on the locked subject id
2138+ IupLockedSubject lockedSubject = activeIup.getLockedSubjectWithOriginalId(subjectId);
2139+ Integer lockedSubjectId = null;
2140+ if(lockedSubject != null){
2141+ lockedSubjectId = lockedSubject.getLockedSubjectId();
2142+ }
2143
2144 if (request.getParameter("comment") != null) {
2145 Attachments attachments = IupCommentUserAction.attachmentsFromRequest(request,
2146@@ -214,11 +222,34 @@
2147 .getParameter("iupSubjectCommentId"));
2148 redirectUrl += "#editForm" + iupSubjectCommentId;
2149
2150+ } else if ("removeLastComment".equals(request.getParameter("command"))) {
2151+
2152+ IupSubjectComment lastComment = iupHandler.getLastComment(activeIup, subjectId);
2153+ if (lastComment != null
2154+ && !lastComment.isSigningMarker()
2155+ && lastComment.getCreatedBy().equals(person)) {
2156+ iupHandler.removeLastComment(activeIup.getId(), subjectId, person);
2157+ }
2158+ redirectUrl += "#person" + request.getParameter("count");
2159+
2160+ } else if ("removeUnpublishedComment".equals(request.getParameter("command"))) {
2161+ if (iupSubjectCommentId != null) {
2162+ IupSubjectComment unpublishedComment = iupHandler.getComment(activeIup, subjectId,
2163+ iupSubjectCommentId);
2164+ if (unpublishedComment != null
2165+ && !unpublishedComment.isSigningMarker()
2166+ && unpublishedComment.getCreatedBy().equals(person)
2167+ && !unpublishedComment.isPublished()) {
2168+ iupHandler.removeComment(activeIup.getId(), subjectId, person, unpublishedComment
2169+ .getId());
2170+ }
2171+ }
2172+ redirectUrl += "#person" + request.getParameter("count");
2173 } else if (request.getParameter("gradings") != null) {
2174
2175 if (request.getParameter("removeGrading") != null) {
2176- if (IupCommentUserAction.canRemoveGrading(person, activeIup, subjectId)) {
2177- iupHandler.removeGrading(person, activeIup.getId(), subjectId);
2178+ if (IupCommentUserAction.canRemoveGrading(person, activeIup, lockedSubjectId)) {
2179+ iupHandler.removeGrading(person, activeIup.getId(), lockedSubjectId);
2180 }
2181
2182 } else {
2183@@ -227,8 +258,8 @@
2184 // created.
2185 // Only needed if we're editing though, not
2186 // creating.
2187- iupHandler.saveGrading(person, IPPRole.TEACHER, activeIup.getId(), subjectId,
2188- new Integer(request.getParameter("selectedGrading")), request
2189+ iupHandler.saveGrading(person, IPPRole.TEACHER, activeIup.getId(), lockedSubjectId,
2190+ new Integer(request.getParameter("selectedLockedGrading")), request
2191 .getParameter("gradingComment"),
2192 request.getParameter("publishGrading") != null);
2193 }
2194@@ -253,30 +284,7 @@
2195
2196 redirectUrl += "#measuresDisplay" + subjectId;
2197
2198- } else if ("removeLastComment".equals(request.getParameter("command"))) {
2199-
2200- IupSubjectComment lastComment = iupHandler.getLastComment(activeIup, subjectId);
2201- if (lastComment != null
2202- && !lastComment.isSigningMarker()
2203- && lastComment.getCreatedBy().equals(person)) {
2204- iupHandler.removeLastComment(activeIup.getId(), subjectId, person);
2205- }
2206- redirectUrl += "#person" + request.getParameter("count");
2207-
2208- } else if ("removeUnpublishedComment".equals(request.getParameter("command"))) {
2209- if (iupSubjectCommentId != null) {
2210- IupSubjectComment unpublishedComment = iupHandler.getComment(activeIup, subjectId,
2211- iupSubjectCommentId);
2212- if (unpublishedComment != null
2213- && !unpublishedComment.isSigningMarker()
2214- && unpublishedComment.getCreatedBy().equals(person)
2215- && !unpublishedComment.isPublished()) {
2216- iupHandler.removeComment(activeIup.getId(), subjectId, person, unpublishedComment
2217- .getId());
2218- }
2219- }
2220- redirectUrl += "#person" + request.getParameter("count");
2221- }
2222+ }
2223 }
2224 }
2225 }
2226@@ -351,20 +359,21 @@
2227 subject, group);
2228 List<Person> personsWithoutSelectedGradingByUser = new ArrayList<Person>(
2229 personsWithAssessmentGradingsEnabled);
2230-
2231+
2232 // Setup published gradings (the ones we show)
2233- for (IupSelectedGrading selectedGrading : iupHandler.getPublishedGradingsForSubject(subject, group)) {
2234- handleSelectedGradings(person, selectedGrading, personAndComments, personsWithoutSelectedGradingByUser,
2235+ for (IupSelectedLockedGrading selectedLockedGrading : iupHandler.getPublishedGradingsForLockedSubject(subject.getId(), group)) {
2236+ handleSelectedLockedGradings(person, selectedLockedGrading, personAndComments, personsWithoutSelectedGradingByUser,
2237 selectedPublishedGradings);
2238 }
2239 // Setup un-published gradings (the ones we edit)
2240 Map<String, Boolean> canRemoveGradingMap = new HashMap<String, Boolean>();
2241 request.setAttribute("canRemoveGradingMap", canRemoveGradingMap);
2242- for (IupSelectedGrading selectedGrading : iupHandler.getUnpublishedGradingsForSubject(subject, group)) {
2243- handleSelectedGradings(person, selectedGrading, personAndComments, personsWithoutSelectedGradingByUser,
2244+
2245+ for (IupSelectedLockedGrading selectedLockedGrading : iupHandler.getUnpublishedGradingsForLockedSubject(subject.getId(), group)) {
2246+ handleSelectedLockedGradings(person, selectedLockedGrading, personAndComments, personsWithoutSelectedGradingByUser,
2247 selectedUnpublishedGradings);
2248- canRemoveGradingMap.put(selectedGrading.getIup().getPerson().getId(), IupCommentUserAction
2249- .canRemoveGrading(person, selectedGrading.getIup(), subjectId));
2250+ canRemoveGradingMap.put(selectedLockedGrading.getIup().getPerson().getId(), IupCommentUserAction
2251+ .canRemoveGrading(person, selectedLockedGrading.getIup(), subjectId));
2252 }
2253
2254 // Prepare for persons without selected grading by user
2255@@ -376,19 +385,19 @@
2256 }
2257
2258 Iup activeIup = iupHandler.getActiveIup(personWithoutGrading);
2259-
2260+ IupLockedSubject lockedSubject = activeIup.getLockedSubjectWithOriginalId(subject.getId());
2261+
2262 if (!activeIup.isWritable()) {
2263 continue;
2264 }
2265
2266 IupSelectedGradingPerUserGUI iupSelectedGradingPerUserGUI = new IupSelectedGradingPerUserGUI();
2267 iupSelectedGradingPerUserGUI.setCanEditSelection(true);
2268- iupSelectedGradingPerUserGUI.setSelectedGrading(null);
2269-
2270- iupSelectedGradingPerUserGUI.setGradingDescription(activeIup.getGradingDescription());
2271- iupSelectedGradingPerUserGUI.setGradingType(activeIup.getGradingType());
2272- iupSelectedGradingPerUserGUI.setGradingScale(activeIup.getGradingScale());
2273-
2274+ iupSelectedGradingPerUserGUI.setSelectedLockedGrading(null);
2275+ iupSelectedGradingPerUserGUI.setGradingDescription(lockedSubject.getLockedGradings().getDescription());
2276+ iupSelectedGradingPerUserGUI.setGradingType(lockedSubject.getLockedGradings().getType());
2277+ iupSelectedGradingPerUserGUI.setGradingScale(lockedSubject.getLockedGradings().getLockedGradingsScale());
2278+
2279 List<IupSelectedGradingPerUserGUI> listOfSelectedGradings = selectedPublishedGradings
2280 .get(personWithoutGrading.getUserid());
2281 if (listOfSelectedGradings == null) {
2282@@ -419,14 +428,14 @@
2283 }
2284
2285
2286- private void handleSelectedGradings(Person person, IupSelectedGrading selectedGrading,
2287+ private void handleSelectedLockedGradings(Person person, IupSelectedLockedGrading selectedLockedGrading,
2288 Map<Person, List<IupSubjectComment>> personAndComments, List<Person> personsWithoutSelectedGradingByUser,
2289 Map<String, List<IupSelectedGradingPerUserGUI>> selectedGradings) {
2290 IupSelectedGradingPerUserGUI iupSelectedGradingPerUserGUI = new IupSelectedGradingPerUserGUI();
2291
2292- Person gradingUser = selectedGrading.getCreatedBy();
2293+ Person gradingUser = selectedLockedGrading.getCreatedBy();
2294
2295- Iup iup = selectedGrading.getIup();
2296+ Iup iup = selectedLockedGrading.getIup();
2297 Person gradedUser = iup.getPerson();
2298
2299 if (personAndComments.get(gradedUser) == null) {
2300@@ -441,7 +450,7 @@
2301
2302 Date lastSigning = iup.getLastSigning();
2303
2304- if (iup.isWritable() && (lastSigning == null || lastSigning.before(selectedGrading.getChanged()))) {
2305+ if (iup.isWritable() && (lastSigning == null || lastSigning.before(selectedLockedGrading.getChanged()))) {
2306 iupSelectedGradingPerUserGUI.setCanEditSelection(true);
2307 }
2308
2309@@ -450,12 +459,16 @@
2310 // grading to it either.
2311 }
2312
2313- iupSelectedGradingPerUserGUI.setSelectedGrading(selectedGrading);
2314
2315- iupSelectedGradingPerUserGUI.setGradingDescription(iup.getGradingDescription());
2316- iupSelectedGradingPerUserGUI.setGradingType(iup.getGradingType());
2317- iupSelectedGradingPerUserGUI.setGradingScale(IupCommentUserAction.transformGradingsForProvider(person
2318- .getGiver(), iup.getGradingType(), iup.getGradingScale()));
2319+ IupLockedSubject lockedSubject = selectedLockedGrading.getLockedSubject();
2320+
2321+ iupSelectedGradingPerUserGUI.setSelectedLockedGrading(selectedLockedGrading);
2322+ iupSelectedGradingPerUserGUI.setGradingDescription(lockedSubject.getLockedGradings().getDescription());
2323+ iupSelectedGradingPerUserGUI.setGradingType(lockedSubject.getLockedGradings().getType());
2324+ iupSelectedGradingPerUserGUI.setGradingScale(
2325+ IupCommentUserAction.transformGradingsForProvider(person.getGiver(),
2326+ lockedSubject.getLockedGradings().getType(),
2327+ lockedSubject.getLockedGradings().getLockedGradingsScale()));
2328
2329 List<IupSelectedGradingPerUserGUI> listOfSelectedGradings = selectedGradings.get(gradedUser.getUserid());
2330 if (listOfSelectedGradings == null) {
2331Index: src/webroot/pp/iup/adminWriteIup.jsp
2332===================================================================
2333--- src/webroot/pp/iup/adminWriteIup.jsp (revision 44545)
2334+++ src/webroot/pp/iup/adminWriteIup.jsp (working copy)
2335@@ -359,13 +359,13 @@
2336 value="${selectedGradings[item.subject.id]}" />
2337 <div class="separator">
2338 <div>
2339- ${gradingDescription}
2340+ ${item.subject.gradings.description}
2341 </div>
2342
2343 <c:forEach items="${gradingsForSubjects}"
2344 var="gradingForSubject">
2345
2346- <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${gradingScale}" gradingType="${gradingType}" />
2347+ <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${item.subject.gradings.gradingsScale}" gradingType="${item.subject.gradings.type}" />
2348
2349 </c:forEach>
2350 </div>
2351Index: src/java/net/pingpong/iup/struts/IupPersonalArchiveShowAction.java
2352===================================================================
2353--- src/java/net/pingpong/iup/struts/IupPersonalArchiveShowAction.java (revision 44545)
2354+++ src/java/net/pingpong/iup/struts/IupPersonalArchiveShowAction.java (working copy)
2355@@ -27,7 +27,8 @@
2356 import net.pingpong.iup.model.AttendanceEntry;
2357 import net.pingpong.iup.model.IPPRole;
2358 import net.pingpong.iup.model.Iup;
2359-import net.pingpong.iup.model.IupSelectedGrading;
2360+import net.pingpong.iup.model.IupLockedSubject;
2361+import net.pingpong.iup.model.IupSelectedLockedGrading;
2362 import net.pingpong.iup.model.IupSubject;
2363 import net.pingpong.iup.model.IupSubjectGoal;
2364 import net.pingpong.iup.model.ProgramOfMeasures;
2365@@ -78,17 +79,17 @@
2366
2367 request.setAttribute("iup", iup);
2368
2369- List<IupSubject> subjects = iup.getSubjects();
2370- request.setAttribute("iupSubjects", subjects);
2371+ List<IupSubject> subjects = iup.getOriginalSubjects();
2372
2373+ request.setAttribute("iupSubjects", subjects);
2374 request.setAttribute("subjectComments", iupHandler.getComments(iup));
2375
2376 // Setup goal and road to goal
2377 List<Item> items = new ArrayList<Item>();
2378- for (IupSubject subject : iup.getSubjects()) {
2379- IupSubjectGoal goal = iupHandler.getSubjectGoal(iup, subject);
2380+ for (IupLockedSubject subject : iup.getLockedSubjects()) {
2381+ IupSubjectGoal goal = iupHandler.getSubjectGoal(iup, subject.getOriginalSubject());
2382 Item item = new IupAdminWriteIupAction.Item();
2383- item.setSubject(subject);
2384+ item.setSubject(subject.getOriginalSubject());
2385 item.setGoal(goal);
2386 items.add(item);
2387 }
2388@@ -126,25 +127,25 @@
2389 request.setAttribute("measuresLastChangedOn", iup.getMeasuresChangedOn());
2390 }
2391
2392- if (iup.usesGradings()) {
2393-
2394+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
2395+ for (IupSubject subject : subjects) {
2396+ if(subject.getGradings() != null){
2397+ subjectsWithGradings.add(subject.getId());
2398+ }
2399+ }
2400+ if (subjectsWithGradings.size() > 0) {
2401 request.setAttribute("useGradings", Boolean.TRUE);
2402-
2403- Set<Integer> subjectsWithGradings = iup.getSubjectsWithGradings();
2404 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
2405- request.setAttribute("gradingDescription", iup.getGradingDescription());
2406- request.setAttribute("gradingType", iup.getGradingType());
2407- request.setAttribute("gradingScale", iup.getGradingScale());
2408+
2409+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
2410
2411- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
2412-
2413- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(iup)) {
2414+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(iup)) {
2415
2416 Integer subjectId = selectedGrading.getSubject().getId();
2417
2418- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
2419+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
2420 if (listOfSelectedGradings == null) {
2421- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
2422+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
2423 }
2424 listOfSelectedGradings.add(selectedGrading);
2425
2426Index: src/java/net/pingpong/iup/struts/IupPersonalSignAction.java
2427===================================================================
2428--- src/java/net/pingpong/iup/struts/IupPersonalSignAction.java (revision 44545)
2429+++ src/java/net/pingpong/iup/struts/IupPersonalSignAction.java (working copy)
2430@@ -24,7 +24,8 @@
2431 import net.pingpong.iup.model.AttendanceEntry;
2432 import net.pingpong.iup.model.IPPRole;
2433 import net.pingpong.iup.model.Iup;
2434-import net.pingpong.iup.model.IupSelectedGrading;
2435+import net.pingpong.iup.model.IupLockedSubject;
2436+import net.pingpong.iup.model.IupSelectedLockedGrading;
2437 import net.pingpong.iup.model.IupSubject;
2438 import net.pingpong.iup.model.IupSubjectGoal;
2439 import net.pingpong.iup.model.ProgramOfMeasures;
2440@@ -105,10 +106,10 @@
2441
2442 // Setup goal and road to goal
2443 List<Item> items = new ArrayList<Item>();
2444- for (IupSubject subject : iup.getSubjects()) {
2445- IupSubjectGoal goal = iupHandler.getSubjectGoal(iup, subject);
2446+ for (IupLockedSubject subject : iup.getLockedSubjects()) {
2447+ IupSubjectGoal goal = iupHandler.getSubjectGoal(iup, subject.getOriginalSubject());
2448 Item item = new IupAdminWriteIupAction.Item();
2449- item.setSubject(subject);
2450+ item.setSubject(subject.getOriginalSubject());
2451 item.setGoal(goal);
2452 items.add(item);
2453 }
2454@@ -118,7 +119,7 @@
2455 request.setAttribute("fieldsContent", iupHandler.getFieldsContent(iup));
2456 }
2457
2458- request.setAttribute("iupSubjects", iup.getSubjects());
2459+ request.setAttribute("iupSubjects", iup.getLockedSubjects());
2460 request.setAttribute("subjectComments", iupHandler.getComments(iup));
2461
2462 boolean attendanceViewing = person.getGiver().getSettings().isAttendanceViewing();
2463@@ -142,7 +143,9 @@
2464 boolean useMeasures = iup.isUseMeasures();
2465 request.setAttribute("useMeasures", useMeasures);
2466
2467- List<IupSubject> subjects = iup.getSubjects();
2468+ List<IupSubject> subjects = new ArrayList<IupSubject>();
2469+
2470+ subjects = iup.getOriginalSubjects();
2471
2472 if (useMeasures) {
2473 Map<Integer, ProgramOfMeasures> programsOfMeasures = iupHandler.getProgramsOfMeasures(iup, subjects);
2474@@ -156,25 +159,25 @@
2475 request.setAttribute("measuresLastChangedOn", iup.getMeasuresChangedOn());
2476 }
2477
2478- if (iup.usesGradings()) {
2479-
2480+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
2481+ for (IupSubject subject : subjects) {
2482+ if(subject.getGradings() != null){
2483+ subjectsWithGradings.add(subject.getId());
2484+ }
2485+ }
2486+ if (subjectsWithGradings.size() > 0) {
2487 request.setAttribute("useGradings", Boolean.TRUE);
2488-
2489- Set<Integer> subjectsWithGradings = iup.getSubjectsWithGradings();
2490 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
2491- request.setAttribute("gradingDescription", iup.getGradingDescription());
2492- request.setAttribute("gradingType", iup.getGradingType());
2493- request.setAttribute("gradingScale", iup.getGradingScale());
2494+
2495+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
2496
2497- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
2498-
2499- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(iup)) {
2500+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(iup)) {
2501
2502 Integer subjectId = selectedGrading.getSubject().getId();
2503
2504- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
2505+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
2506 if (listOfSelectedGradings == null) {
2507- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
2508+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
2509 }
2510 listOfSelectedGradings.add(selectedGrading);
2511
2512Index: src/java/net/pingpong/iup/model/IupGradings.java
2513===================================================================
2514--- src/java/net/pingpong/iup/model/IupGradings.java (revision 0)
2515+++ src/java/net/pingpong/iup/model/IupGradings.java (revision 0)
2516@@ -0,0 +1,84 @@
2517+package net.pingpong.iup.model;
2518+
2519+import java.util.List;
2520+
2521+public class IupGradings {
2522+
2523+ public static final int NO_GRADINGS_ID = -1;
2524+
2525+ private Integer gradingsId = null;
2526+ private GradingType type;
2527+ private int groupId;
2528+ private String giver;
2529+ private String name;
2530+ private String description;
2531+ private List<String> gradingsScale;
2532+
2533+ public Integer getGradingsId() {
2534+ return gradingsId;
2535+ }
2536+
2537+ public void setGradingsId(Integer gradingsId) {
2538+ this.gradingsId = gradingsId;
2539+ }
2540+
2541+ public int getGroupId() {
2542+ return groupId;
2543+ }
2544+
2545+ public void setGroupId(int groupId) {
2546+ this.groupId = groupId;
2547+ }
2548+
2549+ public GradingType getType() {
2550+ return type;
2551+ }
2552+
2553+ public int getTypeAsNum() {
2554+ return type.getNum();
2555+ }
2556+
2557+ public void setType(GradingType type) {
2558+ this.type = type;
2559+ }
2560+
2561+ public void setTypeAsNum(Integer num) {
2562+ this.type = num == null ? null : GradingType.fromOrdinal(num);
2563+ }
2564+
2565+ public String getGiver() {
2566+ return giver;
2567+ }
2568+
2569+ public void setGiver(String giver) {
2570+ this.giver = giver;
2571+ }
2572+
2573+
2574+ public String getName() {
2575+ return name;
2576+ }
2577+
2578+
2579+ public void setName(String name) {
2580+ this.name = name;
2581+ }
2582+
2583+ public String getDescription() {
2584+ return description;
2585+ }
2586+
2587+ public void setDescription(String description) {
2588+ this.description = description;
2589+ }
2590+
2591+
2592+ public List<String> getGradingsScale() {
2593+ return gradingsScale;
2594+ }
2595+
2596+
2597+ public void setGradingsScale(List<String> gradingsScale) {
2598+ this.gradingsScale = gradingsScale;
2599+ }
2600+}
2601Index: src/java/net/pingpong/iup/model/GradingType.java
2602===================================================================
2603--- src/java/net/pingpong/iup/model/GradingType.java (revision 44545)
2604+++ src/java/net/pingpong/iup/model/GradingType.java (working copy)
2605@@ -5,8 +5,18 @@
2606 *
2607 */
2608 public enum GradingType {
2609- WYSIWYG, NUMERIC_SCALE, IMAGE;
2610+ WYSIWYG(0), NUMERIC_SCALE(1), IMAGE(2);
2611
2612+ int num;
2613+
2614+ GradingType(int num){
2615+ this.num = num;
2616+ }
2617+
2618+ public int getNum(){
2619+ return num;
2620+ }
2621+
2622 public static GradingType fromOrdinal(int ordinal) {
2623 switch (ordinal) {
2624 case 0:
2625Index: src/webroot/pp/iup/personalSign.jsp
2626===================================================================
2627--- src/webroot/pp/iup/personalSign.jsp (revision 44545)
2628+++ src/webroot/pp/iup/personalSign.jsp (working copy)
2629@@ -344,12 +344,12 @@
2630 value="${selectedGradings[subject.id]}" />
2631 <div class="separator">
2632 <div>
2633- ${gradingDescription}
2634+ ${subject.gradings.description}
2635 </div>
2636
2637 <c:forEach items="${gradingsForSubjects}" var="gradingForSubject">
2638
2639- <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${gradingScale}" gradingType="${gradingType}"/>
2640+ <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${subject.gradings.gradingsScaleGui}" gradingType="${subject.gradings.type}"/>
2641
2642 </c:forEach>
2643 </div>
2644Index: src/java/net/pingpong/iup/handler/IupHandler.java
2645===================================================================
2646--- src/java/net/pingpong/iup/handler/IupHandler.java (revision 44545)
2647+++ src/java/net/pingpong/iup/handler/IupHandler.java (working copy)
2648@@ -31,12 +31,15 @@
2649 import net.pingpong.custom.skolplatsen.SkolplatsenMethods;
2650 import net.pingpong.iup.dao.IupDAO;
2651 import net.pingpong.iup.model.AttendanceEntry;
2652+import net.pingpong.iup.model.AttendanceEntry.EntryStatus;
2653 import net.pingpong.iup.model.IPPRole;
2654 import net.pingpong.iup.model.Iup;
2655 import net.pingpong.iup.model.IupField;
2656 import net.pingpong.iup.model.IupFieldContent;
2657+import net.pingpong.iup.model.IupGradings;
2658 import net.pingpong.iup.model.IupGroupSettings;
2659-import net.pingpong.iup.model.IupSelectedGrading;
2660+import net.pingpong.iup.model.IupLockedSubject;
2661+import net.pingpong.iup.model.IupSelectedLockedGrading;
2662 import net.pingpong.iup.model.IupSubject;
2663 import net.pingpong.iup.model.IupSubjectComment;
2664 import net.pingpong.iup.model.IupSubjectCommentAttachedLogBookEntry;
2665@@ -45,7 +48,6 @@
2666 import net.pingpong.iup.model.IupTemplate;
2667 import net.pingpong.iup.model.ProgramOfMeasures;
2668 import net.pingpong.iup.model.SearchHit;
2669-import net.pingpong.iup.model.AttendanceEntry.EntryStatus;
2670 import net.pingpong.node.handler.NodeHandler;
2671 import net.pingpong.progress.CourseObjectivesHandler;
2672 import net.pingpong.progress.ObjectiveCompletion;
2673@@ -345,6 +347,11 @@
2674 return dao.getSubject(id);
2675 }
2676
2677+
2678+ public IupLockedSubject getLockedSubject(Integer id) {
2679+ return dao.getLockedSubject(id);
2680+ }
2681+
2682
2683 public IupSubjectGoal getSubjectGoal(Iup iup, IupSubject subject) {
2684 return dao.getSubjectGoal(iup, subject);
2685@@ -593,6 +600,17 @@
2686 return dao.getGroupSettings(person);
2687 }
2688
2689+
2690+ public List<IupGradings> getGradings(Person person) {
2691+ return dao.getGradings(person);
2692+ }
2693+
2694+ public IupGradings getGradings(Integer gradeId) {
2695+ if(gradeId == null){
2696+ return null;
2697+ }
2698+ return dao.getGradings(gradeId);
2699+ }
2700
2701 /**
2702 * Get the groupsettings for precisely that group, i.e. does not walk up to
2703@@ -604,8 +622,7 @@
2704 public IupGroupSettings getGroupSettings(Group group) {
2705 return dao.getGroupSettings(group);
2706 }
2707-
2708-
2709+
2710 public Integer getNextGroupSettingsSeq(Provider provider) {
2711 return dao.getNextGroupSettingsSeq(provider);
2712 }
2713@@ -860,16 +877,16 @@
2714
2715 if (attendanceViewingStart == null || attendanceViewingEnd == null) {
2716
2717- for (IupSubject subject : iup.getSubjects()) {
2718- attendanceEntries.put(subject.getId(), AttendanceEntry.getAttendanceNotStoredEntry(iupUser, subject));
2719+ for (IupLockedSubject lockedSubject : iup.getLockedSubjects()) {
2720+ attendanceEntries.put(lockedSubject.getOriginalSubject().getId(), AttendanceEntry.getAttendanceNotStoredEntry(iupUser, lockedSubject.getOriginalSubject()));
2721 }
2722
2723 } else if (attendanceViewingEnd.after(new Date())) {
2724
2725- for (IupSubject subject : iup.getSubjects()) {
2726+ for (IupLockedSubject lockedSubject : iup.getLockedSubjects()) {
2727 AttendanceEntry attendanceNotStoredYetEntry = AttendanceEntry.getAttendanceNotStoredYetEntry(iupUser,
2728- subject, attendanceViewingStart, attendanceViewingEnd);
2729- attendanceEntries.put(subject.getId(), attendanceNotStoredYetEntry);
2730+ lockedSubject.getOriginalSubject(), attendanceViewingStart, attendanceViewingEnd);
2731+ attendanceEntries.put(lockedSubject.getOriginalSubject().getId(), attendanceNotStoredYetEntry);
2732 }
2733
2734 } else {
2735@@ -879,24 +896,24 @@
2736 attendancePerSubject = dao.getCachedAttendanceForSubjects(iup);
2737 }
2738
2739- for (IupSubject subject : iup.getSubjects()) {
2740+ for (IupLockedSubject lockedSubject : iup.getLockedSubjects()) {
2741
2742 AttendanceEntry entry;
2743- if (attendancePerSubject != null && attendancePerSubject.containsKey(subject)) {
2744- entry = new AttendanceEntry(iupUser, subject);
2745+ if (attendancePerSubject != null && attendancePerSubject.containsKey(lockedSubject)) {
2746+ entry = new AttendanceEntry(iupUser, lockedSubject.getOriginalSubject());
2747
2748- entry.setAttendedPercentage(attendancePerSubject.get(subject));
2749+ entry.setAttendedPercentage(attendancePerSubject.get(lockedSubject));
2750 entry.setEnd(attendanceViewingEnd);
2751 entry.setStart(attendanceViewingStart);
2752 entry.setStatus(AttendanceEntry.EntryStatus.OK);
2753
2754 } else {
2755- entry = getAttendanceForSubject(iupUser, subject, attendanceViewingStart, attendanceViewingEnd);
2756+ entry = getAttendanceForSubject(iupUser, lockedSubject.getOriginalSubject(), attendanceViewingStart, attendanceViewingEnd);
2757 if (entry.getStatus() == EntryStatus.OK) {
2758- dao.saveCachedAttendanceForSubject(iup, subject, entry.getAttendedPercentage());
2759+ dao.saveCachedAttendanceForSubject(iup, lockedSubject.getOriginalSubject(), entry.getAttendedPercentage());
2760 }
2761 }
2762- attendanceEntries.put(subject.getId(), entry);
2763+ attendanceEntries.put(lockedSubject.getOriginalSubject().getId(), entry);
2764 }
2765
2766 }
2767@@ -1069,8 +1086,8 @@
2768
2769 Set<PPCalendarEvent> calendarEventsForSubject = new HashSet<PPCalendarEvent>();
2770
2771- for (IupSubject subject : iup.getSubjects()) {
2772- calendarEventsForSubject.addAll(getCalendarEventsForSubject(iupUser, subject, attendanceViewingStart,
2773+ for (IupLockedSubject lockedSubject : iup.getLockedSubjects()) {
2774+ calendarEventsForSubject.addAll(getCalendarEventsForSubject(iupUser, lockedSubject.getOriginalSubject(), attendanceViewingStart,
2775 attendanceViewingEnd));
2776 }
2777
2778@@ -1236,8 +1253,8 @@
2779 * The iup to get the gradings for.
2780 * @return a map from Subject:ids to IupSubjectPesonGrading:s.
2781 */
2782- public List<IupSelectedGrading> getSelectedPublishedGradings(Iup iup) {
2783- return dao.getSelectedPublishedGradings(iup);
2784+ public List<IupSelectedLockedGrading> getSelectedPublishedLockedGradings(Iup iup) {
2785+ return dao.getSelectedPublishedLockedGradings(iup);
2786 }
2787
2788
2789@@ -1249,8 +1266,8 @@
2790 * The iup to get the gradings for.
2791 * @return a map from Subject:ids to IupSubjectPesonGrading:s.
2792 */
2793- public List<IupSelectedGrading> getSelectedUnpublishedGradings(Iup iup) {
2794- return dao.getSelectedUnpublishedGradings(iup);
2795+ public List<IupSelectedLockedGrading> getSelectedUnpublishedLockedGradings(Iup iup) {
2796+ return dao.getSelectedUnpublishedLockedGradings(iup);
2797 }
2798
2799
2800@@ -1284,13 +1301,13 @@
2801 }
2802
2803
2804- public List<IupSelectedGrading> getPublishedGradingsForSubject(IupSubject subject, Group group) {
2805- return dao.getGradingsForSubject(subject, group, true);
2806+ public List<IupSelectedLockedGrading> getPublishedGradingsForLockedSubject(Integer subjectId, Group group) {
2807+ return dao.getGradingsForLockedSubject(subjectId, group, true);
2808 }
2809
2810
2811- public List<IupSelectedGrading> getUnpublishedGradingsForSubject(IupSubject subject, Group group) {
2812- return dao.getGradingsForSubject(subject, group, false);
2813+ public List<IupSelectedLockedGrading> getUnpublishedGradingsForLockedSubject(Integer subjectId, Group group) {
2814+ return dao.getGradingsForLockedSubject(subjectId, group, false);
2815 }
2816
2817
2818Index: src/java/net/pingpong/resources/ApplicationResources_en_US.properties
2819===================================================================
2820--- src/java/net/pingpong/resources/ApplicationResources_en_US.properties (revision 44624)
2821+++ src/java/net/pingpong/resources/ApplicationResources_en_US.properties (working copy)
2822@@ -1,8 +1,8 @@
2823 aboutpp=<p>{0} is a complete Learning Management System (LMS) for e-learning and Knowledge management. Within an intuitive, user-centred interface, {0} provides a total solution for the training needs of large organisations and educational institutions.</p>
2824+aboutpp.custom=
2825 aboutpp.people=<br /><h2>Version</h2><p><i>{0}</i></p>\n<br /><h2>Technical development</h2>\n<p>{1}.</p><br /><h2>Graphics</h2>\n<p>{2}.</p><br /><h2>Marketing</h2>\n<p>{3}.</p><br /><h2>Customer and Partner education</h2>\n<p>{4}.</p>
2826 aboutpp.thanks-to=<br /><h2>Acknowledgements</h2>\n<p>{0} uses icons from <a href\="http\://tango.freedesktop.org/Tango_Desktop_Project" target\="_blank">The Tango Desktop Project</a></p>
2827 aboutpp.the-system=About the system
2828-aboutpp.custom=
2829 access-denied.description.1=You are not authorized to view this page/file.
2830 access-denied.description.2=Please contact your support for more information.
2831 access-denied.page-title=Access denied
2832@@ -728,6 +728,9 @@
2833 at.events.choose-groups.program=Highlight groups which the grouping event is to become part of
2834 at.events.content-lang=Content language:
2835 at.events.copy-done.jsalert=To finish the copying, click Save!
2836+at.events.copy-done.nodefiles-not-copied.info-plural=These files could not be copied, since they were not owned by the event:
2837+at.events.copy-done.nodefiles-not-copied.info-plural.show-files={0} files
2838+at.events.copy-done.nodefiles-not-copied.info-singular=This file could not be copied, since it was not owned by the event:
2839 at.events.copy-event=Copy event
2840 at.events.copy-event-info=This function has moved. Search for the event and then click the Copy button.
2841 at.events.create-event-info=<table cellpadding=8 cellspacing=0><tr><td class=atHeader>Create and edit events</td></tr><tr><td>Create and edit events here. To create a new event, click <i>New event</i> below.</td></tr><tr><td>To search for a new event, use one of four search methods on the left or a combination of these.</td></tr><tr><td>1. The drop down list above shows all groups of activities you have access to. When you select a group, its content will be listed at the bottom of the screen.</td></tr><tr><td>2. Search for an activity by entering the first part of its name in the search field. All hits are displayed at the bottom of the screen. You can also search by group name.</td></tr><tr><td>3. Click on the first letter of the name of the event required. All hits are listed at the bottom of the screen.</td></tr><tr><td><table border=0 cellpadding=2 cellspacing=0><tr><td colspan=2>4. You can search through the group hierarchy using the symbols above the bottom list:</td></tr><tr><td width=30 align=center>{0}</td><td>Go back to the previous level once you have opened a group.</td></tr><tr><td width=30 align=center>{1}</td><td>Open the group you have selected in order to view its content.</td></tr><tr><td width=30 align=center>{2}</td><td>Show all groups and events in all subordinate levels for the group selected.</td></tr><tr><td width=30 align=center>{3}</td><td>Display information on a selected event or group.</td></tr></table></td></tr><tr><td>When the event you are searching for appears in the list at the bottom, you can highlight the name and click <i>Edit</i> to view the event.</td></tr></table>
2842@@ -913,6 +916,8 @@
2843 at.importpeople.progress.item3=Events and groups
2844 at.importpeople.progress.item4=Preview
2845 at.importpeople.progress.item5=User details
2846+at.importpeople.removed-group=(* Removed)
2847+at.importpeople.removed-group.info=* This is the Removed group for the organisation. When added to it, all other memberships are cancelled (but not for system groups).
2848 at.importpeople.step1.confirm-delete.jsalert=Are you sure you want to remove the template?
2849 at.importpeople.step1.file=Import file
2850 at.importpeople.step1.info=<b>Step 1 (5). Upload file.</b><br>You can create user accounts here by importing personal details from an external file.
2851@@ -983,8 +988,6 @@
2852 at.importpeople.step5.not-imported=Excluded from the import
2853 at.importpeople.step5.updated=Updated user accounts
2854 at.importpoeple.step3.no-license-selected.jsalert=Select licence
2855-at.importpeople.removed-group=(* Removed)
2856-at.importpeople.removed-group.info=* This is the Removed group for the organisation. When added to it, all other memberships are cancelled (but not for system groups).
2857 at.license.no-person-selected.jsalert=You have to highlight at least one person
2858 at.license.to-few-tokens.jsalert=Organisation has too few tokens
2859 at.mail.subject=Information from PING PONG
2860@@ -997,7 +1000,7 @@
2861 at.mailer.error.no-recipients=The message was NOT sent because there were no recipients.
2862 at.mailer.heading=Create mail
2863 at.mailer.info=Here you can create a message to send by e-mail or PIM. If you want to reuse messages and be able to use them as templates, then choose <i>Save as template</i>. To use a template, click on its name in the <i>Templates</i>-list.
2864-at.mailer.infoNote=Note: if the variable %password% is used, a new password will be generated for the user(s).
2865+at.mailer.infoNote=Note: If you choose to include the variable %password%, two different things can happen: Users who have never previously logged in will be given a new password, generated automatically by PING PONG. Users who have previously logged in will see the text, "Your usual password" - not their actual passwords.
2866 at.mailer.message-sent=The message has been sent.
2867 at.mailer.message.heading=Create message
2868 at.mailer.options=Options
2869@@ -2352,9 +2355,9 @@
2870 contenteditor.menu.export=Export...
2871 contenteditor.menu.import=Import...
2872 contenteditor.node.fetching=Fetching...
2873-contenteditor.order.horizontally=Horizontally
2874+contenteditor.order.horizontally=Horizontally (suitable for short answer alternatives)
2875 contenteditor.order.present-direction.label=Present answer choices:
2876-contenteditor.order.vertically=Vertically
2877+contenteditor.order.vertically=Vertically (suitable for longer answer alternatives)
2878 contenteditor.overview=Overview
2879 contenteditor.page-containing-audio.description=Add a page using this imported audio file.
2880 contenteditor.page-containing-audio.title=Page with audio
2881@@ -2773,7 +2776,7 @@
2882 course-question-questions.show.next=Next
2883 course-question-questions.show.previous=Back
2884 course-question.add-question-to-faq=I want to add the question and the answer to the <i>FAQ</i>
2885-course-question.answer-with-pim=Send reply as PIM
2886+course-question.answer-with-pim=Send reply as PIM also
2887 course-question.ask-question.title=Ask questions
2888 course-question.caption.show-reply.label=Answered question
2889 course-question.jsalert.confirm-remove=Do you really want to remove the question and the answer?\\nNote that it will be removed for all trainers.
2890@@ -5849,6 +5852,7 @@
2891 iup.admin.info=Manage ILP documents here.
2892 iup.admin.info.heading=<h4>Working with ILPs</h4>
2893 iup.admin.iup.add=Create an ILP document for the person
2894+iup.admin.iup.already-exists=Note! The user already had an IPP. The reason that you see this message could be that you clicked several times on the Save button
2895 iup.admin.iup.confirm-remove=Are you sure you want to delete the ILP document?
2896 iup.admin.iup.create-for-all-in-group=Create ILP documents for every member of {0}
2897 iup.admin.iup.edit=Edit the ILP document
2898@@ -5871,8 +5875,8 @@
2899 iup.admin.iup.edit.program-of-measures.exists=Individualized Education Program exists
2900 iup.admin.iup.edit.program-of-measures.last-changed=Individualized Education Program last changed {0} by
2901 iup.admin.iup.edit.program-of-measures.needed=Individualized Education Program required
2902-iup.admin.iup.edit.program-of-measures.use=Use Individualized Education Program
2903 iup.admin.iup.edit.program-of-measures.no-measure=No Individualized Education Program exists
2904+iup.admin.iup.edit.program-of-measures.use=Use Individualized Education Program
2905 iup.admin.iup.edit.remove-subject=Click to delete the subject from the ILP document.
2906 iup.admin.iup.edit.require-parent-signature=Require the parent's/guardian's signature.
2907 iup.admin.iup.edit.require-student-signature=Require the learner's signature.
2908@@ -5885,12 +5889,12 @@
2909 iup.admin.iup.saved=The settings for {0} has been saved
2910 iup.admin.iup.write.close=Close
2911 iup.admin.iup.write.closed=Closed
2912+iup.admin.iup.write.de-sign=Remove signature from the ILP document
2913 iup.admin.iup.write.info=This is where you as a trainer write <i>Objective</i> and <i>Methods</i> for a person's ILP. When you are finished, select <i>Sign</i>. Thereafter it is the user's turn to sign his or her ILP document.
2914 iup.admin.iup.write.info.non-mentor=This is where you can see <i>Objectives</i> and <i>Methods</i> for a person's ILP.
2915 iup.admin.iup.write.sign=Sign
2916 iup.admin.iup.write.signed=Signed
2917 iup.admin.iup.write.title=Write ILP
2918-iup.admin.iup.write.de-sign=De-sign the ILP document
2919 iup.admin.menu.arhive=Archive
2920 iup.admin.menu.caption.admin-conf=ILP Configuration
2921 iup.admin.menu.caption.admin-handle=ILP Administration
2922@@ -5933,6 +5937,7 @@
2923 iup.admin.store-iup.error.name-is-required=Name is mandatory.
2924 iup.admin.subject.gradings=Assessment grades
2925 iup.admin.subject.gradings.use=This subject can have assessment grades.
2926+iup.admin.subject.gradings.none=None
2927 iup.admin.subjects.edit.info=This is where you edit a subject to be used in an ILP document. If you set a link, an information symbol will appear by the subject, leading to the link. If you select an event group, only users that are trainers in any event in the group can add comments for the subject.
2928 iup.admin.subjects.edit.page-title=Edit the subject
2929 iup.admin.subjects.info=This is where you specify subjects. An ILP document can contain multiple subjects. You can comment on the subjects in a person's ILP document and write <i>Objectives</i> and <i>Methods</i> for a subject. If the subject is connected to an event group, only the trainers for those events can comment on the subject.
2930@@ -5993,7 +5998,6 @@
2931 iup.comment.print.choose-type.teachers=Trainer's comments
2932 iup.comment.search-hits.info=Note! Only people with an active ILP document are shown in the list. Click on a person's name to write comments.
2933 iup.comment.search-hits.no-hits=No people/groups were found
2934-iup.general.no-search-yet.info=Make a search in the fields in the side.
2935 iup.comment.search.group.select-group=Select a group
2936 iup.comment.signed-by-mentor=The ILP document was signed {0} by the mentor
2937 iup.comment.signed-by-parent=The ILP document was signed {0} by the parent/guardian
2938@@ -6003,12 +6007,12 @@
2939 iup.comment.user.only-one-at-a-time.gradings.jsalert=First save or cancel the assessment grade you are currently composing
2940 iup.comment.user.only-one-at-a-time.measure.jsalert=First save or cancel the Individualized Education Program you are currently composing
2941 iup.comment.user.only-one-at-a-time.report.jsalert=First save or cancel the report you are currently composing
2942+iup.comments.info.number-of-items.one=1 comment/assessment
2943+iup.comments.info.number-of-items.plural={0} comments/assessments
2944 iup.comments.no-comments=No comments
2945-iup.comments.previous-iup-comments=Comments on previous ILP document
2946-iup.comments.info.number-of-items.one=1 comment/report
2947-iup.comments.info.number-of-items.plural={0} comments/reports
2948 iup.comments.open-all-subjects=Open all subjects
2949 iup.comments.open-all-subjects.info=The subject boxes are closed to get a better overview. You can open them one by one or all at once.
2950+iup.comments.previous-iup-comments=Comments on previous ILP document
2951 iup.confirm-message.compulsory-school-subject-created=Subjects from The Swedish National Agency for Education has been created.
2952 iup.current-name=Active ILP document
2953 iup.document=ILP document
2954@@ -6017,11 +6021,13 @@
2955 iup.field=ILP field
2956 iup.fields=ILP fields
2957 iup.fields.short=ILP fields
2958+iup.general.no-search-yet.info=Make a search in the one of the fields here on the side of the page.
2959 iup.goal=Goal
2960 iup.gradings.change-type.jsalert=The current type of gradings settings can\\\'t be converted to the chosen type and will be deleted. Continue anyway?
2961 iup.gradings.choose-image=Choose file
2962 iup.gradings.comment=Comment:
2963 iup.gradings.description=Description
2964+iup.gradings.name=Name
2965 iup.gradings.grading-type=Settings for scale
2966 iup.gradings.grading-type.images=Clickable images
2967 iup.gradings.grading-type.numbers=Numbers
2968@@ -6032,6 +6038,7 @@
2969 iup.gradings.no-gradings=No assessment grades created.
2970 iup.gradings.short=Assessment grade
2971 iup.gradings.step-number=Step {0}
2972+iup.gradings.error.name-is-required=Name is mandatory.
2973 iup.iup.name=Name of the ILP document
2974 iup.link.header=Link
2975 iup.login.failed=Login failed. Incorrect password
2976@@ -6046,6 +6053,7 @@
2977 iup.new-subject.confirm-message.subject-created=The subject has been created.
2978 iup.new-subject.error.name-is-required=Name is mandatory.
2979 iup.new-subject.error.user-group-is-required=User group is mandatory.
2980+iup.new-subject.error.user-grade-is-required=Grade is mandatory.
2981 iup.parent-have-read=Parent/guardian {0} has read the document {1}
2982 iup.personal.active-iup.can-comment=The ILP document can be commented on.
2983 iup.personal.active-iup.can-comment.parent=The child's ILP document can be commented on.
2984@@ -6414,6 +6422,8 @@
2985 library.menu.button.copy=Copy
2986 library.menu.button.move=Move
2987 library.menu.destination=Destination
2988+library.menu.disabled-reason.select-exactly-1=Select only one document/folder for this operation
2989+library.menu.disabled-reason.select-minimum-1=Select at least one document/folder for this operation
2990 library.menu.jsalert.confirm-remove=Are you sure you want to delete the selected files?
2991 library.menu.jsalert.no-selection=Select only one document/folder to edit.
2992 library.menu.link.comment=Comment
2993@@ -8409,10 +8419,9 @@
2994 portlet.google.wikipedia=Wikipedia
2995 portlet.google.youtube=YouTube
2996 portlet.guide.caption=PING PONG Guide
2997-portlet.skolplatsen=Attendance record
2998 portlet.skolplatsen.parent=Attendance record for my child
2999-portlet.skolplatsen.student=Attendance record
3000-portlet.skolplatsen.teacher=Attendance record administration
3001+portlet.skolplatsen.student=Attendance record for learner
3002+portlet.skolplatsen.teacher=Attendance record administration for trainer
3003 portlet.sl=SL
3004 portlet.vasttrafik=V�sttrafik
3005 portlets.admin-mode.button.push=To all in group
3006@@ -9110,12 +9119,12 @@
3007 report.overview.global.new-report.days-back.2m=Two months
3008 report.overview.global.new-report.days-back.3m=Three months
3009 report.overview.global.new-report.days-back.6m=Six months
3010-report.overview.global.new-report.days-back.years={0} years
3011-report.overview.global.new-report.days-back.w=week
3012-report.overview.global.new-report.days-back.ws=weeks
3013 report.overview.global.new-report.days-back.m=month
3014 report.overview.global.new-report.days-back.ms=months
3015+report.overview.global.new-report.days-back.w=week
3016+report.overview.global.new-report.days-back.ws=weeks
3017 report.overview.global.new-report.days-back.y=year
3018+report.overview.global.new-report.days-back.years={0} years
3019 report.overview.global.new-report.days-back.ys=years
3020 report.overview.global.new-report.heading=New report
3021 report.overview.global.new-report.progressbar-message=This type of report may take several minutes to create.
3022@@ -9560,8 +9569,8 @@
3023 rte.access-denied-groupmembership=Group membership required: {0}
3024 rte.access-denied-objective=Objective completion required: {0}
3025 rte.access-denied-starttime=Page accessible from: {0}
3026-rte.access-denied.due-to-being-inside-folder=(due to it being inside the folder <em>{0}</em>)
3027 rte.access-denied.description=The page <em>{0}</em> has the following access restrictions (marked in red=conditions not met):
3028+rte.access-denied.due-to-being-inside-folder=(due to it being inside the folder <em>{0}</em>)
3029 rte.back-to-search=Back to search '${0}'
3030 rte.bookmark.link=Last visited page: {0}
3031 rte.category-score-line.label={0}: {1}% correct ({2} marks out of {3} possible)
3032@@ -10016,6 +10025,8 @@
3033 server-stat.diagram.active-users-over-time.active-teachers=Active trainers
3034 server-stat.diagram.active-users-over-time.active-users=Active users
3035 server-stat.diagram.active-users-over-time.info=This diagram shows the number of active users in the organisation over time.
3036+server-stat.diagram.note-about-total-courses=Please note that the total graph can be less the sum of the two other graphs, because the total graph removes any possible duplicates
3037+server-stat.diagram.note-about-total-users=Please note that the total graph can be less the sum of the two other graphs, because the total graph removes any possible duplicates
3038 server-stat.diagram.number-of-courses-over-time=Number of events over time
3039 server-stat.diagram.number-of-courses-over-time.info=This diagram shows the number of events in the organisation over time.
3040 server-stat.diagram.number-of-logins=Number of logins
3041@@ -10028,8 +10039,6 @@
3042 server-stat.diagram.time-distribution.total=Total
3043 server-stat.diagram.user-distribution=User distribution
3044 server-stat.diagram.user-distribution.info=This diagram shows the distribution of different kind of users in the organisation.
3045-server-stat.diagram.note-about-total-users=Please note that the total graph can be less the sum of the two other graphs, because the total graph removes any possible duplicates
3046-server-stat.diagram.note-about-total-courses=Please note that the total graph can be less the sum of the two other graphs, because the total graph removes any possible duplicates
3047 server-stat.heading.activity=Activity
3048 server-stat.heading.logins=Logins
3049 server-stat.list.active-courses=Active events
3050@@ -10996,3 +11005,6 @@
3051 wysiwyg.i18n.variables.title=Variabel
3052 wysiwyg.i18n.variables.user-variables=USER VARIABLES
3053 yyyy-MM-dd=yyyy-mm-dd
3054+
3055+system.overload.heading=The system load is high at the moment
3056+system.overload.info=Right now the system is under high load. We anticipate that the load will decrease shortly and you can help by waiting a couple of minutes before you use the system again.
3057Index: src/java/net/pingpong/iup/model/IupLockedSubject.java
3058===================================================================
3059--- src/java/net/pingpong/iup/model/IupLockedSubject.java (revision 0)
3060+++ src/java/net/pingpong/iup/model/IupLockedSubject.java (revision 0)
3061@@ -0,0 +1,161 @@
3062+/*
3063+ * Copyright 1997-2006 Ping Pong AB
3064+ * Created on 2006-jul-31 by kudo
3065+ * $Id: IupSubject.java 40953 2009-11-30 22:49:45Z girgen $
3066+ */
3067+
3068+package net.pingpong.iup.model;
3069+
3070+public class IupLockedSubject {
3071+
3072+ private Integer lockedSubjectId;
3073+ private String name;
3074+ private String description;
3075+ private String url;
3076+ private boolean useMeasures;
3077+ private IupLockedGradings lockedGradings;
3078+ private IupSubject originalSubject;
3079+ private int pos = 0;
3080+
3081+ public void copyFromIupSubject(IupSubject subject){
3082+ setName(subject.getName());
3083+ setDescription(subject.getDescription());
3084+ setUrl(subject.getUrl());
3085+ setUseMeasures(subject.isUseMeasures());
3086+ if(subject.getGradings() != null){
3087+ IupLockedGradings ilg = new IupLockedGradings();
3088+ ilg.copyFromGradings(subject.getGradings());
3089+ setLockedGradings(ilg);
3090+ }
3091+ setOriginalSubject(subject);
3092+ }
3093+
3094+ public void copyToIupSubject(IupSubject subject){
3095+ subject.setId(getOriginalSubject().getId());
3096+ subject.setName(getName());
3097+ subject.setDescription(getDescription());
3098+ subject.setUrl(getUrl());
3099+ subject.setUseMeasures(isUseMeasures());
3100+ IupLockedGradings ilg = getLockedGradings();
3101+ if(ilg != null){
3102+ IupGradings ig = new IupGradings();
3103+ ilg.copyToGradings(ig);
3104+ subject.setGradings(ig);
3105+ }
3106+ }
3107+
3108+ @Override
3109+ public boolean equals(Object o) {
3110+ if (!(o instanceof IupLockedSubject)) return false;
3111+
3112+ IupLockedSubject s = (IupLockedSubject) o;
3113+ return (s.getLockedSubjectId().equals(this.getLockedSubjectId()));
3114+ }
3115+
3116+ @Override
3117+ public int hashCode() {
3118+ return getLockedSubjectId();
3119+ }
3120+
3121+ /**
3122+ * @return Returns the name.
3123+ */
3124+ public String getName() {
3125+ return name;
3126+ }
3127+
3128+
3129+ /**
3130+ * @param name
3131+ * The name to set.
3132+ */
3133+ public void setName(String name) {
3134+ this.name = name;
3135+ }
3136+
3137+
3138+ /**
3139+ * @return Returns the url.
3140+ */
3141+ public String getUrl() {
3142+ return url;
3143+ }
3144+
3145+
3146+ /**
3147+ * @param url
3148+ * The url to set.
3149+ */
3150+ public void setUrl(String url) {
3151+ this.url = url;
3152+ }
3153+
3154+
3155+ public String getDescription() {
3156+ return description;
3157+ }
3158+
3159+
3160+ public void setDescription(String description) {
3161+ this.description = description;
3162+ }
3163+
3164+
3165+ /**
3166+ * NOTE: This is necessary since hashCode() depends on id not being null, so
3167+ * debug output could cause NPE when calling toString() on this object
3168+ * before it has been saved.
3169+ */
3170+ @Override
3171+ public String toString() {
3172+ return this.getClass().getSimpleName() + "[id=" + lockedSubjectId + "]";
3173+ }
3174+
3175+
3176+ public boolean isUseMeasures() {
3177+ return useMeasures;
3178+ }
3179+
3180+
3181+ public void setUseMeasures(boolean useMeasures) {
3182+ this.useMeasures = useMeasures;
3183+ }
3184+
3185+
3186+ public IupLockedGradings getLockedGradings() {
3187+ return lockedGradings;
3188+ }
3189+
3190+
3191+ public void setLockedGradings(IupLockedGradings lockedGradings) {
3192+ this.lockedGradings = lockedGradings;
3193+ }
3194+
3195+
3196+ public Integer getLockedSubjectId() {
3197+ return lockedSubjectId;
3198+ }
3199+
3200+
3201+ public void setLockedSubjectId(Integer lockedSubjectId) {
3202+ this.lockedSubjectId = lockedSubjectId;
3203+ }
3204+
3205+
3206+ public IupSubject getOriginalSubject() {
3207+ return originalSubject;
3208+ }
3209+
3210+
3211+ public void setOriginalSubject(IupSubject originalSubject) {
3212+ this.originalSubject = originalSubject;
3213+ }
3214+
3215+ public int getPos() {
3216+ return pos;
3217+ }
3218+
3219+ public void setPos(int pos) {
3220+ this.pos = pos;
3221+ }
3222+}
3223Index: src/java/net/pingpong/iup/model/IupSubject.java
3224===================================================================
3225--- src/java/net/pingpong/iup/model/IupSubject.java (revision 44545)
3226+++ src/java/net/pingpong/iup/model/IupSubject.java (working copy)
3227@@ -25,15 +25,12 @@
3228 private String url;
3229 private boolean deleted;
3230 private Set<Group> groups;
3231-
3232 private Group userGroup;
3233-
3234 private Provider giver;
3235
3236 private boolean useMeasures;
3237- private boolean useGradings;
3238-
3239-
3240+ private IupGradings gradings;
3241+
3242 @Override
3243 public boolean equals(Object o) {
3244 if (!(o instanceof IupSubject)) return false;
3245@@ -168,16 +165,6 @@
3246 }
3247
3248
3249- public boolean isUseGradings() {
3250- return useGradings;
3251- }
3252-
3253-
3254- public void setUseGradings(boolean useGradings) {
3255- this.useGradings = useGradings;
3256- }
3257-
3258-
3259 public Group getUserGroup() {
3260 return userGroup;
3261 }
3262@@ -187,4 +174,13 @@
3263 this.userGroup = userGroup;
3264 }
3265
3266+
3267+ public IupGradings getGradings() {
3268+ return gradings;
3269+ }
3270+
3271+
3272+ public void setGradings(IupGradings gradings) {
3273+ this.gradings = gradings;
3274+ }
3275 }
3276Index: src/java/net/pingpong/iup/struts/IupAdminSubjectsEditAction.java
3277===================================================================
3278--- src/java/net/pingpong/iup/struts/IupAdminSubjectsEditAction.java (revision 44545)
3279+++ src/java/net/pingpong/iup/struts/IupAdminSubjectsEditAction.java (working copy)
3280@@ -16,13 +16,16 @@
3281
3282 import net.pingpong.core.exception.ActionException;
3283 import net.pingpong.core.exception.BusinessLogicException;
3284+import net.pingpong.core.handler.GroupHandler;
3285 import net.pingpong.core.handler.RoleHandler;
3286 import net.pingpong.core.model.Group;
3287 import net.pingpong.core.model.Person;
3288 import net.pingpong.core.model.User;
3289 import net.pingpong.iup.handler.IupHandler;
3290 import net.pingpong.iup.model.IPPRole;
3291+import net.pingpong.iup.model.IupGradings;
3292 import net.pingpong.iup.model.IupSubject;
3293+import net.pingpong.iup.struts.IupAdminGradingsAction.AssessmentGradingBean;
3294
3295 import org.apache.struts.action.ActionForm;
3296 import org.apache.struts.action.ActionForward;
3297@@ -50,10 +53,13 @@
3298 HttpServletRequest request, HttpServletResponse response) throws ActionException, BusinessLogicException,
3299 Exception {
3300 IupAdminSubjectsForm form = (IupAdminSubjectsForm) actionForm;
3301-
3302+ form.setEditGradings(true);
3303+ IupHandler handler = (IupHandler) getBean(IupHandler.BEAN_ID);
3304+
3305 Integer subjectId = form.getSubjectId();
3306+ IupGradings selectedGrading = null;
3307 if (subjectId != null && subjectId != 0 && !failedValidation(request)) {
3308- IupHandler handler = (IupHandler) getBean(IupHandler.BEAN_ID);
3309+
3310 IupSubject subject = handler.getSubject(subjectId);
3311 form.reset(mapping, request);
3312 form.setName(subject.getName());
3313@@ -61,7 +67,12 @@
3314 form.setLink(subject.getUrl());
3315 form.setSubjectId(subject.getId());
3316 form.setUseMeasures(subject.isUseMeasures());
3317- form.setUseGradings(subject.isUseGradings());
3318+ if(subject.getGradings() != null){
3319+ selectedGrading = subject.getGradings();
3320+ form.setGradeId(selectedGrading.getGradingsId());
3321+ form.setEditGradings(false);
3322+ }
3323+
3324 form.setUserGroup(new String[] {
3325 subject.getUserGroup().getId().toString()
3326 });
3327@@ -75,6 +86,67 @@
3328 form.setEventGroups(groups);
3329 }
3330 }
3331+
3332+ List<IupGradings> igs = handler.getGradings(person);
3333+ List<AssessmentGradingBean> gradeList = new ArrayList<AssessmentGradingBean>();
3334+ GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
3335+
3336+ for (IupGradings ig : igs) {
3337+ if (ig.getType() != null) {
3338+ IupAdminGradingsAction iaga = new IupAdminGradingsAction();
3339+ IupAdminGradingsAction.AssessmentGradingBean bean = iaga.new AssessmentGradingBean();
3340+ bean.setId(ig.getGradingsId());
3341+
3342+ Group group = groupHandler.getGroup(ig.getGroupId());
3343+ String groupName = group.getName(user.getLocale().getLanguage()).getName();
3344+ bean.setGroupName(groupName);
3345+ bean.setDescription(ig.getDescription());
3346+ bean.setName(ig.getName());
3347+ gradeList.add(bean);
3348+
3349+ if(selectedGrading != null){
3350+ if(ig.getGradingsId().equals(selectedGrading.getGradingsId())){
3351+ form.setEditGradings(true);
3352+ }
3353+ }
3354+ }
3355+ }
3356+
3357+ if(selectedGrading != null && !form.isEditGradings()){
3358+ IupAdminGradingsAction iaga = new IupAdminGradingsAction();
3359+ IupAdminGradingsAction.AssessmentGradingBean bean = iaga.new AssessmentGradingBean();
3360+ bean.setId(selectedGrading.getGradingsId());
3361+
3362+ Group group = groupHandler.getGroup(selectedGrading.getGroupId());
3363+ String groupName = group.getName(user.getLocale().getLanguage()).getName();
3364+ bean.setGroupName(groupName);
3365+ bean.setDescription(selectedGrading.getDescription());
3366+ bean.setName(selectedGrading.getName());
3367+ request.setAttribute("selectedGradings", bean);
3368+ }
3369+
3370+
3371+// List<IupGroupSettings> groups = handler.getGroupSettings(person);
3372+// List<AssessmentGradingBean> gradeList = new ArrayList<AssessmentGradingBean>();
3373+// int seq = 1;
3374+// for (IupGroupSettings groupSetting : groups) {
3375+// // Check that the group has guides
3376+// if (groupSetting.getGradingType() != null) {
3377+// IupAdminGradingsAction iaga = new IupAdminGradingsAction();
3378+// IupAdminGradingsAction.AssessmentGradingBean bean = iaga.new AssessmentGradingBean();
3379+// bean.setId(groupSetting.getGroup().getId());
3380+// bean.setSeq(seq++);
3381+// bean.setGroupName(groupSetting.getGroup().getName(user.getLocale().getLanguage()).getName());
3382+// bean.setDescription(groupSetting.getGradingDescription());
3383+// gradeList.add(bean);
3384+// }
3385+// }
3386+
3387+
3388+ request.setAttribute("noGradeId", IupGradings.NO_GRADINGS_ID);
3389+ request.setAttribute("gradeList", gradeList);
3390+ request.setAttribute("editGradings", form.isEditGradings());
3391+
3392 RoleHandler roleHandler = getBean(RoleHandler.class);
3393 List<Group> courseGroups = roleHandler.getTopGroups(User.ROLE_IUP_COURSE, person);
3394 request.setAttribute("courseGroups", courseGroups);
3395Index: src/java/net/pingpong/iup/struts/IupPersonalArchiveShowPrintAction.java
3396===================================================================
3397--- src/java/net/pingpong/iup/struts/IupPersonalArchiveShowPrintAction.java (revision 44545)
3398+++ src/java/net/pingpong/iup/struts/IupPersonalArchiveShowPrintAction.java (working copy)
3399@@ -27,7 +27,8 @@
3400 import net.pingpong.iup.model.AttendanceEntry;
3401 import net.pingpong.iup.model.IPPRole;
3402 import net.pingpong.iup.model.Iup;
3403-import net.pingpong.iup.model.IupSelectedGrading;
3404+import net.pingpong.iup.model.IupLockedSubject;
3405+import net.pingpong.iup.model.IupSelectedLockedGrading;
3406 import net.pingpong.iup.model.IupSubject;
3407 import net.pingpong.iup.model.IupSubjectComment;
3408 import net.pingpong.iup.model.IupSubjectGoal;
3409@@ -78,25 +79,28 @@
3410 if (iup != null && iup.getPerson().equals(iupUser)) {
3411 request.setAttribute("iup", iup);
3412
3413- List<IupSubject> subjectsToShow = null;
3414+ List<IupSubject> subjects;
3415 if ("some".equals(iupAdminPrintForm.getSubjectSelector())) {
3416- subjectsToShow = new ArrayList<IupSubject>();
3417+ subjects = new ArrayList<IupSubject>();
3418 String[] subjectToShowArray = iupAdminPrintForm.getSubjects();
3419 if (subjectToShowArray != null && subjectToShowArray.length > 0) {
3420 for (String subjectIdAsString : subjectToShowArray) {
3421- subjectsToShow.add(iupHandler.getSubject(Integer.valueOf(subjectIdAsString)));
3422+ IupLockedSubject lockedSubject = iupHandler.getLockedSubject(Integer.valueOf(subjectIdAsString));
3423+ IupSubject subject = lockedSubject.getOriginalSubject();
3424+ lockedSubject.copyToIupSubject(subject);
3425+ subjects.add(subject);
3426 }
3427 }
3428 } else {
3429- subjectsToShow = iup.getSubjects();
3430+ subjects = iup.getOriginalSubjects();
3431 }
3432
3433- request.setAttribute("iupSubjects", subjectsToShow);
3434+ request.setAttribute("iupSubjects", subjects);
3435
3436- if (!subjectsToShow.isEmpty()) {
3437+ if (!subjects.isEmpty()) {
3438
3439 Set<Integer> subjectIdsToShow = new HashSet<Integer>();
3440- for (IupSubject subject : subjectsToShow) {
3441+ for (IupSubject subject : subjects) {
3442 subjectIdsToShow.add(subject.getId());
3443 }
3444
3445@@ -146,7 +150,7 @@
3446 request.setAttribute("useMeasures", Boolean.TRUE);
3447
3448 Map<Integer, ProgramOfMeasures> programsOfMeasures = iupHandler.getProgramsOfMeasures(iup,
3449- subjectsToShow);
3450+ subjects);
3451 request.setAttribute("programsOfMeasures", programsOfMeasures);
3452
3453 request.setAttribute("measuresNeeded", iup.isMeasuresNeeded());
3454@@ -159,25 +163,25 @@
3455
3456 Boolean showAssessmentGradings = iupAdminPrintForm.getShowAssessmentGradings();
3457
3458- if (showAssessmentGradings && iup.usesGradings()) {
3459-
3460+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
3461+ for (IupSubject subject : subjects) {
3462+ if(subject.getGradings() != null){
3463+ subjectsWithGradings.add(subject.getId());
3464+ }
3465+ }
3466+ if (showAssessmentGradings && subjectsWithGradings.size() > 0) {
3467 request.setAttribute("useGradings", Boolean.TRUE);
3468-
3469- Set<Integer> subjectsWithGradings = iup.getSubjectsWithGradings();
3470 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
3471- request.setAttribute("gradingDescription", iup.getGradingDescription());
3472- request.setAttribute("gradingType", iup.getGradingType());
3473- request.setAttribute("gradingScale", iup.getGradingScale());
3474
3475- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
3476+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
3477
3478- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(iup)) {
3479+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(iup)) {
3480
3481 Integer subjectId = selectedGrading.getSubject().getId();
3482
3483- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
3484+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
3485 if (listOfSelectedGradings == null) {
3486- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
3487+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
3488 }
3489 listOfSelectedGradings.add(selectedGrading);
3490
3491Index: src/java/net/pingpong/iup/struts/IupCommentUserAction.java
3492===================================================================
3493--- src/java/net/pingpong/iup/struts/IupCommentUserAction.java (revision 44608)
3494+++ src/java/net/pingpong/iup/struts/IupCommentUserAction.java (working copy)
3495@@ -36,8 +36,10 @@
3496 import net.pingpong.iup.model.GradingType;
3497 import net.pingpong.iup.model.IPPRole;
3498 import net.pingpong.iup.model.Iup;
3499+import net.pingpong.iup.model.IupGradings;
3500 import net.pingpong.iup.model.IupGroupSettings;
3501-import net.pingpong.iup.model.IupSelectedGrading;
3502+import net.pingpong.iup.model.IupLockedSubject;
3503+import net.pingpong.iup.model.IupSelectedLockedGrading;
3504 import net.pingpong.iup.model.IupSubject;
3505 import net.pingpong.iup.model.IupSubjectComment;
3506 import net.pingpong.iup.model.IupSubjectGoal;
3507@@ -111,7 +113,7 @@
3508 /**
3509 * Can be null if the user haven't made a selection yet.
3510 */
3511- private IupSelectedGrading selectedGrading;
3512+ private IupSelectedLockedGrading selectedLockedGrading;
3513
3514
3515 public boolean isCanEditSelection() {
3516@@ -124,13 +126,13 @@
3517 }
3518
3519
3520- public IupSelectedGrading getSelectedGrading() {
3521- return selectedGrading;
3522+ public IupSelectedLockedGrading getSelectedLockedGrading() {
3523+ return selectedLockedGrading;
3524 }
3525
3526
3527- public void setSelectedGrading(IupSelectedGrading selectedGrading) {
3528- this.selectedGrading = selectedGrading;
3529+ public void setSelectedLockedGrading(IupSelectedLockedGrading selectedLockedGrading) {
3530+ this.selectedLockedGrading = selectedLockedGrading;
3531 }
3532 }
3533
3534@@ -216,6 +218,14 @@
3535 String redirectUrl = WebUtil.appendParameter(urls.get("reload"), "userid", iupUser.getUserid());
3536
3537 Integer subjectId = iupRestrictedActionForm.getSubjectId();
3538+
3539+ // save the comment on the locked subject id
3540+ IupLockedSubject lockedSubject = iup.getLockedSubjectWithOriginalId(subjectId);
3541+ Integer lockedSubjectId = null;
3542+ if(lockedSubject != null){
3543+ lockedSubjectId = lockedSubject.getLockedSubjectId();
3544+ }
3545+
3546 redirectUrl = WebUtil.appendParameter(redirectUrl, "openSubjectId", subjectId.toString());
3547
3548 Integer iupSubjectCommentId = null;
3549@@ -274,14 +284,14 @@
3550
3551 } else if (request.getParameter("gradings") != null) {
3552 if (request.getParameter("removeGrading") != null) {
3553- if (canRemoveGrading(person, iup, subjectId)) {
3554- iupHandler.removeGrading(person, iupId, subjectId);
3555+ if (canRemoveGrading(person, iup, lockedSubjectId)) {
3556+ iupHandler.removeGrading(person, iupId, lockedSubjectId);
3557 }
3558
3559 } else {
3560 iupHandler
3561- .saveGrading(person, viewerRole, iupId, iupRestrictedActionForm.getSubjectId(),
3562- new Integer(request.getParameter("selectedGrading")), request
3563+ .saveGrading(person, viewerRole, iupId, lockedSubjectId,
3564+ new Integer(request.getParameter("selectedLockedGrading")), request
3565 .getParameter("gradingComment"),
3566 request.getParameter("publishGrading") != null);
3567 }
3568@@ -338,10 +348,12 @@
3569
3570 request.setAttribute("activeIup", activeIup);
3571 List<IupSubject> subjects = new ArrayList<IupSubject>();
3572- for (IupSubject subject : activeIup.getSubjects()) {
3573+ for (IupLockedSubject lockedSubject : activeIup.getLockedSubjects()) {
3574 if (viewerRole == IPPRole.PARTICIPANT
3575 || viewerRole == IPPRole.PARENT
3576- || iupHandler.canTeacherAccessSubject(subject, person)) {
3577+ || iupHandler.canTeacherAccessSubject(lockedSubject.getOriginalSubject(), person)) {
3578+ IupSubject subject = lockedSubject.getOriginalSubject();
3579+ lockedSubject.copyToIupSubject(subject);
3580 subjects.add(subject);
3581 }
3582 }
3583@@ -357,6 +369,16 @@
3584 }
3585 request.setAttribute("items", items);
3586
3587+ // add resize img if that grade type is selected
3588+ for(IupSubject subject : subjects){
3589+ IupGradings grades = subject.getGradings();
3590+ if(grades != null){
3591+ grades.setGradingsScale(IupCommentUserAction.transformGradingsForProvider(person.getGiver(),
3592+ grades.getType(),
3593+ grades.getGradingsScale()));
3594+ }
3595+ }
3596+
3597 request.setAttribute("iupSubjects", subjects);
3598 if (attendanceViewing) {
3599 if (activeIup.isAttendancePerSubject()) {
3600@@ -385,17 +407,18 @@
3601 request.setAttribute("measuresLastChangedOn", activeIup.getMeasuresChangedOn());
3602 }
3603
3604- if (activeIup.usesGradings()) {
3605-
3606+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
3607+ for (IupSubject subject : subjects) {
3608+ if(subject.getGradings() != null){
3609+ subjectsWithGradings.add(subject.getId());
3610+ }
3611+ }
3612+
3613+ if (subjectsWithGradings.size() > 0) {
3614 request.setAttribute("useGradings", Boolean.TRUE);
3615
3616- Set<Integer> subjectsWithGradings = activeIup.getSubjectsWithGradings();
3617 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
3618- request.setAttribute("gradingDescription", activeIup.getGradingDescription());
3619- request.setAttribute("gradingType", activeIup.getGradingType());
3620- request.setAttribute("gradingScale", transformGradingsForProvider(person.getGiver(), activeIup
3621- .getGradingType(), activeIup.getGradingScale()));
3622-
3623+
3624 Map<Integer, List<IupSelectedGradingGUI>> selectedPublishedGradings = new HashMap<Integer, List<IupSelectedGradingGUI>>();
3625 Map<Integer, List<IupSelectedGradingGUI>> selectedUnpublishedGradings = new HashMap<Integer, List<IupSelectedGradingGUI>>();
3626 Set<Integer> subjectsWithoutSelectedGradingByUser = null;
3627@@ -406,68 +429,16 @@
3628 Date lastSigning = activeIup.getLastSigning();
3629
3630 // Setup published gradings (the ones we show)
3631- for (IupSelectedGrading selectedPublishedGrading : iupHandler.getSelectedPublishedGradings(activeIup)) {
3632- IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3633-
3634- Integer subjectId = selectedPublishedGrading.getSubject().getId();
3635-
3636- iupSelectedGradingGUI.setSelectedGrading(selectedPublishedGrading);
3637-
3638- List<IupSelectedGradingGUI> listOfSelectedGradings = selectedPublishedGradings.get(subjectId);
3639- if (listOfSelectedGradings == null) {
3640- listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3641- }
3642- listOfSelectedGradings.add(iupSelectedGradingGUI);
3643-
3644- selectedPublishedGradings.put(subjectId, listOfSelectedGradings);
3645- }
3646+ setupPublichedGradings(activeIup, selectedPublishedGradings);
3647
3648 // Setup un-published gradings (the ones we edit)
3649- Map<Integer, Boolean> canRemoveGradingMap = new HashMap<Integer, Boolean>();
3650- request.setAttribute("canRemoveGradingMap", canRemoveGradingMap);
3651- for (IupSelectedGrading selectedUnpublishedGrading : iupHandler
3652- .getSelectedUnpublishedGradings(activeIup)) {
3653- IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3654-
3655- Integer subjectId = selectedUnpublishedGrading.getSubject().getId();
3656- canRemoveGradingMap.put(subjectId, canRemoveGrading(person, activeIup, subjectId));
3657-
3658- // User himself can edit if IUP not signed yet
3659- if (subjectsWithoutSelectedGradingByUser != null
3660- && selectedUnpublishedGrading.getCreatedBy().equals(person)) {
3661- subjectsWithoutSelectedGradingByUser.remove(subjectId);
3662-
3663- if (lastSigning == null || lastSigning.before(selectedUnpublishedGrading.getChanged())) {
3664- iupSelectedGradingGUI.setCanEditSelection(true);
3665- }
3666- }
3667- iupSelectedGradingGUI.setSelectedGrading(selectedUnpublishedGrading);
3668-
3669- List<IupSelectedGradingGUI> listOfSelectedGradings = selectedUnpublishedGradings.get(subjectId);
3670- if (listOfSelectedGradings == null) {
3671- listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3672- }
3673- listOfSelectedGradings.add(iupSelectedGradingGUI);
3674-
3675- selectedUnpublishedGradings.put(subjectId, listOfSelectedGradings);
3676- }
3677+ setupUnPublishedGradings(person, request, activeIup, selectedUnpublishedGradings,
3678+ subjectsWithoutSelectedGradingByUser, lastSigning);
3679
3680 // Prepare for subjects without selected grading by user
3681 if (subjectsWithoutSelectedGradingByUser != null) {
3682- for (Integer subjectWithoutGradingByUser : subjectsWithoutSelectedGradingByUser) {
3683- IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3684- iupSelectedGradingGUI.setCanEditSelection(true);
3685- iupSelectedGradingGUI.selectedGrading = null;
3686-
3687- List<IupSelectedGradingGUI> listOfSelectedGradings = selectedPublishedGradings
3688- .get(subjectWithoutGradingByUser);
3689- if (listOfSelectedGradings == null) {
3690- listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3691- }
3692- listOfSelectedGradings.add(iupSelectedGradingGUI);
3693-
3694- selectedUnpublishedGradings.put(subjectWithoutGradingByUser, listOfSelectedGradings);
3695- }
3696+ prepareSubjectsWithoutSelectedGrading(selectedPublishedGradings, selectedUnpublishedGradings,
3697+ subjectsWithoutSelectedGradingByUser);
3698 }
3699 request.setAttribute("selectedPublishedGradings", selectedPublishedGradings);
3700 request.setAttribute("selectedUnpublishedGradings", selectedUnpublishedGradings);
3701@@ -503,30 +474,106 @@
3702 }
3703
3704
3705+ private void prepareSubjectsWithoutSelectedGrading(
3706+ Map<Integer, List<IupSelectedGradingGUI>> selectedPublishedGradings,
3707+ Map<Integer, List<IupSelectedGradingGUI>> selectedUnpublishedGradings,
3708+ Set<Integer> subjectsWithoutSelectedGradingByUser) {
3709+ for (Integer subjectWithoutGradingByUser : subjectsWithoutSelectedGradingByUser) {
3710+ IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3711+ iupSelectedGradingGUI.setCanEditSelection(true);
3712+ iupSelectedGradingGUI.selectedLockedGrading = null;
3713+
3714+ List<IupSelectedGradingGUI> listOfSelectedGradings = selectedPublishedGradings
3715+ .get(subjectWithoutGradingByUser);
3716+ if (listOfSelectedGradings == null) {
3717+ listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3718+ }
3719+ listOfSelectedGradings.add(iupSelectedGradingGUI);
3720+
3721+ selectedUnpublishedGradings.put(subjectWithoutGradingByUser, listOfSelectedGradings);
3722+ }
3723+ }
3724+
3725+
3726+ private void setupUnPublishedGradings(Person person, HttpServletRequest request, Iup activeIup,
3727+ Map<Integer, List<IupSelectedGradingGUI>> selectedUnpublishedGradings,
3728+ Set<Integer> subjectsWithoutSelectedGradingByUser, Date lastSigning) {
3729+ Map<Integer, Boolean> canRemoveGradingMap = new HashMap<Integer, Boolean>();
3730+ request.setAttribute("canRemoveGradingMap", canRemoveGradingMap);
3731+ for (IupSelectedLockedGrading selectedUnpublishedLockedGrading : iupHandler
3732+ .getSelectedUnpublishedLockedGradings(activeIup)) {
3733+ IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3734+
3735+ Integer subjectId = selectedUnpublishedLockedGrading.getSubject().getId();
3736+
3737+ canRemoveGradingMap.put(subjectId, canRemoveGrading(person, activeIup, subjectId));
3738+
3739+ // User himself can edit if IUP not signed yet
3740+ if (subjectsWithoutSelectedGradingByUser != null
3741+ && selectedUnpublishedLockedGrading.getCreatedBy().equals(person)) {
3742+ subjectsWithoutSelectedGradingByUser.remove(subjectId);
3743+
3744+ if (lastSigning == null || lastSigning.before(selectedUnpublishedLockedGrading.getChanged())) {
3745+ iupSelectedGradingGUI.setCanEditSelection(true);
3746+ }
3747+ }
3748+ iupSelectedGradingGUI.setSelectedLockedGrading(selectedUnpublishedLockedGrading);
3749+
3750+ List<IupSelectedGradingGUI> listOfSelectedGradings = selectedUnpublishedGradings.get(subjectId);
3751+ if (listOfSelectedGradings == null) {
3752+ listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3753+ }
3754+ listOfSelectedGradings.add(iupSelectedGradingGUI);
3755+
3756+ selectedUnpublishedGradings.put(subjectId, listOfSelectedGradings);
3757+ }
3758+ }
3759+
3760+
3761+ private void setupPublichedGradings(Iup activeIup,
3762+ Map<Integer, List<IupSelectedGradingGUI>> selectedPublishedGradings) {
3763+ for (IupSelectedLockedGrading selectedPublishedLockedGrading : iupHandler.getSelectedPublishedLockedGradings(activeIup)) {
3764+ IupSelectedGradingGUI iupSelectedGradingGUI = new IupSelectedGradingGUI();
3765+
3766+ Integer subjectId = selectedPublishedLockedGrading.getSubject().getId();
3767+
3768+ iupSelectedGradingGUI.setSelectedLockedGrading(selectedPublishedLockedGrading);
3769+
3770+ List<IupSelectedGradingGUI> listOfSelectedGradings = selectedPublishedGradings.get(subjectId);
3771+ if (listOfSelectedGradings == null) {
3772+ listOfSelectedGradings = new ArrayList<IupSelectedGradingGUI>();
3773+ }
3774+ listOfSelectedGradings.add(iupSelectedGradingGUI);
3775+
3776+ selectedPublishedGradings.put(subjectId, listOfSelectedGradings);
3777+ }
3778+ }
3779+
3780+
3781 public static boolean canRemoveGrading(Person person, Iup iup, Integer subjectId) {
3782 IupHandler iupHandler = getBean(IupHandler.class);
3783- List<IupSelectedGrading> publishedGradings = iupHandler.getSelectedPublishedGradings(iup);
3784- List<IupSelectedGrading> gradingsForSubject = new ArrayList<IupSelectedGrading>();
3785- for (IupSelectedGrading grading : publishedGradings) {
3786- if (grading.getSubject().getId().equals(subjectId)) {
3787- gradingsForSubject.add(grading);
3788+ List<IupSelectedLockedGrading> publishedLockedGradings = iupHandler.getSelectedPublishedLockedGradings(iup);
3789+ List<IupSelectedLockedGrading> lockedGradingsForSubject = new ArrayList<IupSelectedLockedGrading>();
3790+ for (IupSelectedLockedGrading lockedGrading : publishedLockedGradings) {
3791+ if (lockedGrading.getSubject().getId().equals(subjectId)) {
3792+ lockedGradingsForSubject.add(lockedGrading);
3793 }
3794 }
3795- Collections.sort(gradingsForSubject, new Comparator<IupSelectedGrading>() {
3796+ Collections.sort(lockedGradingsForSubject, new Comparator<IupSelectedLockedGrading>() {
3797
3798 @Override
3799- public int compare(IupSelectedGrading o1, IupSelectedGrading o2) {
3800+ public int compare(IupSelectedLockedGrading o1, IupSelectedLockedGrading o2) {
3801 // Yeah, yeah, user can publish his grading and get it last in
3802 // the list. We need a created date perhaps.
3803 return o1.getChanged().compareTo(o2.getChanged());
3804 }
3805 });
3806- if (gradingsForSubject.size() == 0) {
3807+ if (lockedGradingsForSubject.size() == 0) {
3808 return false;
3809 }
3810
3811 // If users own grading is last now, it can be removed
3812- IupSelectedGrading grading = gradingsForSubject.get(gradingsForSubject.size() - 1);
3813+ IupSelectedLockedGrading grading = lockedGradingsForSubject.get(lockedGradingsForSubject.size() - 1);
3814 return grading.getCreatedBy().equals(person);
3815 }
3816
3817@@ -535,6 +582,7 @@
3818 List<String> gradingScale) {
3819 if (gradingType == GradingType.IMAGE) {
3820 int maxSize = giver.getSettings().getIupGradingImageMaxSize();
3821+
3822 List<String> imageGradings = new ArrayList<String>();
3823 Pattern pattern = Pattern.compile("^(/node.do\\?)id=(\\d+)$");
3824 for (String nodeUrl : gradingScale) {
3825Index: src/java/net/pingpong/iup/struts/IupCommentUserSelectPrintAction.java
3826===================================================================
3827--- src/java/net/pingpong/iup/struts/IupCommentUserSelectPrintAction.java (revision 44545)
3828+++ src/java/net/pingpong/iup/struts/IupCommentUserSelectPrintAction.java (working copy)
3829@@ -75,7 +75,7 @@
3830
3831 request.setAttribute("activeIup", iupToUse);
3832 List<IupSubject> subjects = new ArrayList<IupSubject>();
3833- for (IupSubject subject : iupToUse.getSubjects()) {
3834+ for (IupSubject subject : iupToUse.getOriginalSubjects()) {
3835 if (ippRole == IPPRole.PARTICIPANT
3836 || ippRole == IPPRole.PARENT
3837 || iupHandler.canTeacherAccessSubject(subject, person)) {
3838@@ -121,7 +121,14 @@
3839 request.setAttribute("useMeasures", true);
3840 iupAdminPrintForm.setShowProgramOfMeasures(true);
3841 }
3842- if (iupToUse.usesGradings()) {
3843+
3844+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
3845+ for (IupSubject subject : subjects) {
3846+ if(subject.getGradings() != null){
3847+ subjectsWithGradings.add(subject.getId());
3848+ }
3849+ }
3850+ if (subjectsWithGradings.size() > 0) {
3851 request.setAttribute("useGradings", true);
3852 iupAdminPrintForm.setShowAssessmentGradings(true);
3853 }
3854Index: src/webroot/pp/iup/commentUser.jsp
3855===================================================================
3856--- src/webroot/pp/iup/commentUser.jsp (revision 44545)
3857+++ src/webroot/pp/iup/commentUser.jsp (working copy)
3858@@ -202,7 +202,7 @@
3859
3860 </div>
3861
3862- <c:if test="${fn:length(activeIup.subjects) != 0 && !activeIup.subjectsCommentsOnly}">
3863+ <c:if test="${fn:length(activeIup.lockedSubjects) != 0 && !activeIup.subjectsCommentsOnly}">
3864
3865 <h:expandCollaps headerKey="iup.goal" defaultExpanded="false" styleId="iup-goals-expand">
3866 <br /><br />
3867@@ -273,7 +273,7 @@
3868
3869 <c:forEach items="${iupSubjects}" var="subject">
3870
3871- <c:set var="firstSeparator" value="true" />
3872+ <c:set var="firstSeparator" value="true" />
3873
3874 <bean:define id="caption">
3875 ${subject.name}
3876@@ -381,6 +381,7 @@
3877
3878 ============================================================================================== --%>
3879 <c:if test="${useGradings && pp:containsObject(subjectsWithGradings, subject.id)}">
3880+ <c:set var="gradings" value="${subject.gradings}" />
3881 <c:set var="publishedGradingsForSubjects" value="${selectedPublishedGradings[subject.id]}" />
3882 <%-- Selected Gradings ALWAYS reside in unpublished form if they exist at all --%>
3883 <c:set var="unpublishedGradingsForSubjects" value="${selectedUnpublishedGradings[subject.id]}" />
3884@@ -389,16 +390,16 @@
3885 <c:if test="${firstSeparator}">
3886 <c:set var="firstSeparator" value="false" />
3887 </c:if>
3888- <div>${gradingDescription}</div>
3889+ <div>${gradings.description}</div>
3890 <br />
3891
3892 <%-- Show gradings --%>
3893 <c:forEach items="${publishedGradingsForSubjects}" var="gradingForSubjectGUI">
3894- <c:set var="gradingForSubject" value="${gradingForSubjectGUI.selectedGrading}" />
3895+ <c:set var="gradingForSubject" value="${gradingForSubjectGUI.selectedLockedGrading}" />
3896 <c:set var="gradingUserId" value="${gradingForSubject.createdBy.userid}" />
3897 <c:if test="${gradingForSubject != null}">
3898 <div id="gradingsDisplay${subject.id}_${gradingUserId}" style="display: block;">
3899- <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${gradingScale}" gradingType="${gradingType}" isoDate="false" />
3900+ <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${gradings.gradingsScale}" gradingType="${gradings.type}" isoDate="false" />
3901 <br />
3902 </div>
3903 </c:if>
3904@@ -406,7 +407,7 @@
3905
3906 <%-- Edit gradings --%>
3907 <c:forEach items="${unpublishedGradingsForSubjects}" var="gradingForSubjectGUI">
3908- <c:set var="gradingForSubject" value="${gradingForSubjectGUI.selectedGrading}" />
3909+ <c:set var="gradingForSubject" value="${gradingForSubjectGUI.selectedLockedGrading}" />
3910 <c:set var="gradingUserId" value="${gradingForSubject.createdBy.userid}" />
3911 <c:if test="${gradingForSubjectGUI.canEditSelection}">
3912
3913@@ -434,27 +435,26 @@
3914 <input type="hidden" name="<%= IupRestrictedAction.IPP_ROLE_PARAMETER_NAME %>"
3915 value="<%= ((IPPRole)session.getAttribute(IupRestrictedAction.IPP_ROLE_PARAMETER)).name() %>" />
3916 <input type="hidden" name="gradings" value="true" />
3917-
3918 <table class="iupGradingScale">
3919 <tr>
3920- <c:forEach items="${gradingScale}" var="gradingScaleStep" varStatus="counter">
3921- <td class="${gradingForSubject.selectedGrading == counter.index ? "iupGrading-selected" : "iupGrading-unselected"}">
3922+ <c:forEach items="${gradings.gradingsScale}" var="gradingScaleStep" varStatus="counter">
3923+ <td class="${gradingForSubject.selectedLockedGrading == counter.index ? "iupGrading-selected" : "iupGrading-unselected"}">
3924 <table>
3925 <tr>
3926 <td class="iupGrading-select" >
3927 <input type="radio"
3928- name="selectedGrading"
3929+ name="selectedLockedGrading"
3930 value="${counter.index}"
3931- id="selectedGrading${subject.id}_${counter.index}"
3932- ${gradingForSubject.selectedGrading == counter.index ? 'checked="checked"' : ""}
3933+ id="selectedLockedGrading${subject.id}_${counter.index}"
3934+ ${gradingForSubject.selectedLockedGrading == counter.index ? 'checked="checked"' : ""}
3935 onclick="enableButton('saveButton_${subject.id}'); enableButton('publishButton_${subject.id}');"
3936 />
3937 </td>
3938- <td onclick="$('selectedGrading${subject.id}_${counter.index}').checked = 'checked'; enableButton('saveButton_${subject.id}'); enableButton('publishButton_${subject.id}');">
3939- <c:if test="${gradingType == 'WYSIWYG' || gradingType == 'NUMERIC_SCALE'}">
3940+ <td onclick="$('selectedLockedGrading${subject.id}_${counter.index}').checked = 'checked'; enableButton('saveButton_${subject.id}'); enableButton('publishButton_${subject.id}');">
3941+ <c:if test="${gradings.type == 'WYSIWYG' || gradings.type == 'NUMERIC_SCALE'}">
3942 ${gradingScaleStep}
3943 </c:if>
3944- <c:if test="${gradingType == 'IMAGE'}">
3945+ <c:if test="${gradings.type == 'IMAGE'}">
3946 <div style="text-align:center; width: ${userPerson.giver.settings.iupGradingImageMaxSize}px; height: ${userPerson.giver.settings.iupGradingImageMaxSize}px;">
3947 <img src="${gradingScaleStep}" />
3948 </div>
3949@@ -485,14 +485,14 @@
3950
3951 </c:if>
3952
3953- <h:submit disabled="${gradingForSubject.selectedGrading == null || preview != null ? 'true' : 'false'}" styleId="saveButton_${subject.id}">
3954+ <h:submit disabled="${gradingForSubject.selectedLockedGrading == null || preview != null ? 'true' : 'false'}" styleId="saveButton_${subject.id}">
3955 <bean:message key="general.button.save" />
3956 </h:submit>
3957- <input type="submit" name="publishGrading" class="button ${gradingForSubject.selectedGrading == null || preview != null ? 'disabled' : ''}"
3958- ${gradingForSubject.selectedGrading == null || preview != null ? 'disabled="disabled"' : ''}"
3959+ <input type="submit" name="publishGrading" class="button ${gradingForSubject.selectedLockedGrading == null || preview != null ? 'disabled' : ''}"
3960+ ${gradingForSubject.selectedLockedGrading == null || preview != null ? 'disabled="disabled"' : ''}"
3961 id="publishButton_${subject.id}"
3962 value='<bean:message key="general.button.publish" />' />
3963- <c:if test="${canRemoveGradingMap[subject.id] && gradingForSubject.selectedGrading != null}">
3964+ <c:if test="${canRemoveGradingMap[subject.id] && gradingForSubject.selectedLockedGrading != null}">
3965 <input type="submit" name="removeGrading" class="button"
3966 onclick="return confirm('<bean:message key="general.are-you-sure" />')"
3967 value="<bean:message key="general.button.remove" />" />
3968Index: src/webroot/pp/iup/IupShow.jsp
3969===================================================================
3970--- src/webroot/pp/iup/IupShow.jsp (revision 44545)
3971+++ src/webroot/pp/iup/IupShow.jsp (working copy)
3972@@ -216,7 +216,7 @@
3973
3974 <br />
3975 <c:if
3976- test="${fn:length(iup.subjects) != 0 && !iup.subjectsCommentsOnly}">
3977+ test="${fn:length(iup.lockedSubjects) != 0 && !iup.subjectsCommentsOnly}">
3978 <h:table id="iupPersonalArchiveShow" data="${items}" usePages="none"
3979 boxTable="true">
3980 <h:tableCol attribute="name">
3981@@ -420,12 +420,12 @@
3982 value="${selectedGradings[subject.id]}" />
3983 <div class="separator">
3984 <div>
3985- ${gradingDescription}
3986+ ${subject.gradings.description}
3987 </div>
3988
3989 <c:forEach items="${gradingsForSubjects}" var="gradingForSubject">
3990
3991- <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${gradingScale}" gradingType="${gradingType}"/>
3992+ <ppIupTag:assessmentGrading gradingForSubject="${gradingForSubject}" gradingScale="${subject.gradings.gradingsScale}" gradingType="${subject.gradings.type}"/>
3993
3994 </c:forEach>
3995 </div>
3996Index: src/webroot/WEB-INF/conf/struts-default.xml
3997===================================================================
3998--- src/webroot/WEB-INF/conf/struts-default.xml (revision 44545)
3999+++ src/webroot/WEB-INF/conf/struts-default.xml (working copy)
4000@@ -3341,17 +3341,17 @@
4001 <forward name="success" path=".iup.admin.gradings" />
4002 </action>
4003 <action path="/iupAdminGradingsEdit" type="net.pingpong.iup.struts.IupAdminGradingsEditAction"
4004- name="iupAdminGradingsForm" scope="request">
4005+ name="iupAdminGradingsForm" scope="request" validate="false">
4006 <forward name="success" path=".iup.admin.gradings.edit" />
4007 </action>
4008- <action path="/iupAdminGradingsChoicesEdit" name="iupAdminGradingsForm" forward="/pp/iup/adminGradingsChoices.jsp" />
4009+ <action path="/iupAdminGradingsChoicesEdit" name="iupAdminGradingsForm" forward="/pp/iup/adminGradingsChoices.jsp" validate="false" />
4010
4011 <action path="/iupAdminGradingsSave" type="net.pingpong.iup.struts.IupAdminGradingsSaveAction"
4012- name="iupAdminGradingsForm" scope="request" cancellable="true">
4013+ name="iupAdminGradingsForm" input="/iupAdminGradingsEdit.do" scope="request" cancellable="true" validate="true">
4014 <forward name="success" path="/iupAdminGradings.do" redirect="true"/>
4015 <forward name="cancel" path="/iupAdminGradings.do" redirect="true"/>
4016 </action>
4017- <action path="/iupAdminGradingsRemove" type="net.pingpong.iup.struts.IupAdminGradingsRemoveAction" name="iupRestrictedActionForm">
4018+ <action path="/iupAdminGradingsRemove" type="net.pingpong.iup.struts.IupAdminGradingsRemoveAction" name="iupAdminGradingsForm" validate="false">
4019 <forward name="success" path="/iupAdminGradings.do" redirect="true"/>
4020 </action>
4021
4022Index: src/java/net/pingpong/iup/struts/IupAdminSaveWriteIupAction.java
4023===================================================================
4024--- src/java/net/pingpong/iup/struts/IupAdminSaveWriteIupAction.java (revision 44545)
4025+++ src/java/net/pingpong/iup/struts/IupAdminSaveWriteIupAction.java (working copy)
4026@@ -24,7 +24,7 @@
4027 import net.pingpong.iup.model.IupField;
4028 import net.pingpong.iup.model.IupFieldContent;
4029 import net.pingpong.iup.model.IupGroupSettings;
4030-import net.pingpong.iup.model.IupSubject;
4031+import net.pingpong.iup.model.IupLockedSubject;
4032 import net.pingpong.iup.model.IupSubjectGoal;
4033 import net.pingpong.node.handler.NodeHandler;
4034
4035@@ -112,11 +112,11 @@
4036 }
4037
4038 // Goal and Road to goal
4039- for (IupSubject subject : activeIup.getSubjects()) {
4040- String goalText = request.getParameter("goalText" + subject.getId());
4041- String roadToGoalText = request.getParameter("roadToGoalText" + subject.getId());
4042+ for (IupLockedSubject subject : activeIup.getLockedSubjects()) {
4043+ String goalText = request.getParameter("goalText" + subject.getOriginalSubject().getId());
4044+ String roadToGoalText = request.getParameter("roadToGoalText" + subject.getOriginalSubject().getId());
4045 IupSubjectGoal goal = new IupSubjectGoal();
4046- goal.setEntryId(new IupSubjectGoal.EntryId(activeIup, subject));
4047+ goal.setEntryId(new IupSubjectGoal.EntryId(activeIup, subject.getOriginalSubject()));
4048 goal.setGoal(goalText);
4049 goal.setRoadToGoal(roadToGoalText);
4050 goal.setTs(new Date());
4051Index: src/java/net/pingpong/iup/struts/IupCommentUserPrintAction.java
4052===================================================================
4053--- src/java/net/pingpong/iup/struts/IupCommentUserPrintAction.java (revision 44545)
4054+++ src/java/net/pingpong/iup/struts/IupCommentUserPrintAction.java (working copy)
4055@@ -22,7 +22,8 @@
4056 import net.pingpong.iup.model.IPPRole;
4057 import net.pingpong.iup.model.Iup;
4058 import net.pingpong.iup.model.IupGroupSettings;
4059-import net.pingpong.iup.model.IupSelectedGrading;
4060+import net.pingpong.iup.model.IupLockedSubject;
4061+import net.pingpong.iup.model.IupSelectedLockedGrading;
4062 import net.pingpong.iup.model.IupSubject;
4063 import net.pingpong.iup.model.IupSubjectComment;
4064 import net.pingpong.iup.model.IupSubjectGoal;
4065@@ -80,11 +81,14 @@
4066 }
4067
4068 List<IupSubject> subjects = new ArrayList<IupSubject>();
4069- for (IupSubject subject : activeIup.getSubjects()) {
4070+
4071+ for (IupLockedSubject lockedSubject : activeIup.getLockedSubjects()) {
4072 if (viewerRole == IPPRole.PARTICIPANT
4073 || viewerRole == IPPRole.PARENT
4074- || iupHandler.canTeacherAccessSubject(subject, person)) {
4075- if (subjectsToShow == null || subjectsToShow.contains(subject.getId())) {
4076+ || iupHandler.canTeacherAccessSubject(lockedSubject.getOriginalSubject(), person)) {
4077+ if (subjectsToShow == null || subjectsToShow.contains(lockedSubject.getOriginalSubject().getId())) {
4078+ IupSubject subject = lockedSubject.getOriginalSubject();
4079+ lockedSubject.copyToIupSubject(subject);
4080 subjects.add(subject);
4081 }
4082 }
4083@@ -136,25 +140,25 @@
4084
4085 boolean showAssessmentGradings = iupAdminPrintForm.getShowAssessmentGradings();
4086
4087- if (showAssessmentGradings && activeIup.usesGradings()) {
4088-
4089+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
4090+ for (IupSubject subject : subjects) {
4091+ if(subject.getGradings() != null){
4092+ subjectsWithGradings.add(subject.getId());
4093+ }
4094+ }
4095+ if (showAssessmentGradings && subjectsWithGradings.size() > 0) {
4096 request.setAttribute("useGradings", Boolean.TRUE);
4097-
4098- Set<Integer> subjectsWithGradings = activeIup.getSubjectsWithGradings();
4099 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
4100- request.setAttribute("gradingDescription", activeIup.getGradingDescription());
4101- request.setAttribute("gradingType", activeIup.getGradingType());
4102- request.setAttribute("gradingScale", activeIup.getGradingScale());
4103+
4104+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
4105
4106- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
4107-
4108- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(activeIup)) {
4109+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(activeIup)) {
4110
4111 Integer subjectId = selectedGrading.getSubject().getId();
4112
4113- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
4114+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
4115 if (listOfSelectedGradings == null) {
4116- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
4117+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
4118 }
4119 listOfSelectedGradings.add(selectedGrading);
4120
4121Index: src/java/net/pingpong/iup/struts/IupAdminGradingsSaveAction.java
4122===================================================================
4123--- src/java/net/pingpong/iup/struts/IupAdminGradingsSaveAction.java (revision 44545)
4124+++ src/java/net/pingpong/iup/struts/IupAdminGradingsSaveAction.java (working copy)
4125@@ -13,14 +13,12 @@
4126
4127 import net.pingpong.core.exception.ActionException;
4128 import net.pingpong.core.exception.BusinessLogicException;
4129-import net.pingpong.core.handler.GroupHandler;
4130-import net.pingpong.core.model.Group;
4131 import net.pingpong.core.model.Person;
4132 import net.pingpong.core.model.User;
4133 import net.pingpong.iup.handler.IupHandler;
4134 import net.pingpong.iup.model.GradingType;
4135 import net.pingpong.iup.model.IPPRole;
4136-import net.pingpong.iup.model.IupGroupSettings;
4137+import net.pingpong.iup.model.IupGradings;
4138
4139 import org.apache.struts.action.ActionForm;
4140 import org.apache.struts.action.ActionForward;
4141@@ -53,24 +51,24 @@
4142 }
4143
4144 IupAdminGradingsForm form = (IupAdminGradingsForm) actionForm;
4145- GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
4146 Integer groupId = form.getGroupId();
4147
4148- Group group = groupHandler.getGroup(groupId);
4149 IupHandler iupHandler = (IupHandler) getBean(IupHandler.BEAN_ID);
4150- IupGroupSettings groupSettings = iupHandler.getGroupSettings(group);
4151- if (groupSettings == null) {
4152- groupSettings = new IupGroupSettings();
4153- groupSettings.setGroup(group);
4154- groupSettings.setProvider(person.getGiver());
4155- groupSettings.setSeq(iupHandler.getNextGroupSettingsSeq(person.getGiver()));
4156+// check this with org. why is group removed?
4157+ Integer gradeId = form.getGradeId();
4158+ IupGradings ig = iupHandler.getGradings(gradeId);
4159+ if (ig == null) {
4160+ ig = new IupGradings();
4161+ ig.setGroupId(groupId.intValue());
4162+ ig.setGiver(person.getGiver().getGiver());
4163 }
4164
4165- groupSettings.setGradingDescription(form.getDescription());
4166- groupSettings.setGradingType(GradingType.valueOf(form.getGradingType()));
4167- groupSettings.setGradings(Arrays.asList(form.getGradings()));
4168+ ig.setName(form.getName());
4169+ ig.setDescription(form.getDescription());
4170+ ig.setType(GradingType.valueOf(form.getGradingType()));
4171+ ig.setGradingsScale(Arrays.asList(form.getGradings()));
4172
4173- iupHandler.save(groupSettings);
4174+ iupHandler.save(ig);
4175
4176 return mapping.findForward(SUCCESS);
4177 }
4178Index: src/java/net/pingpong/iup/struts/IupAdminSubjectsSaveAction.java
4179===================================================================
4180--- src/java/net/pingpong/iup/struts/IupAdminSubjectsSaveAction.java (revision 44545)
4181+++ src/java/net/pingpong/iup/struts/IupAdminSubjectsSaveAction.java (working copy)
4182@@ -5,6 +5,7 @@
4183 package net.pingpong.iup.struts;
4184
4185 import java.util.HashSet;
4186+import java.util.List;
4187 import java.util.Set;
4188
4189 import javax.servlet.http.HttpServletRequest;
4190@@ -18,6 +19,7 @@
4191 import net.pingpong.core.model.User;
4192 import net.pingpong.iup.handler.IupHandler;
4193 import net.pingpong.iup.model.IPPRole;
4194+import net.pingpong.iup.model.IupGradings;
4195 import net.pingpong.iup.model.IupSubject;
4196
4197 import org.apache.struts.action.ActionForm;
4198@@ -65,8 +67,16 @@
4199 subject.setUrl(form.getLink());
4200 subject.setGiver(person.getGiver());
4201 subject.setUseMeasures(form.isUseMeasures());
4202- subject.setUseGradings(form.isUseGradings());
4203-
4204+
4205+ List<IupGradings> igs = handler.getGradings(person);
4206+ for(IupGradings grading: igs){
4207+ if(grading.getGradingsId().equals(form.getGradeId())){
4208+ subject.setGradings(handler.getGradings(form.getGradeId()));
4209+ break;
4210+ }
4211+ }
4212+
4213+
4214 GroupHandler groupHandler = (GroupHandler) getBean(GroupHandler.BEAN_ID);
4215 if (form.getEventGroups() != null) {
4216 Set<Group> groups = new HashSet<Group>();
4217Index: src/java/net/pingpong/iup/struts/IupAdminWriteIupAction.java
4218===================================================================
4219--- src/java/net/pingpong/iup/struts/IupAdminWriteIupAction.java (revision 44545)
4220+++ src/java/net/pingpong/iup/struts/IupAdminWriteIupAction.java (working copy)
4221@@ -30,7 +30,7 @@
4222 import net.pingpong.iup.model.Iup;
4223 import net.pingpong.iup.model.IupFieldContent;
4224 import net.pingpong.iup.model.IupGroupSettings;
4225-import net.pingpong.iup.model.IupSelectedGrading;
4226+import net.pingpong.iup.model.IupSelectedLockedGrading;
4227 import net.pingpong.iup.model.IupSubject;
4228 import net.pingpong.iup.model.IupSubjectComment;
4229 import net.pingpong.iup.model.IupSubjectGoal;
4230@@ -99,7 +99,8 @@
4231
4232 // Setup goal and road to goal
4233 List<Item> items = new ArrayList<Item>();
4234- List<IupSubject> subjects = activeIup.getSubjects();
4235+ List<IupSubject> subjects = activeIup.getOriginalSubjects();
4236+
4237 for (IupSubject subject : subjects) {
4238 IupSubjectGoal goal = iupHandler.getSubjectGoal(activeIup, subject);
4239 Item item = new Item();
4240@@ -167,25 +168,26 @@
4241 request.setAttribute("measuresLastChangedOn", activeIup.getMeasuresChangedOn());
4242 }
4243
4244- if (activeIup.usesGradings()) {
4245-
4246+ Set<Integer> subjectsWithGradings = new HashSet<Integer>();
4247+ for (IupSubject subject : subjects) {
4248+ if(subject.getGradings() != null){
4249+ subjectsWithGradings.add(subject.getId());
4250+ }
4251+ }
4252+
4253+ if (subjectsWithGradings.size() > 0) {
4254 request.setAttribute("useGradings", Boolean.TRUE);
4255-
4256- Set<Integer> subjectsWithGradings = activeIup.getSubjectsWithGradings();
4257 request.setAttribute("subjectsWithGradings", subjectsWithGradings);
4258- request.setAttribute("gradingDescription", activeIup.getGradingDescription());
4259- request.setAttribute("gradingType", activeIup.getGradingType());
4260- request.setAttribute("gradingScale", activeIup.getGradingScale());
4261+
4262+ Map<Integer, List<IupSelectedLockedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedLockedGrading>>();
4263
4264- Map<Integer, List<IupSelectedGrading>> selectedGradings = new HashMap<Integer, List<IupSelectedGrading>>();
4265-
4266- for (IupSelectedGrading selectedGrading : iupHandler.getSelectedPublishedGradings(activeIup)) {
4267+ for (IupSelectedLockedGrading selectedGrading : iupHandler.getSelectedPublishedLockedGradings(activeIup)) {
4268
4269 Integer subjectId = selectedGrading.getSubject().getId();
4270
4271- List<IupSelectedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
4272+ List<IupSelectedLockedGrading> listOfSelectedGradings = selectedGradings.get(subjectId);
4273 if (listOfSelectedGradings == null) {
4274- listOfSelectedGradings = new ArrayList<IupSelectedGrading>();
4275+ listOfSelectedGradings = new ArrayList<IupSelectedLockedGrading>();
4276 }
4277 listOfSelectedGradings.add(selectedGrading);