Merge branch 'feature-4026/TabulatorWidget' into feature-3994/Digitaler_Lehrauftrag

This commit is contained in:
Paolo
2019-11-04 16:58:19 +01:00
338 changed files with 26029 additions and 45106 deletions
+21
View File
@@ -113,3 +113,24 @@
#applyFilter, #saveCustomFilterButton {
width: 100px;
}
.text-red {
color: red;
}
.text-orange {
color: orange;
}
.text-blue {
color: blue;
}
.text-green {
color: green;
}
#dragAndDropFieldsArea
{
display: inline-table !important;
}
+14
View File
@@ -2,22 +2,36 @@
margin: 10px 0 5px;
}
h1 {
margin-top: 0px;
font-size: 2rem;
}
h2 {
margin-top: 0px;
font-size: 1.8rem;
}
h3 {
margin-top: 0px;
font-size: 1.6rem;
}
h4 {
margin-top: 0px;
font-size: 1.4rem;
}
h5 {
margin-top: 0px;
font-size: 1.2rem;
}
h6 {
margin-top: 0px;
font-size: 1rem;
}
body
{
background-color: white;
color: black;
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
line-height: 1;
}
+28 -1
View File
@@ -65,4 +65,31 @@
#scrollToTop:hover{
background-color: lightgrey;
}
}
#postponedate{
height: 25px;
width: 99px
}
#postponedatelabel{
font-weight: normal;
}
@media screen and (max-width: 1510px)
{
#postponing{
text-align: center;
}
#postponedatelabel{
display: block;
margin-top: 20px;
}
}
@media screen and (max-width: 768px)
{
#postponedate {
display: inline-block
}
}
@@ -0,0 +1,7 @@
/* styles for infocenter overview page */
/* horizontal line after Studiensemester in dataset table header */
hr.studiensemesterline
{
margin: 6px 6px;
}
+1 -1
View File
@@ -42,7 +42,7 @@ table.tablesort-hover tr:hover, .tablesort-active {
}
/* Remove background color from filter row */
.tablesorter-default .tablesorter-filter-row td {
.tablesorter-default .tablesorter-filter-row td, .tablesorter-default .tablesorter-filter-row:hover td {
background-color: white !important;
}
+144 -213
View File
@@ -15,15 +15,12 @@
* It may be overwritten by a custom refreshSideMenuHook included in a javascript which will be loaded after this one
* The given parameters, filterUniqueId and navigation_page, are required
*/
function refreshSideMenuHook(app, dataset, filterid)
function refreshSideMenuHook()
{
FHC_NavigationWidget.refreshSideMenuHook(
'widgets/Filters/setNavigationMenu',
{
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
app + ":" +
dataset + ":" +
filterid,
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix(),
navigation_page: FHC_NavigationWidget.getNavigationPage()
}
);
@@ -36,8 +33,8 @@ function refreshSideMenuHook(app, dataset, filterid)
*/
function sideMenuHook()
{
// If menu is present and there is only one FilterWidget in this page
if (FHC_FilterWidget._hideMenu != true && FHC_FilterWidget._isMultipleFilterWidgets() != true)
// If menu is present
if (FHC_FilterWidget._hideMenu != true)
{
$(".remove-custom-filter").click(function() {
@@ -46,10 +43,7 @@ function sideMenuHook()
"widgets/Filters/removeCustomFilter",
{
filter_id: $(this).attr("value"), // filter_id of the filter to be removed
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
FHC_FilterWidget._filterWidgetsAttributes[0].app + ":" +
FHC_FilterWidget._filterWidgetsAttributes[0].dataset + ":" +
FHC_FilterWidget._filterWidgetsAttributes[0].filterid
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -62,11 +56,7 @@ function sideMenuHook()
{
if (typeof refreshSideMenuHook == "function")
{
refreshSideMenuHook(
FHC_FilterWidget._filterWidgetsAttributes[0].app,
FHC_FilterWidget._filterWidgetsAttributes[0].dataset,
FHC_FilterWidget._filterWidgetsAttributes[0].filterid
);
refreshSideMenuHook();
}
}
}
@@ -93,7 +83,6 @@ var FHC_FilterWidget = {
// Properties
_datasetRepresentation: null, // contains the current data representation
_filterWidgetsAttributes: null, //
_hideMenu: false, //
_hideOptions: false, //
@@ -101,17 +90,15 @@ var FHC_FilterWidget = {
// Public methods
/**
* To display the FilterWidget using the loaded data prenset in the session
* To display the FilterWidget using the loaded data present in the session
*/
display: function() {
FHC_FilterWidget._setFilterWidgetsAttributes();
FHC_FilterWidget._getFilter(FHC_FilterWidget._renderFilterWidget);
},
/**
* 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() {
@@ -119,13 +106,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
*/
getFilterUniqueIdPrefix: 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
@@ -164,30 +168,30 @@ var FHC_FilterWidget = {
/**
* To reset the Filter Options GUI
*/
_resetGUI: function(filterWidgetDiv) {
_resetGUI: function() {
filterWidgetDiv.find("#dragAndDropFieldsArea").html("");
filterWidgetDiv.find("#addField").html("<option value=''>" + FHC_PhrasesLib.t("ui", "bitteEintragWaehlen") + "</option>");
filterWidgetDiv.find("#appliedFilters").html("");
filterWidgetDiv.find("#addFilter").html("<option value=''>" + FHC_PhrasesLib.t("ui", "bitteEintragWaehlen") + "</option>");
$("#dragAndDropFieldsArea").html("");
$("#addField").html("<option value=''>" + FHC_PhrasesLib.t("ui", "bitteEintragWaehlen") + "</option>");
$("#appliedFilters").html("");
$("#addFilter").html("<option value=''>" + FHC_PhrasesLib.t("ui", "bitteEintragWaehlen") + "</option>");
// If the choosen dataset representation is tablesorter
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
filterWidgetDiv.find("#filterTableDataset > thead > tr").html("");
filterWidgetDiv.find("#filterTableDataset > tbody").html("");
$("#filterTableDataset > thead > tr").html("");
$("#filterTableDataset > tbody").html("");
}
// If the choosen dataset representation is pivotUI
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
{
filterWidgetDiv.find("#filterPivotUI").html("");
$("#filterPivotUI").html("");
}
// If the choosen dataset representation is tabulator
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABULATOR)
{
filterWidgetDiv.find("#filterTabulator").html("");
$("#filterTabulator").html("");
}
},
@@ -197,74 +201,61 @@ var FHC_FilterWidget = {
*/
_getFilter: function(renderFunction) {
FHC_FilterWidget._filterWidgetsAttributes.forEach(function(filterWidgetsAttributes) {
FHC_AjaxClient.ajaxCallGet(
"widgets/Filters/getFilter",
{
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
FHC_AjaxClient.ajaxCallGet(
"widgets/Filters/getFilter",
{
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
filterWidgetsAttributes.app + ":" +
filterWidgetsAttributes.dataset + ":" +
filterWidgetsAttributes.filterid
},
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
if (FHC_AjaxClient.hasData(data))
{
if (typeof renderFunction == "function")
{
if (typeof renderFunction == "function")
{
renderFunction(FHC_AjaxClient.getData(data));
}
}
else
{
console.log(FHC_AjaxClient.getError(data));
renderFunction(FHC_AjaxClient.getData(data));
}
}
else
{
console.log(FHC_AjaxClient.getError(data));
}
}
);
});
}
);
},
/**
* 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
*/
_renderFilterWidget: function(data) {
var app = data.app != null ? data.app : "";
var dataset = data.datasetName != null ? data.datasetName : "";
var filterid = data.filter_id != null ? data.filter_id : "";
var filterWidgetDiv = $('div[app="' + app + '"][dataset="' + dataset + '"][filterid="' + filterid + '"]');
FHC_FilterWidget._initSessionStorage(); // initialize the session storage
FHC_FilterWidget._setDatasetRepresentation(data); // set what type of dataset representation was choosen
FHC_FilterWidget._setHideMenu(data); // sets the _hideMenu property
FHC_FilterWidget._setHideOptions(data);
FHC_FilterWidget._turnOffEvents(filterWidgetDiv); // turns all the events off
FHC_FilterWidget._resetGUI(filterWidgetDiv); // Reset the entire GUI
FHC_FilterWidget._turnOffEvents(); // turns all the events off
FHC_FilterWidget._resetGUI(); // Reset the entire GUI
// Render the GUI for this FilterWidget
FHC_FilterWidget._setFilterName(filterWidgetDiv, data); // set the name in the GUI
FHC_FilterWidget._setFilterName(data); // set the name in the GUI
if (FHC_FilterWidget._hideOptions != true)
{
FHC_FilterWidget._renderDragAndDropFields(filterWidgetDiv, data); // render the fields drag and drop GUI
FHC_FilterWidget._renderDropDownFields(filterWidgetDiv, data); // render the fields drop-down
FHC_FilterWidget._renderAppliedFilters(filterWidgetDiv, data); // render the GUI for the applied filters
FHC_FilterWidget._renderDropDownFilters(filterWidgetDiv, data); // render the filters drop-down
FHC_FilterWidget._renderDragAndDropFields(data); // render the fields drag and drop GUI
FHC_FilterWidget._renderDropDownFields(data); // render the fields drop-down
FHC_FilterWidget._renderAppliedFilters(data); // render the GUI for the applied filters
FHC_FilterWidget._renderDropDownFilters(data); // render the filters drop-down
}
FHC_FilterWidget._renderDataset(filterWidgetDiv, data);
FHC_FilterWidget._renderDataset(data);
FHC_FilterWidget._turnOnEvents(filterWidgetDiv); // turns all the events off
FHC_FilterWidget._turnOnEvents(); // turns all the events off
},
/**
@@ -291,23 +282,23 @@ var FHC_FilterWidget = {
* Turns all the events off
* NOTE: must be aligned to _turnOnEvents
*/
_turnOffEvents: function(filterWidgetDiv) {
_turnOffEvents: function() {
filterWidgetDiv.find('[data-toggle="collapse"]').off("click");
filterWidgetDiv.find(".drag-and-drop-fields-span").off("draggable");
filterWidgetDiv.find(".drag-and-drop-fields-span").off("droppable");
filterWidgetDiv.find(".remove-selected-field").off("click");
filterWidgetDiv.find("#addField").off("change");
filterWidgetDiv.find(".applied-filter-operation").off("change");
filterWidgetDiv.find(".remove-applied-filter").off("click");
filterWidgetDiv.find("#addFilter").off("change");
filterWidgetDiv.find("#applyFilter").off("click");
filterWidgetDiv.find("#saveCustomFilterButton").off("click");
$('[data-toggle="collapse"]').off("click");
$(".drag-and-drop-fields-span").off("draggable");
$(".drag-and-drop-fields-span").off("droppable");
$(".remove-selected-field").off("click");
$("#addField").off("change");
$(".applied-filter-operation").off("change");
$(".remove-applied-filter").off("click");
$("#addFilter").off("change");
$("#applyFilter").off("click");
$("#saveCustomFilterButton").off("click");
// If the choosen dataset representation is tablesorter
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_FilterWidget._disableTablesorter(filterWidgetDiv); // disable the tablesorter
FHC_FilterWidget._disableTablesorter(); // disable the tablesorter
}
},
@@ -315,23 +306,23 @@ var FHC_FilterWidget = {
* Turns all the events on
* NOTE: must be aligned to _turnOffEvents
*/
_turnOnEvents: function(filterWidgetDiv) {
_turnOnEvents: function() {
filterWidgetDiv.find('[data-toggle="collapse"]').click(FHC_FilterWidget._dataToggleCollapseEvent); // Click event to collapse or to open the filter options panel
filterWidgetDiv.find(".drag-and-drop-fields-span").draggable(FHC_FilterWidget._draggableConf); // draggable event on selected fields
filterWidgetDiv.find(".drag-and-drop-fields-span").droppable(FHC_FilterWidget._droppableConf); // droppable event on selected fields
filterWidgetDiv.find(".remove-selected-field").click(FHC_FilterWidget._revomeSelectedFieldsEvent); // Click event on the "X" link
filterWidgetDiv.find("#addField").change(FHC_FilterWidget._addFieldEvent); // Change event on the fields drop-down to add new fields
filterWidgetDiv.find(".applied-filter-operation").change(FHC_FilterWidget._appliedFiltersOperationsEvent); // Change event on the operation drop-down
filterWidgetDiv.find(".remove-applied-filter").click(FHC_FilterWidget._removeAppliedFiltersEvent); // Click event to the "X" button to remove an applied filter
filterWidgetDiv.find("#addFilter").change(FHC_FilterWidget._addFilterEvent); // Click event on the applied filters drop-down to add a new filter to the dataset
filterWidgetDiv.find("#applyFilter").click(FHC_FilterWidget._applyFilterEvent); // Click event on the applied filters drop-down to apply filters to the dataset
filterWidgetDiv.find("#saveCustomFilterButton").click(FHC_FilterWidget._saveCustomFilterButtonEvent); // Click evento to for the save custom filter button
$('[data-toggle="collapse"]').click(FHC_FilterWidget._dataToggleCollapseEvent); // Click event to collapse or to open the filter options panel
$(".drag-and-drop-fields-span").draggable(FHC_FilterWidget._draggableConf); // draggable event on selected fields
$(".drag-and-drop-fields-span").droppable(FHC_FilterWidget._droppableConf); // droppable event on selected fields
$(".remove-selected-field").click(FHC_FilterWidget._revomeSelectedFieldsEvent); // Click event on the "X" link
$("#addField").change(FHC_FilterWidget._addFieldEvent); // Change event on the fields drop-down to add new fields
$(".applied-filter-operation").change(FHC_FilterWidget._appliedFiltersOperationsEvent); // Change event on the operation drop-down
$(".remove-applied-filter").click(FHC_FilterWidget._removeAppliedFiltersEvent); // Click event to the "X" button to remove an applied filter
$("#addFilter").change(FHC_FilterWidget._addFilterEvent); // Click event on the applied filters drop-down to add a new filter to the dataset
$("#applyFilter").click(FHC_FilterWidget._applyFilterEvent); // Click event on the applied filters drop-down to apply filters to the dataset
$("#saveCustomFilterButton").click(FHC_FilterWidget._saveCustomFilterButtonEvent); // Click evento to for the save custom filter button
// If the choosen dataset representation is tablesorter
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_FilterWidget._enableTableSorter(filterWidgetDiv); // enable the tablesorter
FHC_FilterWidget._enableTableSorter(); // enable the tablesorter
}
},
@@ -412,20 +403,14 @@ var FHC_FilterWidget = {
});
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/sortSelectedFields",
{
selectedFields: arrayDndId,
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
FHC_FilterWidget._cleanTablesorterLocalStorage(divFilterWidgetDataset.find("#filterTableDataset"));
FHC_FilterWidget._failOrRefresh(data, textStatus, jqXHR);
}
}
@@ -438,16 +423,11 @@ var FHC_FilterWidget = {
*/
_revomeSelectedFieldsEvent: function(event) {
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/removeSelectedField",
{
selectedField: $(this).attr("fieldToRemove"),
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -483,20 +463,14 @@ var FHC_FilterWidget = {
*/
_addFieldEvent: function(event) {
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/addSelectedField",
{
selectedField: $(this).val(),
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
FHC_FilterWidget._cleanTablesorterLocalStorage(divFilterWidgetDataset.find("#filterTableDataset"));
FHC_FilterWidget._failOrRefresh(data, textStatus, jqXHR);
}
}
@@ -508,14 +482,12 @@ var FHC_FilterWidget = {
*/
_applyFilterEvent: function() {
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
var appliedFilters = [];
var appliedFiltersOperations = [];
var appliedFiltersConditions = [];
var appliedFiltersOptions = [];
divFilterWidgetDataset.find("#appliedFilters > div").each(function(i, e) {
$("#appliedFilters > div").each(function(i, e) {
appliedFilters.push($(this).find(".hidden-field-name").val());
appliedFiltersOperations.push($(this).find(".applied-filter-operation").val());
appliedFiltersConditions.push($(this).find(".applied-filter-condition:enabled").val());
@@ -529,10 +501,7 @@ var FHC_FilterWidget = {
appliedFiltersOperations: appliedFiltersOperations,
appliedFiltersConditions: appliedFiltersConditions,
appliedFiltersOptions: appliedFiltersOptions,
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -547,16 +516,11 @@ var FHC_FilterWidget = {
*/
_removeAppliedFiltersEvent: function(event) {
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/removeAppliedFilter",
{
appliedFilter: $(this).attr("filterToRemove"),
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -571,16 +535,11 @@ var FHC_FilterWidget = {
*/
_addFilterEvent: function(event) {
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/addFilter",
{
filter: $(this).val(),
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -618,27 +577,22 @@ var FHC_FilterWidget = {
if ($("#customFilterDescription").val() != "")
{
var divFilterWidgetDataset = $(this).parents("#divFilterWidgetDataset");
FHC_AjaxClient.ajaxCallPost(
"widgets/Filters/saveCustomFilter",
{
customFilterDescription: $("#customFilterDescription").val(),
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
divFilterWidgetDataset.attr("app") + ":" +
divFilterWidgetDataset.attr("dataset") + ":" +
divFilterWidgetDataset.attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
// If menu is present and there is only one FilterWidget in this page
if (FHC_FilterWidget._hideMenu != true && FHC_FilterWidget._isMultipleFilterWidgets() != true)
// If menu is present
if (FHC_FilterWidget._hideMenu != true)
{
// If a success and refreshSideMenuHook is a valid function then call it to refresh the side menu
if (typeof refreshSideMenuHook == "function")
{
refreshSideMenuHook(divFilterWidgetDataset.attr("app"), divFilterWidgetDataset.attr("dataset"), divFilterWidgetDataset.attr("filterid"));
refreshSideMenuHook();
}
}
}
@@ -654,11 +608,11 @@ var FHC_FilterWidget = {
/**
* Retrive the filter name from data and display it in the GUI
*/
_setFilterName: function(filterWidgetDiv, data) {
_setFilterName: function(data) {
if (data.hasOwnProperty("filterName"))
{
filterWidgetDiv.find(".filter-name-title").html(data.filterName);
$(".filter-name-title").html(data.filterName);
}
},
@@ -667,7 +621,7 @@ var FHC_FilterWidget = {
* Retrieves the list of used fields, the list of all the fields and
* their possibly present aliases from the parameter data
*/
_renderDragAndDropFields: function(filterWidgetDiv, data) {
_renderDragAndDropFields: function(data) {
var arrayFieldsToDisplay = FHC_FilterWidget._getFieldsToDisplay(data);
@@ -683,7 +637,7 @@ var FHC_FilterWidget = {
strHtml += " </span>";
strHtml += "</span>";
filterWidgetDiv.find("#dragAndDropFieldsArea").append(strHtml);
$("#dragAndDropFieldsArea").append(strHtml);
}
},
@@ -691,16 +645,16 @@ var FHC_FilterWidget = {
* Renders the drop-down element that contains all the usable fields in the FilterWidget
* The list of all usable fields and their possibly aliases are retrieved from the parameter data
*/
_renderDropDownFields: function(filterWidgetDiv, data) {
_renderDropDownFields: function(data) {
FHC_FilterWidget._renderDropDown(filterWidgetDiv, data, data.selectedFields, 'addField');
FHC_FilterWidget._renderDropDown(data, data.selectedFields, 'addField');
},
/**
* Renders a dropdown attached to the HTML element ddElementId, using the elements from data.fields
* and excluding the elements that are prenset in the elements parameter
*/
_renderDropDown: function(filterWidgetDiv, data, elements, ddElementId) {
_renderDropDown: function(data, elements, ddElementId) {
if (data.hasOwnProperty("fields") && $.isArray(data.fields))
{
@@ -729,9 +683,9 @@ var FHC_FilterWidget = {
fieldToDisplay = data.columnsAliases[fc];
}
if (filterWidgetDiv.find("#" + ddElementId).length) // checks if the element exists
if ($("#" + ddElementId).length) // checks if the element exists
{
filterWidgetDiv.find("#" + ddElementId).append("<option value='" + fieldName + "'>" + fieldToDisplay + "</option>");
$("#" + ddElementId).append("<option value='" + fieldName + "'>" + fieldToDisplay + "</option>");
}
}
}
@@ -742,7 +696,7 @@ var FHC_FilterWidget = {
* Render the GUI to operate with the filters applied to the dataset
* The list of all applied filters is retrieved from the parameter data
*/
_renderAppliedFilters: function(filterWidgetDiv, data) {
_renderAppliedFilters: function(data) {
if (data.hasOwnProperty("datasetMetadata") && $.isArray(data.datasetMetadata)
&& data.hasOwnProperty("filters") && $.isArray(data.filters))
@@ -773,7 +727,7 @@ var FHC_FilterWidget = {
appliedFilters += "</div>";
filterWidgetDiv.find("#appliedFilters").append(appliedFilters);
$("#appliedFilters").append(appliedFilters);
}
}
}
@@ -785,9 +739,9 @@ var FHC_FilterWidget = {
* to apply a filter to the dataset
* The list of all usable fields and their possibly aliases are retrieved from the parameter data
*/
_renderDropDownFilters: function(filterWidgetDiv, data) {
_renderDropDownFilters: function(data) {
FHC_FilterWidget._renderDropDown(filterWidgetDiv, data, data.filters, 'addFilter');
FHC_FilterWidget._renderDropDown(data, data.filters, 'addFilter');
},
/**
@@ -884,24 +838,24 @@ var FHC_FilterWidget = {
return html;
},
_renderDataset: function(filterWidgetDiv, data) {
_renderDataset: function(data) {
// If the choosen dataset representation is tablesorter then...
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_FilterWidget._renderDatasetTablesorter(filterWidgetDiv, data); // ...render the tablesorter GUI
FHC_FilterWidget._renderDatasetTablesorter(data); // ...render the tablesorter GUI
}
// If the choosen dataset representation is pivotUI then...
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
{
FHC_FilterWidget._renderDatasetPivotUI(filterWidgetDiv, data); // ...render the pivotUI GUI
FHC_FilterWidget._renderDatasetPivotUI(data); // ...render the pivotUI GUI
}
// If the choosen dataset representation is tabulator then...
if (FHC_FilterWidget._datasetRepresentation == DATASET_REP_TABULATOR)
{
FHC_FilterWidget._renderDatasetTabulator(filterWidgetDiv, data); // ...render the tabulator GUI
FHC_FilterWidget._renderDatasetTabulator(data); // ...render the tabulator GUI
}
},
@@ -909,11 +863,19 @@ var FHC_FilterWidget = {
* Renders the tablesorter for the FilterWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetTablesorter: function(filterWidgetDiv, data) {
_renderDatasetTablesorter: function(data) {
//clear tablesorter filter storage
var keepTsFilter = FHC_AjaxClient.getUrlParameter("keepTsFilter");
if (typeof keepTsFilter === "undefined" || keepTsFilter !== "true")
{
FHC_FilterWidget._clearTablesorterLocalStorage();
}
if (data.hasOwnProperty("checkboxes") && data.checkboxes != null && data.checkboxes.trim() != "")
{
filterWidgetDiv.find("#filterTableDataset > thead > tr").append("<th data-filter='false' title='Select'>Select</th>");
$("#filterTableDataset > thead > tr").append("<th data-filter='false' title='Select'>Select</th>");
}
var arrayFieldsToDisplay = FHC_FilterWidget._getFieldsToDisplay(data);
@@ -922,7 +884,7 @@ var FHC_FilterWidget = {
{
var columnName = arrayFieldsToDisplay[i];
filterWidgetDiv.find("#filterTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
$("#filterTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
}
if (data.hasOwnProperty("additionalColumns") && $.isArray(data.additionalColumns))
@@ -931,7 +893,7 @@ var FHC_FilterWidget = {
{
var columnName = data.additionalColumns[i];
filterWidgetDiv.find("#filterTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
$("#filterTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
}
}
@@ -942,8 +904,8 @@ var FHC_FilterWidget = {
if (data.checkboxes != null && data.checkboxes != "")
{
// select checkbox range with shift key
if (typeof filterWidgetDiv.find("#filterTableDataset").checkboxes === 'function')
filterWidgetDiv.find("#filterTableDataset").checkboxes("range", true);
if (typeof $("#filterTableDataset").checkboxes === 'function')
$("#filterTableDataset").checkboxes("range", true);
}
for (var i = 0; i < data.dataset.length; i++)
@@ -985,7 +947,7 @@ var FHC_FilterWidget = {
strHtml += "</tr>";
filterWidgetDiv.find("#filterTableDataset > tbody").append(strHtml);
$("#filterTableDataset > tbody").append(strHtml);
}
}
}
@@ -994,9 +956,9 @@ var FHC_FilterWidget = {
/**
* Enable the tablesorter libs to render the dataset table with sorting features
*/
_enableTableSorter: function(filterWidgetDiv) {
_enableTableSorter: function() {
var filterWidgetTablesorter = filterWidgetDiv.find("#filterTableDataset");
var filterWidgetTablesorter = $("#filterTableDataset");
// Checks if the table contains data (rows)
if (filterWidgetTablesorter.find("tbody:empty").length == 0
@@ -1011,10 +973,6 @@ var FHC_FilterWidget = {
}
});
// Reset filter storage if there is a filter id in url
var filter_id = FHC_AjaxClient.getUrlParameter("filter_id");
if (typeof filter_id !== "undefined") FHC_FilterWidget._cleanTablesorterLocalStorage(filterWidgetTablesorter);
$.tablesorter.updateAll(filterWidgetTablesorter[0].config, true, null);
}
},
@@ -1022,24 +980,24 @@ var FHC_FilterWidget = {
/**
* Disable the tablesorter
*/
_disableTablesorter: function(filterWidgetDiv) {
_disableTablesorter: function() {
filterWidgetDiv.find("#filterTableDataset").trigger("disable");
$("#filterTableDataset").trigger("disable");
},
/**
* Tablesorter filter local storage clean
*/
_cleanTablesorterLocalStorage: function(filterWidgetTablesorter) {
_cleanTablesorterLocalStorage: function() {
filterWidgetTablesorter.trigger("filterResetSaved");
$("#filterTableDataset").trigger("filterResetSaved");
},
/**
* Renders the pivotUI for the FilterWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetPivotUI: function(filterWidgetDiv, data) {
_renderDatasetPivotUI: function(data) {
// Checks if options were given and returns them
var options = FHC_FilterWidget._getRepresentationOptions(data);
@@ -1088,7 +1046,7 @@ var FHC_FilterWidget = {
}
// Renders the pivotUI
filterWidgetDiv.find("#filterPivotUI").pivotUI(
$("#filterPivotUI").pivotUI(
pivotUIData,
options
);
@@ -1131,7 +1089,7 @@ var FHC_FilterWidget = {
* Renders the tabulator for the FilterWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetTabulator: function(filterWidgetDiv, data) {
_renderDatasetTabulator: function(data) {
// Checks if options were given and returns them
var options = FHC_FilterWidget._getRepresentationOptions(data);
@@ -1152,7 +1110,7 @@ var FHC_FilterWidget = {
options.data = data.dataset;
// Renders the tabulator
filterWidgetDiv.find("#filterTabulator").tabulator(options);
$("#filterTabulator").tabulator(options);
}
}
},
@@ -1267,6 +1225,10 @@ var FHC_FilterWidget = {
return fieldsDefinitions;
},
_clearTablesorterLocalStorage: function() {
localStorage.removeItem("tablesorter-filters");
},
/**
* Set what type of dataset representation was choosen
*/
@@ -1283,11 +1245,7 @@ var FHC_FilterWidget = {
*/
_setHideMenu: function(data) {
if (FHC_FilterWidget._filterWidgetsAttributes.length > 1)
{
FHC_FilterWidget._hideMenu = true;
}
else if (data.hasOwnProperty("hideMenu"))
if (data.hasOwnProperty("hideMenu"))
{
FHC_FilterWidget._hideMenu = data.hideMenu;
}
@@ -1302,33 +1260,6 @@ var FHC_FilterWidget = {
{
FHC_FilterWidget._hideOptions = data.hideOptions;
}
},
/**
* Return true if there are more then one FilterWidget in this page, otherwise false
*/
_isMultipleFilterWidgets: function() {
return $("div[id*='divFilterWidgetDataset']").length > 1;
},
/**
*
*/
_setFilterWidgetsAttributes: function() {
FHC_FilterWidget._filterWidgetsAttributes = [];
$("div[id*='divFilterWidgetDataset']").each(function(i, e) {
var filterWidgetsAttributes = {};
filterWidgetsAttributes.app = e.attributes["app"].nodeValue;
filterWidgetsAttributes.dataset = e.attributes["dataset"].nodeValue;
filterWidgetsAttributes.filterid = e.attributes["filterid"].nodeValue;
FHC_FilterWidget._filterWidgetsAttributes.push(filterWidgetsAttributes);
});
}
};
+594
View File
@@ -0,0 +1,594 @@
/**
* TableWidget JS magic
*/
//--------------------------------------------------------------------------------------------------------------------
// Constants
//
const DATASET_REP_TABLESORTER = "tablesorter";
const DATASET_REP_PIVOTUI = "pivotUI";
const DATASET_REP_TABULATOR = "tabulator";
/**
* FHC_TableWidget this object is used to render the GUI of a table widget and to operate with it
*/
var FHC_TableWidget = {
//------------------------------------------------------------------------------------------------------------------
// Properties
_datasetRepresentation: null, // contains the current data representation
//------------------------------------------------------------------------------------------------------------------
// Public methods
/**
* To display the TableWidget using the loaded data prenset in the session
*/
display: function() {
FHC_TableWidget._getTables(FHC_TableWidget._renderTableWidget);
},
/**
* Alias call to method display only to inprove the readability of the code
*/
refresh: function() {
FHC_TableWidget.display();
},
//------------------------------------------------------------------------------------------------------------------
// Private methods
/**
* To retrive the page where the TableWidget is used, using the FHC_JS_DATA_STORAGE_OBJECT
*/
_getTableUniqueIdPrefix: function() {
return FHC_JS_DATA_STORAGE_OBJECT.called_path + "/" + FHC_JS_DATA_STORAGE_OBJECT.called_method;
},
/**
* Utility method that checks if data contains an error and print that to the console
* otherwise the TableWidget GUI is refreshed
*/
_failOrRefresh: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.isError(data))
{
console.log(FHC_AjaxClient.getError(data));
}
else
{
FHC_TableWidget.refresh();
}
},
/**
* Utility method that checks if data contains an error and print that to the console
* otherwise the page is reloaded
*/
_failOrReload: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.isError(data))
{
console.log(FHC_AjaxClient.getError(data));
}
else
{
location.reload();
}
},
/**
* To reset the Table Widget GUI
*/
_resetGUI: function(tableWidgetDiv) {
// If the choosen dataset representation is tablesorter
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").html("");
tableWidgetDiv.find("#tableWidgetTableDataset > tbody").html("");
}
// If the choosen dataset representation is pivotUI
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
{
tableWidgetDiv.find("#tableWidgetPivotUI").html("");
}
// If the choosen dataset representation is tabulator
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABULATOR)
{
tableWidgetDiv.find("#tableWidgetTabulator").html("");
}
},
/**
* To get via Ajax all the data related to the TableWidget present in the given page
* If the parameter renderFunction is a valid function, is called on success
*/
_getTables: function(renderFunction) {
var tableWidgetUniqueIdArray = FHC_TableWidget._getTableWidgetUniqueIdArray();
for (var tableWidgetsCounter = 0; tableWidgetsCounter < tableWidgetUniqueIdArray.length; tableWidgetsCounter++)
{
FHC_AjaxClient.ajaxCallGet(
"widgets/Tables/getTable",
{
tableUniqueId: FHC_TableWidget._getTableUniqueIdPrefix() + "/" + tableWidgetUniqueIdArray[tableWidgetsCounter]
},
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
if (typeof renderFunction == "function")
{
renderFunction(FHC_AjaxClient.getData(data));
}
}
else
{
console.log(FHC_AjaxClient.getError(data));
}
}
}
);
}
},
/**
* This method calls all the other methods needed to rendere the GUI for a TableWidget
* The parameter data contains all the data about the TableWidget 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
*/
_renderTableWidget: function(data) {
FHC_TableWidget._setDatasetRepresentation(data); // set what type of dataset representation was choosen
var tableWidgetDiv = $('div[tableUniqueId="' + data.tableUniqueId + '"]');
FHC_TableWidget._turnOffEvents(tableWidgetDiv); // turns all the events off
FHC_TableWidget._resetGUI(tableWidgetDiv); // Reset the entire GUI
FHC_TableWidget._renderDataset(tableWidgetDiv, data);
FHC_TableWidget._turnOnEvents(tableWidgetDiv); // turns all the events off
},
/**
* Turns all the events off
* NOTE: must be aligned to _turnOnEvents
*/
_turnOffEvents: function(tableWidgetDiv) {
// If the choosen dataset representation is tablesorter
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_TableWidget._disableTablesorter(tableWidgetDiv); // disable the tablesorter
}
},
/**
* Turns all the events on
* NOTE: must be aligned to _turnOffEvents
*/
_turnOnEvents: function(tableWidgetDiv) {
// If the choosen dataset representation is tablesorter
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_TableWidget._enableTableSorter(tableWidgetDiv); // enable the tablesorter
}
},
_renderDataset: function(tableWidgetDiv, data) {
// If the choosen dataset representation is tablesorter then...
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABLESORTER)
{
FHC_TableWidget._renderDatasetTablesorter(tableWidgetDiv, data); // ...render the tablesorter GUI
}
// If the choosen dataset representation is pivotUI then...
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_PIVOTUI)
{
FHC_TableWidget._renderDatasetPivotUI(tableWidgetDiv, data); // ...render the pivotUI GUI
}
// If the choosen dataset representation is tabulator then...
if (FHC_TableWidget._datasetRepresentation == DATASET_REP_TABULATOR)
{
FHC_TableWidget._renderDatasetTabulator(tableWidgetDiv, data); // ...render the tabulator GUI
}
},
/**
* Renders the tablesorter for the TableWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetTablesorter: function(tableWidgetDiv, data) {
if (data.hasOwnProperty("checkboxes") && data.checkboxes != null && data.checkboxes.trim() != "")
{
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th data-filter='false' title='Select'>Select</th>");
}
var arrayFieldsToDisplay = FHC_TableWidget._getFieldsToDisplay(data);
for (var i = 0; i < arrayFieldsToDisplay.length; i++)
{
var columnName = arrayFieldsToDisplay[i];
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
}
if (data.hasOwnProperty("additionalColumns") && $.isArray(data.additionalColumns))
{
for (var i = 0; i < data.additionalColumns.length; i++)
{
var columnName = data.additionalColumns[i];
tableWidgetDiv.find("#tableWidgetTableDataset > thead > tr").append("<th title='" + columnName + "'>" + columnName + "</th>");
}
}
if (arrayFieldsToDisplay.length > 0)
{
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
{
if (data.checkboxes != null && data.checkboxes != "")
{
// select checkbox range with shift key
if (typeof tableWidgetDiv.find("#tableWidgetTableDataset").checkboxes === 'function')
tableWidgetDiv.find("#tableWidgetTableDataset").checkboxes("range", true);
}
for (var i = 0; i < data.dataset.length; i++)
{
var record = data.dataset[i];
if ($.isEmptyObject(record))
{
continue;
}
var strHtml = "<tr class='" + record.MARK_ROW_CLASS + "'>";
if (data.checkboxes != null && data.checkboxes != "")
{
strHtml += "<td>";
strHtml += "<input type='checkbox' name='" + data.checkboxes + "[]' value='" + record[data.checkboxes] + "'>";
strHtml += "</td>";
}
$.each(arrayFieldsToDisplay, function(i, fieldToDisplay) {
if (record.hasOwnProperty(data.fields[i]))
{
strHtml += "<td>" + record[data.fields[i]] + "</td>";
}
});
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
{
$.each(data.additionalColumns, function(i, additionalColumn) {
if (record.hasOwnProperty(additionalColumn))
{
strHtml += "<td>" + record[additionalColumn] + "</td>";
}
});
}
strHtml += "</tr>";
tableWidgetDiv.find("#tableWidgetTableDataset > tbody").append(strHtml);
}
}
}
},
/**
* Enable the tablesorter libs to render the dataset table with sorting features
*/
_enableTableSorter: function(tableWidgetDiv) {
var tableWidgetTablesorter = tableWidgetDiv.find("#tableWidgetTableDataset");
// Checks if the table contains data (rows)
if (tableWidgetTablesorter.find("tbody:empty").length == 0
&& tableWidgetTablesorter.find("tr:empty").length == 0
&& tableWidgetTablesorter.hasClass("table-condensed"))
{
tableWidgetTablesorter.tablesorter({
dateFormat: "ddmmyyyy",
widgets: ["zebra", "filter"],
widgetOptions: {
filter_saveFilters : true
}
});
$.tablesorter.updateAll(tableWidgetTablesorter[0].config, true, null);
}
},
/**
* Disable the tablesorter
*/
_disableTablesorter: function(tableWidgetDiv) {
tableWidgetDiv.find("#tableWidgetTableDataset").trigger("disable");
},
/**
* Renders the pivotUI for the TableWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetPivotUI: function(tableWidgetDiv, data) {
// Checks if options were given and returns them
var options = FHC_TableWidget._getRepresentationOptions(data);
// Manipulation for the representation!
var arrayFieldsToDisplay = FHC_TableWidget._getFieldsToDisplay(data);
// If there are fields to be displayed...
if (arrayFieldsToDisplay.length > 0)
{
// ...if there are data to be displayed...
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
{
// Build the array of objects used by pivotUI and store it in pivotUIData
var pivotUIData = [];
// Loops through data
for (var i = 0; i < data.dataset.length; i++)
{
var record = data.dataset[i]; // Single record
var tmpObj = {}; // New object that represents a record
// Loops through columns of a record
$.each(arrayFieldsToDisplay, function(i, fieldToDisplay) {
if (record.hasOwnProperty(data.fields[i]))
{
tmpObj[fieldToDisplay] = record[data.fields[i]]; // Add data with the column alias
}
});
// If additional columns are present...
if (data.additionalColumns != null && $.isArray(data.additionalColumns))
{
// ...loops through them
$.each(data.additionalColumns, function(i, additionalColumn) {
if (record.hasOwnProperty(additionalColumn))
{
tmpObj[additionalColumn] = record[additionalColumn]; // Add the additional column
}
});
}
pivotUIData.push(tmpObj); // Add tmpObj to pivotUIData
}
// Renders the pivotUI
tableWidgetDiv.find("#tableWidgetPivotUI").pivotUI(
pivotUIData,
options
);
}
}
},
/**
* Retrives the fields to be displayed from the data parameter, if aliases are present then they are used
*/
_getFieldsToDisplay: function(data) {
var arrayFieldsToDisplay = [];
if (data.hasOwnProperty("fields") && $.isArray(data.fields))
{
if (data.hasOwnProperty("columnsAliases") && $.isArray(data.columnsAliases))
{
for (var sfc = 0; sfc < data.fields.length; sfc++)
{
for (var fc = 0; fc < data.fields.length; fc++)
{
if (data.fields[sfc] == data.fields[fc])
{
arrayFieldsToDisplay[sfc] = data.columnsAliases[fc];
}
}
}
}
else
{
arrayFieldsToDisplay = data.fields;
}
}
return arrayFieldsToDisplay;
},
/**
* Renders the tabulator for the TableWidget
* The data to be displayed are retrived from the parameter data
*/
_renderDatasetTabulator: function(tableWidgetDiv, data) {
// Checks if options were given and returns them
var options = FHC_TableWidget._getRepresentationOptions(data);
// Checks if record fields definitions were given and returns them
var recordFieldsDefinitions = FHC_TableWidget._getRepresentationFieldsDefinitions(data);
// Manipulation for the representation!
var arrayTabulatorColumns = FHC_TableWidget._getTabulatorColumns(data, recordFieldsDefinitions);
if (arrayTabulatorColumns.length > 0)
{
// ...if there are data to be displayed...
if (data.hasOwnProperty("dataset") && $.isArray(data.dataset))
{
if (options == null) options = {};
options.columns = arrayTabulatorColumns;
options.data = data.dataset;
// Renders the tabulator
tableWidgetDiv.find("#tableWidgetTabulator").tabulator(options);
}
}
},
/**
* Retrives the fields to be displayed from the data parameter, if aliases are present then they are used
*/
_getTabulatorColumns: function(data, recordFieldsDefinitions) {
var fieldsToDisplayTabulator = [];
if (data.hasOwnProperty("fields") && $.isArray(data.fields))
{
for (var sfc = 0; sfc < data.fields.length; sfc++)
{
for (var fc = 0; fc < data.fields.length; fc++)
{
if (data.fields[sfc] == data.fields[fc])
{
// Build the array of objects (columns) used by tabulator and store it in tabulatorColumns
var tmpColumnObj = {}; // New object that represents a column
// If was given a definition for this field then use it!
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(data.fields[sfc]))
{
tmpColumnObj = recordFieldsDefinitions[data.fields[sfc]];
}
tmpColumnObj.field = data.fields[sfc]; // Field name to be linked with dataset field name
// If there is an alias for this field use it to give a title to this field (header)
if (data.hasOwnProperty("columnsAliases") && $.isArray(data.columnsAliases))
{
tmpColumnObj.title = data.columnsAliases[fc];
}
else // otherwise use the field name itself
{
tmpColumnObj.title = data.fields[sfc];
}
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
}
}
}
}
// If additional columns are present...
if (data.hasOwnProperty("additionalColumns") && data.additionalColumns != null && $.isArray(data.additionalColumns))
{
// ...loops through them
$.each(data.additionalColumns, function(i, additionalColumn) {
var tmpColumnObj = {}; // New object that represents a column
// If was given a definition for this field then use it!
if (recordFieldsDefinitions != null && recordFieldsDefinitions.hasOwnProperty(additionalColumn))
{
tmpColumnObj = recordFieldsDefinitions[additionalColumn];
}
tmpColumnObj.title = additionalColumn; // Give a title to this field (header)
tmpColumnObj.field = additionalColumn; // Field name to be linked with dataset field name
fieldsToDisplayTabulator.push(tmpColumnObj); // Add tmpColumnObj to tabulatorColumns
});
}
return fieldsToDisplayTabulator;
},
/**
* Gets options for the representation
*/
_getRepresentationOptions: function(data) {
var options = {}; // eventually contains options fot the representation
// Checks if options were given
if (data.hasOwnProperty("datasetRepresentationOptions") && data.datasetRepresentationOptions != "")
{
var tmpOptions = eval("(" + data.datasetRepresentationOptions + ")"); // and converts them from string to javascript code
// If it is an object then can be used
if (typeof tmpOptions == "object")
{
options = tmpOptions;
}
}
return options;
},
/**
* Gets record fields definitions to represent the dataset
*/
_getRepresentationFieldsDefinitions: function(data) {
var fieldsDefinitions = {}; // eventually contains record fields definitions
// Checks if record fields definitions was given as parameter
if (data.hasOwnProperty("datasetRepresentationFieldsDefinitions") && data.datasetRepresentationFieldsDefinitions != "")
{
var tmpFDefs = eval("(" + data.datasetRepresentationFieldsDefinitions + ")"); // and converts them from string to javascript code
// If it is an object then can be used
if (typeof tmpFDefs == "object")
{
fieldsDefinitions = tmpFDefs;
}
}
return fieldsDefinitions;
},
/**
* Set what type of dataset representation was choosen
*/
_setDatasetRepresentation: function(data) {
if (data.hasOwnProperty("datasetRepresentation"))
{
FHC_TableWidget._datasetRepresentation = data.datasetRepresentation;
}
},
_getTableWidgetUniqueIdArray: function() {
var tableWidgetUniqueIdArray = [];
$("div[id*='divTableWidgetDataset']").each(function(i, e) {
tableWidgetUniqueIdArray.push(e.attributes["tableUniqueId"].nodeValue);
});
return tableWidgetUniqueIdArray;
}
};
/**
* When JQuery is up
*/
$(document).ready(function() {
FHC_TableWidget.display();
});
+224 -129
View File
@@ -10,111 +10,113 @@ const STGFREIGABE_MESSAGE_VORLAGE = "InfocenterSTGfreigegeben";
//Statusgründe for which no Studiengang Freigabe Message should be sent
const FIT_PROGRAMM_STUDIENGAENGE = [10021, 10027];
const PARKEDNAME = 'parked';
const ONHOLDNAME = 'onhold';
/**
* javascript file for infocenterDetails page
*/
$(document).ready(function ()
{
//initialise table sorter
Tablesort.addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
Tablesort.addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
//initialise table sorter
Tablesort.addTablesorter("doctable", [[2, 1], [1, 0]], ["zebra"]);
Tablesort.addTablesorter("nachgdoctable", [[2, 0], [1, 1]], ["zebra"]);
InfocenterDetails._formatMessageTable();
InfocenterDetails._formatNotizTable();
InfocenterDetails._formatLogTable();
InfocenterDetails._formatMessageTable();
InfocenterDetails._formatNotizTable();
InfocenterDetails._formatLogTable();
var personid = $("#hiddenpersonid").val();
//add submit event to message send link
$("#sendmsglink").click(function ()
{
$("#sendmsgform").submit();
});
//add click events to "formal geprüft" checkboxes
$(".prchbox").click(function ()
{
var boxid = this.id;
var akteid = boxid.substr(boxid.indexOf("_") + 1);
var checked = this.checked;
InfocenterDetails.saveFormalGeprueft(personid, akteid, checked)
});
//add click events to zgv Prüfung section
InfocenterDetails._addZgvPruefungEvents(personid);
MessageList.initMessageList();
//save notiz
$("#notizform").on("submit", function (e)
{
e.preventDefault();
var notizid = $("#notizform :input[name='hiddenNotizId']").val();
var formdata = $(this).serializeArray();
var data = {};
data.person_id = personid;
for (var i = 0; i < formdata.length; i++)
{
data[formdata[i].name] = formdata[i].value;
}
$("#notizmsg").empty();
if (notizid !== '')
{
InfocenterDetails.updateNotiz(notizid, data);
}
else
{
InfocenterDetails.saveNotiz(personid, data);
}
}
);
//update notiz - autofill notizform
$(document).on("click", "#notiztable tbody tr", function ()
{
$("#notizmsg").empty();
var notizid = $(this).find("td.hiddennotizid").html();
InfocenterDetails.getNotiz(notizid);
}
);
//update notiz - abbrechen-button: reset styles
$("#notizform :input[type='reset']").click(function ()
{
InfocenterDetails._resetNotizFields();
}
);
//check if person is parked and display it
InfocenterDetails.getParkedDate(personid);
if ($(document).scrollTop() > 20)
$("#scrollToTop").show();
//scroll to top button
$(window).scroll(function()
{
if ($(document).scrollTop() > 20)
$("#scrollToTop").show();
else
$("#scrollToTop").hide();
}
);
$("#scrollToTop").click(function()
{
$('html,body').animate({scrollTop:0},250,'linear');
}
)
var personid = $("#hiddenpersonid").val();
//add submit event to message send link
$("#sendmsglink").click(function ()
{
$("#sendmsgform").submit();
});
//add click events to "formal geprüft" checkboxes
$(".prchbox").click(function ()
{
var boxid = this.id;
var akteid = boxid.substr(boxid.indexOf("_") + 1);
var checked = this.checked;
InfocenterDetails.saveFormalGeprueft(personid, akteid, checked)
});
//add click events to zgv Prüfung section
InfocenterDetails._addZgvPruefungEvents(personid);
MessageList.initMessageList();
//save notiz
$("#notizform").on("submit", function (e)
{
e.preventDefault();
var notizid = $("#notizform :input[name='hiddenNotizId']").val();
var formdata = $(this).serializeArray();
var data = {};
data.person_id = personid;
for (var i = 0; i < formdata.length; i++)
{
data[formdata[i].name] = formdata[i].value;
}
$("#notizmsg").empty();
if (notizid !== '')
{
InfocenterDetails.updateNotiz(notizid, data);
}
else
{
InfocenterDetails.saveNotiz(personid, data);
}
}
);
//update notiz - autofill notizform
$(document).on("click", "#notiztable tbody tr", function ()
{
$("#notizmsg").empty();
var notizid = $(this).find("td.hiddennotizid").html();
InfocenterDetails.getNotiz(notizid);
}
);
//update notiz - abbrechen-button: reset styles
$("#notizform :input[type='reset']").click(function ()
{
InfocenterDetails._resetNotizFields();
}
);
//check if person is postponed (parked, on hold...) and display it
InfocenterDetails.getPostponeDate(personid);
if ($(document).scrollTop() > 20)
$("#scrollToTop").show();
//scroll to top button
$(window).scroll(function()
{
if ($(document).scrollTop() > 20)
$("#scrollToTop").show();
else
$("#scrollToTop").hide();
}
);
$("#scrollToTop").click(function()
{
$('html,body').animate({scrollTop:0},250,'linear');
}
)
});
var InfocenterDetails = {
openZgvInfoForPrestudent: function(prestudent_id)
@@ -397,7 +399,7 @@ var InfocenterDetails = {
{
var engdate = $.datepicker.parseDate("yy-mm-dd", FHC_AjaxClient.getData(data)[0]);
var gerdate = $.datepicker.formatDate("dd.mm.yy", engdate);
$("#parkdate").val(gerdate);
$("#postponedate").val(gerdate);
}
},
errorCallback: function()
@@ -408,19 +410,19 @@ var InfocenterDetails = {
}
);
},
getParkedDate: function(personid)
getPostponeDate: function(personid)
{
FHC_AjaxClient.ajaxCallGet(
CALLED_PATH + "/getParkedDate/"+encodeURIComponent(personid),
CALLED_PATH + "/getPostponeDate/"+encodeURIComponent(personid),
null,
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
var parkedDate = FHC_AjaxClient.getData(data)[0];
InfocenterDetails._refreshParking(parkedDate);
var postponeobj = FHC_AjaxClient.getData(data);
InfocenterDetails._refreshPostpone(postponeobj);
InfocenterDetails._refreshLog();
if (parkedDate === null)
if (postponeobj === null || postponeobj.type === null)
InfocenterDetails.getStudienjahrEnd();
}
},
@@ -435,7 +437,7 @@ var InfocenterDetails = {
parkPerson: function(personid, date)
{
var parkError = function(){
$("#parkmsg").text(" Fehler beim Parken!");
$("#postponemsg").text(" Fehler beim Parken!");
};
FHC_AjaxClient.ajaxCallPost(
@@ -447,7 +449,7 @@ var InfocenterDetails = {
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
InfocenterDetails.getParkedDate(personid);
InfocenterDetails.getPostponeDate(personid);
else
{
parkError();
@@ -469,13 +471,62 @@ var InfocenterDetails = {
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
InfocenterDetails.getParkedDate(personid);
InfocenterDetails.getPostponeDate(personid);
}
else
$("#unparkmsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken'));
$("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumAusparken'));
},
errorCallback: function(){
$("#unparkmsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken'));
$("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimAusparken'));
},
veilTimeout: 0
}
);
},
setPersonOnHold: function(personid, date)
{
var onHoldError = function(){
$("#postponemsg").text(" Fehler beim Setzen auf On Hold!");
};
FHC_AjaxClient.ajaxCallPost(
CALLED_PATH + '/setOnHold',
{
"person_id": personid,
"onholddate": date
},
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
InfocenterDetails.getPostponeDate(personid);
else
{
onHoldError();
}
},
errorCallback: onHoldError,
veilTimeout: 0
}
);
},
removePersonOnHold: function(personid)
{
FHC_AjaxClient.ajaxCallPost(
CALLED_PATH + '/removeOnHold',
{
"person_id": personid
},
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
InfocenterDetails.getPostponeDate(personid);
}
else
$("#unpostponemsg").removeClass().addClass("text-warning").text(FHC_PhrasesLib.t('infocenter', 'nichtsZumEntfernen'));
},
errorCallback: function(){
$("#unpostponemsg").removeClass().addClass("text-danger").text(FHC_PhrasesLib.t('infocenter', 'fehlerBeimEntfernen'));
},
veilTimeout: 0
}
@@ -864,50 +915,94 @@ var InfocenterDetails = {
}
);
},
_refreshParking: function(date)
_refreshPostpone: function(postponeobj)
{
if (date === null)
var personid = $("#hiddenpersonid").val();
if (postponeobj === null || postponeobj.date === null || postponeobj.type === null)
{
$("#parking").html(
//show both park and on hold buttons if not parked and not on hold
$("#postponing").html(
'<div class="form-group form-inline">'+
'<button class="btn btn-default" id="parklink" type="button""><i class="fa fa-clock-o"></i>&nbsp;' + FHC_PhrasesLib.t('infocenter', 'bewerberParken') + '</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
FHC_PhrasesLib.t('global', 'bis') + '&nbsp;&nbsp;'+
'<input id="parkdate" type="text" class="form-control" placeholder="Parkdatum" style="height: 25px; width: 99px">&nbsp;'+
'<span class="text-danger" id="parkmsg"></span>'+
'<button class="btn btn-default" id="onholdlink" type="button""><i class="fa fa-anchor"></i>&nbsp;' + FHC_PhrasesLib.t('infocenter', 'bewerberOnHold') + '</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'<label id="postponedatelabel">'+FHC_PhrasesLib.t('global', 'bis') + '&nbsp;&nbsp;'+
'<input id="postponedate" type="text" class="form-control" placeholder="Parkdatum">&nbsp;'+
'<i class="fa fa-info-circle" data-toggle="tooltip" title="'+FHC_PhrasesLib.t('infocenter', 'parkenZurueckstellenInfo')+'"></i></label>'+
'<span class="text-danger" id="postponemsg"></span>'+
'</div>');
$("#parkdate").datepicker({
$("#postponedate").datepicker({
"dateFormat": "dd.mm.yy",
"minDate": 0
"minDate": 1
});
$("#parklink").click(
function ()
{
var personid = $("#hiddenpersonid").val();
var date = $("#parkdate").val();
var date = $("#postponedate").val();
InfocenterDetails.parkPerson(personid, date);
}
);
$("#onholdlink").click(
function ()
{
var date = $("#postponedate").val();
InfocenterDetails.setPersonOnHold(personid, date);
}
);
}
else
{
var parkdate = $.datepicker.parseDate("yy-mm-dd", date);
var gerparkdate = $.datepicker.formatDate("dd.mm.yy", parkdate);
$("#parking").html(
FHC_PhrasesLib.t('infocenter', 'bewerberGeparktBis')+'&nbsp;&nbsp;'+gerparkdate+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'<button class="btn btn-default" id="unparklink"><i class="fa fa-sign-out"></i>&nbsp;'+FHC_PhrasesLib.t('infocenter', 'bewerberAusparken')+'</button>&nbsp;'+
'<span id="unparkmsg"></span>'
//info if parked/on hold and possibility to undo parking/on hold
var postponedate = $.datepicker.parseDate("yy-mm-dd", postponeobj.date);
var gerpostponedate = $.datepicker.formatDate("dd.mm.yy", postponedate);
//var postponehtml = "";
var callbackforundo = null;
var removePhrase = "";
var postponedPhrase = "";
var postponedtext = "";
if (postponeobj.type === PARKEDNAME)
{
removePhrase = 'bewerberAusparken';
postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberGeparktBis')+'&nbsp;&nbsp;'+gerpostponedate;
callbackforundo = function ()
{
InfocenterDetails.unparkPerson(personid);
}
}
else if (postponeobj.type === ONHOLDNAME)
{
removePhrase = 'bewerberOnHoldEntfernen';
postponedtext = FHC_PhrasesLib.t('infocenter', 'bewerberOnHoldBis')+'&nbsp;&nbsp;'+gerpostponedate;
var currdate = new Date();
if (currdate > postponedate)
postponedtext = "<span class='alert-danger' data-toggle='tooltip' title='"+FHC_PhrasesLib.t('infocenter', 'rueckstelldatumUeberschritten')+"'>"+postponedtext+"</span>";
callbackforundo = function ()
{
InfocenterDetails.removePersonOnHold(personid);
}
}
var postponehtml = postponedtext+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+
'<button class="btn btn-default" id="unpostponelink"><i class="fa fa-sign-out"></i>&nbsp;'+FHC_PhrasesLib.t('infocenter', removePhrase)+'</button>&nbsp;'+
'<span id="unpostponemsg"></span>';
$("#postponing").html(
postponehtml
);
$("#unparklink").click(
function ()
{
var personid = $("#hiddenpersonid").val();
InfocenterDetails.unparkPerson(personid, date);
}
$("#unpostponelink").click(
callbackforundo
);
}
},
+112 -12
View File
@@ -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>&nbsp;' +
infocenter_studiensemester +
'&nbsp;<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>&nbsp;Alle</a>&nbsp;&nbsp;' +
@@ -42,17 +50,30 @@ var InfocenterPersonDataset = {
'<i class="fa fa-envelope"></i>&nbsp;Nachricht senden</a>';
var legendHtml = '<i class="fa fa-circle text-danger"></i> Gesperrt&nbsp;&nbsp;&nbsp;&nbsp;' +
'<i class="fa fa-circle text-info"></i> Geparkt';
'<i class="fa fa-circle text-info"></i> Geparkt&nbsp;&nbsp;&nbsp;&nbsp;' +
'<i class="fa fa-circle text-success"></i> Zurückgestellt';
// 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(
'widgets/Filters/rowNumber',
{
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix() + "/" +
$("#divFilterWidgetDataset").attr("app") + ":" +
$("#divFilterWidgetDataset").attr("dataset") + ":" +
$("#divFilterWidgetDataset").attr("filterid")
filterUniqueId: FHC_FilterWidget.getFilterUniqueIdPrefix()
},
{
successCallback: function(data, textStatus, jqXHR) {
@@ -73,9 +94,9 @@ var InfocenterPersonDataset = {
$("#datasetActionsTop, #datasetActionsBottom").append(
"<div class='row'>"+
"<div class='col-xs-6'>" + selectAllHtml + "&nbsp;&nbsp;" + actionHtml + "</div>"+
"<div class='col-xs-4'>" + legendHtml + "</div>"+
"<div class='col-xs-2 text-right'>" +
"<div class='col-xs-4'>" + selectAllHtml + "&nbsp;&nbsp;" + 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>"+
@@ -128,8 +149,87 @@ var InfocenterPersonDataset = {
trs.find("input[name=PersonId\\[\\]]").prop("checked", false);
}
);
}
//make sure tablesorter local storage for homepage url with and without "/index" shares same values
$("#filterTableDataset").bind('filterEnd', function()
{
if (FHC_JS_DATA_STORAGE_OBJECT.called_method === 'index')
{
var pathname = window.location.pathname;
var storageobj = localStorage.getItem("tablesorter-filters");
var parsed = JSON.parse(storageobj);
var regex = new RegExp(/\/index(?!\.ci\.php)/);
if (regex.test(pathname))
{
parsed[pathname.replace(regex, "")] = parsed[pathname];
}
else
{
parsed[pathname + "/index"] = parsed[pathname];
}
storageobj = JSON.stringify(parsed);
localStorage.setItem("tablesorter-filters", storageobj);
}
});
},
/**
* 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);
}
}
);
}
};
/**
@@ -137,6 +237,6 @@ var InfocenterPersonDataset = {
*/
$(document).ready(function() {
InfocenterPersonDataset.appendTableActionsHtml();
InfocenterPersonDataset.getStudiensemesterUservar(InfocenterPersonDataset.appendTableActionsHtml);
});
@@ -275,7 +275,7 @@ function func_footerElement(){
// Performs download CSV
function footer_downloadCSV(){
$('#filterTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
@@ -283,7 +283,7 @@ function footer_downloadCSV(){
* Select all (filtered) rows and ignore rows that are bestellt and erteilt
*/
function footer_selectAll(){
$('#filterTabulator').tabulator('getRows', true)
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(row => row.getData().bestellt != null && // bestellt
row.getData().erteilt != null && // AND erteilt
row.getData().akzeptiert == null && // AND NOT akzeptiert
@@ -296,7 +296,7 @@ function footer_selectAll(){
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#filterTabulator').tabulator('deselectRow');
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
@@ -432,12 +432,12 @@ $(function() {
// Show all rows
$("#show-all").click(function(){
$('#filterTabulator').tabulator('clearFilter');
$('#tableWidgetTabulator').tabulator('clearFilter');
});
// Show only rows with ordered lehrauftraege
$("#show-ordered").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '=', value: null},
@@ -448,7 +448,7 @@ $(function() {
// Show only rows with erteilte lehrauftraege
$("#show-approved").click(function(){
$('#filterTabulator').tabulator('setFilter', [
$('#tableWidgetTabulator').tabulator('setFilter', [
{field: 'bestellt', type: '!=', value: null}, // filter when is bestellt
{field: 'erteilt', type: '!=', value: null}, // and is erteilt
{field: 'akzeptiert', type: '=', value: null} // and is not akzeptiert
@@ -458,7 +458,7 @@ $(function() {
// Show only rows with akzeptierte lehrauftraege
$("#show-accepted").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '!=', value: null},
@@ -491,7 +491,7 @@ $(function() {
$("#accept-lehrauftraege").click(function(){
// Get selected rows data
var selected_data = $('#filterTabulator').tabulator('getSelectedData')
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
.map(function(data){
// reduce to necessary fields
return {
@@ -543,7 +543,7 @@ $(function() {
if (!data.error && data.retval != null)
{
// Update status 'Erteilt'
$('#filterTabulator').tabulator('updateData', data.retval);
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden akzeptiert.");
}
},
@@ -559,4 +559,4 @@ $(function() {
});
});
});
@@ -277,7 +277,7 @@ function func_footerElement(){
// Performs download CSV
function footer_downloadCSV(){
$('#filterTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
@@ -285,7 +285,7 @@ function footer_downloadCSV(){
* Select all (filtered) rows that are bestellt
*/
function footer_selectAll(){
$('#filterTabulator').tabulator('getRows', true)
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(row => row.getData().personalnummer >= 0 && // NOT dummies
row.getData().bestellt != null && // AND bestellt
row.getData().erteilt == null && // AND NOT erteilt
@@ -298,7 +298,7 @@ function footer_selectAll(){
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#filterTabulator').tabulator('deselectRow');
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
@@ -447,12 +447,12 @@ $(function() {
// Show all rows
$("#show-all").click(function(){
$('#filterTabulator').tabulator('clearFilter');
$('#tableWidgetTabulator').tabulator('clearFilter');
});
// Show only rows with new lehrauftraege (not dummy lectors)
$("#show-new").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0},
{field: 'bestellt', type: '=', value: null},
@@ -464,7 +464,7 @@ $(function() {
// Show only rows with ordered lehrauftraege
$("#show-ordered").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0},
{field: 'bestellt', type: '!=', value: null},
@@ -476,7 +476,7 @@ $(function() {
// Show only rows with erteilte lehrauftraege
$("#show-approved").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '!=', value: null},
@@ -487,7 +487,7 @@ $(function() {
// Show only rows with accepted lehrauftraege
$("#show-accepted").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '!=', value: null},
@@ -498,7 +498,7 @@ $(function() {
// Show only rows with dummy lectors
$("#show-dummies").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '!=', value: null},
{field: 'personalnummer', type: '<=', value: 0},
@@ -509,7 +509,7 @@ $(function() {
// Show only rows with dummy lectors
$("#show-changed").click(function(){
// needs custom filter to compare fields betrag and vertrag_betrag
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector AND
{field: 'bestellt', type: '!=', value: null}, // bestellt AND
@@ -553,7 +553,7 @@ $(function() {
// Approve Lehrauftraege
$("#approve-lehrauftraege").click(function(){
var selected_data = $('#filterTabulator').tabulator('getSelectedData')
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
.filter(function(val){
// filter pseudo lines of groupBy (e.g. the bottom calculations lines)
return val.row_index != null || typeof(val.row_index) !== 'undefined';
@@ -592,7 +592,7 @@ $(function() {
if (!data.error && data.retval != null)
{
// Update status 'Erteilt'
$('#filterTabulator').tabulator('updateData', data.retval);
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
}
FHC_DialogLib.alertSuccess(data.retval.length + " Lehraufträge wurden erteilt.");
@@ -605,4 +605,4 @@ $(function() {
);
});
});
});
+13 -13
View File
@@ -286,7 +286,7 @@ function func_footerElement(){
// Performs download CSV
function footer_downloadCSV(){
$('#filterTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
$('#tableWidgetTabulator').tabulator("download", "csv", "data.csv", {bom:true}); // BOM for correct UTF-8 char output
}
/*
@@ -294,7 +294,7 @@ function footer_downloadCSV(){
* Select all (filtered) rows and ignore rows which have status bestellt
*/
function footer_selectAll(){
$('#filterTabulator').tabulator('getRows', true)
$('#tableWidgetTabulator').tabulator('getRows', true)
.filter(row => row.getData().personalnummer >= 0 && // NOT dummies
row.getData().bestellt == null || // AND neu
row.getData().bestellt != null && // OR (bestellt
@@ -307,7 +307,7 @@ function footer_selectAll(){
* Deselect all (filtered) rows
*/
function footer_deselectAll(){
$('#filterTabulator').tabulator('deselectRow');
$('#tableWidgetTabulator').tabulator('deselectRow');
}
// Displays number of selected rows on row selection change
@@ -460,12 +460,12 @@ $(function() {
// Show all rows
$("#show-all").click(function(){
$('#filterTabulator').tabulator('clearFilter');
$('#tableWidgetTabulator').tabulator('clearFilter');
});
// Show only rows with new lehrauftraege (not dummy lectors)
$("#show-new").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0},
{field: 'bestellt', type: '=', value: null},
@@ -477,7 +477,7 @@ $(function() {
// Show only rows with ordered lehrauftraege
$("#show-ordered").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0},
{field: 'bestellt', type: '!=', value: null},
@@ -489,7 +489,7 @@ $(function() {
// Show only rows with erteilte lehrauftraege
$("#show-approved").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '!=', value: null},
@@ -500,7 +500,7 @@ $(function() {
// Show only rows with akzeptierte lehrauftraege
$("#show-accepted").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'bestellt', type: '!=', value: null},
{field: 'erteilt', type: '!=', value: null},
@@ -512,7 +512,7 @@ $(function() {
// Show only rows with geaenderte lectors
$("#show-changed").click(function(){
// needs custom filter to compare fields betrag and vertrag_betrag
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '>=', value: 0}, // NOT dummy lector AND
{field: 'bestellt', type: '!=', value: null}, // bestellt AND
@@ -523,7 +523,7 @@ $(function() {
// Show only rows with dummy lectors
$("#show-dummies").click(function(){
$('#filterTabulator').tabulator('setFilter',
$('#tableWidgetTabulator').tabulator('setFilter',
[
{field: 'personalnummer', type: '!=', value: null},
{field: 'personalnummer', type: '<=', value: 0},
@@ -566,7 +566,7 @@ $(function() {
// Order Lehrauftraege
$("#order-lehrauftraege").click(function(){
var selected_data = $('#filterTabulator').tabulator('getSelectedData')
var selected_data = $('#tableWidgetTabulator').tabulator('getSelectedData')
.filter(function(val){
// filter pseudo lines of groupBy (e.g. the bottom calculations lines)
return val.row_index != null || typeof(val.row_index) !== 'undefined';
@@ -615,7 +615,7 @@ $(function() {
if (!data.error && data.retval != null)
{
// Update status 'Bestellt'
$('#filterTabulator').tabulator('updateData', data.retval);
$('#tableWidgetTabulator').tabulator('updateData', data.retval);
}
FHC_DialogLib.alertSuccess("Alle " + data.retval.length + " Lehraufträge wurden bestellt.")
@@ -627,4 +627,4 @@ $(function() {
}
);
});
});
});
+76
View File
@@ -0,0 +1,76 @@
(function() {
var callWithJQuery;
callWithJQuery = function(pivotModule) {
if (typeof exports === "object" && typeof module === "object") {
return pivotModule(require("jquery"));
} else if (typeof define === "function" && define.amd) {
return define(["jquery"], pivotModule);
} else {
return pivotModule(jQuery);
}
};
callWithJQuery(function($) {
var deFmt, deFmtInt, deFmtPct, nf, tpl;
nf = $.pivotUtilities.numberFormat;
tpl = $.pivotUtilities.aggregatorTemplates;
deFmt = nf({
thousandsSep: ".",
decimalSep: ","
});
deFmtInt = nf({
digitsAfterDecimal: 0,
thousandsSep: ".",
decimalSep: ","
});
deFmtPct = nf({
digitsAfterDecimal: 1,
scaler: 100,
suffix: "%",
thousandsSep: ".",
decimalSep: ","
});
return $.pivotUtilities.locales.de = {
localeStrings: {
renderError: "Bei dem Zeichnen der Pivot Ergebnisse ist ein Fehler aufgetreten.",
computeError: "Bei dem berechnen der Pivot Ergebnisse ist ein Fehler aufgetreten.",
uiRenderError: "Bei dem Zeichnen des Pivot Interfaces ist ein Fehler aufgetreten.",
selectAll: "W&auml;hle alle",
selectNone: "W&auml;hle keine",
tooMany: "(zu viele Ergebnisse)",
filterResults: "Ergebnisse filtern",
totals: "Total",
vs: "vs",
by: "von"
},
aggregators: {
"Anzahl": tpl.count(deFmtInt),
"Anzahl einzigartiger Werte": tpl.countUnique(deFmtInt),
"Liste einzigartiger Werte": tpl.listUnique(", "),
"Summe": tpl.sum(deFmt),
"Summe in ganzen Zahlen": tpl.sum(deFmtInt),
"Durchschnitt": tpl.average(deFmt),
"Summe &uuml;ber Summe": tpl.sumOverSum(deFmt),
"80% obere Grenze": tpl.sumOverSumBound80(true, deFmt),
"80% untere Grenze": tpl.sumOverSumBound80(false, deFmt),
"Prozent": tpl.fractionOf(tpl.sum(), "total", deFmtPct),
"Prozent pro Reihe": tpl.fractionOf(tpl.sum(), "row", deFmtPct),
"Prozent pro Spalte": tpl.fractionOf(tpl.sum(), "col", deFmtPct),
"Anzahl als Teil des Ganzen": tpl.fractionOf(tpl.count(), "total", deFmtPct),
"Anzahl als Teil der Reihe": tpl.fractionOf(tpl.count(), "row", deFmtPct),
"Anzahl als Teil der Spalte": tpl.fractionOf(tpl.count(), "col", deFmtPct)
},
renderers: {
"Tabelle": $.pivotUtilities.renderers["Table"],
"Tabelle mit Balken": $.pivotUtilities.renderers["Table Barchart"],
"Heatmap": $.pivotUtilities.renderers["Heatmap"],
"Heatmap f&uuml;r Reihen": $.pivotUtilities.renderers["Row Heatmap"],
"Heatmap f&uuml;r Spalten": $.pivotUtilities.renderers["Col Heatmap"]
}
};
});
}).call(this);
//# sourceMappingURL=pivot.de.js.map