Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/admin_templates/js/forms.js
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | |||||
Form.MinControlsHeight = 0; | Form.MinControlsHeight = 0; | ||||
Form.Options = new Object(); | Form.Options = new Object(); | ||||
Form.FlexibleCount = 0; | Form.FlexibleCount = 0; | ||||
Form.ScrollerW = 17; | Form.ScrollerW = 17; | ||||
Form.ScrollerH = 17; | Form.ScrollerH = 17; | ||||
Form.HasChanged = false; | Form.HasChanged = false; | ||||
Form.reizeTimeoutId = false; | |||||
Form.Init = function(id) { | Form.Init = function(id) { | ||||
this.Div = document.getElementById(id); | this.Div = document.getElementById(id); | ||||
if (!this.Div) { | if (!this.Div) { | ||||
return ; | return ; | ||||
} | } | ||||
for (var i = 0; i < this.Controls.length; i++) { | for (var i = 0; i < this.Controls.length; i++) { | ||||
dim = getDimensions( document.getElementById(this.Controls[i]) ); | dim = getDimensions( document.getElementById(this.Controls[i]) ); | ||||
Show All 27 Lines | |||||
this.Table = $('table:first', this.Div).get(0); | this.Table = $('table:first', this.Div).get(0); | ||||
this.Table.style.height = 'auto'; | this.Table.style.height = 'auto'; | ||||
// this.Table.style.width = 'auto'; | // this.Table.style.width = 'auto'; | ||||
this.MinHeight = this.Table.offsetHeight; | this.MinHeight = this.Table.offsetHeight; | ||||
this.MinWidth = this.Table.offsetWidth; | this.MinWidth = this.Table.offsetWidth; | ||||
// alert('Measuring min width now') | // alert('Measuring min width now') | ||||
addEvent(window, 'resize', function() {Form.Resize()}) | // Call the "resize" event using debounce technique. | ||||
$(window).resize(function () { | |||||
clearTimeout(Form.reizeTimeoutId); | |||||
Form.reizeTimeoutId = setTimeout(function () { | |||||
Form.Resize(); | |||||
}, 100); | |||||
}); | |||||
this.Resize(false); | this.Resize(false); | ||||
this.displayFirstError(); | this.displayFirstError(); | ||||
if (_Simultaneous_Edit_Message != '') { | if (_Simultaneous_Edit_Message != '') { | ||||
alert(_Simultaneous_Edit_Message); | alert(_Simultaneous_Edit_Message); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
var $ckeditor_textarea = $( '#' + jq($editor_id) ); | var $ckeditor_textarea = $( '#' + jq($editor_id) ); | ||||
CKEDITOR.instances[ $editor_id ].resize( $ckeditor_textarea.width(), $ckeditor_textarea.height() ); | CKEDITOR.instances[ $editor_id ].resize( $ckeditor_textarea.width(), $ckeditor_textarea.height() ); | ||||
} | } | ||||
} | } | ||||
var h = (document.all ? window.document.body.offsetHeight : window.innerHeight); | var h = (document.all ? window.document.body.offsetHeight : window.innerHeight); | ||||
var $div = $(this.Div); | var $div = $(this.Div); | ||||
var pos = $div.offset(); | var pos = this.GetOffsetWithoutUserScroll($div); | ||||
h -= pos.top; | h -= pos.top; | ||||
if (this.Div.style.height.length) { | if (this.Div.style.height.length) { | ||||
// height set for scroll_container overrides automatic container height detection | // height set for scroll_container overrides automatic container height detection | ||||
h = this._parseSize(this.Div.style.height); | h = this._parseSize(this.Div.style.height); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 62 Lines • ▼ Show 20 Line(s) | |||||
document.getElementById(this.Controls[i]).style.height = this.Options[ this.Controls[i] ]['real_height'] + 'px'; | document.getElementById(this.Controls[i]).style.height = this.Options[ this.Controls[i] ]['real_height'] + 'px'; | ||||
// document.getElementById(this.Controls[i]).value = this.Options[this.Controls[i]]['real_height']; | // document.getElementById(this.Controls[i]).value = this.Options[this.Controls[i]]['real_height']; | ||||
} | } | ||||
// alert('h is: '+h+' min height is '+this.MinHeight+' MinControlsHeight is '+this.MinControlsHeight+' -> '+split+' to split between '+count); | // alert('h is: '+h+' min height is '+this.MinHeight+' MinControlsHeight is '+this.MinControlsHeight+' -> '+split+' to split between '+count); | ||||
// print_pre(this.Controls) | // print_pre(this.Controls) | ||||
}; | }; | ||||
Form.GetOffsetWithoutUserScroll = function ($div) { | |||||
var $ret, | |||||
$wrapper_div = $div.parent(), | |||||
$old_scroll_top = $wrapper_div.scrollTop(); | |||||
$wrapper_div.scrollTop(0); | |||||
$ret = $div.offset(); | |||||
$wrapper_div.scrollTop($old_scroll_top); | |||||
return $ret; | |||||
}; | |||||
Form.ResetHeights = function() | Form.ResetHeights = function() | ||||
{ | { | ||||
for (var i = 0; i < this.Controls.length; i++) { | for (var i = 0; i < this.Controls.length; i++) { | ||||
var options = this.Options[this.Controls[i]] | var options = this.Options[this.Controls[i]] | ||||
options['real_height'] = 0; | options['real_height'] = 0; | ||||
options.fixed = false; | options.fixed = false; | ||||
} | } | ||||
this.FlexibleCount = this.Controls.length; | this.FlexibleCount = this.Controls.length; | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |