OSDN Git Service

初回コミット(v2.6.17.1)
[magic3/magic3.git] / scripts / fckeditor2.6.6 / editor / wsc / w.html
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
56         </style>
57         <script type="text/javascript">
58
59 var oEditor = window.parent.InnerDialogLoaded() ;
60 var FCKConfig = oEditor.FCKConfig;
61
62 function doLoadScript(url)
63 {
64         if (!url)
65                 return false ;
66
67         var s = document.createElement('script') ;
68         s.type = 'text/javascript' ;
69         s.src = url ;
70
71         document.getElementsByTagName('head')[0].appendChild(s) ;
72
73         return true ;
74 }
75
76 function Ok()
77 {
78         return window.parent.Cancel() ;
79 }
80
81 function _callOnCancel( dT )
82 {
83         window.parent.Cancel() ;
84 }
85
86 function _callOnFinish( dT )
87 {
88         oEditor.FCK.SetData( dT.value ) ;
89         window.parent.CloseDialog( true ) ;
90 }
91
92 function _cancelOnError(m)
93 {
94         var _conId = 'errorMessage' ;
95         var message = m || 'Sorry, but service is unavailable now.' ;
96
97         if ( typeof( WSC_Error ) == 'undefined' )
98         {
99                 var _con = document.createElement( 'div' ) ;
100                 _con.setAttribute( 'id', _conId ) ;
101                 document.body.appendChild( _con ) ;
102                 dom_con = document.getElementById( _conId ) ;
103                 dom_con.innerHTML = message ;
104                 dom_con.style.display = 'block' ;
105         }
106         //return Ok() ;
107 }
108
109 function URL_abs2full( uri )
110 {
111         return uri.match( 'http' )
112                 ? uri
113                 : document.location.protocol + '//' + document.location.host + uri ;
114 }
115
116 function clearErrorUsermessage()
117 {
118         // empty error container
119         var _con = document.getElementById( 'errorMessage' ) ;
120
121         if ( !_con )
122                 return ;
123
124         _con.innerHTML = '' ;
125         _con.style.display = 'none' ;
126 }
127
128 var gInterval ;
129
130 function onLoad()
131 {
132         clearErrorUsermessage() ;
133         var _errorMessage = 'The SpellChecker Service is currently unavailable.' ;
134         if ( 'undefined' != typeof( oEditor.FCK.Config.WSChLoaderScript ) )
135             _errorMessage = '<div>The SpellChecker Service is currently unavailable.</div><p>Error loading application<br>service host: ' + oEditor.FCK.Config.WSChLoaderScript + '</p>';
136
137         var burnSpelling = function( oName, _eMessage )
138         {
139                 var i = 0 ;
140
141                 return function ()
142                 {
143                         if ( typeof( window[oName] ) == 'function' )
144                                 initAndSpell() ;
145                         else if ( i++ == 180 )
146                                 _cancelOnError( _eMessage ) ;
147                 }
148         }
149
150         gInterval = window.setInterval( burnSpelling( 'doSpell', _errorMessage ), 250 ) ;
151
152         // WSC CORE init section
153         var protocol = document.location.protocol || 'http:' ;
154         var baseUrl = protocol + '//loader.spellchecker.net/sproxy_fck/sproxy.php' ;
155         var plugin = "fck2" ;
156         var customerid = oEditor.FCK.Config.WSCnCustomerId
157                 || "1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk" ;
158         var wscCoreUrl = oEditor.FCK.Config.WSChLoaderScript
159                 || ( baseUrl + '?'
160                         + 'plugin='    + plugin + '&'
161                         + 'customerid='+ customerid + '&'
162                         + 'cmd=script&doc=wsc&schema=22' ) ;
163
164         // load WSC core
165         doLoadScript( wscCoreUrl ) ;
166 }
167
168 function initAndSpell()
169 {
170         //xall from window.setInteval expected at once
171         if ( typeof( gInterval ) == 'undefined' )
172                 return null ;
173         window.clearInterval( gInterval ) ;
174
175         // global var is used in FCK specific core
176         // change on equal var used in fckplugin.js
177         gFCKPluginName = 'wsc' ;
178
179         // get the data to be checked
180         var sData = oEditor.FCK.GetData() ;
181
182         // prepare content
183         var ctrlId =  'myEditor' ;
184         var dCurT = document.getElementById( ctrlId ) ;
185         dCurT.value = sData ;
186
187         // service paths corecting/preparing
188         var sPath2Scin = URL_abs2full( oEditor.FCK.Config.SkinDialogCSS ) ;
189         var sPathCiframe = FCKConfig.BasePath + 'wsc/ciframe.html' ;
190         var sPathFrameset = FCKConfig.BasePath + 'wsc/tmpFrameset.html' ;
191
192         // language abbr standarts comparer
193         var LangComparer = new _SP_FCK_LangCompare() ;
194         LangComparer.setDefaulLangCode( oEditor.FCK.Language.DefaultLanguage ) ;
195
196         // clear user message console (if application was loaded more then after 2 seconds)
197         clearErrorUsermessage() ;
198
199         doSpell( {
200                 ctrl : ctrlId,
201                 lang : LangComparer.getSPLangCode( oEditor.FCK.Language.GetActiveLanguage() ),
202                 winType : 'wsc_frames',// if not defined app will run on winpopup
203
204                 // callback binding section
205                 onCancel :window._callOnCancel,
206                 onFinish :window._callOnFinish,
207
208                 // @TODO: basePath assingning
209
210                 // some manipulations with client static pages
211                 framesetPath : sPathFrameset,
212                 iframePath : sPathCiframe,
213
214                 // styles defining
215                 schemaURI : sPath2Scin
216         } ) ;
217
218         return true ;
219 }
220
221         </script>
222 </head>
223 <body onload="onLoad()" style="padding: 0px; overflow: hidden;">
224         <textarea style="display: none;" id="myEditor" rows="10" cols="40"></textarea>
225         <iframe src="" name="wsc_frames" id="wsc_frames"></iframe>
226 </body>
227 </html>