| f3d88ca0 |
1 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 2 | <head> |
| 3 | <title>FCKeditor</title> |
| 4 | <script type="text/javascript"> |
| 5 | |
| 6 | // #### URLParams: holds all URL passed parameters (like ?Param1=Value1&Param2=Value2) |
| 7 | var FCKURLParams = new Object() ; |
| 8 | |
| 9 | var aParams = document.location.search.substr(1).split('&') ; |
| 10 | for ( var i = 0 ; i < aParams.length ; i++ ) |
| 11 | { |
| 12 | var aParam = aParams[i].split('=') ; |
| 13 | var sParamName = aParam[0] ; |
| 14 | var sParamValue = aParam[1] ; |
| 15 | |
| 16 | FCKURLParams[ sParamName ] = sParamValue ; |
| 17 | } |
| 18 | |
| 19 | // It is preferable to have the oFCKeditor object defined in the opener window, |
| 20 | // so all the configurations will be there. In this way the popup doesn't need |
| 21 | // to take care of the configurations "clonning". |
| 22 | var oFCKeditor = window.opener[ FCKURLParams[ 'var' ] ] ; |
| 23 | oFCKeditor.Width = '100%' ; |
| 24 | oFCKeditor.Height = '100%' ; |
| 25 | oFCKeditor.Value = window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ; |
| 26 | |
| 27 | function Ok() |
| 28 | { |
| 29 | var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ; |
| 30 | |
| 31 | window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value = oEditor.GetXHTML( true ) ; // "true" means you want it formatted. |
| 32 | |
| 33 | window.opener.focus() ; |
| 34 | window.close() ; |
| 35 | } |
| 36 | |
| 37 | function Cancel() |
| 38 | { |
| 39 | var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ; |
| 40 | |
| 41 | if ( oEditor.IsDirty() ) |
| 42 | { |
| 43 | if ( !confirm( 'Are you sure you want to cancel? Your changes will be lost.' ) ) |
| 44 | return ; |
| 45 | } |
| 46 | |
| 47 | window.close() ; |
| 48 | } |
| 49 | |
| 50 | </script> |
| 51 | </head> |
| 52 | <body> |
| 53 | <table width="100%" height="100%"> |
| 54 | <tr> |
| 55 | <td height="100%"> |
| 56 | <script type="text/javascript"> |
| 57 | |
| 58 | // For now, it is not possible to retrieve the output HTML, so we must do it by |
| 59 | // hand. Future implementations of FCKeditor could bring a |
| 60 | // oFCKeditor.CreateHtml() function. |
| 61 | document.write( '<input type="hidden" id="' + oFCKeditor.InstanceName + '" name="' + oFCKeditor.InstanceName + '" value="' + oFCKeditor._HTMLEncode( oFCKeditor.Value ) + '" style="display:none" />' ) ; |
| 62 | document.write( oFCKeditor._GetConfigHtml() ) ; |
| 63 | document.write( oFCKeditor._GetIFrameHtml() ) ; |
| 64 | |
| 65 | </script> |
| 66 | </td> |
| 67 | </tr> |
| 68 | <tr> |
| 69 | <td> |
| 70 | <input type="button" value="Ok" onclick="Ok();" style="width:120px" /> |
| 71 | <input type="button" value="Cancel" onclick="Cancel();" /> |
| 72 | </td> |
| 73 | </tr> |
| 74 | </table> |
| 75 | </body> |
| 76 | </html> |