mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
if content of template contains data for key "msg", call egw.message() with it and remove it from content
This commit is contained in:
parent
b13a7eefb8
commit
4dab9cba88
@ -72,7 +72,7 @@
|
|||||||
*
|
*
|
||||||
* @param _container is the DOM-Node into which the DOM-Nodes of this instance
|
* @param _container is the DOM-Node into which the DOM-Nodes of this instance
|
||||||
* should be inserted
|
* should be inserted
|
||||||
* @param _submitURL is the URL to which the form data should be submitted.
|
* @param _menuaction is the URL to which the form data should be submitted.
|
||||||
*/
|
*/
|
||||||
function etemplate2(_container, _menuaction)
|
function etemplate2(_container, _menuaction)
|
||||||
{
|
{
|
||||||
@ -155,6 +155,8 @@ etemplate2.prototype.clear = function()
|
|||||||
* Creates an associative array containing the data array managers for each part
|
* Creates an associative array containing the data array managers for each part
|
||||||
* of the associative data array. A part is something like "content", "readonlys"
|
* of the associative data array. A part is something like "content", "readonlys"
|
||||||
* or "sel_options".
|
* or "sel_options".
|
||||||
|
*
|
||||||
|
* @param {object} _data object with values for attributes content, sel_options, readonlys, modifications
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype._createArrayManagers = function(_data)
|
etemplate2.prototype._createArrayManagers = function(_data)
|
||||||
{
|
{
|
||||||
@ -234,12 +236,25 @@ etemplate2.prototype.unbind_unload = function()
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the template from the given URL and sets the data object
|
* Loads the template from the given URL and sets the data object
|
||||||
|
*
|
||||||
|
* @param {string} _name name of template
|
||||||
|
* @param {string} _url url to load template
|
||||||
|
* @param {object} _data object with attributes content, langRequire, etemplate_exec_id, ...
|
||||||
|
* @param {function} _callback called after tempalte is loaded
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
||||||
{
|
{
|
||||||
egw().debug("info", "Loaded data", _data);
|
egw().debug("info", "Loaded data", _data);
|
||||||
var currentapp = this.app = _data.currentapp || window.egw_appName;
|
var currentapp = this.app = _data.currentapp || window.egw_appName;
|
||||||
|
|
||||||
|
// extract $content['msg'] and call egw.message() with it
|
||||||
|
var msg = _data.content.msg;
|
||||||
|
if (typeof msg != 'undefined')
|
||||||
|
{
|
||||||
|
egw(window).message(msg);
|
||||||
|
delete _data.content.msg;
|
||||||
|
}
|
||||||
|
|
||||||
// Register a handler for AJAX responses
|
// Register a handler for AJAX responses
|
||||||
egw(currentapp, window).registerJSONPlugin(etemplate2_handle_assign, this, 'assign');
|
egw(currentapp, window).registerJSONPlugin(etemplate2_handle_assign, this, 'assign');
|
||||||
|
|
||||||
@ -445,9 +460,9 @@ etemplate2.prototype.isDirty = function()
|
|||||||
/**
|
/**
|
||||||
* Submit form via ajax
|
* Submit form via ajax
|
||||||
*
|
*
|
||||||
* @param et2_button|string button button widget or string with id
|
* @param {(et2_button|string)} button button widget or string with id
|
||||||
* @param boolean async true: do an asynchronious submit, default is synchronious
|
* @param {boolean} async true: do an asynchronious submit, default is synchronious
|
||||||
* @return boolean true if submit was send, false if eg. validation stoped submit
|
* @return {boolean} true if submit was send, false if eg. validation stoped submit
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.submit = function(button, async)
|
etemplate2.prototype.submit = function(button, async)
|
||||||
{
|
{
|
||||||
@ -572,6 +587,8 @@ etemplate2.prototype.postSubmit = function()
|
|||||||
* Fetches all input element values and returns them in an associative
|
* Fetches all input element values and returns them in an associative
|
||||||
* array. Widgets which introduce namespacing can use the internal _target
|
* array. Widgets which introduce namespacing can use the internal _target
|
||||||
* parameter to add another layer.
|
* parameter to add another layer.
|
||||||
|
*
|
||||||
|
* @param {et2_widget} _root widget to start iterating
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.getValues = function(_root)
|
etemplate2.prototype.getValues = function(_root)
|
||||||
{
|
{
|
||||||
@ -686,15 +703,17 @@ etemplate2.prototype.getValues = function(_root)
|
|||||||
* If there's a message provided, we try to find where it goes and set it directly. Then
|
* If there's a message provided, we try to find where it goes and set it directly. Then
|
||||||
* we look for a nextmatch widget, and tell it to refresh its data based on that ID.
|
* we look for a nextmatch widget, and tell it to refresh its data based on that ID.
|
||||||
*
|
*
|
||||||
* @param msg String Message to try to display. eg: "Entry added" (not used anymore, handeled by egw_refresh and egw_message)
|
* @param {string} msg message to try to display. eg: "Entry added" (not used anymore, handeled by egw_refresh and egw_message)
|
||||||
* @param id String|null Application specific entry ID to try to refresh
|
* @param {string} app app-name
|
||||||
* @param type String|null Type of change. One of 'update','edit', 'delete', 'add' or null
|
* @param {(string|null)} id application specific entry ID to try to refresh
|
||||||
|
* @param {(string|null)} type type of change. One of 'update','edit', 'delete', 'add' or null
|
||||||
*
|
*
|
||||||
* @see jsapi.egw_refresh()
|
* @see jsapi.egw_refresh()
|
||||||
* @see egw_fw.egw_refresh()
|
* @see egw_fw.egw_refresh()
|
||||||
*/
|
*/
|
||||||
etemplate2.prototype.refresh = function(msg, app, id, type)
|
etemplate2.prototype.refresh = function(msg, app, id, type)
|
||||||
{
|
{
|
||||||
|
msg, app; // unused but required by function signature
|
||||||
// Refresh nextmatches
|
// Refresh nextmatches
|
||||||
this.widgetContainer.iterateOver(function(_widget) {
|
this.widgetContainer.iterateOver(function(_widget) {
|
||||||
// Trigger refresh
|
// Trigger refresh
|
||||||
@ -735,9 +754,8 @@ etemplate2.getByTemplate = function(template)
|
|||||||
*
|
*
|
||||||
* "Associated" is determined by the first part of the template
|
* "Associated" is determined by the first part of the template
|
||||||
*
|
*
|
||||||
* @param template String Name of the template that was loaded
|
* @param {string} app app-name
|
||||||
*
|
* @return {array} list of etemplate2 that have that app as the first part of their loaded template
|
||||||
* @return Array list of etemplate2 that have that app as the first part of their loaded template
|
|
||||||
*/
|
*/
|
||||||
etemplate2.getByApplication = function(app)
|
etemplate2.getByApplication = function(app)
|
||||||
{
|
{
|
||||||
@ -860,18 +878,20 @@ function etemplate2_handle_validation_error(_type, _response)
|
|||||||
/**
|
/**
|
||||||
* Handle assign for attributes on etemplate2 widgets
|
* Handle assign for attributes on etemplate2 widgets
|
||||||
*
|
*
|
||||||
* @param {String} type "assign"
|
* @param {string} type "assign"
|
||||||
* @param res Response
|
* @param {object} res Response
|
||||||
* @param res.data.id {String} Widget ID
|
* res.data.id {String} Widget ID
|
||||||
* @param res.data.key {String} Attribute name
|
* res.data.key {String} Attribute name
|
||||||
* @param res.data.value New value for widget
|
* res.data.value New value for widget
|
||||||
* @param res.data.etemplate_exec_id
|
* res.data.etemplate_exec_id
|
||||||
* @param {type} req
|
* @param {object} req
|
||||||
* @returns {Boolean} Handled by this plugin
|
* @returns {Boolean} Handled by this plugin
|
||||||
* @throws Invalid parameters if the required res.data parameters are missing
|
* @throws Invalid parameters if the required res.data parameters are missing
|
||||||
*/
|
*/
|
||||||
function etemplate2_handle_assign(type, res, req)
|
function etemplate2_handle_assign(type, res, req)
|
||||||
{
|
{
|
||||||
|
type, req; // unused, but required by plugin signature
|
||||||
|
|
||||||
//Check whether all needed parameters have been passed and call the alertHandler function
|
//Check whether all needed parameters have been passed and call the alertHandler function
|
||||||
if ((typeof res.data.id != 'undefined') &&
|
if ((typeof res.data.id != 'undefined') &&
|
||||||
(typeof res.data.key != 'undefined') &&
|
(typeof res.data.key != 'undefined') &&
|
||||||
|
Loading…
Reference in New Issue
Block a user