mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-24 10:22:18 +00:00
Merge branch 'feature-3854/Refactor_sqls_for_filterwidgets'
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
/* styles for infocenter overview page */
|
||||
|
||||
/* horizontal line after Studiensemester in dataset table header */
|
||||
hr.studiensemesterline
|
||||
{
|
||||
margin: 6px 6px;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Alias call to method display only to inprove the readability of the code
|
||||
* Alias call to method display only to improve the readability of the code
|
||||
*/
|
||||
refresh: function() {
|
||||
|
||||
@@ -100,13 +100,30 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* To retrive the page where the FilterWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
|
||||
* To retrieve the page where the FilterWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
|
||||
*/
|
||||
getFilterPage: function() {
|
||||
|
||||
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
|
||||
},
|
||||
|
||||
/**
|
||||
* Reload of dataset, also reloads page to show changes
|
||||
*/
|
||||
reloadDataset: function() {
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
"system/Filters/reloadDataset",
|
||||
{
|
||||
filter_page: FHC_FilterWidget.getFilterPage()
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
FHC_FilterWidget._failOrReload(data);
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
// Private methods
|
||||
|
||||
@@ -197,7 +214,7 @@ var FHC_FilterWidget = {
|
||||
},
|
||||
|
||||
/**
|
||||
* This method calls all the other methods needed to rendere the GUI for a FilterWidget
|
||||
* This method calls all the other methods needed to render the GUI for a FilterWidget
|
||||
* The parameter data contains all the data about the FilterWidget and it is given as parameter
|
||||
* to all the methods that here are called
|
||||
* NOTE: think very carefully before changing the order of the calls
|
||||
|
||||
@@ -19,18 +19,26 @@ if (FHC_JS_DATA_STORAGE_OBJECT.called_method == 'index')
|
||||
*
|
||||
*/
|
||||
var InfocenterPersonDataset = {
|
||||
infocenter_studiensemester_variablename: 'infocenter_studiensemester',
|
||||
|
||||
/**
|
||||
* adds person table additional actions html (above and beneath it)
|
||||
*/
|
||||
appendTableActionsHtml: function()
|
||||
appendTableActionsHtml: function(infocenter_studiensemester)
|
||||
{
|
||||
var currurl = window.location.href;
|
||||
var url = FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + "/system/Messages/write";
|
||||
|
||||
var formHtml = '<form id="sendMsgsForm" method="post" action="'+ url +'" target="_blank"></form>';
|
||||
$("#datasetActionsTop").before(formHtml);
|
||||
|
||||
var studienSemesterHtml = '<button class="btn btn-default btn-xs decStudiensemester">' +
|
||||
'<i class="fa fa-chevron-left"></i>' +
|
||||
'</button> ' +
|
||||
infocenter_studiensemester +
|
||||
' <button class="btn btn-default btn-xs incStudiensemester">' +
|
||||
'<i class="fa fa-chevron-right"></i>' +
|
||||
'</button>';
|
||||
|
||||
var selectAllHtml =
|
||||
'<a href="javascript:void(0)" class="selectAll">' +
|
||||
'<i class="fa fa-check"></i> Alle</a> ' +
|
||||
@@ -44,6 +52,21 @@ var InfocenterPersonDataset = {
|
||||
var legendHtml = '<i class="fa fa-circle text-danger"></i> Gesperrt ' +
|
||||
'<i class="fa fa-circle text-info"></i> Geparkt';
|
||||
|
||||
// userdefined Semestervariable shown independently of personcount,
|
||||
// it is possible to change the semester
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='row'>"+
|
||||
"<div class='col-xs-12 text-center'>"+studienSemesterHtml+"</div>"+
|
||||
"</div><div class='h-divider'></div><hr class='studiensemesterline'>");
|
||||
|
||||
$("button.incStudiensemester").click(function() {
|
||||
InfocenterPersonDataset.changeStudiensemesterUservar(1);
|
||||
});
|
||||
|
||||
$("button.decStudiensemester").click(function() {
|
||||
InfocenterPersonDataset.changeStudiensemesterUservar(-1);
|
||||
});
|
||||
|
||||
var personcount = 0;
|
||||
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
@@ -70,9 +93,9 @@ var InfocenterPersonDataset = {
|
||||
|
||||
$("#datasetActionsTop, #datasetActionsBottom").append(
|
||||
"<div class='row'>"+
|
||||
"<div class='col-xs-6'>" + selectAllHtml + " " + actionHtml + "</div>"+
|
||||
"<div class='col-xs-4'>" + legendHtml + "</div>"+
|
||||
"<div class='col-xs-2 text-right'>" +
|
||||
"<div class='col-xs-4'>" + selectAllHtml + " " + actionHtml + "</div>"+
|
||||
"<div class='col-xs-4 text-center'>" + legendHtml + "</div>"+
|
||||
"<div class='col-xs-4 text-right'>" +
|
||||
"<span class='filterTableDatasetCntFiltered'></span>" +
|
||||
countHtml + "</div>"+
|
||||
"<div class='clearfix'></div>"+
|
||||
@@ -125,8 +148,65 @@ var InfocenterPersonDataset = {
|
||||
trs.find("input[name=PersonId\\[\\]]").prop("checked", false);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* initializes change of the uservariable infocenter_studiensemesster, either
|
||||
* to next semester (change > 0) or previous semester (change < 0)
|
||||
*/
|
||||
changeStudiensemesterUservar: function(change)
|
||||
{
|
||||
FHC_AjaxClient.showVeil();
|
||||
|
||||
FHC_AjaxClient.ajaxCallPost(
|
||||
'system/Variables/changeStudiensemesterVar',
|
||||
{
|
||||
'name': InfocenterPersonDataset.infocenter_studiensemester_variablename,
|
||||
'change': change
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
// refresh filterwidget with page reload
|
||||
FHC_FilterWidget.reloadDataset();
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
FHC_AjaxClient.hideVeil();
|
||||
alert(textStatus);//TODO dialoglib
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* initializes call to get the Studiensemester user variable
|
||||
*/
|
||||
getStudiensemesterUservar: function(callback)
|
||||
{
|
||||
FHC_AjaxClient.ajaxCallGet(
|
||||
'system/Variables/getVar',
|
||||
{
|
||||
'name': InfocenterPersonDataset.infocenter_studiensemester_variablename
|
||||
},
|
||||
{
|
||||
successCallback: function(data, textStatus, jqXHR) {
|
||||
if (FHC_AjaxClient.hasData(data))
|
||||
{
|
||||
if (typeof callback === "function")
|
||||
{
|
||||
var infocenter_studiensemester = FHC_AjaxClient.getData(data);
|
||||
callback(infocenter_studiensemester[InfocenterPersonDataset.infocenter_studiensemester_variablename]);
|
||||
}
|
||||
}
|
||||
},
|
||||
errorCallback: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -134,6 +214,6 @@ var InfocenterPersonDataset = {
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
|
||||
InfocenterPersonDataset.appendTableActionsHtml();
|
||||
InfocenterPersonDataset.getStudiensemesterUservar(InfocenterPersonDataset.appendTableActionsHtml);
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user