Skip to content

Commit

Permalink
SAK-26250 Syllabus: you can add item to calendar without dates
Browse files Browse the repository at this point in the history
git-svn-id: https://source.sakaiproject.org/svn/syllabus/trunk@309664 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
Bryan Holladay committed May 20, 2014
1 parent 73fbe3d commit 34e48e7
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jqueryDatePickerTimeFormat=hh:mm tt
empty_title_validate=Alert: Please specify a title.
empty_content_validate=Error:
invalid_dates=Alert: You must enter valid dates and the start date must be before the end date.
invalid_calendar=You must select a start date or end date before posting to the calendar.
attachment=Attachments
attachment_local=Local File
file_picker=From Resourses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ public String getDraftStatus() {

private boolean displayDateError=false;

private boolean displayCalendarError=false;

private boolean dontUpdateEntries = false;

private String evilTagMsg=null;
Expand Down Expand Up @@ -926,6 +928,7 @@ public String processEditCancel()
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
entries.clear();
entry = null;
attachments.clear();
Expand All @@ -943,6 +946,7 @@ public String processEditSave() throws PermissionException
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if (!this.checkAccess())
{
return "permission_error";
Expand Down Expand Up @@ -988,6 +992,8 @@ else if(entry.getEntry().getTitle().trim().equals(""))
displayDateError = true;
return "edit";
}
//calendar can not be posted to when it's saved as a draft
entry.getEntry().setLinkCalendar(false);
if (entry.justCreated == true)
{
syllabusManager.addSyllabusToSyllabusItem(syllabusItem, getEntry()
Expand Down Expand Up @@ -1171,6 +1177,7 @@ public String processEditPost() throws PermissionException
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if (!this.checkAccess())
{
return "permission_error";
Expand Down Expand Up @@ -1216,6 +1223,10 @@ else if(entry.getEntry().getTitle().trim().equals(""))
displayDateError = true;
return "edit";
}
if(entry.getEntry().getLinkCalendar() && entry.getEntry().getStartDate() == null && entry.getEntry().getEndDate() == null){
displayCalendarError = true;
return "edit";
}
if (entry.justCreated == true)
{
getEntry().getEntry().setStatus(SyllabusData.ITEM_POSTED);
Expand Down Expand Up @@ -1445,6 +1456,7 @@ public String processReadCancel()
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
entries.clear();
entry = null;
attachments.clear();
Expand All @@ -1462,6 +1474,7 @@ public String processReadSave() throws PermissionException
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if (!this.checkAccess())
{
return "permission_error";
Expand Down Expand Up @@ -1508,6 +1521,8 @@ else if(entry.getEntry().getTitle().trim().equals(""))
displayDateError = true;
return "edit";
}
//calendar can not be posted to when its a draft
entry.getEntry().setLinkCalendar(false);
if (entry.justCreated == false)
{
getEntry().getEntry().setStatus(SyllabusData.ITEM_DRAFT);
Expand Down Expand Up @@ -1558,6 +1573,7 @@ public String processReadPost() throws PermissionException
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if (!this.checkAccess())
{
return "permission_error";
Expand Down Expand Up @@ -1603,6 +1619,10 @@ else if(entry.getEntry().getTitle().trim().equals(""))
displayDateError = true;
return "read";
}
if(entry.getEntry().getLinkCalendar() && entry.getEntry().getStartDate() == null && entry.getEntry().getEndDate() == null){
displayCalendarError = true;
return "read";
}
if (entry.justCreated == false)
{
getEntry().getEntry().setStatus(SyllabusData.ITEM_POSTED);
Expand Down Expand Up @@ -1730,6 +1750,7 @@ public String processEditPreview()
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if(entry.getEntry().getTitle() == null)
{
displayTitleErroMsg = true;
Expand Down Expand Up @@ -1769,6 +1790,10 @@ public String processEditPreview()
displayDateError = true;
return "edit";
}
if(entry.getEntry().getLinkCalendar() && entry.getEntry().getStartDate() == null && entry.getEntry().getEndDate() == null){
displayCalendarError = true;
return "edit";
}
return "preview";

}
Expand All @@ -1783,6 +1808,7 @@ public String processReadPreview()
displayTitleErroMsg = false;
displayEvilTagMsg=false;
displayDateError=false;
displayCalendarError = false;
if(entry.getEntry().getTitle() == null)
{
displayTitleErroMsg = true;
Expand Down Expand Up @@ -1822,6 +1848,10 @@ public String processReadPreview()
displayDateError = true;
return "read";
}
if(entry.getEntry().getLinkCalendar() && entry.getEntry().getStartDate() == null && entry.getEntry().getEndDate() == null){
displayCalendarError = true;
return "read";
}
return "read_preview";

}
Expand Down Expand Up @@ -3147,4 +3177,12 @@ public boolean isOpenInNewWindow() {
public void setOpenInNewWindow(boolean openInNewWindow) {
this.openInNewWindow = openInNewWindow;
}

public boolean isDisplayCalendarError() {
return displayCalendarError;
}

public void setDisplayCalendarError(boolean displayCalendarError) {
this.displayCalendarError = displayCalendarError;
}
}
2 changes: 2 additions & 0 deletions syllabus/syllabus-app/src/webapp/syllabus/edit.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
</h4>
<h:outputText value="#{msgs.invalid_dates}" styleClass="alertMessage"
rendered="#{SyllabusTool.displayDateError}"/>
<h:outputText value="#{msgs.invalid_calendar}" styleClass="alertMessage"
rendered="#{SyllabusTool.displayCalendarError}"/>
<h:panelGrid columns="1" styleClass="jsfFormTable">
<h:panelGroup styleClass="shorttext">
<h:outputLabel for="dataStartDate">
Expand Down
2 changes: 2 additions & 0 deletions syllabus/syllabus-app/src/webapp/syllabus/read.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
</h4>
<h:outputText value="#{msgs.invalid_dates}" styleClass="alertMessage"
rendered="#{SyllabusTool.displayDateError}"/>
<h:outputText value="#{msgs.invalid_calendar}" styleClass="alertMessage"
rendered="#{SyllabusTool.displayCalendarError}"/>
<h:panelGrid columns="1" styleClass="jsfFormTable">
<h:panelGroup styleClass="shorttext">
<h:outputLabel for="dataStartDate">
Expand Down

0 comments on commit 34e48e7

Please sign in to comment.