added lock mechanism for persons, outsourced infocenter code to javascript

This commit is contained in:
alex
2018-02-20 18:05:36 +01:00
parent d9f6bfb76b
commit 695e7f60af
10 changed files with 371 additions and 126 deletions
@@ -0,0 +1,74 @@
/*
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/>.
*/
/**
* javascript file for infocenterDetails page
*/
$(document).ready(
function ()
{
//initialise table sorter
addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
addTablesorter("msgtable", [[0, 1], [2, 0]], ["zebra", "filter"], 2);
addTablesorter("logtable", [[0, 1]], ["filter"], 2);
addTablesorter("notiztable", [[0, 1]], ["filter"], 2);
//add pager
tablesortAddPager("logtable", "logpager", 23);
tablesortAddPager("notiztable", "notizpager", 10);
//initialise datepicker
$.datepicker.setDefaults($.datepicker.regional['de']);
$(".dateinput").datepicker({
"dateFormat": "dd.mm.yy"
});
//add click events to "formal geprüft" checkboxes
/* $(".prchbox input[type=checkbox]").click(
function()
{
var akteid = this.;
var personid = ;
window.location = "../saveFormalGeprueft?akte_id="+akteid+"&formal_geprueft=" + this.checked + "&person_id="+personid;
}
);*/
//add submit event to message send link
$("#sendmsglink").click(
function ()
{
$("#sendmsgform").submit();
}
);
//prevent opening modal when Statusgrund not chosen
$("#absageModal").on('show.bs.modal', function (e)
{
if ($("[name=statusgrund]").val() === "null")
{
$("#statusgrselect").addClass("has-error");
return e.preventDefault();
}
}
);
$("[name=statusgrund]").change(function ()
{
$("#statusgrselect").removeClass("has-error");
}
);
}
);
@@ -1,8 +1,26 @@
/*
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/>.
*/
/**
* javascript file for infocenter overview page
*/
$(document).ready(
function()
{
//bootstrap table
$("#tableDataset").addClass('table table-bordered table-responsive');
// Checks if the table contains data (rows)
if ($('#tableDataset').find('tbody:empty').length == 0
&& $('#tableDataset').find('tr:empty').length == 0)
@@ -17,6 +35,9 @@ $(document).ready(
}
);
/**
* adds person table additional actions html (above and beneath it)
*/
function appendTableActionsHtml()
{
var currurl = window.location.href;
@@ -47,7 +68,9 @@ function appendTableActionsHtml()
$("#datasetActionsBottom").append("<br><br>");
}
/**
* sets functionality for the actions above and beneath the person table
*/
function setTableActions()
{
$(".sendMsgsLink").click(function() {
@@ -67,7 +90,7 @@ function setTableActions()
$(".selectAll").click(function()
{
//trs only if not filtered by tablesorter
//select only trs if not filtered by tablesorter
var trs = $("#tableDataset tbody tr").not(".filtered");
trs.find("input[name=PersonId\\[\\]]").prop("checked", true);
}
+86
View File
@@ -0,0 +1,86 @@
/*
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/>.
*/
/**
* provides helper functions for adding mottie tablesorter
* enables easier configuration of the tablesorter by providing a common default configuration
*/
/**
* adds tablesorter to specified tableid, german date format, default theme
* @param tableid
* @param sortList columns to sort by, as array of arrays (each array contains column number and 1/0 for asc/desc order)
* @param widgets optional widgets like zebra or filter
* @param minrows optional minimal amount of rows for filter row to be shown (only relevant for filter widget)
*/
function addTablesorter(tableid, sortList, widgets, minrows)
{
$("#" + tableid).tablesorter(
{
theme: "default",
dateFormat: "ddmmyyyy",
sortList: sortList,
widgets: widgets
}
);
if($("#" + tableid + " tr.tablesorter-filter-row").length)
{
//hide filters if less than n datarows (+ 2 for headings and filter row itself), default 0
var minrows = minrows || 0;
if ($("#" + tableid + " tr").length < minrows + 2)
{
$("#" + tableid + " tr.tablesorter-filter-row").hide();
}
}
}
/**
* adds pager for specified tableid. Assumes bootstap icons are available!
* @param tableid
* @param pagerid
* @param size number of rows for each page
*/
function tablesortAddPager(tableid, pagerid, size)
{
var html =
'<div id="' + pagerid + '" class="pager"> ' +
'<form class="form-inline">' +
'<i class="fa fa-step-backward first"></i>&nbsp;' +
'<i class="fa fa-backward prev"></i>' +
'<span class="pagedisplay"></span>' +
'<i class="fa fa-forward next"></i>&nbsp;' +
'<i class="fa fa-step-forward last"></i>' +
'</form>' +
'</div>';
var rowcount = $("#" + tableid + " tr").length;
//not show pager if only one table page
if (rowcount > size)
{
var table = $("#" + tableid);
table.after(html);
table.tablesorterPager(
{
container: $("#" + pagerid),
size: size,
cssDisabled: 'disabled',
savePages: false,
output: '{startRow} {endRow} / {totalRows} Zeilen'
}
);
}
}