Skip to content

Commit

Permalink
SAK-32578 Show confirm dialog in sections when change from Automatic …
Browse files Browse the repository at this point in the history
…to Manual, just as when you switch from manual to automatic (sakaiproject#4867)
  • Loading branch information
joaquinmarques authored and ottenhoff committed Dec 11, 2017
1 parent 5e4ee34 commit 83d20b0
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 3 deletions.
3 changes: 3 additions & 0 deletions sections/sections-app-util/src/bundle/sections.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ edit_student_page_header=Assign Students
section_add_failure_title_too_long=The section name ''{0}'' exceeds the maximum length of {1} characters.
student_view_header_location=Location
overview_link_managers=Assign TAs
confirm=Confirm
cancel=Cancel
edit_manager_update=Assign TAs
validation_messages_present=There were problems with the last action. Please see details below.
Expand All @@ -36,6 +37,7 @@ student_view_join=Join
edit_student_unassigned=Unassigned Students
update=Update
options_automatically_manage=Automatically Manage
options_manually_manage=Manually Manage
no_sections_available=There are no sections defined for this site.
section_separator=,
add_section_successful_singular=has
Expand Down Expand Up @@ -77,6 +79,7 @@ add_section_add_meeting=Add day(s) with a different meeting time and/or location
section_table_category_header={0} Sections
overview_table_header_remove=Remove
options_confirm=The automatic setting will override any sections you have manually defined along with their memberships. You will need to go to the Site Info tool and "Edit Rosters" to assign sections to the site for automatic membership management. Would you like to continue?
options_confirmInternal=Manually manage will prevent automatic updates from registration system. Do you want to continue?
section_plural=sections
edit_section_page_header=Edit Section
edit_manager_page_header=Assign Teaching Assistants
Expand Down
11 changes: 11 additions & 0 deletions sections/sections-app/src/webapp/css/sections.css
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,16 @@ table.narrowTable tr th {
/* Indent options checkboxes */
.indent {text-indent: 1em;}

.ui-dialog-titlebar-close {
visibility: hidden;
}

.displayNone {
display: none;
}

.dialogConfirm {
float:left;
margin:12px 12px 20px 0;
}

23 changes: 23 additions & 0 deletions sections/sections-app/src/webapp/js/sections.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,26 @@ function setSectionPageFocus() {
}
}
}

function initManuallyManageDialog() {
$( "#dialog-confirm" ).dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
buttons: [
{
text: button_ok,
click: function() {
$( "#optionsForm #confirmExternallyManagedButton" ).click();
}
},
{
text: button_cancel,
click: function() {
$( this ).dialog( "close" );
}
}
]
});
}
35 changes: 32 additions & 3 deletions sections/sections-app/src/webapp/options.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<div class="portletBody">
<h:form id="optionsForm">

<script type="text/javascript">
var button_ok = "<h:outputText value="#{msgs.confirm}"/>";
var button_cancel = "<h:outputText value="#{msgs.cancel}"/>";
</script>

<sakai:flowState bean="#{optionsBean}"/>

<t:aliasBean alias="#{viewName}" value="options">
Expand All @@ -23,6 +28,10 @@
</h:panelGrid>
</t:div>

<div id="dialog-confirm" title="<h:outputText value="#{msgs.options_manually_manage}"/>" class="displayNone">
<p><span class="ui-icon ui-icon-alert dialogConfirm"></span><h:outputText value="#{msgs.options_confirmInternal}"/></p>
</div>

<t:selectOneRadio id="externallyManaged" layout="spread" value="#{optionsBean.management}"
disabled="#{optionsBean.confirmMode}"
onclick="updateOptionBoxes(this);">
Expand Down Expand Up @@ -52,12 +61,24 @@
</t:div>

<t:div styleClass="act verticalPadding">
<h:commandButton
action="#{optionsBean.update}"
<h:commandButton
value="#{msgs.update}"
styleClass="active"
rendered="#{optionsBean.sectionOptionsManagementEnabled}"
disabled="#{optionsBean.confirmMode}" />
disabled="#{optionsBean.confirmMode}"
onclick="if(document.optionsForm[1].checked){
if(#{optionsBean.management == 'external'}){
initManuallyManageDialog();
return false;
}
}else{
if(#{optionsBean.management == 'internal'}){
document.getElementById('optionsForm:updateSectionsButton').click();
return false;
}
}
document.getElementById('optionsForm:confirmExternallyManagedButton').click();
return false;" />
<h:commandButton
action="overview"
value="#{msgs.cancel}"
Expand All @@ -67,6 +88,14 @@
action="overview"
value="#{msgs.options_done}"
rendered="#{ ! optionsBean.sectionOptionsManagementEnabled}"/>
<h:commandButton
id="updateSectionsButton"
action="#{optionsBean.update}"
style="display:none" />
<h:commandButton
id="confirmExternallyManagedButton"
action="#{optionsBean.confirmExternallyManaged}"
style="display:none" />
</t:div>

<t:div style="height:340px">
Expand Down

0 comments on commit 83d20b0

Please sign in to comment.