| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <html xmlns="http://www.w3.org/1999/xhtml"> 2 <head> 3 <title>FCKeditor</title> 4 <!-- $id$ --> 5 6 <script type="text/javascript"> 7 document.write('<scr' + 'ipt src="' + window.opener['Drupal'].settings.basePath + 'misc/jquery.js"></scr' + 'ipt>'); 8 // #### URLParams: holds all URL passed parameters (like ?Param1=Value1&Param2=Value2) 9 var FCKURLParams = new Object() ; 10 11 var aParams = document.location.search.substr(1).split('&') ; 12 for ( var i = 0 ; i < aParams.length ; i++ ) 13 { 14 var aParam = aParams[i].split('=') ; 15 var sParamName = aParam[0] ; 16 var sParamValue = aParam[1] ; 17 18 FCKURLParams[ sParamName ] = sParamValue ; 19 } 20 21 // It is preferable to have the oFCKeditor object defined in the opener window, 22 // so all the configurations will be there. In this way the popup doesn't need 23 // to take care of the configurations "clonning". 24 var oFCKeditor = window.opener[ FCKURLParams[ 'var' ] ] ; 25 oFCKeditor.Width = '100%' ; 26 oFCKeditor.Height = '100%' ; 27 28 if (FCKURLParams[ 'teaser' ]) { 29 var text = window.opener.document.getElementById( FCKURLParams[ 'teaser' ] ).value ; 30 if (text.length > 0) { 31 text = text + '\n<!--break-->\n'; 32 } 33 oFCKeditor.Value = text + window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ; 34 } else { 35 oFCKeditor.Value = window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ; 36 } 37 38 function FCKeditor_trim(text) { 39 return text.replace(/^\s+/g, '').replace(/\s+$/g, ''); 40 } 41 42 function Ok() 43 { 44 var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ; 45 46 if (FCKURLParams[ 'teaser' ]) { 47 var text = oEditor.GetData( true ); 48 var t = text.indexOf('<!--break-->'); 49 var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] ); 50 var teaser = window.opener.document.getElementById( FCKURLParams[ 'teaser' ] ); 51 // for now, do nothing when the body field is in joined mode 52 if(t != -1 && teaser.parentNode.style.display != 'none') { 53 teaser.value = FCKeditor_trim(text.slice(0,t)); 54 textarea.value = FCKeditor_trim(text.slice(t+12)); 55 } else { 56 teaser.value = ''; 57 textarea.value = text; 58 } 59 } else { 60 window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value = oEditor.GetData( true ) ; // "true" means you want it formatted. 61 } 62 63 window.opener.focus() ; 64 window.close() ; 65 } 66 67 var oEditor; 68 69 function Cancel() 70 { 71 var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ; 72 73 if ( oEditor.IsDirty() ) 74 { 75 if ( !confirm( 'Are you sure you want to cancel? Your changes will be lost.' ) ) 76 return ; 77 } 78 79 window.close() ; 80 } 81 82 function FCKeditor_OnComplete( editorInstance ) 83 { 84 oEditor = editorInstance; 85 var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] ); 86 if ($(textarea).attr('class').indexOf("filterxss2") != -1) { 87 $.post(window.opener['Drupal'].settings.basePath + 'index.php?q=fckeditor/xss', { 88 text: oFCKeditor.Value, 89 'filters[]': window.opener['Drupal'].settings.fckeditor_filters[FCKURLParams[ 'var' ]] 90 }, 91 function(text) { 92 oEditor.SetData(text); 93 } 94 ); 95 } 96 } 97 </script> 98 </head> 99 <body> 100 <table width="100%" height="100%"> 101 <tr> 102 <td height="100%"> 103 <script type="text/javascript"> 104 105 //image_assist integration 106 IaObj = window.opener.document.getElementById( 'img_assist-link-' + FCKURLParams[ 'el' ] ); 107 if(IaObj){ 108 IaObj.href = IaObj.href.replace("/load/textarea", "/load/fckeditor"); 109 document.write( '<a className="img_assist-link" href='+ IaObj.href +' id="img_assist-link-' + FCKURLParams[ 'el' ] +'" style="display:none" /></a>' ) ; 110 } 111 // For now, it is not possible to retrieve the output HTML, so we must do it by 112 // hand. Future implementations of FCKeditor could bring a 113 // oFCKeditor.CreateHtml() function. 114 115 var textarea = window.opener.document.getElementById( FCKURLParams[ 'el' ] ); 116 if ($(textarea).attr('class').indexOf("filterxss2") != -1) { 117 var initialHTML = ''; 118 } 119 else { 120 var initialHTML = oFCKeditor.Value; 121 } 122 123 document.write( '<input type="hidden" id="' + oFCKeditor.InstanceName + '" name="' + oFCKeditor.InstanceName + '" value="' + oFCKeditor._HTMLEncode( initialHTML ) + '" style="display:none" />' ) ; 124 document.write( oFCKeditor._GetConfigHtml() ) ; 125 document.write( oFCKeditor._GetIFrameHtml() ) ; 126 </script> 127 </td> 128 </tr> 129 <tr> 130 <td> 131 <input type="button" value="Ok" onclick="Ok();" style="width:120px" /> 132 <input type="button" value="Cancel" onclick="Cancel();" /> 133 </td> 134 </tr> 135 </table> 136 </body> 137 </html>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |