change handling of progress attribute; only XET-ids work, when fetched with getWidgetById and widget.getDomNode (it may not be available at creation time, so we (re)check on createStatus time)

This commit is contained in:
Klaus Leithoff 2013-09-10 12:57:40 +00:00
parent 355ffbbb9b
commit 8667f81010

View File

@ -53,7 +53,7 @@ var et2_file = et2_inputWidget.extend(
"name": "Progress node", "name": "Progress node",
"type": "string", "type": "string",
"default": et2_no_init, "default": et2_no_init,
"description": "The ID of an alternate node (div) to display progress and results. The Node is fetched with et2 getWidgetById so you MUST use the id assigned in XET-File" "description": "The ID of an alternate node (div) to display progress and results. The Node is fetched with et2 getWidgetById so you MUST use the id assigned in XET-File (it may not be available at creation time, so we (re)check on createStatus time)"
}, },
"onStart": { "onStart": {
"name": "Start event handler", "name": "Start event handler",
@ -173,6 +173,7 @@ var et2_file = et2_inputWidget.extend(
var widget = this.getRoot().getWidgetById(this.options.progress); var widget = this.getRoot().getWidgetById(this.options.progress);
if(widget) if(widget)
{ {
//may be not available at createInputWidget time
this.progress = $j(widget.getDOMNode()); this.progress = $j(widget.getDOMNode());
} }
} }
@ -406,7 +407,15 @@ var et2_file = et2_inputWidget.extend(
error = this.egw().lang("File too large. Maximum %1", et2_vfsSize.prototype.human_size(this.options.max_file_size)); error = this.egw().lang("File too large. Maximum %1", et2_vfsSize.prototype.human_size(this.options.max_file_size));
} }
} }
if(this.options.progress)
{
var widget = this.getRoot().getWidgetById(this.options.progress);
if(widget)
{
this.progress = $j(widget.getDOMNode());
this.progress.addClass("progress");
}
}
if(this.progress) if(this.progress)
{ {
var status = $j("<li file='"+file_name+"'>"+file_name var status = $j("<li file='"+file_name+"'>"+file_name
@ -433,7 +442,7 @@ var et2_file = et2_inputWidget.extend(
}, },
onError: function(event, name, error) { onError: function(event, name, error) {
console.warn(event,name,error); console.warn(event,name,error);
}, },
/** /**
@ -481,7 +490,7 @@ console.warn(event,name,error);
*/ */
remove_file: function(filename) remove_file: function(filename)
{ {
console.info(filename); //console.info(filename);
for(var key in this.options.value) for(var key in this.options.value)
{ {
if(this.options.value[key].name == filename) if(this.options.value[key].name == filename)