More fixes forjQuery/jQueryUI update issues

This commit is contained in:
Nathan Gray 2013-07-20 17:20:55 +00:00
parent f2906a1052
commit f4a6c9859a
12 changed files with 51 additions and 35 deletions

View File

@ -88,9 +88,9 @@ var et2_checkbox = et2_inputWidget.extend(
if(_value == this.options.selected_value || if(_value == this.options.selected_value ||
_value && this.options.selected_value == this.__proto__.attributes.selected_value["default"] && _value && this.options.selected_value == this.__proto__.attributes.selected_value["default"] &&
_value != this.options.unselected_value) { _value != this.options.unselected_value) {
this.input.attr("checked", "checked"); this.input.prop("checked", true);
} else { } else {
this.input.removeAttr("checked"); this.input.prop("checked", false);
} }
} }
}, },
@ -99,7 +99,7 @@ var et2_checkbox = et2_inputWidget.extend(
* Override default to return unchecked value * Override default to return unchecked value
*/ */
getValue: function() { getValue: function() {
if(this.input.attr("checked")) { if(this.input.prop("checked")) {
return this.options.selected_value; return this.options.selected_value;
} else { } else {
return this.options.unselected_value; return this.options.unselected_value;

View File

@ -233,16 +233,19 @@ var et2_dialog = et2_widget.extend({
* Clean up dialog * Clean up dialog
*/ */
destroy: function() { destroy: function() {
// Un-dialog the dialog if(this.div != null)
this.div.dialog("destroy");
if(this.template)
{ {
this.template.clear(); // Un-dialog the dialog
this.template = null; this.div.dialog("destroy");
}
this.div = null; if(this.template)
{
this.template.clear();
this.template = null;
}
this.div = null;
}
// Call the inherited constructor // Call the inherited constructor
this._super.apply(this, arguments); this._super.apply(this, arguments);

View File

@ -85,7 +85,7 @@ var et2_diff = et2_valueWidget.extend([et2_IDetachedDOM],
buttons: [{text: self.egw().lang('ok'), click: function() {jQuery(this).dialog("close");}}], buttons: [{text: self.egw().lang('ok'), click: function() {jQuery(this).dialog("close");}}],
close: function(event, ui) { close: function(event, ui) {
// Need to destroy the dialog, etemplate widget needs divs back where they were // Need to destroy the dialog, etemplate widget needs divs back where they were
diff.dialog("destroy"); dialog_div.dialog("destroy");
self.minify(this); self.minify(this);
// Put it back where it came from, or et2 will error when clear() is called // Put it back where it came from, or et2 will error when clear() is called

View File

@ -185,8 +185,11 @@ var et2_favorites = et2_dropdown_button.extend([et2_INextmatchHeader],
}, },
destroy: function() { destroy: function() {
this.popup.dialog("destroy"); if(this.popup != null)
this.popup = null; {
this.popup.dialog("destroy");
this.popup = null;
}
if(this.sidebox_target.length) if(this.sidebox_target.length)
{ {
this.sidebox_target this.sidebox_target

View File

@ -140,6 +140,7 @@ var et2_file = et2_inputWidget.extend(
}, },
destroy: function() { destroy: function() {
this._super.apply(this, arguments);
this.node = null; this.node = null;
this.input = null; this.input = null;
this.progress = null; this.progress = null;

View File

@ -115,7 +115,11 @@ var et2_historylog = et2_valueWidget.extend([et2_IDataProvider],
* Finish initialization which was skipped until tab was selected * Finish initialization which was skipped until tab was selected
*/ */
finishInit: function() { finishInit: function() {
// No point with no ID
if(!this.options.value || !this.options.value.id)
{
return;
}
this._filters = { this._filters = {
record_id: this.options.value.id, record_id: this.options.value.id,
appname: this.options.value.app, appname: this.options.value.app,

View File

@ -526,7 +526,8 @@ var et2_link_entry = et2_inputWidget.extend(
return false; return false;
}, },
minLength: self.minimum_characters, minLength: self.minimum_characters,
disabled: self.options.disabled disabled: self.options.disabled,
appendTo: self.div
}); });
// Custom display (colors) // Custom display (colors)
@ -711,7 +712,7 @@ var et2_link_entry = et2_inputWidget.extend(
} }
this.options.value = _value; this.options.value = _value;
jQuery("option[value='"+_value.app+"']",this.app_select).attr("selected",true); jQuery("option[value='"+_value.app+"']",this.app_select).prop("selected",true);
this.app_select.hide(); this.app_select.hide();
this.div.addClass("no_app"); this.div.addClass("no_app");
}, },

View File

@ -98,9 +98,9 @@ var et2_radiobox = et2_inputWidget.extend(
*/ */
set_value: function(_value) { set_value: function(_value) {
if(_value == this.options.set_value) { if(_value == this.options.set_value) {
this.input.attr("checked", "checked"); this.input.prop("checked", true);
} else { } else {
this.input.removeAttr("checked"); this.input.prop("checked", false);
} }
}, },

View File

@ -186,7 +186,7 @@ var et2_selectAccount = et2_selectbox.extend(
// Put search results as a DOM sibling of the options, for proper display // Put search results as a DOM sibling of the options, for proper display
this.search_widget.search.on("autocompleteopen", jQuery.proxy(function() { this.search_widget.search.on("autocompleteopen", jQuery.proxy(function() {
this.search_widget.search.data("autocomplete").menu.element.appendTo(this.node); this.search_widget.search.data("ui-autocomplete").menu.element.appendTo(this.node);
},this)); },this));
this.search = jQuery(document.createElement("li")) this.search = jQuery(document.createElement("li"))
.appendTo(this.multiOptions.prev().find('ul')); .appendTo(this.multiOptions.prev().find('ul'));
@ -405,7 +405,7 @@ var et2_selectAccount = et2_selectbox.extend(
// Override link-entry auto-complete for custom display // Override link-entry auto-complete for custom display
// Don't show normal drop-down // Don't show normal drop-down
search_widget.search.data("autocomplete")._suggest = function(items) { search_widget.search.data("ui-autocomplete")._suggest = function(items) {
jQuery.each(items, function (index, item) { jQuery.each(items, function (index, item) {
self._add_search_result(results, item); self._add_search_result(results, item);
}); });

View File

@ -467,24 +467,24 @@ var et2_selectbox = et2_inputWidget.extend(
// Unchanged // Unchanged
if(_value == this.value) return; if(_value == this.value) return;
} }
jQuery("option",this.input).attr("selected", false); jQuery("option",this.input).prop("selected", false);
if(typeof _value == "array") if(typeof _value == "array")
{ {
for(var i = 0; i < _value.length; i++) for(var i = 0; i < _value.length; i++)
{ {
jQuery("option[value='"+_value[i]+"']", this.input).attr("selected", true); jQuery("option[value='"+_value[i]+"']", this.input).prop("selected", true);
} }
} }
else if (typeof _value == "object") else if (typeof _value == "object")
{ {
for(var i in _value) for(var i in _value)
{ {
jQuery("option[value='"+_value[i]+"']", this.input).attr("selected", true); jQuery("option[value='"+_value[i]+"']", this.input).prop("selected", true);
} }
} }
else else
{ {
if(jQuery("option[value='"+_value+"']", this.input).attr("selected", true).length == 0) if(jQuery("option[value='"+_value+"']", this.input).prop("selected", true).length == 0)
{ {
if(this.options.select_options[_value]) if(this.options.select_options[_value])
{ {
@ -499,24 +499,24 @@ var et2_selectbox = et2_inputWidget.extend(
}, },
set_multi_value: function(_value) { set_multi_value: function(_value) {
jQuery("input",this.multiOptions).attr("checked", false); jQuery("input",this.multiOptions).prop("checked", false);
if(typeof _value == "array") if(typeof _value == "array")
{ {
for(var i = 0; i < _value.length; i++) for(var i = 0; i < _value.length; i++)
{ {
jQuery("input[value='"+_value[i]+"']", this.multiOptions).attr("checked", true); jQuery("input[value='"+_value[i]+"']", this.multiOptions).prop("checked", true);
} }
} }
else if (typeof _value == "object") else if (typeof _value == "object")
{ {
for(var i in _value) for(var i in _value)
{ {
jQuery("input[value='"+_value[i]+"']", this.multiOptions).attr("checked", true); jQuery("input[value='"+_value[i]+"']", this.multiOptions).prop("checked", true);
} }
} }
else else
{ {
if(jQuery("input[value='"+_value+"']", this.multiOptions).attr("checked", true).length == 0) if(jQuery("input[value='"+_value+"']", this.multiOptions).prop("checked", true).length == 0)
{ {
this.egw().debug("warning", "Tried to set value that isn't an option", this, _value); this.egw().debug("warning", "Tried to set value that isn't an option", this, _value);
} }
@ -726,7 +726,7 @@ var et2_selectbox_ro = et2_selectbox.extend([et2_IDetachedDOM],
// Translate the options // Translate the options
if(!this.options.no_lang) if(!this.options.no_lang)
{ {
if (typeof _options[key] === 'object') if (typeof _options[key] === 'object' && _options[key] != null)
{ {
if(_options[key]["label"]) _options[key]["label"] = this.egw().lang(_options[key]["label"]); if(_options[key]["label"]) _options[key]["label"] = this.egw().lang(_options[key]["label"]);
if(_options[key]["title"]) _options[key]["title"] = this.egw().lang(_options[key]["title"]); if(_options[key]["title"]) _options[key]["title"] = this.egw().lang(_options[key]["title"]);

View File

@ -53,6 +53,7 @@ var et2_url = et2_textbox.extend(
this.input.unbind(); this.input.unbind();
} }
this._button = null; this._button = null;
this._super.apply(this);
}, },
/** /**

View File

@ -804,7 +804,7 @@ div.message.floating {
.nextmatch_header .header_count { .nextmatch_header .header_count {
padding: 0px 20px; padding: 0px 20px;
margin: 5px 20px 0px; margin: 6px 20px 0px;
border: 1px solid #E0E0E0; border: 1px solid #E0E0E0;
float:right; float:right;
font-size: 150%; font-size: 150%;
@ -837,8 +837,8 @@ div.message.floating {
margin-bottom: 3px; margin-bottom: 3px;
} }
/* Favorites */ /* Favorites */
.nextmatch_header div#favorite_wrapper { .nextmatch_header div[id$=favorite_wrapper] {
margin-top: 8px; margin-top: 6px;
vertical-align: middle; vertical-align: middle;
} }
#nm_favorites_popup_filters .filter_id, #nm_favorites_popup_filters .filter_value { #nm_favorites_popup_filters .filter_id, #nm_favorites_popup_filters .filter_value {
@ -848,7 +848,7 @@ div.message.floating {
.nextmatch_header ul.favorites { .nextmatch_header ul.favorites {
min-width: 20ex; min-width: 20ex;
} }
.nextmatch_header .favorites li a { .nextmatch_header .favorites li .ui-menu .ui-menu-item a {
text-indent: -22px; text-indent: -22px;
margin-left: 21px; margin-left: 21px;
} }
@ -862,6 +862,7 @@ div.message.floating {
margin-right: 1ex; margin-right: 1ex;
} }
.favorites div.ui-icon-trash { .favorites div.ui-icon-trash {
position: relative;
float:right; float:right;
display:none; display:none;
} }
@ -891,12 +892,14 @@ div.message.floating {
text-decoration: underline; text-decoration: underline;
} }
.sidebox-favorites .favorites div.ui-icon-heart{ .sidebox-favorites .favorites div.ui-icon-heart{
position: relative;
float: left; float: left;
display:inline-block; display:inline-block;
margin: -3px 1px 0px 1px; margin: -3px 1px 0px 1px;
} }
.sidebox-favorites .favorites div.ui-icon-trash{ .sidebox-favorites .favorites div.ui-icon-trash{
margin-top: -3px; margin-top: -5px;
margin-right: 2px;
} }
.nextmatch_sortheader { .nextmatch_sortheader {
color: #003075; color: #003075;