//>>built
define("mill/dataBrowser/parametersView","dojo/DeferredList dijit/TitlePane dijit/form/ValidationTextBox dijit/form/CheckBox dijit/form/SimpleTextarea dijit/form/Textarea dijit/form/DateTextBox mill/mill mill/dataBrowser/blobAttachment".split(" "),function(){mill.dataBrowser||(mill.dataBrowser={});dojo.declare("mill.dataBrowser.parametersView",[],{grid:null,item:null,identity:null,rttiManager:null,routine:null,routineInfo:null,parameters:null,dialog:null,fileExtension:null,buttonsPaneContent:dojo.cache("mill",
"dataBrowser/buttonsPane.html",'\x3cdiv align\x3d"right"\x3e\x3cspan dojoType\x3d"dijit.form.Button" onClick\x3d"dijit.byNode(this.domNode.parentNode.parentNode.parentNode.parentNode.parentNode)._perform()"\x3e\x3cb\x3eOK\x3c/b\x3e\x3c/span\x3e\x3cspan dojoType\x3d"dijit.form.Button" onClick\x3d"dijit.byNode(this.domNode.parentNode.parentNode.parentNode.parentNode.parentNode).hide()"\x3e \u041e\u0442\u043c\u0435\u043d\u0430 \x3c/span\x3e\x3c/div\x3e'),constructor:function(a){a&&dojo.mixin(this,a);
this.routineInfo=this.rttiManager.getRoutine(this.routine);this.parameters=dojo.clone(this.rttiManager.listParameters(this.routine));dojo.forEach(this.parameters,dojo.hitch(this,function(f){f.domain=this.rttiManager.getDomain(f.Domain);"TBlobDomain"!=f.domain.handle||f.domain.blobSubtype||(f.domain.blobSubtype=this.rttiManager.get("TEnumerationItem",f.domain.BlobSubtype,null))}));!this.identity&&this.item&&(a=dojo.isArray(this.item)?this.item[0]:this.item)&&(this.identity=a.store.getIdentity(a))},
show:function(){var a=this.rttiManager,f="1"==this.routineInfo.UseTabs?new dijit.layout.TabContainer({region:"center"}):new dijit.layout.BorderContainer({design:"sidebar",region:"center"}),k=[],g=function(b,c){var l=null;dojo.forEach(k,function(q){q.caption==b&&(l=q)});l||(l={caption:b,groups:[]},k.push(l));var r=null;dojo.forEach(l.groups,function(q){q.caption==c&&(r=q)});r||(r={caption:c,parameters:[]},l.groups.push(r));return r};dojo.forEach(this.parameters,function(b){g(b.Tab,b.Group).parameters.push(b)});
var h=!1;dojo.forEach(k,function(b,c){var l=!1,r=new dijit.layout.ContentPane({splitter:!0,style:"overflow: auto",title:b.caption});dojo.forEach(b.groups,function(q){var z=!1,u=new dijit.TitlePane({toggleable:!1,title:q.caption,style:"margin-bottom:8px;"},r.containerNode.appendChild(document.createElement("div")));q.caption||(dojo.style(u.titleBarNode,{display:"none"}),dojo.style(u.hideNode,{borderTop:"1px solid #B5BCC7"}));dojo.style(u.containerNode,{padding:"2px"});var y=document.createElement("table");
y.width="100%";dojo.forEach(q.parameters,function(d){var m=y.insertRow(-1);if("TBooleanDomain"==d.domain.handle){var e=m.insertCell(-1);e.appendChild(document.createTextNode(d.Description+":"));e=m.insertCell(-1);d.control=new dijit.form.CheckBox({onChange:function(v){this.domNode.parentNode.removeChild(this.domNode.nextSibling);this.domNode.parentNode.appendChild(document.createTextNode(v?d.domain.TrueValue:d.domain.FalseValue))}},e.appendChild(document.createElement("span")));e.appendChild(document.createTextNode(d.domain.FalseValue))}else"TEnumerationDomain"==
d.domain.handle?(e=m.insertCell(-1),e.appendChild(document.createTextNode(d.Description+":")),e=m.insertCell(-1),d.control=new dijit.form.ValidationTextBox({style:"width:100%",onChange:function(v){(v=a.get("TEnumerationItem",v))&&this.attr("value","1"==d.domain.ShowNames?v.Name:v.Description)}},e.appendChild(document.createElement("span")))):"TStringDomain"==d.domain.handle&&128<d.domain.Length?(e=m.insertCell(-1),e.colSpan=2,e.appendChild(document.createTextNode(d.Description+":")),e.appendChild(document.createElement("br")),
d.control=new dijit.form.SimpleTextarea({style:"width:100%",rows:5},e.appendChild(document.createElement("span")))):"TDateDomain"==d.domain.handle?(e=m.insertCell(-1),e.appendChild(document.createTextNode(d.Description+":")),e=m.insertCell(-1),d.control=new dijit.form.DateTextBox({style:"width:100%",required:"1"==d.domain.Required},e.appendChild(document.createElement("span")))):"TBlobDomain"==d.domain.handle?"btNamedFile"==d.domain.blobSubtype.Name||"btXHTML"==d.domain.blobSubtype.Name||"btImage"==
d.domain.blobSubtype.Name||"btText"==d.domain.blobSubtype.Name||"btHTML"==d.domain.blobSubtype.Name?(e=m.insertCell(-1),e.appendChild(document.createTextNode(d.Description+":")),e=m.insertCell(-1),d.control=new mill.dataBrowser.parametersViewDownloadableBlob({handle:a.handle,rttiManager:a,domain:d.Domain,style:"width:100%"},e.appendChild(document.createElement("span")))):(e=m.insertCell(-1),e.appendChild(document.createTextNode(d.Description+":")),e=m.insertCell(-1),d.control=new dijit.form.ValidationTextBox({required:"1"==
d.domain.Required,style:"width:100%"},e.appendChild(document.createElement("span")))):(e=m.insertCell(-1),e.appendChild(document.createTextNode(d.Description+":")),e=m.insertCell(-1),d.control=new dijit.form.ValidationTextBox({required:"1"==d.domain.Required,style:"width:100%"},e.appendChild(document.createElement("span"))));"scPrivate"==a.get("TEnumerationItem",d.Scope,null).Name?m.style.display="none":h=l=z=!0});z?u.attr("content",y):u.domNode.parentNode.removeChild(u.domNode)});l&&f.addChild(r)});
if("1"!=this.routineInfo.UseTabs){var t=f.getChildren();dojo.forEach(t,function(b,c){c?b.attr("region","right"):b.attr("region","center");b.domNode.style.width=100/t.length+"%"})}var p=[];dojo.forEach(this.parameters,dojo.hitch(this,function(b){!this._initParameter(b)&&b.InitializationMember&&(b.initializationMember=a.get("TProperty",b.InitializationMember)||a.get("TMethod",b.InitializationMember),b.initializationMember&&("TProperty"==b.initializationMember.handle?("TClassDomain"==b.domain.handle&&
p.push({part:0,name:b.initializationMember.Name+("soName"==a.get("TEnumerationItem",b.domain.ShowObjectInfoType,null).Name?"$N":"$D")}),p.push({part:0,name:b.initializationMember.Name})):mill.executeMethod({handler:a.handle,sync:!1,className:a.get("TClass",b.initializationMember.Master).Name,methodName:b.initializationMember.Name,params:{ID:this.identity},load:function(c){c=mill.decodeDataNode(c.documentElement.childNodes[0].childNodes[0]);"TBooleanDomain"==b.domain.handle?b.control.attr("checked",
"1"==c):"TDateDomain"==b.domain.handle?b.control.attr("value",mill.parseDate(c)):b.control.attr("value",c)}})))}));p.length&&(p.push({part:1,name:"ID",value:this.identity}),mill.queryCursor({handler:a.handle,className:a.get("TClass",this.routineInfo.Master).Name,sync:!0,query:p,fetched:dojo.hitch(this,function(b){dojo.forEach(this.parameters,function(c){c.initializationMember&&"TProperty"==c.initializationMember.handle&&("TClassDomain"==c.domain.handle?(c.control.attr("value",mill.fieldValue(b,c.initializationMember.Name+
("soName"==a.get("TEnumerationItem",c.domain.ShowObjectInfoType,null).Name?"-N":"-D"))),c.initValue=mill.fieldValue(b,c.initializationMember.Name)):"TBooleanDomain"==c.domain.handle?c.control.attr("checked","1"==mill.fieldValue(b,c.initializationMember.Name)):"TDateDomain"==c.domain.handle?c.control.attr("value",mill.parseDate(mill.fieldValue(b,c.initializationMember.Name))):c.control.attr("value",mill.fieldValue(b,c.initializationMember.Name)))})})}));if(h){var n=new dijit.Dialog({title:this.routineInfo.Description}),
w=new dijit.layout.BorderContainer({design:"headline",style:"width:100%;height:100%"}),x=new dijit.layout.ContentPane({region:"bottom",splitter:!1,style:"padding:0;border:0 none",content:this.buttonsPaneContent});w.addChild(f);w.addChild(x);x=dojo.coords(dojo.body());dojo.style(n.containerNode,{width:.9*x.w+"px",height:.95*x.h+"px",padding:0});n.containerNode.appendChild(w.domNode);dojo.mixin(n,{_perform:dojo.hitch(this,function(){this._perform()&&n.hide()})});this.dialog=n;this._dialogCreated();
n.startup();n.show().always(function(){var b=1E6;dojo.forEach(f.getChildren(),function(c){var l=c.containerNode.childNodes;l=dojo.coords(dijit.byNode(l[l.length-1]).hideNode);c=dojo.coords(c.containerNode).h-(l.t+l.h);b>c-18&&(b=c-18)});0<b&&(n.containerNode.style.height=dojo.coords(n.containerNode).h-b+"px",n._size(),n._position(),w.layout())})}else this._perform()},validate:function(){var a=!0;dojo.forEach(this.parameters,dojo.hitch(this,function(f){a&&f.control&&f.control.validate&&((a=f.control.validate())||
dijit.focus(f.control.focusNode))}));return a},_perform:function(a){if(!this.validate()||this.routineInfo.Confirmation&&!confirm(this.routineInfo.Confirmation))return!1;dojo.forEach(dojo.isArray(this.item)&&"1"!=this.routineInfo.IsClassMethod?dojo.map(this.item,dojo.hitch(this,function(f){return f.store.getIdentity(f)})):[this.identity],dojo.hitch(this,function(f){var k={handler:this.rttiManager.handle,sync:!1,className:this.rttiManager.get("TClass",this.routineInfo.Master).Name,params:{},load:dojo.hitch(this,
function(){!a&&this.grid&&(this.grid.parentView?this.grid.parentView.refresh():this.grid.refresh())})};"1"!=this.routineInfo.IsClassMethod&&dojo.mixin(k.params,{ID:f});dojo.forEach(this.parameters,dojo.hitch(this,function(g){if(!g.useLess){var h=null;if("TBooleanDomain"==g.domain.handle)h=g.control.attr("checked")?1:0;else if("TDateDomain"==g.domain.handle)h=mill.formatDate(g.control.attr("value"));else if("TEnumerationDomain"==g.domain.handle){var t=g.control.attr("value");h=(h=dojo.filter(this.rttiManager.byHandle("TEnumerationItem"),
function(p){return(p.Master==g.domain.ID||p.Master==g.domain.BasedOnDomain)&&t==("1"==g.domain.ShowNames?p.Name:p.Description)})[0])?h.ID:null}else h=g.initValue||g.control.attr("value");k.params[g.Name]=h}}));"TMethod"==this.routineInfo.handle?(dojo.mixin(k,{methodName:this.routineInfo.Name}),mill.executeMethod(k)):"TOleObjectMethod"==this.routineInfo.handle?(dojo.mixin(k,{methodName:this.routineInfo.Name}),mill.executeOleMethod(k)):"TExcelTemplate"==this.routineInfo.handle?(dojo.mixin(k,{extension:this.fileExtension,
fileName:this.routineInfo.Description+(this.fileExtension||".xls"),templateName:this.routineInfo.Name}),mill.executeExcelTemplate(k)):"TWordTemplate"==this.routineInfo.handle&&(dojo.mixin(k,{fileName:this.routineInfo.Description+".doc",templateName:this.routineInfo.Name}),mill.executeWordTemplate(k))}));return!0},_dialogCreated:function(){},_initParameter:function(a){return!1}});dojo.declare("mill.dataBrowser.parametersViewDownloadableBlob",[dijit._Widget,dijit._Templated],{templateString:'\x3ca target\x3d"blank"\x3e(\u041d\u0435\u0442)\x3c/a\x3e',
attributeMap:dojo.delegate(dijit._WidgetBase,{propertyName:"",className:"",value:"",hasData:""}),propertyName:null,className:null,value:null,hasData:!1,handle:null,domain:null,rttiManager:null,_render:function(){if(this.hasData){var a=this.rttiManager.getDomain(this.domain);"btXHTML"==a.blobSubtype.Name||"btText"==a.blobSubtype.Name||"btHTML"==a.blobSubtype.Name?(this.domNode.target="",this.domNode.href="javascript:mill.dataBrowser.parametersViewDownloadableBlob.__showXHTMLBlob('"+handle+"','"+this.className+
"','"+this.propertyName+"','"+this.value+"')"):"btImage"==a.blobSubtype.Name?(this.domNode.target="",new mill.dataBrowser.blobAttachment({hrefConstructor:["javascript:mill.dataBrowser.parametersViewDownloadableBlob.__showImageBlob('",[handle,this.className,this.propertyName,this.value,a.Extension||".bmp"],"')"],parametersView:!0},this.domNode)):(this.domNode.target="_blank",this.domNode.href="/"+this.handle+"/getblob?query\x3d"+mill._itemsToQuery({className:this.className,propName:this.propertyName,
domain:this.domain,ID:this.value}));this.domNode.innerHTML="(\u0414\u0430\u043d\u043d\u044b\u0435)"}else this.domNode.href="",this.domNode.innerHTML="(\u041d\u0435\u0442)"},_setPropertyNameAttr:function(a){this.propertyName=a;this._render()},_setClassNameAttr:function(a){this.className=a;this._render()},_setValueAttr:function(a){this.value=a;this._render()},_setHasDataAttr:function(a){this.hasData=a;this._render()}});dojo.mixin(mill.dataBrowser.parametersViewDownloadableBlob,{__showXHTMLBlob:function(a,
f,k,g){(new dijit.Dialog({content:dojo.i18n.substitute(dojo.cache("mill","showReferenceDialog.html",'\x3cdiv design\x3d"headline" dojoType\x3d"dijit.layout.BorderContainer" gutters\x3d"false" style\x3d"padding:10px;overflow:hidden"\x3e\x3cdiv dojoType\x3d"dijit.layout.ContentPane" extractContent\x3d"true" region\x3d"center" style\x3d"margin:0;padding:0;overflow:auto"\x3e\x3c/div\x3e\x3cdiv dojoType\x3d"dijit.layout.ContentPane" region\x3d"bottom" style\x3d"margin:0;padding:0;padding-top:10px"\x3e\x3cbutton dojoType\x3d"dijit.form.Button" onClick\x3d"dijit.byNode(this.domNode.parentNode.parentNode.parentNode.parentNode).hide()"\x3e\x3cb\x3e ${close} \x3c/b\x3e\x3c/button\x3e\x3c/div\x3e\x3c/div\x3e'),
dojo.i18n.getLocalization("mill","resources")),draggable:!1,parseOnLoad:!0,title:"\u0414\u0430\u043d\u043d\u044b\u0435",style:"width:90%;height:90%",onShow:function(){this.containerNode.children[0].style.height=dojo.contentBox(this.domNode).h-dojo.marginBox(this.titleBar).h-20+"px";dojo.query('[region\x3d"center"]',this.domNode).forEach(function(h){h=dijit.byNode(h);onload&&(h.onLoad=dojo.hitch(h,onload));h.attr("href","/"+a+"/getblob?query\x3d"+mill._itemsToQuery({className:f,propName:k,ID:g}))})},
onHide:function(){setTimeout(dojo.hitch(this,this.destroyRecursive),1)}})).show()},__showImageBlob:function(a,f,k,g,h,t){"newTab"==t?mill.downloadBlob({handler:a,className:f,propName:k,ID:g,extension:h}):"download"==t?mill.downloadBlob({handler:a,className:f,propName:k,ID:g,extension:h,fileName:"\u0421\u043a\u0430\u043d_\u0441\u043f\u0440\u0430\u0432\u043a\u0438"+h}):(new dijit.Dialog({content:dojo.i18n.substitute(dojo.cache("mill","showImageDialog.html",'\x3cdiv design\x3d"headline" dojoType\x3d"dijit.layout.BorderContainer" gutters\x3d"false" style\x3d"padding:0px;padding-top:0;overflow:hidden"\x3e\x3cdiv dojoType\x3d"dijit.layout.ContentPane" region\x3d"top" style\x3d"height:30px;padding:0px"\x3e\x3cdiv dojoType\x3d"dijit.Toolbar"\x3e\x3cdiv dojoType\x3d"dijit.form.Button" iconClass\x3d"dijitEditorIcon dijitEditorIconFullScreen" onClick\x3d"mill.inscribeImage(dojo.query(\'img\', this.domNode.parentNode.parentNode.parentNode.parentNode.parentNode)[0])" showLabel\x3d"false"\x3e 100% \x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv dojoType\x3d"dijit.layout.ContentPane" region\x3d"center" style\x3d"padding:10px"\x3e\x3cdiv style\x3d"margin:0;overflow:auto;width:100%;height:100%"\x3e\x3cimg/\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv dojoType\x3d"dijit.layout.ContentPane" region\x3d"bottom" style\x3d"margin:0;padding:10px"\x3e\x3cbutton dojoType\x3d"dijit.form.Button" onClick\x3d"dijit.byNode(this.domNode.parentNode.parentNode.parentNode.parentNode).hide()"\x3e\x3cb\x3e ${close} \x3c/b\x3e\x3c/button\x3e\x3c/div\x3e\x3c/div\x3e'),
dojo.i18n.getLocalization("mill","resources")),draggable:!1,parseOnLoad:!0,title:"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435",style:"width:90%;height:90%",onShow:function(){this.containerNode.children[0].style.height=dojo.contentBox(this.domNode).h-dojo.marginBox(this.titleBar).h-20+"px";dojo.query('[region\x3d"center"]',this.domNode).forEach(function(p){var n=dijit.byNode(p);onload&&(n.onLoad=dojo.hitch(n,onload));dojo.query("*",p)[0].src="/"+a+"/getblob"+h+"?query\x3d"+mill._itemsToQuery({className:f,
propName:k,ID:g})})},onHide:function(){setTimeout(dojo.hitch(this,this.destroyRecursive),1)}})).show()}})});