FCKeditor 2.6.6
[freeside.git] / httemplate / elements / fckeditor / editor / wsc / w.html
diff --git a/httemplate/elements/fckeditor/editor/wsc/w.html b/httemplate/elements/fckeditor/editor/wsc/w.html
new file mode 100644 (file)
index 0000000..df327a6
--- /dev/null
@@ -0,0 +1,227 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
+<!--\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2010 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ *  - GNU General Public License Version 2 or later (the "GPL")\r
+ *    http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ *    http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ *    http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+-->\r
+<html>\r
+<head>\r
+       <title></title>\r
+       <style>\r
+               #wsc_frames , #errorMessage{\r
+                       position:absolute;\r
+                       top:0px;\r
+                       left:0px;\r
+                       width:500px;\r
+                       height:395px;\r
+                       margin:0px;\r
+                       padding:0px;\r
+                       border:0px;\r
+                       display:block;\r
+                       overflow: hidden;\r
+               }\r
+               #wsc_frames   { z-index:10;}\r
+               #errorMessage {\r
+                       color:red;\r
+                       display:none;\r
+                       font-size:16px;\r
+                       font-weight:bold;\r
+                       padding-top:160px;\r
+                       text-align:center;\r
+                       z-index:11;\r
+               }\r
+               #errorMessage p {\r
+                       color:#000;\r
+                       font-size:11px;\r
+                       text-align:left;\r
+                       font-weight: normal;\r
+                       padding-left:80px;\r
+               }\r
+\r
+       </style>\r
+       <script type="text/javascript">\r
+\r
+var oEditor = window.parent.InnerDialogLoaded() ;\r
+var FCKConfig = oEditor.FCKConfig;\r
+\r
+function doLoadScript(url)\r
+{\r
+       if (!url)\r
+               return false ;\r
+\r
+       var s = document.createElement('script') ;\r
+       s.type = 'text/javascript' ;\r
+       s.src = url ;\r
+\r
+       document.getElementsByTagName('head')[0].appendChild(s) ;\r
+\r
+       return true ;\r
+}\r
+\r
+function Ok()\r
+{\r
+       return window.parent.Cancel() ;\r
+}\r
+\r
+function _callOnCancel( dT )\r
+{\r
+       window.parent.Cancel() ;\r
+}\r
+\r
+function _callOnFinish( dT )\r
+{\r
+       oEditor.FCK.SetData( dT.value ) ;\r
+       window.parent.CloseDialog( true ) ;\r
+}\r
+\r
+function _cancelOnError(m)\r
+{\r
+       var _conId = 'errorMessage' ;\r
+       var message = m || 'Sorry, but service is unavailable now.' ;\r
+\r
+       if ( typeof( WSC_Error ) == 'undefined' )\r
+       {\r
+               var _con = document.createElement( 'div' ) ;\r
+               _con.setAttribute( 'id', _conId ) ;\r
+               document.body.appendChild( _con ) ;\r
+               dom_con = document.getElementById( _conId ) ;\r
+               dom_con.innerHTML = message ;\r
+               dom_con.style.display = 'block' ;\r
+       }\r
+       //return Ok() ;\r
+}\r
+\r
+function URL_abs2full( uri )\r
+{\r
+       return uri.match( 'http' )\r
+               ? uri\r
+               : document.location.protocol + '//' + document.location.host + uri ;\r
+}\r
+\r
+function clearErrorUsermessage()\r
+{\r
+       // empty error container\r
+       var _con = document.getElementById( 'errorMessage' ) ;\r
+\r
+       if ( !_con )\r
+               return ;\r
+\r
+       _con.innerHTML = '' ;\r
+       _con.style.display = 'none' ;\r
+}\r
+\r
+var gInterval ;\r
+\r
+function onLoad()\r
+{\r
+       clearErrorUsermessage() ;\r
+       var _errorMessage = 'The SpellChecker Service is currently unavailable.' ;\r
+       if ( 'undefined' != typeof( oEditor.FCK.Config.WSChLoaderScript ) )\r
+           _errorMessage = '<div>The SpellChecker Service is currently unavailable.</div><p>Error loading application<br>service host: ' + oEditor.FCK.Config.WSChLoaderScript + '</p>';\r
+\r
+       var burnSpelling = function( oName, _eMessage )\r
+       {\r
+               var i = 0 ;\r
+\r
+               return function ()\r
+               {\r
+                       if ( typeof( window[oName] ) == 'function' )\r
+                               initAndSpell() ;\r
+                       else if ( i++ == 180 )\r
+                               _cancelOnError( _eMessage ) ;\r
+               }\r
+       }\r
+\r
+       gInterval = window.setInterval( burnSpelling( 'doSpell', _errorMessage ), 250 ) ;\r
+\r
+       // WSC CORE init section\r
+       var protocol = document.location.protocol || 'http:' ;\r
+       var baseUrl = protocol + '//loader.spellchecker.net/sproxy_fck/sproxy.php' ;\r
+       var plugin = "fck2" ;\r
+       var customerid = oEditor.FCK.Config.WSCnCustomerId\r
+               || "1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk" ;\r
+       var wscCoreUrl = oEditor.FCK.Config.WSChLoaderScript\r
+               || ( baseUrl + '?'\r
+                       + 'plugin='    + plugin + '&'\r
+                       + 'customerid='+ customerid + '&'\r
+                       + 'cmd=script&doc=wsc&schema=22' ) ;\r
+\r
+       // load WSC core\r
+       doLoadScript( wscCoreUrl ) ;\r
+}\r
+\r
+function initAndSpell()\r
+{\r
+       //xall from window.setInteval expected at once\r
+       if ( typeof( gInterval ) == 'undefined' )\r
+               return null ;\r
+       window.clearInterval( gInterval ) ;\r
+\r
+       // global var is used in FCK specific core\r
+       // change on equal var used in fckplugin.js\r
+       gFCKPluginName = 'wsc' ;\r
+\r
+       // get the data to be checked\r
+       var sData = oEditor.FCK.GetData() ;\r
+\r
+       // prepare content\r
+       var ctrlId =  'myEditor' ;\r
+       var dCurT = document.getElementById( ctrlId ) ;\r
+       dCurT.value = sData ;\r
+\r
+       // service paths corecting/preparing\r
+       var sPath2Scin = URL_abs2full( oEditor.FCK.Config.SkinDialogCSS ) ;\r
+       var sPathCiframe = FCKConfig.BasePath + 'wsc/ciframe.html' ;\r
+       var sPathFrameset = FCKConfig.BasePath + 'wsc/tmpFrameset.html' ;\r
+\r
+       // language abbr standarts comparer\r
+       var LangComparer = new _SP_FCK_LangCompare() ;\r
+       LangComparer.setDefaulLangCode( oEditor.FCK.Language.DefaultLanguage ) ;\r
+\r
+       // clear user message console (if application was loaded more then after 2 seconds)\r
+       clearErrorUsermessage() ;\r
+\r
+       doSpell( {\r
+               ctrl : ctrlId,\r
+               lang : LangComparer.getSPLangCode( oEditor.FCK.Language.GetActiveLanguage() ),\r
+               winType : 'wsc_frames',// if not defined app will run on winpopup\r
+\r
+               // callback binding section\r
+               onCancel :window._callOnCancel,\r
+               onFinish :window._callOnFinish,\r
+\r
+               // @TODO: basePath assingning\r
+\r
+               // some manipulations with client static pages\r
+               framesetPath : sPathFrameset,\r
+               iframePath : sPathCiframe,\r
+\r
+               // styles defining\r
+               schemaURI : sPath2Scin\r
+       } ) ;\r
+\r
+       return true ;\r
+}\r
+\r
+       </script>\r
+</head>\r
+<body onload="onLoad()" style="padding: 0px; overflow: hidden;">\r
+       <textarea style="display: none;" id="myEditor" rows="10" cols="40"></textarea>\r
+       <iframe src="" name="wsc_frames" id="wsc_frames"></iframe>\r
+</body>\r
+</html>\r