PHP Classes

File: WICore/WIJ/roles.js

Recommend this page to a friend!
  Classes of Jules Warner   WICMS   WICore/WIJ/roles.js   Download  
File: WICore/WIJ/roles.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: WICMS
Database driven content management system with PDO
Author: By
Last change:
Date: 7 years ago
Size: 1,366 bytes
 

Contents

Class file image Download
var roles = {}; roles.addRole = function () { wiengine.removeErrorMessages(); var role = $("#role-name"); if($.trim(role.val()) == "") { wiengine.displayErrorMessage(role); return; } $.ajax({ url: "WICore/WIClass/WIAjax.php", type: 'POST', data: { action: "addRole", role : role.val() }, success: function (result) { try { var res = JSON.parse(result); if(res.status == "success") { var html = '<tr class="role-row">'; html += '<td>'+res.roleName+'</td>'; html += '<td>0</td>'; html += '<td><button type="button" class="btn btn-danger btn-sm" onclick="roles.deleteRole(this,'+res.roleId+');">'; html += '<i class="icon-trash glyphicon glyphicon-trash"></i> ' + $_lang.delete; html += '</button>'; html += '</td>'; html += '</tr>'; $(".roles-table").append(html); } else wiengine.displayErrorMessage(role, res.message); } catch(e) { alert($_lang.error_updating_db) } } }); } roles.deleteRole = function (element, roleId) { var t = confirm($_lang.are_you_sure); if(t) { $.ajax({ url: "WICore/WIClass/WIAjax.php", type: 'POST', data: { action: "deleteRole", roleId: roleId }, success: function () { $(element).parents(".role-row").fadeOut("slow", function () { $(this).remove(); }); } }); } };