diff --git a/sections/sections-app-util/src/bundle/sections.properties b/sections/sections-app-util/src/bundle/sections.properties index 7b8fd39e673c..80994b93c0e4 100644 --- a/sections/sections-app-util/src/bundle/sections.properties +++ b/sections/sections-app-util/src/bundle/sections.properties @@ -152,4 +152,13 @@ add_section_successful={0} {1} been successfully created\! You may now assign T edit_student_sections_instructions=To assign this student to a section, click Assign. \ You may only assign a student to one section within each category. \ If the student is already a member of a section in a category, they wil be removed \ -from that section if you assign them to a new section. \ No newline at end of file +from that section if you assign them to a new section. +# +# Control closed sections +# +section_close_title=Section Tool Closed +section_close_desc=This tool is closed. You will be able to access the sections tool at the date and time your faculty specified. +section_close_opendate=Open Date: +section_open_info=Close sections tool for students until Open Date: +section_refresh_info=Refresh the page to see the groups after the due date. +error_date_format=Error with the Date/Time format \ No newline at end of file diff --git a/sections/sections-app-util/src/bundle/sections_ca.properties b/sections/sections-app-util/src/bundle/sections_ca.properties index 3d4ab17b869a..b282aa81830c 100644 --- a/sections/sections-app-util/src/bundle/sections_ca.properties +++ b/sections/sections-app-util/src/bundle/sections_ca.properties @@ -142,4 +142,13 @@ section_start_time=Hora d'inici student_view_instructions_switch=Per canviar de secci\u00F3, a l'enlla\u00E7 "canvia", feu clic a sobre de la secci\u00F3 a la qual us vulgueu despla\u00E7ar. Sortireu autom\u00E0ticament de la secci\u00F3 actual d'aquest tipus de secci\u00F3. student_view_header_time=Temps/Dies add_section_successful={0} {1} s'han creat satisfact\u00F2riament\! Ara podeu assignar AP i alumnes a la {2} escollint els enlla\u00E7os de la secci\u00F3. -edit_student_sections_instructions=Per assignar aquest alumne a la secci\u00F3, feu clic a Assigna. Nom\u00E9s podeu assignar un alumne a una secci\u00F3 dins de cada categoria. Si l'alumne ja \u00E9s membre d'una secci\u00F3 en una categoria, ser\u00E0 suprimit d'aquella secci\u00F3 si l'assigna a una nova secci\u00F3. \ No newline at end of file +edit_student_sections_instructions=Per assignar aquest alumne a la secci\u00F3, feu clic a Assigna. Nom\u00E9s podeu assignar un alumne a una secci\u00F3 dins de cada categoria. Si l'alumne ja \u00E9s membre d'una secci\u00F3 en una categoria, ser\u00E0 suprimit d'aquella secci\u00F3 si l'assigna a una nova secci\u00F3. +# +# Control closed sections +# +section_close_title=Aplicaci\u00F3 Grups tancada +section_close_desc=Aquesta aplicaci\u00F3 troba tancada temporalment. Podr\u00E0 accedir a les opcions d'informaci\u00F3gesti\u00F3 dels seus grups a l'hora i data indicada pel seu professor. +section_close_opendate=Data d'obertura: +section_open_info=Tancar ferramenta grups per als alumnes fins la data d'obertura: +section_refresh_info=Quan arribe la data d'obertura, refresque la p\u00E0gina per vore els grups. +error_date_format=Errada en el format de la Data/Hora diff --git a/sections/sections-app-util/src/bundle/sections_es.properties b/sections/sections-app-util/src/bundle/sections_es.properties index efb195236160..79b26c88d159 100644 --- a/sections/sections-app-util/src/bundle/sections_es.properties +++ b/sections/sections-app-util/src/bundle/sections_es.properties @@ -150,4 +150,13 @@ edit_student_over_max_warning_try=Ha intentado incluir {0} estudiantes en el gru roster_page_header=Pertenencia de estudiantes student_view_join_sc=(Uni\u00f3n {0}) student_view_switch_sc=(Cambio a {0}) -edit_student_sections_instructions=Para asignar este estudiante a un grupo, pulse en Asignar. Puede asisgnar solamente un estudiante a un grupo de cada categor\u00EDa. Si el estudiante ya es miembro de un grupo en una categor\u00EDa, ser\u00E1 eliminado de dicho grupo si lo asigna a un grupo nuevo. \ No newline at end of file +edit_student_sections_instructions=Para asignar este estudiante a un grupo, pulse en Asignar. Puede asisgnar solamente un estudiante a un grupo de cada categor\u00EDa. Si el estudiante ya es miembro de un grupo en una categor\u00EDa, ser\u00E1 eliminado de dicho grupo si lo asigna a un grupo nuevo. +# +# Control closed sections +# +section_close_title=Aplicaci\u00F3n Grupos Cerrada +section_close_desc=Esta aplicaci\u00F3n encuentra cerrada temporalmente. Podr\u00E1 acceder a las opciones de informaci\u00F3n y gesti\u00F3n de sus grupos a la fecha y hora indicada por su profesor. +section_close_opendate=Fecha de Apertura: +section_open_info=Cerrar herramienta grupos para alumnos hasta la Fecha de Apertura..: +section_refresh_info=Llegada la hora de apertura, refresque la p\u00E1gina para ver los grupos. +error_date_format=Error en el formato de la Fecha/Hora \ No newline at end of file diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java index d41cabefbaf0..1e91f35e7c9a 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/EntryServlet.java @@ -1,6 +1,7 @@ package org.sakaiproject.tool.section; import java.io.IOException; +import java.util.Calendar; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; @@ -12,6 +13,9 @@ import org.sakaiproject.section.api.facade.manager.Authn; import org.sakaiproject.section.api.facade.manager.Authz; import org.sakaiproject.section.api.facade.manager.Context; +import org.sakaiproject.section.api.SectionManager; +import org.sakaiproject.component.section.sakai.SectionManagerImpl; +import org.sakaiproject.tool.section.jsf.backingbean.StudentViewBean; import org.springframework.context.ApplicationContext; import org.springframework.web.context.WebApplicationContext; @@ -44,7 +48,16 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) { path.append("/overview.jsf"); } else if (viewOwnSections) { if(log.isDebugEnabled()) log.debug("Sending user to the student view page"); - path.append("/studentView.jsf"); + //Control if the access to the groups is closed + SectionManager sm = (SectionManager)ac.getBean("org.sakaiproject.section.api.SectionManager"); + Calendar open = sm.getOpenDate(siteContext); + Calendar now = Calendar.getInstance(); + if (now.before(open)) { + System.out.println("SECTIONS: Grupos Cerrados..."); + path.append("/closed.jsf"); + }else { + path.append("/studentView.jsf"); + }; } else { // The role filter has not been invoked yet, so this could happen here path.append("/noRole.jsp"); diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java index 77bedea0c94a..9f2ddf28eea3 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/filter/RoleFilter.java @@ -119,6 +119,8 @@ public void doFilter(ServletRequest servletRequest, ServletResponse response, Fi } else if (authz.isViewOwnSectionsAllowed(userUid, siteContext) && authzFilterConfigBean.getViewOwnSections().contains(pageName)) { isAuthorized = true; + } else if (pageName.contains("closed")) { + isAuthorized = true; } // SAK-13408 - This fix addresses the problem of the filter receiving a blank field on WebSphere. diff --git a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java index 56314fda90fe..d6ffe88729cc 100644 --- a/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java +++ b/sections/sections-app/src/java/org/sakaiproject/tool/section/jsf/backingbean/OptionsBean.java @@ -27,7 +27,9 @@ import org.sakaiproject.section.api.SectionManager; import org.sakaiproject.section.api.SectionManager.ExternalIntegrationConfig; import org.sakaiproject.tool.section.jsf.JsfUtil; - +import java.util.Calendar; +import java.util.Date; +import java.text.SimpleDateFormat; /** * Controls the options page. * @@ -47,7 +49,10 @@ public class OptionsBean extends CourseDependentBean implements Serializable { private String management; private boolean confirmMode; private boolean managementToggleEnabled; - + private boolean openSwitch; + private Calendar openDate; + private boolean errorflag; + public void init() { // We don't need to initialize the bean when we're in confirm mode if(confirmMode) { @@ -71,6 +76,12 @@ public void init() { } else { management = INTERNAL; } + this.openDate = sm.getOpenDate(getCourse().getSiteContext()); + if (this.openDate!=null){ + openSwitch=true; + } else { + openSwitch=false; + } } public String confirmExternallyManaged() { @@ -82,6 +93,9 @@ public String update() { } public String update(boolean checkForConfirmation) { + if (errorflag) { + return "options"; + } if(!isSectionOptionsManagementEnabled()) { // This should never happen log.warn("Updating section options not permitted for user " + getUserUid()); @@ -106,6 +120,9 @@ public String update(boolean checkForConfirmation) { // If we're externally managed, these will automatically be set to false if(INTERNAL.equals(management) || management == null) { getSectionManager().setJoinOptions(courseUuid, selfRegister, selfSwitch); + // Update the open date + if (!openSwitch) {this.openDate=null;}; + getSectionManager().setOpenDate(courseUuid,openDate); } // TODO Customize the message depending on the action taken @@ -129,6 +146,13 @@ public void setSelfSwitch(boolean selfSwitch) { this.selfSwitch = selfSwitch; } + public boolean isOpenSwitch() { + return openSwitch; + } + + public void setOpenSwitch(boolean openSwitch) { + this.openSwitch = openSwitch; + } /** * See http://issues.apache.org/jira/browse/MYFACES-570 for the reason for this boolean/String hack * @return @@ -158,5 +182,28 @@ public void setConfirmMode(boolean confirmMode) { public boolean isManagementToggleEnabled() { return managementToggleEnabled; } + public String getOpenDate() { + if (openDate == null) { + return null; + } else { + SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); + return sd.format(openDate.getTime()); + } + } + public void setOpenDate(String date){ + if (date==null || date.length()==0) { + this.openDate=null; + }else{ + SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss a"); + Calendar p = Calendar.getInstance(); + try { + p.setTime(sd.parse(date)); + } catch (Exception e){ + JsfUtil.addErrorMessage(JsfUtil.getLocalizedMessage("error_date_format")); + errorflag=true; + }; + this.openDate=p; + } + } } diff --git a/sections/sections-app/src/webapp/common/WEB-INF/faces-navigation.xml b/sections/sections-app/src/webapp/common/WEB-INF/faces-navigation.xml index ae53e741ad1b..4f1faf72391f 100644 --- a/sections/sections-app/src/webapp/common/WEB-INF/faces-navigation.xml +++ b/sections/sections-app/src/webapp/common/WEB-INF/faces-navigation.xml @@ -13,6 +13,11 @@ /overview.jsp + + closed + /closed.jsp + + editSection /editSection.jsp diff --git a/sections/sections-app/src/webapp/common/js/sections.js b/sections/sections-app/src/webapp/common/js/sections.js index 9d690c8a39f5..6fde75596c48 100644 --- a/sections/sections-app/src/webapp/common/js/sections.js +++ b/sections/sections-app/src/webapp/common/js/sections.js @@ -71,6 +71,8 @@ function updateOptionBoxes(externallyManaged) { } var selfJoin = document.getElementById("optionsForm:selfRegister"); var selfSwitch = document.getElementById("optionsForm:selfSwitch"); + var openSwitch = document.getElementById("optionsForm:openSwitch"); + var openDate = document.getElementById("optionsForm:openDate"); if(externallyManaged.value=='external') { // Automatic section management is selected @@ -78,10 +80,17 @@ function updateOptionBoxes(externallyManaged) { selfJoin.disabled = true; selfSwitch.checked = false; selfSwitch.disabled = true; + openSwitch.checked = false; + openSwitch.disabled = true; + openDate.value = ""; + openDate.disabled = true; } else { // Manual section management is selected selfJoin.disabled = false; selfSwitch.disabled = false; + openSwitch.disabled = false; + openDate.disabled = false; + calendar.disabled = false; } } diff --git a/sections/sections-app/src/webapp/common/options.jsp b/sections/sections-app/src/webapp/common/options.jsp index b2834073511c..ef07805451fe 100644 --- a/sections/sections-app/src/webapp/common/options.jsp +++ b/sections/sections-app/src/webapp/common/options.jsp @@ -44,6 +44,14 @@ + + + + + + +