--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/drupal/modules/fckeditor/fckeditor.popup.html Fri Aug 21 16:26:26 2009 +0000
@@ -0,0 +1,137 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>FCKeditor</title>
+ <!-- $id$ -->
+ <script type="text/javascript">
+document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.basePath + 'misc/jquery.js"></scr' + 'ipt>');
+// #### URLParams: holds all URL passed parameters (like ?Param1=Value1&Param2=Value2)
+var FCKURLParams = new Object() ;
+
+var aParams = document.location.search.substr(1).split('&') ;
+for ( var i = 0 ; i < aParams.length ; i++ )
+{
+ var aParam = aParams[i].split('=') ;
+ var sParamName = aParam[0] ;
+ var sParamValue = aParam[1] ;
+
+ FCKURLParams[ sParamName ] = sParamValue ;
+}
+
+// It is preferable to have the oFCKeditor object defined in the opener window,
+// so all the configurations will be there. In this way the popup doesn't need
+// to take care of the configurations "clonning".
+var oFCKeditor = window.opener[ FCKURLParams[ 'var' ] ] ;
+oFCKeditor.Width = '100%' ;
+oFCKeditor.Height = '100%' ;
+
+if (FCKURLParams[ 'teaser' ]) {
+ var text = window.opener.document.getElementById( FCKURLParams[ 'teaser' ] ).value ;
+ if (text.length > 0) {
+ text = text + '\n<!--break-->\n';
+ }
+ oFCKeditor.Value = text + window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ;
+} else {
+ oFCKeditor.Value = window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ;
+}
+
+function FCKeditor_trim(text) {
+ return text.replace(/^\s+/g, '').replace(/\s+$/g, '');
+}
+
+function Ok()
+{
+ var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ;
+
+ if (FCKURLParams[ 'teaser' ]) {
+ var text = oEditor.GetData( true );
+ var t = text.indexOf('<!--break-->');
+ var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] );
+ var teaser = window.opener.document.getElementById( FCKURLParams[ 'teaser' ] );
+ console.debug(teaser.parentNode.style.display);
+ // for now, do nothing when the body field is in joined mode
+ if(t != -1 && teaser.parentNode.style.display != 'none') {
+ teaser.value = FCKeditor_trim(text.slice(0,t));
+ textarea.value = FCKeditor_trim(text.slice(t+12));
+ } else {
+ teaser.value = '';
+ textarea.value = text;
+ }
+ } else {
+ window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value = oEditor.GetData( true ) ; // "true" means you want it formatted.
+ }
+
+ window.opener.focus() ;
+ window.close() ;
+}
+
+function FCKeditor_OnComplete( editorInstance )
+{
+ oEditor = editorInstance;
+ var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] );
+ if ($(textarea).attr('class').indexOf("filterxss2") != -1) {
+ $.post(window.opener['Drupal'].settings.basePath + 'index.php?q=fckeditor/xss', {
+ text: oFCKeditor.Value,
+ 'filters[]': window.opener['Drupal'].settings.fckeditor_filters[FCKURLParams[ 'var' ]]
+ },
+ function(text) {
+ oEditor.SetData(text);
+ }
+ );
+ }
+}
+
+function Cancel()
+{
+ var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ;
+
+ if ( oEditor.IsDirty() )
+ {
+ if ( !confirm( 'Are you sure you want to cancel? Your changes will be lost.' ) )
+ return ;
+ }
+
+ window.close() ;
+}
+
+ </script>
+</head>
+<body>
+ <table width="100%" height="100%">
+ <tr>
+ <td height="100%">
+ <script type="text/javascript">
+
+//image_assist integration
+IaObj = window.opener.document.getElementById( 'img_assist-link-' + FCKURLParams[ 'el' ] );
+if(IaObj){
+ IaObj.href = IaObj.href.replace("/load/textarea", "/load/fckeditor");
+ document.write( '<a className="img_assist-link" href='+ IaObj.href +' id="img_assist-link-' + FCKURLParams[ 'el' ] +'" style="display:none" /></a>' ) ;
+}
+
+var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] );
+if ($(textarea).attr('class').indexOf("filterxss2") != -1) {
+ var initialHTML = '';
+}
+else {
+ var initialHTML = oFCKeditor.Value;
+}
+
+// For now, it is not possible to retrieve the output HTML, so we must do it by
+// hand. Future implementations of FCKeditor could bring a
+// oFCKeditor.CreateHtml() function.
+document.write( '<input type="hidden" id="' + oFCKeditor.InstanceName + '" name="' + oFCKeditor.InstanceName + '" value="' + oFCKeditor._HTMLEncode( initialHTML ) + '" style="display:none" />' ) ;
+document.write( oFCKeditor._GetConfigHtml() ) ;
+document.write( oFCKeditor._GetIFrameHtml() ) ;
+
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="button" value="Ok" onclick="Ok();" style="width:120px" />
+ <input type="button" value="Cancel" onclick="Cancel();" />
+ </td>
+ </tr>
+ </table>
+</body>
+</html>