2017-05-19 01:50:56 +08:00
|
|
|
function updateMonitorDimensions( element ) {
|
|
|
|
var form = element.form;
|
|
|
|
var widthFactor = parseInt( defaultAspectRatio.replace( /:.*$/, '' ) );
|
|
|
|
var heightFactor = parseInt( defaultAspectRatio.replace( /^.*:/, '' ) );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
if ( form.elements['preserveAspectRatio'].checked ) {
|
|
|
|
var monitorWidth = parseInt(form.elements['newMonitor[Width]'].value);
|
|
|
|
var monitorHeight = parseInt(form.elements['newMonitor[Height]'].value);
|
2019-01-19 23:32:40 +08:00
|
|
|
switch ( element.name ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
case 'newMonitor[Width]':
|
2019-01-19 23:32:40 +08:00
|
|
|
if ( monitorWidth >= 0 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
form.elements['newMonitor[Height]'].value = Math.round((monitorWidth * heightFactor) / widthFactor);
|
2019-01-19 23:32:40 +08:00
|
|
|
} else {
|
2017-05-19 01:50:56 +08:00
|
|
|
form.elements['newMonitor[Height]'].value = '';
|
2019-01-19 23:32:40 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
break;
|
|
|
|
case 'newMonitor[Height]':
|
2019-01-19 23:32:40 +08:00
|
|
|
if ( monitorHeight >= 0 ) {
|
2017-05-19 01:50:56 +08:00
|
|
|
form.elements['newMonitor[Width]'].value = Math.round((monitorHeight * widthFactor) / heightFactor);
|
2019-01-19 23:32:40 +08:00
|
|
|
} else {
|
2017-05-19 01:50:56 +08:00
|
|
|
form.elements['newMonitor[Width]'].value = '';
|
2019-01-19 23:32:40 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
break;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
2019-01-19 23:32:40 +08:00
|
|
|
return ( false );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function loadLocations( element ) {
|
|
|
|
var form = element.form;
|
|
|
|
var controlIdSelect = form.elements['newMonitor[ControlId]'];
|
|
|
|
var returnLocationSelect = form.elements['newMonitor[ReturnLocation]'];
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
returnLocationSelect.options.length = 1;
|
|
|
|
//returnLocationSelect.options[0] = new Option( noneString, -1 );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
var returnLocationOptions = controlOptions[controlIdSelect.selectedIndex];
|
|
|
|
if ( returnLocationOptions ) {
|
|
|
|
for ( var i = 0; i < returnLocationOptions.length; i++ ) {
|
|
|
|
returnLocationSelect.options[returnLocationSelect.options.length] = new Option( returnLocationOptions[i], i );
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2017-05-19 01:50:56 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2008-07-16 16:40:21 +08:00
|
|
|
|
2017-05-19 01:50:56 +08:00
|
|
|
function initPage() {
|
|
|
|
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
|
|
|
|
//if ( $(protocolSelector).getTag() == 'select' )
|
|
|
|
//updateMethods( $(protocolSelector) );
|
2008-07-16 16:40:21 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
window.addEvent( 'domready', initPage );
|