Index: branches/RC/core/editor/editor/plugins/document/document.js =================================================================== diff -u -r10974 -r11852 --- branches/RC/core/editor/editor/plugins/document/document.js (.../document.js) (revision 10974) +++ branches/RC/core/editor/editor/plugins/document/document.js (.../document.js) (revision 11852) @@ -17,8 +17,8 @@ /*if ( oDocument ) FCK.Selection.MoveToNode( oDocument ) ; -*/ -var aDocProperties = new Array(); +*/ +var aDocProperties = new Array(); var docImageType = 'none'; var icon_image = ''; var image_tag = ''; @@ -59,12 +59,12 @@ function LoadSelection() { - + if ( oEditor.FCKBrowserInfo.IsIE ) GetE('txtTitle').value = FCK.EditorDocument.selection.createRange().text.replace( /(^\s*)|(\s*$)/g, '' ); else GetE('txtTitle').value = FCK.EditorWindow.getSelection().getRangeAt(0).toString().replace( /(^\s*)|(\s*$)/g, '' ); - + if ( ! oDocument ) { SetImageType('none'); return ; @@ -75,24 +75,24 @@ if (!id) { SetImageType('none'); id = ''; - } - - if (id.match(/^Doc_|_+/)) + } + + if (id.match(/^Doc_|_+/)) { sType = 'Doc'; - + aDocProperties = id.split("_|_"); /* [0] - Type [1] - file_name [2] - Image_tag - + */ } else { SetImageType('none'); return ; } - + var sHRef = oDocument.getAttribute('href',2) + '' ; var oPopupMatch = ''; var onclick = oDocument.getAttribute( 'onclick_fckprotectedatt' ) ; @@ -114,15 +114,15 @@ GetE( 'cmbTarget' ).value = 'popup' ; SetTarget( 'popup' ) ; ShowE('divPopupSize',1); - + } } - - + + GetE('docUrl').value = sHRef ; file_name = GetFilename(sHRef); old_file_name = GetFilename(sHRef); - + if(FCK.EditorDocument.getElementById(file_name)) { fileSize = FCK.EditorDocument.getElementById(file_name).innerHTML; GetE('txtTitle').value = GetE('txtTitle').value.slice(0, GetE('txtTitle').value.length - fileSize.length ).replace( /(^\s*)|(\s*$)/g, '' ); @@ -137,14 +137,14 @@ GetE('display_size').disabled = true; image_tag = aDocProperties[2]; //GetAttribute( oDocument, 'imagetag', '' ); - - if (image_tag && image_tag != 'doc' && image_tag != 'pdf' && image_tag != 'image' && image_tag != 'excel' && image_tag != 'ppt'&& image_tag != 'audio' && image_tag != 'video' && image_tag != 'none') + + if (image_tag && image_tag != 'doc' && image_tag != 'pdf' && image_tag != 'image' && image_tag != 'excel' && image_tag != 'ppt'&& image_tag != 'audio' && image_tag != 'video' && image_tag != 'none') { SetImageType('other'); GetE('otherUrl').value = image_tag; } else if (image_tag && image_tag != 'none') { SetImageType(image_tag); - } else { + } else { SetImageType('none'); } if ( !oPopupMatch ) @@ -160,7 +160,7 @@ sTarget = sTarget.toLowerCase() ; GetE('cmbTarget').value = sTarget ; } - else + else GetE('cmbTarget').value = '' ; } } @@ -188,10 +188,8 @@ function Ok() { - var alert_msg = ''; - - - + var alert_msg = ''; + if ( GetE('docUrl').value.length == 0 ) { GetE('docUrl').focus() ; @@ -209,7 +207,7 @@ alert(alert_msg); return false ; } - + sUri = GetE('docUrl').value; file_name = GetFilename(sUri); @@ -218,26 +216,26 @@ */ if (docImageType != 'other') imgUri = GetE('otherUrl').value; - + var add_insert = ''; // if (oDocument) // oDocument.parentNode.removeChild(oDocument) GetIconByType(); - - if (GetE('display_size').checked == true) - add_insert = ' ('+fileSize+' KB)'; + + if (GetE('display_size').checked == true) + add_insert = ' ('+fileSize+' KB)'; var my_title = ''; if (GetE('txtTitle').value) my_title = GetE('txtTitle').value+' ' - + if (GetE('cmbTarget').value == 'popup') { var onclick = 'FCKOpenPopUp(this,event,'+ GetE('txtPopupWidth').value +','+ GetE('txtPopupHeight').value +');'; var insert = ''+icon_image+my_title+add_insert+' '; } else if (GetE('cmbTarget').value != '') var insert = ''+icon_image+my_title+add_insert+' '; else var insert = ''+icon_image+my_title+add_insert+' '; - + oEditor.FCK.InsertHtml(insert); return true; @@ -247,41 +245,48 @@ { if (docImageType != 'none' && docImageType != 'other') { icon_image = ''+GetE('txtTitle').value+' ' - image_tag = docImageType; + image_tag = docImageType; } if (docImageType == 'other') { image_tag = GetE('otherUrl').value; icon_image = ''+GetE('txtTitle').value+''; } if (docImageType == 'none') { icon_image = ''; - image_tag = docImageType; + image_tag = docImageType; } - + } function BrowseServer(field) { - urlField = field; + urlField = field; // gobal variable, used in SetUrl function later + // Open the browser window. - if (field == 'docUrl') - OpenFileBrowser( FCKConfig.BaseUrl + FCKConfig.DocumentsBrowserURL, FCKConfig.DocumentsBrowserWindowWidth, FCKConfig.DocumentsBrowserWindowHeight ) ; - else - OpenFileBrowser( FCKConfig.BaseUrl + FCKConfig.ImageBrowserURL, FCKConfig.DocumentsBrowserWindowWidth, FCKConfig.DocumentsBrowserWindowHeight ) ; + if (field == 'docUrl') { + OpenFileBrowser( FCKConfig.DocumentsBrowserURL, FCKConfig.DocumentsBrowserWindowWidth, FCKConfig.DocumentsBrowserWindowHeight ) ; + } + else { + OpenFileBrowser( FCKConfig.ImageBrowserURL, FCKConfig.DocumentsBrowserWindowWidth, FCKConfig.DocumentsBrowserWindowHeight ) ; + } } function SetUrl( url, width, height, alt, fsize ) { if (urlField == 'docUrl') { - if (fsize > 0) + if (fsize > 0) { GetE('display_size').disabled = false; + } + fileSize = fsize; } + GetE(urlField).value = url ; - - if ( alt ) + + if ( alt ) { GetE('txtAlt').value = alt; + } } function SetTarget( targetType ) @@ -300,14 +305,14 @@ break ; } - if ( targetType == 'popup' ) + if ( targetType == 'popup' ) { ShowE('divPopupSize',1); window.parent.SetAutoSize( true ) ; if (!GetE('txtPopupWidth').value) GetE('txtPopupWidth').value = 800; if (!GetE('txtPopupHeight').value) GetE('txtPopupHeight').value = 600; - } else + } else ShowE('divPopupSize',0); } \ No newline at end of file