/* * File: dataTables.editor.min.js * Version: 1.2.3 * Author: SpryMedia (www.sprymedia.co.uk) * Info: http://editor.datatables.net * * Copyright 2012 SpryMedia, all rights reserved. * License: DataTables Editor - http://editor.datatables.net/license */ /* DataTables Editor: http://editor.datatables.net/license */ (function(m,o,n,e,j){var f=function(a){!this instanceof f&&alert("DataTables Editor must be initilaised as a 'new' instance'");this._constructor(a)};j.Editor=f;f.models={};f.models.displayController={init:function(){},open:function(){},close:function(){}};f.models.field={className:"",name:null,dataProp:"",label:"",id:"",type:"text",fieldInfo:"",labelInfo:"","default":"",dataSourceGet:null,dataSourceSet:null,el:null,_fieldMessage:null,_fieldInfo:null,_fieldError:null,_labelInfo:null};f.models.fieldType= {create:function(){},get:function(){},set:function(){},enable:function(){},disable:function(){}};f.models.settings={ajaxUrl:"",ajax:null,domTable:null,dbTable:"",opts:null,displayController:null,fields:[],order:[],id:-1,displayed:!1,processing:!1,editRow:null,removeRows:null,action:null,idSrc:null,events:{onProcessing:[],onPreOpen:[],onOpen:[],onPreClose:[],onClose:[],onPreSubmit:[],onPostSubmit:[],onSubmitComplete:[],onSubmitSuccess:[],onSubmitError:[],onInitCreate:[],onPreCreate:[],onCreate:[], onPostCreate:[],onInitEdit:[],onPreEdit:[],onEdit:[],onPostEdit:[],onInitRemove:[],onPreRemove:[],onRemove:[],onPostRemove:[],onSetData:[],onInitComplete:[]}};f.models.button={label:null,fn:null,className:null};f.display={};var k=jQuery,g;f.display.lightbox=k.extend(!0,{},f.models.displayController,{init:function(){g._init();return g},open:function(a,c,b){if(g._shown)b&&b();else{g._dte=a;k(g._dom.content).children().detach();g._dom.content.appendChild(c);g._dom.content.appendChild(g._dom.close);g._shown= true;g._show(b)}},close:function(a,c){if(g._shown){g._dte=a;g._hide(c);g._shown=false}else c&&c()},_init:function(){if(!g._ready){g._dom.content=k("div.DTED_Lightbox_Content",g._dom.wrapper)[0];o.body.appendChild(g._dom.background);o.body.appendChild(g._dom.wrapper);g._dom.background.style.visbility="hidden";g._dom.background.style.display="block";g._cssBackgroundOpacity=k(g._dom.background).css("opacity");g._dom.background.style.display="none";g._dom.background.style.visbility="visible"}},_show:function(a){a|| (a=function(){});g._dom.content.style.height="auto";var c=g._dom.wrapper.style;c.opacity=0;c.display="block";g._heightCalc();c.display="none";c.opacity=1;k(g._dom.wrapper).fadeIn();g._dom.background.style.opacity=0;g._dom.background.style.display="block";k(g._dom.background).animate({opacity:g._cssBackgroundOpacity},"normal",a);k(g._dom.close).bind("click.DTED_Lightbox",function(){g._dte.close("icon")});k(g._dom.background).bind("click.DTED_Lightbox",function(){g._dte.close("background")});k("div.DTED_Lightbox_Content_Wrapper", g._dom.wrapper).bind("click.DTED_Lightbox",function(a){k(a.target).hasClass("DTED_Lightbox_Content_Wrapper")&&g._dte.close("background")});k(m).bind("resize.DTED_Lightbox",function(){g._heightCalc()})},_heightCalc:function(){g.conf.heightCalc?g.conf.heightCalc(g._dom.wrapper):k(g._dom.content).children().height();var a=k(m).height()-g.conf.windowPadding*2-k("div.DTE_Header",g._dom.wrapper).outerHeight()-k("div.DTE_Footer",g._dom.wrapper).outerHeight();k("div.DTE_Body_Content",g._dom.wrapper).css("maxHeight", a)},_hide:function(a){a||(a=function(){});k([g._dom.wrapper,g._dom.background]).fadeOut("normal",a);k(g._dom.close).unbind("click.DTED_Lightbox");k(g._dom.background).unbind("click.DTED_Lightbox");k("div.DTED_Lightbox_Content_Wrapper",g._dom.wrapper).unbind("click.DTED_Lightbox");k(m).unbind("resize.DTED_Lightbox")},_dte:null,_ready:!1,_shown:!1,_cssBackgroundOpacity:1,_dom:{wrapper:k('
')[0], background:k('
')[0],close:k('
')[0],content:null}});g=f.display.lightbox;g.conf={windowPadding:100,heightCalc:null};var i=jQuery,d;f.display.envelope=i.extend(!0,{},f.models.displayController,{init:function(a){d._dte=a;d._init();return d},open:function(a,c,b){d._dte=a;i(d._dom.content).children().detach();d._dom.content.appendChild(c);d._dom.content.appendChild(d._dom.close);d._show(b)},close:function(a,c){d._dte=a; d._hide(c)},_init:function(){if(!d._ready){d._dom.content=i("div.DTED_Envelope_Container",d._dom.wrapper)[0];o.body.appendChild(d._dom.background);o.body.appendChild(d._dom.wrapper);d._dom.background.style.visbility="hidden";d._dom.background.style.display="block";d._cssBackgroundOpacity=i(d._dom.background).css("opacity");d._dom.background.style.display="none";d._dom.background.style.visbility="visible"}},_show:function(a){a||(a=function(){});d._dom.content.style.height="auto";var c=d._dom.wrapper.style; c.opacity=0;c.display="block";var b=d._findAttachRow(),e=d._heightCalc(),h=b.offsetWidth;c.display="none";c.opacity=1;d._dom.wrapper.style.width=h+"px";d._dom.wrapper.style.marginLeft=-(h/2)+"px";d._dom.wrapper.style.top=i(b).offset().top+b.offsetHeight+"px";d._dom.content.style.top=-1*e-20+"px";d._dom.background.style.opacity=0;d._dom.background.style.display="block";i(d._dom.background).animate({opacity:d._cssBackgroundOpacity},"normal");i(d._dom.wrapper).fadeIn();d.conf.windowScroll?i("html,body").animate({scrollTop:i(b).offset().top+ b.offsetHeight-d.conf.windowPadding},function(){i(d._dom.content).animate({top:0},600,a)}):i(d._dom.content).animate({top:0},600,a);i(d._dom.close).bind("click.DTED_Envelope",function(){d._dte.close("icon")});i(d._dom.background).bind("click.DTED_Envelope",function(){d._dte.close("background")});i("div.DTED_Lightbox_Content_Wrapper",d._dom.wrapper).bind("click.DTED_Envelope",function(a){i(a.target).hasClass("DTED_Envelope_Content_Wrapper")&&d._dte.close("background")});i(m).bind("resize.DTED_Envelope", function(){d._heightCalc()})},_heightCalc:function(){d.conf.heightCalc?d.conf.heightCalc(d._dom.wrapper):i(d._dom.content).children().height();var a=i(m).height()-d.conf.windowPadding*2-i("div.DTE_Header",d._dom.wrapper).outerHeight()-i("div.DTE_Footer",d._dom.wrapper).outerHeight();i("div.DTE_Body_Content",d._dom.wrapper).css("maxHeight",a);return i(d._dte.dom.wrapper).outerHeight()},_hide:function(a){a||(a=function(){});i(d._dom.content).animate({top:-(d._dom.content.offsetHeight+50)},600,function(){i([d._dom.wrapper, d._dom.background]).fadeOut("normal",a)});i(d._dom.close).unbind("click.DTED_Lightbox");i(d._dom.background).unbind("click.DTED_Lightbox");i("div.DTED_Lightbox_Content_Wrapper",d._dom.wrapper).unbind("click.DTED_Lightbox");i(m).unbind("resize.DTED_Lightbox")},_findAttachRow:function(){if(d.conf.attach==="head"||d._dte.s.action==="create")return i(d._dte.s.domTable).dataTable().fnSettings().nTHead;if(d._dte.s.action==="edit")return d._dte.s.editRow;if(d._dte.s.action==="remove")return d._dte.s.removeRows[0]}, _dte:null,_ready:!1,_cssBackgroundOpacity:1,_dom:{wrapper:i('
')[0],background:i('
')[0],close:i('
×
')[0],content:null}});d=f.display.envelope;d.conf={windowPadding:50,heightCalc:null,attach:"row",windowScroll:!0};f.prototype.add=function(a){var c= this,b=this.classes.field;if(e.isArray(a))for(var b=0,d=a.length;b
'+a.fieldInfo+"
")[0],d=f.fieldTypes[a.type].create.call(this, a),null!==d?this._$("input",b).prepend(d):b.style.display="none",this.dom.formContent.appendChild(b),this.dom.formContent.appendChild(this.dom.formClear),a.el=b,a._fieldInfo=this._$("msg-info",b)[0],a._labelInfo=this._$("msg-label",b)[0],a._fieldError=this._$("msg-error",b)[0],a._fieldMessage=this._$("msg-message",b)[0],this.s.fields.push(a),this.s.order.push(a.name)};f.prototype.buttons=function(a){var c=this,b,d,h;if(e.isArray(a)){e(this.dom.buttons).empty();var f=function(a){return function(b){b.preventDefault(); a.fn&&a.fn.call(c)}};b=0;for(d=a.length;b
')[0],form:null,formClear:null,formError:null,formInfo:null,formContent:null,header:null,body:null,bodyContent:null,footer:null,processing:null,buttons:null};this.s.domTable=a.domTable;this.s.dbTable=a.dbTable;this.s.ajaxUrl=a.ajaxUrl;this.s.ajax=a.ajax;this.s.idSrc=a.idSrc;this.i18n=a.i18n;if(m.TableTools){var d=m.TableTools.BUTTONS,h=this.i18n; e.each(["create","edit","remove"],function(a,c){d["editor_"+c].sButtonText=h[c].button;d["editor_"+c].formTitle=h[c].title;d["editor_"+c].formButtons[0].label=h[c].submit});d.editor_remove.question=function(a){return("string"===h.remove.confirm?h.remove.confirm:h.remove.confirm[a]?h.remove.confirm[a]:h.remove.confirm._).replace(/%d/g,a)}}e.each(a.events,function(a,b){c._callbackReg(a,b,"User")});var b=this.dom,g=b.wrapper;b.form=this._$("form",g)[0];b.formClear=this._$("form_clear",g)[0];b.formError= this._$("form_error",g)[0];b.formInfo=this._$("form_info",g)[0];b.formContent=this._$("form_content",g)[0];b.header=this._$("head_content",g)[0];b.body=this._$("body",g)[0];b.bodyContent=this._$("body_content",g)[0];b.footer=this._$("foot",g)[0];b.processing=this._$("processing",g)[0];b.buttons=this._$("form_buttons",g)[0];""!==this.s.dbTable&&e(this.dom.wrapper).addClass("DTE_Table_Name_"+this.s.dbTable);if(a.fields){b=0;for(g=a.fields.length;b").attr(e.extend({id:a.id,type:"text",readonly:"readonly"},a.attr||{}));return a._input[0]}});l.text=e.extend(!0,{},j, {create:function(a){a._input=e("").attr(e.extend({id:a.id,type:"text"},a.attr||{}));return a._input[0]}});l.password=e.extend(!0,{},j,{create:function(a){a._input=e("").attr(e.extend({id:a.id,type:"password"},a.attr||{}));return a._input[0]}});l.textarea=e.extend(!0,{},j,{create:function(a){a._input=e("