revert-70aa11f8
kamidu 8 years ago
commit 12e609c737

@ -17,6 +17,7 @@ import org.wso2.carbon.context.PrivilegedCarbonContext;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
@ -42,8 +43,10 @@ public class CertificateManagementAdminServiceImpl implements CertificateManagem
for (EnrollmentCertificate enrollmentCertificate : enrollmentCertificates) {
certificate = new org.wso2.carbon.certificate.mgt.core.bean.Certificate();
certificate.setTenantId(PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
certificate.setSerial(enrollmentCertificate.getSerial());
certificate.setCertificate(certificateService.pemToX509Certificate(enrollmentCertificate.getPem()));
X509Certificate x509Certificate = certificateService
.pemToX509Certificate(enrollmentCertificate.getPem());
certificate.setSerial(x509Certificate.getSerialNumber().toString());
certificate.setCertificate(x509Certificate);
certificates.add(certificate);
}
certificateService.saveCertificate(certificates);

@ -231,8 +231,8 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
policyDeleted = false;
}
}
if(policyDeleted) {
for(int i : policyIds) {
if (policyDeleted) {
for (int i : policyIds) {
Policy policy = pap.getPolicy(i);
pap.deletePolicy(policy);
}
@ -244,13 +244,16 @@ public class PolicyManagementServiceImpl implements PolicyManagementService {
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
if (policyDeleted) {
return Response.status(Response.Status.OK).entity("Policies have been successfully deleted").build();
return Response.status(Response.Status.OK).entity("Policies have been successfully " +
"deleted").build();
} else {
//TODO:Check of this logic is correct
String ModifiedInvalidPolicyIds = invalidPolicyIds.substring(0, invalidPolicyIds.length()-1);
return Response.status(Response.Status.BAD_REQUEST).entity(
new ErrorResponse.ErrorResponseBuilder().setMessage("Policies with the policy ID " +
ModifiedInvalidPolicyIds + " doesn't exist").build()).build();
String modifiedInvalidPolicyIds =
invalidPolicyIds.substring(0, invalidPolicyIds.length() - 1);
return Response.status(Response.Status.BAD_REQUEST).
entity(new ErrorResponse.ErrorResponseBuilder().
setMessage("Policies with the policy ID " + modifiedInvalidPolicyIds +
" doesn't exist").build()).build();
}
}

@ -51,14 +51,6 @@
<div id="certificate-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label ">
Serial Number *
</label>
<br>
<div id="serialNoInputField" class="form-group wr-input-control">
<input type="text" id="serialNo" class="form-control"/>
</div>
<label class="wr-input-label">Certificate *</label>
<div id="certificateField" class="form-group wr-input-control">
<input type="file" id="certificate" class="form-control"/>

@ -92,17 +92,11 @@ $(document).ready(function () {
* when a user clicks on "Add Certificate" button.
*/
$("button#add-certificate-btn").click(function () {
var serialNoInput = $("input#serialNo");
var serialNo = serialNoInput.val();
if (!serialNo) {
$(errorMsg).text("Serial Number is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else if (!pemContent) {
if (!pemContent) {
$(errorMsg).text(" .pem file must contains certificate information.");
$(errorMsgWrapper).removeClass("hidden");
} else {
var addCertificateFormData = {};
addCertificateFormData.serial = serialNo;
addCertificateFormData.pem = pemContent;
var certificateList = [];
certificateList.push(addCertificateFormData);

@ -16,6 +16,7 @@
under the License.
}}
{{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}}
<li>
@ -110,73 +111,6 @@
<a href="#">By Serial Number</a>
</div>
</div>
<div id="remove-certificate-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this certificate ?</h3>
<div class="buttons">
<a href="#" id="remove-certificate-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-certificate-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-certificate-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Certificate was successfully removed.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
<div id="remove-certificate-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
<div id="errorCertificateView" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Unauthorized action!
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}

@ -54,8 +54,11 @@ function hidePopup() {
*/
function removeCertificate(serialNumber) {
var serviceUrl = base_api_url + "/admin/certificates/" + serialNumber;
$(modalPopupContent).html($('#remove-certificate-modal-content').html());
showPopup();
modalDialog.header('Do you really want to remove this certificate ?');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-yes-link" class="btn-operations">' +
'Remove</a><a href="#" id="remove-certificate-cancel-link" class="btn-operations btn-default">Cancel</a>' +
'</div>');
modalDialog.show();
$("a#remove-certificate-yes-link").click(function () {
invokerUtil.delete(
@ -63,23 +66,29 @@ function removeCertificate(serialNumber) {
function () {
$("#" + serialNumber).remove();
var newCertificateListCount = $(".user-list > span").length;
$("#certificate-listing-status-msg").text("Total number of Certificates found : " + newCertificateListCount);
$(modalPopupContent).html($('#remove-certificate-success-content').html());
$("#certificate-listing-status-msg").text("Total number of Certificates found : " +
newCertificateListCount);
modalDialog.header('Done. Certificate was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-certificate-success-link").click(function () {
hidePopup();
modalDialog.hide();
});
},
function () {
$(modalPopupContent).html($('#remove-certificate-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-certificate-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
});
$("a#remove-certificate-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
@ -103,8 +112,9 @@ function InitiateViewOption() {
if ($("#can-view").val()) {
$(location).attr('href', $(this).data("url"));
} else {
$(modalPopupContent).html($('#errorCertificateView').html());
showPopup();
modalDialog.header('Unauthorized action!');
modalDialog.content('You do not have permission to view this certificate.');
modalDialog.showAsAWarning();
}
}

@ -1,4 +1,5 @@
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}}
<li>
@ -55,22 +56,6 @@
</div>
</div>
</div>
<div id="group-error-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h4 id="error-msg">Unexpected error occurred!</h4>
<br/>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
{{js "js/group-add.js"}}

@ -71,10 +71,13 @@ $(function () {
});
function displayErrors(message) {
showPopup();
$('#error-msg').html(message.responseText);
$(modalPopupContent).html($('#group-error-content').html());
modalDialog.header('Unexpected error occurred!');
modalDialog.content('<h4 id="error-msg"></h4>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-unexpected-error-link" class="btn-operations">Ok' +
'</a></div>');
modalDialog.showAsError();
$("a#group-unexpected-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}

@ -17,8 +17,8 @@
}}
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}}
{{unit "cdmf.unit.lib.data-table"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}}
<li>
@ -93,213 +93,6 @@
</div>
</div>
{{/if}}
<div id="share-group-w1-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Enter user name to manage group sharing</h3>
<div id="user-names">
<br />
<input type="text" id="share-user-selector" style="color:#3f3f3f;padding:5px;width:250px;">
</input>
</div>
<div class="buttons">
<a href="#" id="share-group-next-link" class="btn-operations">
Next
</a>
<a href="#" id="share-group-w1-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="share-group-w2-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Select sharing roles</h3>
<br/>
<div id="user-roles">Loading...</div>
<div class="buttons">
<a href="#" id="share-group-yes-link" class="btn-operations">
OK
</a>
<a href="#" id="share-group-w2-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="share-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group sharing updated successfully.</h3>
</div>
</div>
</div>
</div>
<div id="remove-group-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this group from your Group List?</h3>
<div class="buttons">
<a href="#" id="remove-group-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="remove-group-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group was successfully removed.</h3>
</div>
</div>
</div>
</div>
<div id="edit-group-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Please enter new name and description for the group</h3>
<br/>
<div>
<input id="edit-group-name" style="color:#3f3f3f;padding:5px" type="text"
value=""
placeholder="Group Name" size="60">
</div>
<br/>
<div>
<input id="edit-group-description" style="color:#3f3f3f;padding:5px" type="text"
value=""
placeholder="Group Description" size="60">
</div>
<div class="buttons">
<a href="#" id="edit-group-yes-link" class="btn-operations">
Update
</a>
<a href="#" id="edit-group-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="edit-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group was successfully updated.</h3>
</div>
</div>
</div>
</div>
<div id="group-400-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3 id="error-msg">Bad Request. Please contact your administrator.</h3>
<div class="buttons">
<a href="#" id="group-400-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-403-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Operation not permitted.</h3>
<div class="buttons">
<a href="#" id="group-403-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-404-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3 id="group-404-message">Not found.</h3>
<div class="buttons">
<a href="#" id="group-404-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-409-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group does not exist.</h3>
<div class="buttons">
<a href="#" id="group-409-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-unexpected-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Unexpected error occurred!</h3>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

@ -295,9 +295,13 @@ function attachEvents() {
$("a.share-group-link").click(function () {
var groupName = $(this).data("group-name");
var groupOwner = $(this).data("group-owner");
$(modalPopupContent).html($('#share-group-w1-modal-content').html());
modalDialog.header('Enter user name to manage group sharing');
modalDialog.content('<input type="text" id="share-user-selector" ' +
'style="color:#3f3f3f;padding:5px;width:250px;" />');
modalDialog.footer('<div class="buttons"><a href="#" id="share-group-next-link" class="btn-operations">Next' +
'</a><a href="#" id="share-group-w1-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
$("a#share-group-next-link").show();
showPopup();
modalDialog.show();
$("a#share-group-next-link").click(function () {
var selectedUser = $('#share-user-selector').val();
if (selectedUser == $("#group-listing").data("current-user")) {
@ -308,7 +312,7 @@ function attachEvents() {
}
});
$("a#share-group-w1-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});
@ -321,16 +325,18 @@ function attachEvents() {
var groupName = $(this).data("group-name");
var groupOwner = $(this).data("group-owner");
$(modalPopupContent).html($('#remove-group-modal-content').html());
showPopup();
modalDialog.header('Do you really want to remove this group from your Group List?');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-group-yes-link" class="btn-operations">Yes' +
'</a><a href="#" id="remove-group-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$("a#remove-group-yes-link").click(function () {
var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data);
if (xhr.status == 200) {
$(modalPopupContent).html($('#remove-group-200-content').html());
modalDialog.header('Group was successfully removed.');
setTimeout(function () {
hidePopup();
modalDialog.hide();
location.reload(false);
}, 2000);
} else {
@ -345,7 +351,7 @@ function attachEvents() {
});
$("a#remove-group-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});
@ -360,10 +366,15 @@ function attachEvents() {
var groupOwner = $(this).data("group-owner");
var groupDescription = $(this).data("group-description");
$(modalPopupContent).html($('#edit-group-modal-content').html());
modalDialog.header('Please enter new name and description for the group.');
modalDialog.content('<div><input id="edit-group-name" style="color:#3f3f3f;padding:5px" type="text" value="" ' +
'placeholder="Group Name" size="60"></div><br/><div><input id="edit-group-description" ' +
'style="color:#3f3f3f;padding:5px" type="text" value="" placeholder="Group Description" size="60"></div>');
modalDialog.footer('<div class="buttons"><a href="#" id="edit-group-yes-link" class="btn-operations">Update' +
'</a><a href="#" id="edit-group-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
$('#edit-group-name').val(groupName);
$('#edit-group-description').val(groupDescription);
showPopup();
modalDialog.show();
$("a#edit-group-yes-link").click(function () {
var newGroupName = $('#edit-group-name').val();
@ -373,8 +384,11 @@ function attachEvents() {
var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data);
if (xhr.status == 200) {
modalDialog.hide();
modalDialog.header('Group was successfully updated.');
modalDialog.show();
setTimeout(function () {
hidePopup();
modalDialog.hide();
location.reload(false);
}, 2000);
} else {
@ -389,14 +403,19 @@ function attachEvents() {
});
$("a#edit-group-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});
}
function getAllRoles(groupName, groupOwner, selectedUser) {
$(modalPopupContent).html($('#share-group-w2-modal-content').html());
$('#user-roles').html('<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>');
modalDialog.header('Select sharing roles');
modalDialog.content('<div id="user-roles">Loading...</div>');
modalDialog.footer('<div class="buttons"><a href="#" id="share-group-yes-link" class="btn-operations">OK</a><a ' +
'href="#" id="share-group-w2-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$('#user-roles').html('<div style="height:100px" data-state="loading" data-loading-text="Loading..." ' +
'data-loading-style="icon-only" data-loading-inverse="true"></div>');
$("a#share-group-yes-link").hide();
var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data);
@ -417,7 +436,7 @@ function getAllRoles(groupName, groupOwner, selectedUser) {
});
$("a#share-group-w2-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
@ -463,15 +482,17 @@ function generateRoleMap(groupName, groupOwner, selectedUser, allRoles) {
});
$("a#share-group-w2-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
function updateGroupShare(groupName, groupOwner, selectedUser, roles) {
var successCallback = function (data) {
$(modalPopupContent).html($('#share-group-200-content').html());
// $(modalPopupContent).html($('#share-group-200-content').html());
modalDialog.header('Group sharing updated successfully.');
modalDialog.show();
setTimeout(function () {
hidePopup();
modalDialog.hide();
location.reload(false);
}, 2000);
};
@ -483,35 +504,44 @@ function updateGroupShare(groupName, groupOwner, selectedUser, roles) {
}
function displayErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html());
modalDialog.header('<h3 id="error-msg">Bad Request. Please contact your administrator.</h3>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-400-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
if (jqXHR.responseText) {
$('#error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), ""));
}
$("a#group-400-link").click(function () {
hidePopup();
modalDialog.hide();
});
} else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html());
modalDialog.header('Operation not permitted.');
modalDialog.footer('<div class="buttons"><a href="#" id="group-403-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-403-link").click(function () {
hidePopup();
modalDialog.hide();
});
} else if (jqXHR.status == 404) {
$(modalPopupContent).html($('#group-404-content').html());
modalDialog.header('<h3 id="group-404-message">Not found.</h3>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-404-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("#group-404-message").html(jqXHR.responseText);
$("a#group-404-link").click(function () {
hidePopup();
modalDialog.hide();
});
} else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html());
modalDialog.header('Group does not exist..');
modalDialog.footer('<div class="buttons"><a href="#" id="group-409-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-409-link").click(function () {
hidePopup();
modalDialog.hide();
});
} else {
$(modalPopupContent).html($('#group-unexpected-error-content').html());
modalDialog.header('Unexpected error occurred!');
modalDialog.footer('<div class="buttons"><a href="#" id="group-unexpected-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-unexpected-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
console.log("Error code: " + jqXHR.status);
}

@ -17,6 +17,7 @@
}}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "topCss"}}
<style>
@ -254,384 +255,6 @@
<a href="#">By Status</a>
</div>
</div>
<div id="remove-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to remove the selected policy(s)?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-policy-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
<div id="remove-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully removed.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-devices" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Cannot Remove Policies.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>You cannot remove policies that are already applied to devices. Please deselect
them and try
again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-error-devices" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="publish-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to publish the selected policy(s)?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-yes-link" class="btn-operations">Yes</a>
<a href="#" id="publish-policy-cancel-link" class="btn-operations btn-default">No</a>
</div>
</div>
</div>
<div id="publish-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully published.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="publish-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="unpublish-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to unpublish the selected policy(s)?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="unpublish-policy-cancel-link" class="btn-operations btn-default">
No
</a>
</div>
</div>
</div>
<div id="unpublish-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully unpublished.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="unpublish-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. New Policy priorities were successfully updated.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="save-policy-priorities-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="save-policy-priorities-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="change-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to apply changes to all policies?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="change-policy-cancel-link" class="btn-operations btn-default">
No
</a>
</div>
</div>
</div>
<div id="change-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Changes applied successfully.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="change-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyUnPublish" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to unpublish.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyUnPublishSelection" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>You cannot select already inactive policies. Please deselect inactive policies
and try again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyPublishSelection" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>You cannot select already active policies. Please deselect active policies and
try again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyPublish" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to publish.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicy" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to remove.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}

@ -154,8 +154,10 @@ $(document).ready(function () {
$("#appbar-btn-apply-changes").click(function () {
var applyPolicyChangesAPI = "/devicemgt_admin/policies/apply-changes";
$(modalPopupContent).html($('#change-policy-modal-content').html());
showPopup();
modalDialog.header('Do you really want to apply changes to all policies?');
modalDialog.footer('<div class="buttons"><a href="#" id="change-policy-yes-link" class="btn-operations">Yes' +
'</a><a href="#" id="change-policy-cancel-link" class="btn-operations btn-default">No</a></div>');
modalDialog.show();
$("a#change-policy-yes-link").click(function () {
invokerUtil.put(
@ -163,26 +165,29 @@ $(document).ready(function () {
null,
// on success
function () {
$(modalPopupContent).html($('#change-policy-success-content').html());
showPopup();
modalDialog.header('Done. Changes applied successfully.');
modalDialog.footer('<div class="buttons"><a href="#" id="change-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#change-policy-success-link").click(function () {
hidePopup();
modalDialog.hide();
location.reload();
});
},
// on error
function () {
$(modalPopupContent).html($('#change-policy-error-content').html());
showPopup();
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="change-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#change-policy-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
});
$("a#change-policy-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});
@ -204,19 +209,22 @@ $(document).ready(function () {
updatePolicyAPI,
newPolicyPriorityList,
function () {
$(modalPopupContent).html($('#save-policy-priorities-success-content').html());
showPopup();
modalDialog.header('Done. New Policy priorities were successfully updated.');
modalDialog.footer('<a href="#" id="save-policy-priorities-success-link" class="btn-operations">Ok' +
'</a>');
modalDialog.show();
$("a#save-policy-priorities-success-link").click(function () {
hidePopup();
modalDialog.hide();
});
},
function () {
$("#save-policy-priorities-error-content").find(".message-from-server").html(
"Message From Server : " + data["statusText"]);
$(modalPopupContent).html($('#save-policy-priorities-error-content').html());
showPopup();
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.content(html("Message From Server : " + data["statusText"]));
modalDialog.footer('<div class="buttons"><a href="#" id="save-policy-priorities-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#save-policy-priorities-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
@ -227,16 +235,27 @@ $(document).ready(function () {
var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates();
if (($.inArray('Inactive/Updated', statusList) > -1) || ($.inArray('Inactive', statusList) > -1)) {
$(modalPopupContent).html($("#errorPolicyUnPublishSelection").html());
showPopup();
modalDialog.header('Operation cannot be performed !');
modalDialog.content('You cannot select already inactive policies. Please deselect inactive policies and ' +
'try again.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
} else {
var serviceURL = "/devicemgt_admin/policies/inactivate";
if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicyUnPublish").html());
modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to unpublish.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
} else {
$(modalPopupContent).html($('#unpublish-policy-modal-content').html());
modalDialog.header('Do you really want to unpublish the selected policy(s)?');
modalDialog.footer('<div class="buttons"><a href="#" id="unpublish-policy-yes-link" ' +
'class="btn-operations">Yes</a><a href="#" id="unpublish-policy-cancel-link" ' +
'class="btn-operations btn-default">No</a></div>');
modalDialog.show();
}
showPopup();
$("a#unpublish-policy-yes-link").click(function () {
invokerUtil.put(
@ -244,24 +263,29 @@ $(document).ready(function () {
policyList,
// on success
function () {
$(modalPopupContent).html($('#unpublish-policy-success-content').html());
modalDialog.header('Done. Selected policy was successfully unpublished.');
modalDialog.footer('<div class="buttons"><a href="#" id="unpublish-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#unpublish-policy-success-link").click(function () {
hidePopup();
modalDialog.hide();
location.reload();
});
},
// on error
function () {
$(modalPopupContent).html($('#unpublish-policy-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="unpublish-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#unpublish-policy-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
});
$("a#unpublish-policy-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
});
@ -271,16 +295,27 @@ $(document).ready(function () {
var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates();
if (($.inArray('Active/Updated', statusList) > -1) || ($.inArray('Active', statusList) > -1)) {
$(modalPopupContent).html($("#errorPolicyPublishSelection").html());
showPopup();
modalDialog.header('Operation cannot be performed !');
modalDialog.content('You cannot select already active policies. Please deselect active policies and try ' +
'again.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else {
var serviceURL = "/devicemgt_admin/policies/activate";
if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicyPublish").html());
modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to publish.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else {
$(modalPopupContent).html($('#publish-policy-modal-content').html());
modalDialog.header('Do you really want to publish the selected policy(s)?');
modalDialog.footer('<div class="buttons"><a href="#" id="publish-policy-yes-link" ' +
'class="btn-operations">Yes</a><a href="#" id="publish-policy-cancel-link" ' +
'class="btn-operations btn-default">No</a></div>');
modalDialog.show();
}
showPopup();
$("a#publish-policy-yes-link").click(function () {
invokerUtil.put(
@ -288,24 +323,29 @@ $(document).ready(function () {
policyList,
// on success
function () {
$(modalPopupContent).html($('#publish-policy-success-content').html());
modalDialog.header('Done. Selected policy was successfully published.');
modalDialog.footer('<div class="buttons"><a href="#" id="publish-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#publish-policy-success-link").click(function () {
hidePopup();
modalDialog.hide();
location.reload();
});
},
// on error
function () {
$(modalPopupContent).html($('#publish-policy-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="publish-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#publish-policy-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
});
$("a#publish-policy-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
});
@ -314,11 +354,18 @@ $(document).ready(function () {
var policyList = getSelectedPolicies();
var deletePolicyAPI = "/devicemgt_admin/policies/bulk-remove";
if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicy").html());
modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to remove.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else {
$(modalPopupContent).html($('#remove-policy-modal-content').html());
modalDialog.header('Do you really want to remove the selected policy(s)?');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-yes-link" class=' +
'"btn-operations">Remove</a> <a href="#" id="remove-policy-cancel-link" ' +
'class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
}
showPopup();
$("a#remove-policy-yes-link").click(function () {
invokerUtil.post(
@ -328,30 +375,41 @@ $(document).ready(function () {
function (data) {
data = JSON.parse(data);
if (data.errorMessage) {
$(modalPopupContent).html($('#remove-policy-error-devices').html());
modalDialog.header('Cannot Remove Policies.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-devices" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-devices").click(function () {
hidePopup();
modalDialog.hide();
});
} else {
$(modalPopupContent).html($('#remove-policy-success-content').html());
modalDialog.header('Done. Selected policy was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-policy-success-link").click(function () {
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
thisTable.api().rows('.DTTT_selected').remove().draw(false);
hidePopup();
modalDialog.hide();
});
}
},
// on error
function (data) {
if (JSON.parse(data.responseText).errorMessage) {
$(modalPopupContent).html($('#remove-policy-error-devices').html());
modalDialog.header('Cannot Remove Policies.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-devices" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-devices").click(function () {
hidePopup();
modalDialog.hide();
});
} else {
$(modalPopupContent).html($('#remove-policy-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
}
@ -359,7 +417,7 @@ $(document).ready(function () {
});
$("a#remove-policy-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});
$("#loading-content").remove();

@ -210,8 +210,10 @@ $("#role-grid").on("click", ".remove-role-link", function () {
if (userStore) {
removeRoleAPI += "?user-store=" + encodeURIComponent(userStore);
}
$(modalPopupContent).html($('#remove-role-modal-content').html());
showPopup();
modalDialog.header('Do you really want to remove this role ?');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-yes-link" class="btn-operations">Remove</a>' +
'<a href="#" id="remove-role-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$("a#remove-role-yes-link").click(function () {
invokerUtil.delete(
@ -221,22 +223,28 @@ $("#role-grid").on("click", ".remove-role-link", function () {
role = userStore + '/' + role;
}
$('[id="role-' + role + '"]').remove();
$(modalPopupContent).html($('#remove-role-success-content').html());
modalDialog.header('Done. Role was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-role-success-link").click(function () {
hidePopup();
modalDialog.hide();
});
},
function () {
$(modalPopupContent).html($('#remove-role-error-content').html());
// $(modalPopupContent).html($('#remove-role-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-role-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
);
});
$("a#remove-role-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});

@ -18,6 +18,7 @@
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}}
<li>
@ -80,58 +81,6 @@
<th>By Role name</th>
</div>
</div>
<div id="remove-role-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to remove this role ?</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-role-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
<div id="remove-role-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Role was successfully removed.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-role-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}

@ -16,6 +16,8 @@
under the License.
}}
{{unit "cdmf.unit.ui.modal"}}
<div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar">
<span class="page-sub-title">
@ -88,111 +90,6 @@
{{/equal}}
</div>
</div>
<div id="apply-changes-modal-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>Do you really want to apply changes to all policies?</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-yes-link" class="btn-operations">
Yes
</a>
<a href="javascript:void(0)" id="apply-changes-cancel-link" class="btn-operations">
No
</a>
</div>
</div>
</div>
<div id="apply-changes-success-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>Done. Changes applied successfully.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="apply-changes-error-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="remove-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-success-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>Done. New Policy priorities were successfully updated.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="save-policy-priorities-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-error-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="save-policy-priorities-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
{{#zone "bottomJs"}}

@ -87,10 +87,12 @@ $(document).ready(function () {
// on success
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$(modalPopupContent).html($('#save-policy-priorities-success-content').html());
showPopup();
modalDialog.header('Done. New Policy priorities were successfully updated.');
modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="save-policy-priorities-success-link" class="btn-operations">Ok</a></div>');
modalDialog.show();
$("a#save-policy-priorities-success-link").click(function () {
hidePopup();
modalDialog.hide();
});
$(applyChangesBtn).prop("disabled", false);
}
@ -98,10 +100,12 @@ $(document).ready(function () {
// on error
function (jqXHR) {
if (jqXHR.status == 400 || jqXHR.status == 500) {
$(modalPopupContent).html($("#save-policy-priorities-error-content").html());
showPopup();
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="save-policy-priorities-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#save-policy-priorities-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
}
@ -110,8 +114,11 @@ $(document).ready(function () {
$(applyChangesBtn).click(function () {
var applyPolicyChangesAPI = "/api/device-mgt/v1.0/policies/apply-changes";
$(modalPopupContent).html($("#apply-changes-modal-content").html());
showPopup();
modalDialog.header('Do you really want to apply changes to all policies?');
modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" id="apply-changes-yes-link" ' +
'class="btn-operations">Yes</a><a href="javascript:void(0)" id="apply-changes-cancel-link" ' +
'class="btn-operations">No</a></div>');
modalDialog.show();
$("a#apply-changes-yes-link").click(function () {
invokerUtil.put(
@ -120,20 +127,24 @@ $(document).ready(function () {
// on success
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$(modalPopupContent).html($("#apply-changes-success-content").html());
showPopup();
modalDialog.header('Done. Changes applied successfully.');
modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="apply-changes-success-link" class="btn-operations">Ok</a></div>');
modalDialog.show();
$("a#apply-changes-success-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
},
// on error
function (jqXHR) {
if (jqXHR.status == 500) {
$(modalPopupContent).html($("#apply-changes-error-content").html());
showPopup();
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="apply-changes-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#apply-changes-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
}
}
@ -141,7 +152,7 @@ $(document).ready(function () {
});
$("a#apply-changes-cancel-link").click(function () {
hidePopup();
modalDialog.hide();
});
});

@ -16,6 +16,9 @@
under the License.
}}
<!-- content/body -->
{{unit "cdmf.unit.ui.modal"}}
<div class="row">
<div class="col-md-12">
<!-- content -->
@ -81,22 +84,6 @@
</a>
</div>
</div>
<div id="child-deselect-error-content" class="hide">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i>
</button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h3>Can't deselect child permissions when parent permission is selected.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="child-deselect-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<!-- /content -->
</div>
</div>

@ -132,10 +132,14 @@ $(document).ready(function () {
$("#permissionList li input").click(function(){
var parentInput = $(this).parents("ul:eq(1) > li").find('input:eq(0)');
if(parentInput && parentInput.is(':checked')){
$(modalPopupContent).html($('#child-deselect-error-content').html());
showPopup();
modalDialog.header('');
modalDialog.content('Can\'t deselect child permissions when parent permission is ' +
'selected.');
modalDialog.footer('<div class="buttons"><a href="#" id="child-deselect-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
$("a#child-deselect-error-link").click(function () {
hidePopup();
modalDialog.hide();
});
return false;
}

@ -6506,3 +6506,8 @@ select > option:hover {
.label-bold{
font-weight:400;
}
/* Adding style for required fields */
.required:before {
content: "*";
}
Loading…
Cancel
Save