(function(){CKEDITOR.dialog.add('attachment',function(editor){var selectableTargets=/^(_(?:self|top|parent|blank))$/;var parseLink=function(editor,element){var href=element?(element.getAttribute('_cke_saved_href')||element.getAttribute('href')):'',emailMatch,anchorMatch,urlMatch,retval={};retval.type='url';retval.url=href;if(element){var target=element.getAttribute('target');retval.target={};if(target){var targetMatch=target.match(selectableTargets);if(targetMatch)retval.target.type=retval.target.name=target;else{retval.target.type='frame';retval.target.name=target}}var me=this;retval.title=element.getAttribute('title')}var elements=editor.document.getElementsByTag('img'),realAnchors=new CKEDITOR.dom.nodeList(editor.document.$.anchors),anchors=retval.anchors=[];for(var i=0;i',editor.document);selection=editor.getSelection();element.moveChildren(newElement);element.copyAttributes(newElement,{name:1});newElement.replace(element);element=newElement;selection.selectElement(element)}element.setAttributes(attributes);element.removeAttributes(removeAttributes);if(element.getAttribute('title'))element.setHtml(element.getAttribute('title'));if(element.getAttribute('name'))element.addClass('cke_anchor');else element.removeClass('cke_anchor');if(this.fakeObj)editor.createFakeElement(element,'cke_anchor','anchor').replace(this.fakeObj);delete this._.selectedElement}},contents:[{label:editor.lang.common.generalTab,id:'general',accessKey:'I',elements:[{type:'vbox',padding:0,children:[{type:'html',html:''+CKEDITOR.tools.htmlEncode(editor.lang.attachment.url)+''},{type:'hbox',widths:['280px','110px'],align:'right',children:[{id:'src',type:'text',label:'',validate:CKEDITOR.dialog.validate.notEmpty(editor.lang.flash.validateSrc),setup:function(data){if(data.url)this.setValue(data.url);this.select()},commit:function(data){data.url=this.getValue()}},{type:'button',id:'browse',filebrowser:'general:src',hidden:true,align:'center',label:editor.lang.common.browseServer}]}]},{type:'vbox',padding:0,children:[{id:'name',type:'text',label:editor.lang.attachment.name,setup:function(data){if(data.title)this.setValue(data.title)},commit:function(data){data.title=this.getValue()}}]},{type:'hbox',widths:['50%','50%'],children:[{type:'select',id:'linkTargetType',label:editor.lang.link.target,'default':'notSet',style:'width : 100%;','items':[[editor.lang.link.targetNotSet,'notSet'],[editor.lang.link.targetFrame,'frame'],[editor.lang.link.targetNew,'_blank'],[editor.lang.link.targetTop,'_top'],[editor.lang.link.targetSelf,'_self'],[editor.lang.link.targetParent,'_parent']],onChange:targetChanged,setup:function(data){if(data.target)this.setValue(data.target.type)},commit:function(data){if(!data.target)data.target={};data.target.type=this.getValue()}},{type:'text',id:'linkTargetName',label:editor.lang.link.targetFrameName,'default':'',setup:function(data){if(data.target)this.setValue(data.target.name)},commit:function(data){if(!data.target)data.target={};data.target.name=this.getValue()}}]}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:editor.lang.common.upload,elements:[{type:'file',id:'upload',label:editor.lang.common.upload,size:38},{type:'fileButton',id:'uploadButton',label:editor.lang.common.uploadSubmit,filebrowser:'general:src','for':['Upload','upload']}]},]}})})();