Avoid some init / destroy errors in color picker popup

This commit is contained in:
Nathan Gray 2013-03-25 19:39:02 +00:00
parent 84b3edbfcb
commit d394cca06f
2 changed files with 18 additions and 7 deletions

View File

@ -56,14 +56,23 @@ var et2_color = et2_inputWidget.extend({
// Translations // Translations
for(var key in jQuery.fn.jPicker.defaults.localization.text) for(var key in jQuery.fn.jPicker.defaults.localization.text)
{
if(jQuery.fn.jPicker.defaults.localization.text[key])
{ {
jQuery.fn.jPicker.defaults.localization.text[key] = this.egw().lang(jQuery.fn.jPicker.defaults.localization.text[key]); jQuery.fn.jPicker.defaults.localization.text[key] = this.egw().lang(jQuery.fn.jPicker.defaults.localization.text[key]);
} }
}
for(var key in jQuery.fn.jPicker.defaults.localization.tooltips) for(var key in jQuery.fn.jPicker.defaults.localization.tooltips)
{
if(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok)
{ {
jQuery.fn.jPicker.defaults.localization.tooltips[key].ok = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok); jQuery.fn.jPicker.defaults.localization.tooltips[key].ok = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok);
}
if(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel)
{
jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel); jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel);
} }
}
this.options = jQuery.extend({}, this.defaults, this.options); this.options = jQuery.extend({}, this.defaults, this.options);
this.setDOMNode(this.$node[0]); this.setDOMNode(this.$node[0]);
@ -120,14 +129,16 @@ var et2_color = et2_inputWidget.extend({
title: self.options.statustext ? self.options.statustext : self.egw().lang('Select color'), title: self.options.statustext ? self.options.statustext : self.egw().lang('Select color'),
autoOpen: false, autoOpen: false,
resizable: false, resizable: false,
width: self.get_jPicker() ? self.get_jPicker().width : "auto" width: "auto"
}); });
// Hide original move bar // Hide original move bar
jQuery('table.jPicker .Move').hide(); jQuery('table.jPicker .Move').hide();
// Trigger dialog opening // Trigger dialog opening
jQuery('.Image',self.$node.next()).click(function() {jQuery("table.jPicker").dialog("open")}); jQuery('.Image',self.$node.next()).click(function() {
jQuery("table.jPicker").dialog("open");
});
},500); },500);
return true; return true;
}, },

View File

@ -1852,7 +1852,7 @@
commitCallback = null; commitCallback = null;
cancelCallback = null; cancelCallback = null;
liveCallback = null; liveCallback = null;
container.html(''); container.remove();
for (i = 0; i < List.length; i++) if (List[i] == $this) List.splice(i, 1); for (i = 0; i < List.length; i++) if (List[i] == $this) List.splice(i, 1);
}, },
images = settings.images, // local copies for YUI compressor images = settings.images, // local copies for YUI compressor