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