2019-01-20 19:37:45 +01:00
|
|
|
/* This file is part of the Calibre-Web (https://github.com/janeczku/calibre-web)
|
|
|
|
* Copyright (C) 2018 OzzieIsaacs
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-07-13 20:45:48 +02:00
|
|
|
/* exported TableActions */
|
|
|
|
|
2018-08-28 09:42:19 +02:00
|
|
|
$(function() {
|
|
|
|
|
2019-01-08 07:58:22 +01:00
|
|
|
$("#domain_submit").click(function(event) {
|
2018-08-28 09:42:19 +02:00
|
|
|
event.preventDefault();
|
|
|
|
$("#domain_add").ajaxForm();
|
|
|
|
$(this).closest("form").submit();
|
2019-07-13 20:45:48 +02:00
|
|
|
$.ajax ({
|
2018-08-28 09:42:19 +02:00
|
|
|
method:"get",
|
|
|
|
url: window.location.pathname + "/../../ajax/domainlist",
|
|
|
|
async: true,
|
|
|
|
timeout: 900,
|
2019-07-13 20:45:48 +02:00
|
|
|
success:function(data) {
|
2019-03-05 16:31:09 +01:00
|
|
|
$("#domain-table").bootstrapTable("load", data);
|
2018-08-28 09:42:19 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
2019-01-08 07:58:22 +01:00
|
|
|
$("#domain-table").bootstrapTable({
|
|
|
|
formatNoMatches: function () {
|
|
|
|
return "";
|
2019-03-05 16:31:09 +01:00
|
|
|
},
|
|
|
|
striped: false
|
2018-08-28 09:42:19 +02:00
|
|
|
});
|
|
|
|
$("#btndeletedomain").click(function() {
|
|
|
|
//get data-id attribute of the clicked element
|
2019-01-08 07:58:22 +01:00
|
|
|
var domainId = $(this).data("domainId");
|
2018-08-28 09:42:19 +02:00
|
|
|
$.ajax({
|
|
|
|
method:"post",
|
|
|
|
url: window.location.pathname + "/../../ajax/deletedomain",
|
|
|
|
data: {"domainid":domainId}
|
|
|
|
});
|
2019-01-08 07:58:22 +01:00
|
|
|
$("#DeleteDomain").modal("hide");
|
2018-08-28 09:42:19 +02:00
|
|
|
$.ajax({
|
|
|
|
method:"get",
|
|
|
|
url: window.location.pathname + "/../../ajax/domainlist",
|
|
|
|
async: true,
|
|
|
|
timeout: 900,
|
2019-03-05 16:31:09 +01:00
|
|
|
success:function(data) {
|
2019-01-08 07:58:22 +01:00
|
|
|
$("#domain-table").bootstrapTable("load", data);
|
2018-08-28 09:42:19 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
//triggered when modal is about to be shown
|
2019-01-15 20:08:47 +01:00
|
|
|
$("#DeleteDomain").on("show.bs.modal", function(e) {
|
2018-08-28 09:42:19 +02:00
|
|
|
//get data-id attribute of the clicked element and store in button
|
2019-01-08 07:58:22 +01:00
|
|
|
var domainId = $(e.relatedTarget).data("domain-id");
|
|
|
|
$(e.currentTarget).find("#btndeletedomain").data("domainId", domainId);
|
2018-08-28 09:42:19 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-04-14 14:08:49 +02:00
|
|
|
/* Function for deleting domain restrictions */
|
|
|
|
function TableActions (value, row, index) {
|
2018-08-28 09:42:19 +02:00
|
|
|
return [
|
2019-01-08 07:58:22 +01:00
|
|
|
"<a class=\"danger remove\" data-toggle=\"modal\" data-target=\"#DeleteDomain\" data-domain-id=\"" + row.id
|
|
|
|
+ "\" title=\"Remove\">",
|
|
|
|
"<i class=\"glyphicon glyphicon-trash\"></i>",
|
|
|
|
"</a>"
|
|
|
|
].join("");
|
2019-04-14 14:08:49 +02:00
|
|
|
}
|