Commit f9b36ff9 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Merge branch '6345_AlertRework'

parents ce066ba3 42811aa9
......@@ -46,6 +46,8 @@ Notes
^^^^^
* Config.qfq.php: the variable T3_DB_NAME is not necessary anymore.
* Following SYSTEM_STORE variables renamed. Old: '_dbNameQfq' ,'_dbNameData'. New: 'dbNameQfq' ,'dbNameData'
* New: Bootstrap 'col-lg-10' is defined on every form. On screens greater than 'md' the forms won't be expanded to 100% anymore.
Features
^^^^^^^^
......@@ -53,11 +55,11 @@ Features
* #3992 / STORE_SYSTEM: dbNameQfq, dbNameData, dbNameT3
* Config.php: read 'dbNameT3' from TYPO3_CONF_VARS or from T3 config file.
* Download.php: get dbNameT3 now from STORE_SYSTEM
* #4906 Php Session Timeout: can be specified globally in configuration and per form. Affects only logged in FE User.
* #4906 / Php Session Timeout: can be specified globally in configuration and per form. Affects only logged in FE User.
* #6866 / On logout destroy STORE_USER. Session.php: check if _COOKIE['fe_typo_user'] has changed - yes: clear STORE_USER. Store.php: Rearrange functions.
* #6999 (Feature) Bootstrap/Form: define columns for desktop 'col-lg-10'
* #6999 / Bootstrap/Form: define columns for desktop 'col-lg-10'
* #7138 / PDF / single source: deliver without converting
* #7293/ Implement new logging for file upload.
* #7293 / Implement new logging for file upload.
* #7406 / dbinit might contain multiple sql statements now.
* #7407 / MariaDB / Ubuntu 18 complains about missing values if column of type TEXT isn't explicit specified in INSERT. New default for database.init=SET sql_mode = "NO_ENGINE_SUBSTITUTION"
* #7431 / FE.type=afterSave (FE Action): SQL won't report the causing FE.name/id
......
......@@ -4955,7 +4955,7 @@ tells QFQ to separate the rows of the result by a HTML-line break. The final res
::
10.sql = SELECT id AS personId, CONCAT(firstName, " ", lastName, " ") AS name FROM person
10.sep = <br>
10.rsep = <br>
HTML output:
::
......
......@@ -46,6 +46,8 @@ Notes
^^^^^
* Config.qfq.php: the variable T3_DB_NAME is not necessary anymore.
* Following SYSTEM_STORE variables renamed. Old: '_dbNameQfq' ,'_dbNameData'. New: 'dbNameQfq' ,'dbNameData'
* New: Bootstrap 'col-lg-10' is defined on every form. On screens greater than 'md' the forms won't be expanded to 100% anymore.
Features
^^^^^^^^
......@@ -53,11 +55,11 @@ Features
* #3992 / STORE_SYSTEM: dbNameQfq, dbNameData, dbNameT3
* Config.php: read 'dbNameT3' from TYPO3_CONF_VARS or from T3 config file.
* Download.php: get dbNameT3 now from STORE_SYSTEM
* #4906 Php Session Timeout: can be specified globally in configuration and per form. Affects only logged in FE User.
* #4906 / Php Session Timeout: can be specified globally in configuration and per form. Affects only logged in FE User.
* #6866 / On logout destroy STORE_USER. Session.php: check if _COOKIE['fe_typo_user'] has changed - yes: clear STORE_USER. Store.php: Rearrange functions.
* #6999 (Feature) Bootstrap/Form: define columns for desktop 'col-lg-10'
* #6999 / Bootstrap/Form: define columns for desktop 'col-lg-10'
* #7138 / PDF / single source: deliver without converting
* #7293/ Implement new logging for file upload.
* #7293 / Implement new logging for file upload.
* #7406 / dbinit might contain multiple sql statements now.
* #7407 / MariaDB / Ubuntu 18 complains about missing values if column of type TEXT isn't explicit specified in INSERT. New default for database.init=SET sql_mode = "NO_ENGINE_SUBSTITUTION"
* #7431 / FE.type=afterSave (FE Action): SQL won't report the causing FE.name/id
......
......@@ -91,7 +91,7 @@ class FormAction {
// Preparation for Log, Debug
$this->store->setVar(SYSTEM_FORM_ELEMENT, Logger::formatFormElementName($fe), STORE_SYSTEM); // debug
$this->store->setVar(SYSTEM_FORM_ELEMENT_ID, $fe[FE_ID], STORE_SYSTEM); // debug
$this->store->setVar(SYSTEM_FORM_ELEMENT_ID, $fe[FE_ID]??'', STORE_SYSTEM); // debug
$fe = HelperFormElement::initActionFormElement($fe);
......@@ -153,7 +153,7 @@ class FormAction {
break;
default:
// Always work on recent data: previous actions might have modified the data.
$this->store->fillStoreWithRecord($this->primaryTableName, $recordId, $this->db, $this->formSpec[F_PRIMARY_KEY]);
$this->store->fillStoreWithRecord($this->primaryTableName, $recordId, $this->db, $this->formSpec[F_PRIMARY_KEY]??'');
}
if (!$this->checkRequiredList($fe)) {
......
......@@ -5,6 +5,7 @@
/* global $ */
/* global EventEmitter */
/* @depend QfqEvents.js */
/* @depend AlertManager.js */
/**
* Qfq Namespace
......@@ -111,6 +112,8 @@ var QfqNS = QfqNS || {};
this.fadeInDuration = 400;
this.fadeOutDuration = 400;
this.timerId = null;
this.parent = {};
this.identifier = false;
this.eventEmitter = new EventEmitter();
};
......@@ -128,14 +131,15 @@ var QfqNS = QfqNS || {};
* @private
*/
n.Alert.prototype.makeAlertContainerSingleton = function () {
var alertContainer = $(n.Alert.constants.alertContainerSelector);
alertContainer.remove();
// No container so far, create one
alertContainer = $("<div>").attr("id", n.Alert.constants.alertContainerId);
if (!n.QfqPage.alertManager) {
n.QfqPage.alertManager = new n.AlertManager({});
}
$("body").append(alertContainer);
return n.QfqPage.alertManager;
};
return alertContainer;
n.Alert.prototype.setIdentifier = function (i) {
this.identifier = i;
};
/**
......@@ -151,9 +155,9 @@ var QfqNS = QfqNS || {};
* @private
*/
n.Alert.prototype.removeAlertContainer = function () {
$(n.Alert.constants.alertContainerSelector + "> div").remove();
if (this.modal) {
$("#alert-interactive").remove();
this.shown = false;
this.parent.removeModalAlert();
}
};
......@@ -220,27 +224,20 @@ var QfqNS = QfqNS || {};
*/
n.Alert.prototype.show = function () {
$(".removeMe").remove();
var $alertContainer;
var alertContainer;
if (this.shown) {
// We only allow showing once
return;
}
$(n.Alert.constants.alertContainerSelector + " > div").trigger(n.Alert.constants.jQueryAlertRemoveEventName);
this.parent = this.makeAlertContainerSingleton();
this.parent.addAlert(this);
$alertContainer = this.makeAlertContainerSingleton();
if (this.modal) {
this.$modalDiv = $("<div>", {
class: "removeMe"
});
this.$modalDiv.css('z-index', 1000);
$alertContainer.css('position', 'fixed');
$alertContainer.css('left', 0);
$alertContainer.css('top', 0);
$alertContainer.css('z-index', 999);
$alertContainer.css('background', 'rgba(0,0,0,0.5)');
$alertContainer.css('width', "100%");
$alertContainer.css('height', Math.max($(document).height(), $(window).height()) + "px");
this.parent.createBlockScreen(this);
}
if (this.messageTitle) {
......@@ -265,6 +262,7 @@ var QfqNS = QfqNS || {};
if (this.modal) {
this.$alertDiv.addClass("alert-interactive");
this.$alertDiv.css('z-index', 1000);
} else {
this.$alertDiv.addClass("alert-side");
}
......@@ -282,7 +280,7 @@ var QfqNS = QfqNS || {};
this.$alertDiv.on(n.Alert.constants.jQueryAlertRemoveEventName, this.removeAlert.bind(this));
}
$alertContainer.append(this.$alertDiv);
this.parent.$container.append(this.$alertDiv);
//this.$alertDiv.slideDown(this.fadeInDuration, this.afterFadeIn.bind(this));
......@@ -324,11 +322,7 @@ var QfqNS = QfqNS || {};
that.$alertDiv.remove();
that.$alertDiv = null;
that.shown = false;
// TODO: removeAlert should not have knowledge on how to handle alert container
if (that.countAlertsInAlertContainer() === 0) {
that.removeAlertContainer();
}
that.parent.removeOutdatedAlerts();
});
} else {
this.$alertDiv.fadeOut(this.fadeOutDuration, function(){
......@@ -338,8 +332,7 @@ var QfqNS = QfqNS || {};
that.removeAlertContainer();
});
}
$(".removeMe").remove();
this.parent.removeAlert(this.identifier);
};
/**
......
/**
* @author Benjamin Baer <benjamin.baer@math.uzh.ch>
*/
/* global $ */
/* global EventEmitter */
/* @depend QfqEvents.js */
/**
* Qfq Namespace
*
* @namespace QfqNS
*/
var QfqNS = QfqNS || {};
(function (n) {
'use strict';
/**
* Manages multiple Alerts and provides an Alert Container.
*
* Is usually initialized with the first Alert that is created. (see n.Alert)
*
* @param {object} options For later
*/
n.AlertManager = function(options) {
this.screenBlocked = false;
this.alerts = [];
this.$container = $("<div>");
this.blockingAlert = {};
this.eventEmitter = new EventEmitter();
this.regularCheck = {};
$("body").append(this.$container);
console.log("Created Alert Container");
};
n.AlertManager.prototype.on = n.EventEmitter.onMixin;
/**
* Add an Alert to the Alert Manager
* @param alert
*/
n.AlertManager.prototype.addAlert = function(alert) {
this.alerts.push(alert);
alert.setIdentifier(this.alerts.length);
console.log(this.alerts);
};
n.AlertManager.prototype.removeAlert = function(identifier) {
for(var i=0; this.alerts.length > i; i++) {
if (this.alerts[i].identifier === identifier) {
this.alerts.splice(i, 1);
}
}
};
/**
* Removes the last Alert in the Array. Can be used to safely delete all alerts in a loop.
* Returns false when the AlertManager has no more Alerts.
* @returns Boolean
*/
n.AlertManager.prototype.removeLastAlert = function() {
if (this.alert.length > 0) {
var alert = this.alerts.pop();
alert.removeAlert();
return true;
} else {
return false;
}
};
/**
* Savely removes outdated Alerts with isShown = false
*/
n.AlertManager.prototype.removeOutdatedAlerts = function() {
for(var i = 0; this.alerts.length > i; i++) {
if(!this.alerts[i].isShown) {
this.alerts[i].removeAlert();
this.alerts.splice(i, 1);
}
}
};
/**
* Returns the number of Alerts currently active
* @returns {number}
*/
n.AlertManager.prototype.count = function() {
return this.alerts.length;
};
/**
* Creates a semi-transparent black screen behind the alert.
* Used to block other user input by modal alerts
* @param alert
*/
n.AlertManager.prototype.createBlockScreen = function(alert) {
if (!this.screenBlocked) {
var $blockScreen = $("<div>")
.addClass("blockscreenQfq")
.appendTo(this.$container);
$blockScreen.css({
'position': 'fixed',
'left': 0,
'right': 0,
'top': 0,
'z-index': 998,
'background': 'rgba(0,0,0,0.5)',
'width': '100%',
'height': Math.max($(document).height(), $(window).height()) + "px"
});
var that = this;
this.screenBlocked = true;
this.blockingAlert = alert;
this.regularCheck = setInterval(function () {
that.checkAlert();
}, 500);
}
};
/**
* Is used by the interval this.regularcheck to guarantee
* that the screen block is removed.
*/
n.AlertManager.prototype.checkAlert = function() {
if (!this.blockingAlert.isShown) {
this.removeModalAlert();
}
};
/**
* Remove modal alerts
*/
n.AlertManager.prototype.removeModalAlert = function() {
if (this.screenBlocked) {
$(".blockscreenQfq").remove();
clearInterval(this.regularCheck);
this.screenBlocked = false;
}
this.removeOutdatedAlerts();
};
})(QfqNS);
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment