w.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <!--
  3. * FCKeditor - The text editor for Internet - http://www.fckeditor.net
  4. * Copyright (C) 2003-2010 Frederico Caldeira Knabben
  5. *
  6. * == BEGIN LICENSE ==
  7. *
  8. * Licensed under the terms of any of the following licenses at your
  9. * choice:
  10. *
  11. * - GNU General Public License Version 2 or later (the "GPL")
  12. * http://www.gnu.org/licenses/gpl.html
  13. *
  14. * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
  15. * http://www.gnu.org/licenses/lgpl.html
  16. *
  17. * - Mozilla Public License Version 1.1 or later (the "MPL")
  18. * http://www.mozilla.org/MPL/MPL-1.1.html
  19. *
  20. * == END LICENSE ==
  21. -->
  22. <html>
  23. <head>
  24. <title></title>
  25. <style>
  26. #wsc_frames , #errorMessage{
  27. position:absolute;
  28. top:0px;
  29. left:0px;
  30. width:500px;
  31. height:395px;
  32. margin:0px;
  33. padding:0px;
  34. border:0px;
  35. display:block;
  36. overflow: hidden;
  37. }
  38. #wsc_frames { z-index:10;}
  39. #errorMessage {
  40. color:red;
  41. display:none;
  42. font-size:16px;
  43. font-weight:bold;
  44. padding-top:160px;
  45. text-align:center;
  46. z-index:11;
  47. }
  48. #errorMessage p {
  49. color:#000;
  50. font-size:11px;
  51. text-align:left;
  52. font-weight: normal;
  53. padding-left:80px;
  54. }
  55. </style>
  56. <script type="text/javascript">
  57. var oEditor = window.parent.InnerDialogLoaded() ;
  58. var FCKConfig = oEditor.FCKConfig;
  59. function doLoadScript(url)
  60. {
  61. if (!url)
  62. return false ;
  63. var s = document.createElement('script') ;
  64. s.type = 'text/javascript' ;
  65. s.src = url ;
  66. document.getElementsByTagName('head')[0].appendChild(s) ;
  67. return true ;
  68. }
  69. function Ok()
  70. {
  71. return window.parent.Cancel() ;
  72. }
  73. function _callOnCancel( dT )
  74. {
  75. window.parent.Cancel() ;
  76. }
  77. function _callOnFinish( dT )
  78. {
  79. oEditor.FCK.SetData( dT.value ) ;
  80. window.parent.CloseDialog( true ) ;
  81. }
  82. function _cancelOnError(m)
  83. {
  84. var _conId = 'errorMessage' ;
  85. var message = m || 'Sorry, but service is unavailable now.' ;
  86. if ( typeof( WSC_Error ) == 'undefined' )
  87. {
  88. var _con = document.createElement( 'div' ) ;
  89. _con.setAttribute( 'id', _conId ) ;
  90. document.body.appendChild( _con ) ;
  91. dom_con = document.getElementById( _conId ) ;
  92. dom_con.innerHTML = message ;
  93. dom_con.style.display = 'block' ;
  94. }
  95. //return Ok() ;
  96. }
  97. function URL_abs2full( uri )
  98. {
  99. return uri.match( 'http' )
  100. ? uri
  101. : document.location.protocol + '//' + document.location.host + uri ;
  102. }
  103. function clearErrorUsermessage()
  104. {
  105. // empty error container
  106. var _con = document.getElementById( 'errorMessage' ) ;
  107. if ( !_con )
  108. return ;
  109. _con.innerHTML = '' ;
  110. _con.style.display = 'none' ;
  111. }
  112. var gInterval ;
  113. function onLoad()
  114. {
  115. clearErrorUsermessage() ;
  116. var _errorMessage = 'The SpellChecker Service is currently unavailable.' ;
  117. if ( 'undefined' != typeof( oEditor.FCK.Config.WSChLoaderScript ) )
  118. _errorMessage = '<div>The SpellChecker Service is currently unavailable.</div><p>Error loading application<br>service host: ' + oEditor.FCK.Config.WSChLoaderScript + '</p>';
  119. var burnSpelling = function( oName, _eMessage )
  120. {
  121. var i = 0 ;
  122. return function ()
  123. {
  124. if ( typeof( window[oName] ) == 'function' )
  125. initAndSpell() ;
  126. else if ( i++ == 180 )
  127. _cancelOnError( _eMessage ) ;
  128. }
  129. }
  130. gInterval = window.setInterval( burnSpelling( 'doSpell', _errorMessage ), 250 ) ;
  131. // WSC CORE init section
  132. var protocol = document.location.protocol || 'http:' ;
  133. var baseUrl = protocol + '//loader.spellchecker.net/sproxy_fck/sproxy.php' ;
  134. var plugin = "fck2" ;
  135. var customerid = oEditor.FCK.Config.WSCnCustomerId
  136. || "1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk" ;
  137. var wscCoreUrl = oEditor.FCK.Config.WSChLoaderScript
  138. || ( baseUrl + '?'
  139. + 'plugin=' + plugin + '&'
  140. + 'customerid='+ customerid + '&'
  141. + 'cmd=script&doc=wsc&schema=22' ) ;
  142. // load WSC core
  143. doLoadScript( wscCoreUrl ) ;
  144. }
  145. function initAndSpell()
  146. {
  147. //xall from window.setInteval expected at once
  148. if ( typeof( gInterval ) == 'undefined' )
  149. return null ;
  150. window.clearInterval( gInterval ) ;
  151. // global var is used in FCK specific core
  152. // change on equal var used in fckplugin.js
  153. gFCKPluginName = 'wsc' ;
  154. // get the data to be checked
  155. var sData = oEditor.FCK.GetData() ;
  156. // prepare content
  157. var ctrlId = 'myEditor' ;
  158. var dCurT = document.getElementById( ctrlId ) ;
  159. dCurT.value = sData ;
  160. // service paths corecting/preparing
  161. var sPath2Scin = URL_abs2full( oEditor.FCK.Config.SkinDialogCSS ) ;
  162. var sPathCiframe = FCKConfig.BasePath + 'wsc/ciframe.html' ;
  163. var sPathFrameset = FCKConfig.BasePath + 'wsc/tmpFrameset.html' ;
  164. // language abbr standarts comparer
  165. var LangComparer = new _SP_FCK_LangCompare() ;
  166. LangComparer.setDefaulLangCode( oEditor.FCK.Language.DefaultLanguage ) ;
  167. // clear user message console (if application was loaded more then after 2 seconds)
  168. clearErrorUsermessage() ;
  169. doSpell( {
  170. ctrl : ctrlId,
  171. lang : LangComparer.getSPLangCode( oEditor.FCK.Language.GetActiveLanguage() ),
  172. winType : 'wsc_frames',// if not defined app will run on winpopup
  173. // callback binding section
  174. onCancel :window._callOnCancel,
  175. onFinish :window._callOnFinish,
  176. // @TODO: basePath assingning
  177. // some manipulations with client static pages
  178. framesetPath : sPathFrameset,
  179. iframePath : sPathCiframe,
  180. // styles defining
  181. schemaURI : sPath2Scin
  182. } ) ;
  183. return true ;
  184. }
  185. </script>
  186. </head>
  187. <body onload="onLoad()" style="padding: 0px; overflow: hidden;">
  188. <textarea style="display: none;" id="myEditor" rows="10" cols="40"></textarea>
  189. <iframe src="" name="wsc_frames" id="wsc_frames"></iframe>
  190. </body>
  191. </html>