X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=plugins%2Fscayt%2Fdialogs%2Foptions.js;h=8178e1affa385c0b46712aeb96f0ad13ae26fdee;hb=dc5b273b4cbd7e7d0167499e7649867ba2a5b408;hp=c243e9ff6246bdeb9bf62c98c49d5deaad8d260a;hpb=860af3c4bde9866c53d5123c57e3dc6166e0fe1e;p=ckeditor.git diff --git a/plugins/scayt/dialogs/options.js b/plugins/scayt/dialogs/options.js index c243e9f..8178e1a 100644 --- a/plugins/scayt/dialogs/options.js +++ b/plugins/scayt/dialogs/options.js @@ -1,19 +1,17 @@ -/* - Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. - For licensing, see LICENSE.html or http://ckeditor.com/license -*/ -CKEDITOR.dialog.add("scaytcheck",function(j){function w(){return"undefined"!=typeof document.forms["optionsbar_"+a]?document.forms["optionsbar_"+a].options:[]}function x(b,a){if(b){var e=b.length;if(void 0==e)b.checked=b.value==a.toString();else for(var d=0;d'+b+"")}function o(b){f.getById("dic_message_"+a).setHtml(''+b+"")} -function p(b){for(var b=(""+b).split(","),a=0,e=b.length;a
\t
\t
\t\t\t\t\t
\t
\t\t\t\t\t
\t
\t\t\t\t
\t
\t\t\t\t\t
'}]},{id:"langs",label:g.languagesTab,elements:[{type:"html",id:"langs",html:'
\t
\t
'}]},{id:"dictionaries",label:g.dictionariesTab,elements:[{type:"html",style:"",id:"dictionaries",html:'
\t
\t
Dictionary name
\t\t\t\t\t
\t\t\t\t\t\t
\t\t
\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\t
'}]},{id:"about",label:g.aboutTab,elements:[{type:"html",id:"about",style:"margin: 5px 5px;",html:'
'}]}],B={title:g.title,minWidth:360,minHeight:220,onShow:function(){var b=this;b.data=j.fire("scaytDialog",{});b.options=b.data.scayt_control.option();b.chosed_lang=b.sLang=b.data.scayt_control.sLang;if(!b.data||!b.data.scayt||!b.data.scayt_control)alert("Error loading application service"), -b.hide();else{var a=0;s?b.data.scayt.getCaption(j.langCode||"en",function(e){0'+ -h["button_"+d[c]]+"");f.getById("dic_info_"+a).setHtml(h.dic_info)}if(1==l[0])for(c in v)d="label_"+v[c],g=f.getById(d+"_"+a),"undefined"!=typeof g&&("undefined"!=typeof h[d]&&"undefined"!=typeof k.options[v[c]])&&(g.setHtml(h[d]),g.getParent().$.style.display="block");d='

'+h.version+window.scayt.getAboutInfo().version.toString()+"

"+h.about_throwt_copy+"

";f.getById("scayt_about_"+a).setHtml(d);d=function(a,b){var c=f.createElement("label"); -c.setAttribute("for","cke_option"+a);c.setHtml(b[a]);k.sLang==a&&(k.chosed_lang=a);var d=f.createElement("div"),e=CKEDITOR.dom.element.createFromHtml('');e.on("click",function(){this.$.checked=true;k.chosed_lang=a});d.append(e);d.append(c);return{lang:b[a],code:a,radio:d}};if(1==l[1]){for(c in e.rtl)i[i.length]=d(c,e.ltr);for(c in e.ltr)i[i.length]=d(c,e.ltr);i.sort(function(a,b){return b.lang> -a.lang?-1:1});e=f.getById("scayt_lcol_"+a);d=f.getById("scayt_rcol_"+a);for(c=0;c

'+g.getLocal("version")+g.getVersion()+"

"+g.getLocal("text_copyrights")+"

",l=CKEDITOR.document,i={isChanged:function(){return null===this.newLang||this.currentLang===this.newLang?!1:!0},currentLang:g.getLang(),newLang:null,reset:function(){this.currentLang=g.getLang();this.newLang=null},id:"lang"},k=[{id:"options",label:g.getLocal("tab_options"),onShow:function(){},elements:[{type:"vbox", +id:"scaytOptions",children:function(){var a=g.getApplicationConfig(),e=[],c={"ignore-all-caps-words":"label_allCaps","ignore-domain-names":"label_ignoreDomainNames","ignore-words-with-mixed-cases":"label_mixedCase","ignore-words-with-numbers":"label_mixedWithDigits"},d;for(d in a){var b={type:"checkbox"};b.id=d;b.label=g.getLocal(c[d]);e.push(b)}return e}(),onShow:function(){this.getChild();for(var a=f.scayt,e=0;e
',onShow:function(){var a=f.scayt.getLang();l.getById("scaytLang_"+a).$.checked=!0}}]}]},{id:"dictionaries",label:g.getLocal("tab_dictionaries"), +elements:[{type:"vbox",id:"rightCol_col__left",children:[{type:"html",id:"dictionaryNote",html:""},{type:"text",id:"dictionaryName",label:g.getLocal("label_fieldNameDic")||"Dictionary name",onShow:function(a){var e=a.sender,c=f.scayt;setTimeout(function(){e.getContentElement("dictionaries","dictionaryNote").getElement().setText("");null!=c.getUserDictionaryName()&&""!=c.getUserDictionaryName()&&e.getContentElement("dictionaries","dictionaryName").setValue(c.getUserDictionaryName())},0)}},{type:"hbox", +id:"notExistDic",align:"left",style:"width:auto;",widths:["50%","50%"],children:[{type:"button",id:"createDic",label:g.getLocal("btn_createDic"),title:g.getLocal("btn_createDic"),onClick:function(){var a=this.getDialog(),e=j,c=f.scayt,d=a.getContentElement("dictionaries","dictionaryName").getValue();c.createUserDictionary(d,function(b){b.error||e.toggleDictionaryButtons.call(a,!0);b.dialog=a;b.command="create";b.name=d;f.fire("scaytUserDictionaryAction",b)},function(b){b.dialog=a;b.command="create"; +b.name=d;f.fire("scaytUserDictionaryActionError",b)})}},{type:"button",id:"restoreDic",label:g.getLocal("btn_restoreDic"),title:g.getLocal("btn_restoreDic"),onClick:function(){var a=this.getDialog(),e=f.scayt,c=j,d=a.getContentElement("dictionaries","dictionaryName").getValue();e.restoreUserDictionary(d,function(b){b.dialog=a;b.error||c.toggleDictionaryButtons.call(a,!0);b.command="restore";b.name=d;f.fire("scaytUserDictionaryAction",b)},function(b){b.dialog=a;b.command="restore";b.name=d;f.fire("scaytUserDictionaryActionError", +b)})}}]},{type:"hbox",id:"existDic",align:"left",style:"width:auto;",widths:["50%","50%"],children:[{type:"button",id:"removeDic",label:g.getLocal("btn_deleteDic"),title:g.getLocal("btn_deleteDic"),onClick:function(){var a=this.getDialog(),e=f.scayt,c=j,d=a.getContentElement("dictionaries","dictionaryName"),b=d.getValue();e.removeUserDictionary(b,function(e){d.setValue("");e.error||c.toggleDictionaryButtons.call(a,!1);e.dialog=a;e.command="remove";e.name=b;f.fire("scaytUserDictionaryAction",e)},function(c){c.dialog= +a;c.command="remove";c.name=b;f.fire("scaytUserDictionaryActionError",c)})}},{type:"button",id:"renameDic",label:g.getLocal("btn_renameDic"),title:g.getLocal("btn_renameDic"),onClick:function(){var a=this.getDialog(),e=f.scayt,c=a.getContentElement("dictionaries","dictionaryName").getValue();e.renameUserDictionary(c,function(d){d.dialog=a;d.command="rename";d.name=c;f.fire("scaytUserDictionaryAction",d)},function(d){d.dialog=a;d.command="rename";d.name=c;f.fire("scaytUserDictionaryActionError",d)})}}]}, +{type:"html",id:"dicInfo",html:'
'+g.getLocal("text_descriptionDic")+"
"}]}]},{id:"about",label:g.getLocal("tab_about"),elements:[{type:"html",id:"about",style:"margin: 5px 5px;",html:'
'+k+"
"}]}];f.on("scaytUserDictionaryAction",function(a){var e=SCAYT.prototype.UILib,c=a.data.dialog,d=c.getContentElement("dictionaries","dictionaryNote").getElement(),b=a.editor.scayt,f;void 0=== +a.data.error?(f=b.getLocal("message_success_"+a.data.command+"Dic"),f=f.replace("%s",a.data.name),d.setText(f),e.css(d.$,{color:"blue"})):(""===a.data.name?d.setText(b.getLocal("message_info_emptyDic")):(f=b.getLocal("message_error_"+a.data.command+"Dic"),f=f.replace("%s",a.data.name),d.setText(f)),e.css(d.$,{color:"red"}),null!=b.getUserDictionaryName()&&""!=b.getUserDictionaryName()?c.getContentElement("dictionaries","dictionaryName").setValue(b.getUserDictionaryName()):c.getContentElement("dictionaries", +"dictionaryName").setValue(""))});f.on("scaytUserDictionaryActionError",function(a){var e=SCAYT.prototype.UILib,c=a.data.dialog,d=c.getContentElement("dictionaries","dictionaryNote").getElement(),b=a.editor.scayt,f;""===a.data.name?d.setText(b.getLocal("message_info_emptyDic")):(f=b.getLocal("message_error_"+a.data.command+"Dic"),f=f.replace("%s",a.data.name),d.setText(f));e.css(d.$,{color:"red"});null!=b.getUserDictionaryName()&&""!=b.getUserDictionaryName()?c.getContentElement("dictionaries","dictionaryName").setValue(b.getUserDictionaryName()): +c.getContentElement("dictionaries","dictionaryName").setValue("")});var j={title:g.getLocal("text_title"),resizable:CKEDITOR.DIALOG_RESIZE_BOTH,minWidth:340,minHeight:260,onLoad:function(){if(0!=f.config.scayt_uiTabs[1]){var a=j,e=a.getLangBoxes.call(this);e.getParent().setStyle("white-space","normal");a.renderLangList(e);this.definition.minWidth=this.getSize().width;this.resize(this.definition.minWidth,this.definition.minHeight)}},onCancel:function(){i.reset()},onHide:function(){f.unlockSelection()}, +onShow:function(){f.fire("scaytDialogShown",this);if(0!=f.config.scayt_uiTabs[2]){var a=f.scayt,e=this.getContentElement("dictionaries","dictionaryName"),c=this.getContentElement("dictionaries","existDic").getElement().getParent(),d=this.getContentElement("dictionaries","notExistDic").getElement().getParent();c.hide();d.hide();null!=a.getUserDictionaryName()&&""!=a.getUserDictionaryName()?(this.getContentElement("dictionaries","dictionaryName").setValue(a.getUserDictionaryName()),c.show()):(e.setValue(""), +d.show())}},onOk:function(){var a=j,e=f.scayt;this.getContentElement("options","scaytOptions");a=a.getChangedOption.call(this);e.commitOption({changedOptions:a})},toggleDictionaryButtons:function(a){var e=this.getContentElement("dictionaries","existDic").getElement().getParent(),c=this.getContentElement("dictionaries","notExistDic").getElement().getParent();a?(e.show(),c.hide()):(e.hide(),c.show())},getChangedOption:function(){var a={};if(1==f.config.scayt_uiTabs[0])for(var e=this.getContentElement("options", +"scaytOptions").getChild(),c=0;c'),g=new CKEDITOR.dom.element("label"),h=f.scayt;c.setStyles({"white-space":"normal",position:"relative", +"padding-bottom":"2px"});b.on("click",function(a){i.newLang=a.sender.getValue()});g.appendText(a);g.setAttribute("for",d);c.append(b);c.append(g);e===h.getLang()&&(b.setAttribute("checked",!0),b.setAttribute("defaultChecked","defaultChecked"));return c},renderLangList:function(a){var e=a.find("#left-col-"+f.name).getItem(0),a=a.find("#right-col-"+f.name).getItem(0),c=g.getLangList(),d={},b=[],i=0,h;for(h in c.ltr)d[h]=c.ltr[h];for(h in c.rtl)d[h]=c.rtl[h];for(h in d)b.push([h,d[h]]);b.sort(function(a, +c){var b=0;a[1]>c[1]?b=1:a[1]