X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Felements%2Ffckeditor%2Feditor%2Fdialog%2Fcommon%2Ffck_dialog_common.js;h=478d3d52ef77fd7cfb581cc36fca4ecd4006dc6f;hp=26b5628061930aee652beb2d2b2db684bf6a6e65;hb=18067f0bd41356e905666128c5e8105d1fca7c60;hpb=d0b2224eefe4df27ba4f5158a58fb86f9221301c diff --git a/httemplate/elements/fckeditor/editor/dialog/common/fck_dialog_common.js b/httemplate/elements/fckeditor/editor/dialog/common/fck_dialog_common.js index 26b562806..478d3d52e 100644 --- a/httemplate/elements/fckeditor/editor/dialog/common/fck_dialog_common.js +++ b/httemplate/elements/fckeditor/editor/dialog/common/fck_dialog_common.js @@ -1,6 +1,6 @@ /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net - * Copyright (C) 2003-2007 Frederico Caldeira Knabben + * Copyright (C) 2003-2010 Frederico Caldeira Knabben * * == BEGIN LICENSE == * @@ -19,9 +19,47 @@ * == END LICENSE == * * Useful functions used by almost all dialog window pages. + * Dialogs should link to this file as the very first script on the page. */ -var GECKO_BOGUS = '
' ; +// Automatically detect the correct document.domain (#123). +(function() +{ + var d = document.domain ; + + while ( true ) + { + // Test if we can access a parent property. + try + { + var test = window.parent.document.domain ; + break ; + } + catch( e ) {} + + // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... + d = d.replace( /.*?(?:\.|$)/, '' ) ; + + if ( d.length == 0 ) + break ; // It was not able to detect the domain. + + try + { + document.domain = d ; + } + catch (e) + { + break ; + } + } +})() ; + +// Attention: FCKConfig must be available in the page. +function GetCommonDialogCss( prefix ) +{ + // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see _dev/css_compression.txt). + return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}' ; +} // Gets a element by its Id. Used for shorter coding. function GetE( elementId ) @@ -59,22 +97,48 @@ function GetAttribute( element, attName, valueIfNull ) return ( oValue == null ? valueIfNull : oValue ) ; } -// Functions used by text fiels to accept numbers only. -function IsDigit( e ) +function SelectField( elementId ) { - if ( !e ) - e = event ; + var element = GetE( elementId ) ; + element.focus() ; - var iCode = ( e.keyCode || e.charCode ) ; - - return ( - ( iCode >= 48 && iCode <= 57 ) // Numbers - || (iCode >= 37 && iCode <= 40) // Arrows - || iCode == 8 // Backspace - || iCode == 46 // Delete - ) ; + // element.select may not be available for some fields (like