et2_debug is now capable of taking any count of arguments as the console.* functions do, improved 'Attribute does not exist' message, fixed memory leak in grid (inherited destructor was not called)

This commit is contained in:
Andreas Stöckel 2011-08-15 16:03:53 +00:00
parent 8207a325aa
commit 3bdca867e7
8 changed files with 40 additions and 12 deletions

View File

@ -73,8 +73,16 @@ var et2_button = et2_baseWidget.extend(et2_IInput, {
}
},
/**
* Implementation of the et2_IInput interface
*/
/**
* Always return false as a button is never dirty
*/
isDirty: function() {
return true;
return false;
},
resetDirty: function() {
@ -85,6 +93,9 @@ var et2_button = et2_baseWidget.extend(et2_IInput, {
{
return true;
}
// If "null" is returned, the result is not added to the submitted
// array.
return null;
}

View File

@ -31,32 +31,39 @@ if (typeof Array.prototype.indexOf == "undefined")
*/
var ET2_DEBUGLEVEL = 4;
function et2_debug(_level, _msg)
function et2_debug(_level)
{
if (typeof console != "undefined")
{
// Get the passed parameters and remove the first entry
var args = [];
for (var i = 1; i < arguments.length; i++)
{
args.push(arguments[i]);
}
if (_level == "log" && ET2_DEBUGLEVEL >= 4 &&
typeof console.log == "function")
{
console.log(_msg);
console.log.apply(console, args);
}
if (_level == "info" && ET2_DEBUGLEVEL >= 3 &&
typeof console.info == "function")
{
console.info(_msg);
console.info.apply(console, args);
}
if (_level == "warn" && ET2_DEBUGLEVEL >= 2 &&
typeof console.warn == "function")
{
console.warn(_msg);
console.warn.apply(console, args);
}
if (_level == "error" && ET2_DEBUGLEVEL >= 1 &&
typeof console.error == "function")
{
console.error(_msg);
console.error.apply(console, args);
}
}
}

View File

@ -43,6 +43,8 @@ var et2_grid = et2_DOMWidget.extend({
},
destroy: function() {
this._super.call(this, arguments);
// Delete all references to cells or widgets
this.cells = null;
this.managementArray = null;

View File

@ -314,7 +314,7 @@
}
else
{
et2_error("error", "Attribute '" + _name + "' does not exist!");
et2_error("error", this, "Attribute '" + _name + "' does not exist!");
}
}
@ -348,7 +348,7 @@
}
else
{
et2_debug("warn", "Attribute '" + _name + "' does not exist!");
et2_debug("warn", this, "Attribute '" + _name + "' does not exist!");
}
}

View File

@ -545,7 +545,7 @@ var et2_widget = Class.extend({
// Check whether the entry is really undefined
if (typeof _target[_widget.id] != "undefined")
{
et2_debug("error", "Overwriting value of '" + _widget.id +
et2_debug("error", _widget, "Overwriting value of '" + _widget.id +
"', id exists twice!");
}

View File

@ -76,7 +76,7 @@ etemplate2.prototype._createArrayManagers = function(_data)
{
if (typeof _data[neededEntries[i]] == "undefined")
{
et2_debug("info", "Created not passed entry '" + neededEntries[i] + "' in data array.");
et2_debug("log", "Created not passed entry '" + neededEntries[i] + "' in data array.");
_data[neededEntries[i]] = {};
}
}

View File

@ -70,6 +70,12 @@ egw_tooltip.prototype.bindToElement = function(_elem, _text)
egw_tooltip.prototype.unbindFromElement = function(_elem)
{
if (this.current_elem == _elem)
{
this.hide();
this.current_elem = null;
}
_elem.unbind('mouseenter.tooltip');
_elem.unbind('mouseleave.tooltip');
_elem.unbind('mousemove.tooltip');

View File

@ -1,13 +1,15 @@
<?xml version="1.0"?>
<overlay>
<textbox id="test1" value="This is a single line textbox." statustext="Write something here!"/>
<textbox id="test1" value="This is a single line textbox."/>
<textbox id="test2" multiline="true" value="This is a multi line textbox."/>
<template id="testbox">
<textbox id="test3" value="This is a single line textbox." statustext="And something else here!"/>
<textbox id="test3" value="This is a single line textbox."/>
<textbox id="test4" multiline="true" value="This is a multi line textbox."/>
</template>
<template id="testbox"/>
<button label="test" onclick="open_xet('et2_test_textbox.xet');" statustext="button"/>
</overlay>