//>>built
require({cache:{"url:mill/jssupport/form/_formContent.html":'\x3cdiv\x3e\x3cdiv class\x3d"officeFormContentHeader"\x3e\x3cdiv data-dojo-type\x3d"office.TranslatableNode" data-dojo-attach-point\x3d"formTitleNode" class\x3d"bold white"\x3e\x3c/div\x3e\x3c/div\x3e\x3cdiv class\x3d"officeFormContentFormWrapper"\x3e\x3cdiv data-dojo-attach-point\x3d"messageNode"\x3e\x3c/div\x3e\x3cform data-dojo-attach-event\x3d"onSubmit: submitForm" data-dojo-attach-point\x3d"formNode" class\x3d"officeFormContentForm" method\x3d"GET" action\x3d"javascript:"\x3e\x3cdiv data-dojo-attach-point\x3d"containerNode"\x3e\x3c/div\x3e\x3cdiv data-dojo-type\x3d"office.form.ButtonField" data-testid\x3d"form-submit" data-dojo-props\x3d"type: \'${submitButtonType}\'" data-dojo-attach-point\x3d"submitButton"\x3e\x3cdiv data-dojo-type\x3d"office.form.ButtonWidget" data-dojo-props\x3d"labelIdentifier: \'Office.Cancel\'" data-dojo-attach-point\x3d"button2" data-dojo-attach-event\x3d"onClick: hideForValue" style\x3d"display: none"\x3e\x3c/div\x3e\x3c/div\x3e\x3c/form\x3e\x3cdiv class\x3d"officeFormContentLoading"\x3e\x3cdiv data-dojo-attach-point\x3d"loadingNode" class\x3d"loading"\x3e\x3cspan\x3e.\x3c/span\x3e\x3cspan\x3e.\x3c/span\x3e\x3cspan\x3e.\x3c/span\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e\x3c/div\x3e'}});
define("mill/jssupport/form/_FormContent","dojo/_base/declare dojo/_base/lang dojo/_base/array dojo/_base/fx dojo/topic dojo/dom-style dojo/dom-class dojo/dom-construct dojo/window dojo/when dojo/Deferred dojo/DeferredList dojo/request dijit/_Widget dijit/_Container dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojox/form/manager/_Mixin dojox/form/manager/_NodeMixin dojox/form/manager/_FormMixin dojox/form/manager/_ValueMixin dojox/form/manager/_EnableMixin dojox/form/manager/_DisplayMixin dojox/form/manager/_ClassMixin dojo/text!mill/jssupport/form/_formContent.html dojo/i18n!mill/nls/resources mill/jssupport/form/_FormContentUtils mill/jssupport/form/_FormContentSup mill/jssupport/Announcement mill/jssupport/_TranslationMixin mill/jssupport/TranslatableNode mill/jssupport/base mill/jssupport/session mill/mill".split(" "),
function(v,d,t,V,r,n,w,F,x,u,q,y,z,A,G,B,C,H,I,J,K,L,M,N,O,D,P,Q,R,S,T,p,E,k){var U=v("FormContainer",[A,B,C],{});return mill.registerAlias("office.form._FormContent",v("mill.jssupport.form._FormContent",[A,B,C,G,H,I,J,K,L,M,N,P,Q,S],{baseClass:"officeFormContent",templateString:O,style:{position:"relative"},submitButtonType:"button",submitApplicationLabel:"Office.SubmitApplication",submittingApplicationLabel:"Office.SubmittingApplication",retrySubmitApplicationLabel:"Office.RetrySubmitApplication",
executeMethodName:"Create",dataChangingMode:!0,_dataChangingMode:null,executeClassName:null,submitButtonLabel:null,content:null,statusClassName:null,timePointIdent:null,formTitle:null,scrollSpyTitle:null,hideSubmitTextColumn:null,canChangeData:null,_announcementWidget:null,_layoutScrollSpyItem:null,_idx:null,_preventClearWidgetChildren:!1,_preventInspectFormWidgets:!1,postRequestAwaitHandler:null,onSelect:null,messageNode:null,postMixInProperties:function(){this.inherited(arguments);this.submitButtonLabel=
this.submitApplicationLabel},_setSubmitButtonLabelAttr:function(a){this.submitButton.set("label",this.submitButtonLabel=a)},_setContentAttr:function(a){(new U({templateString:this.content=a,attachScope:this})).placeAt(this.containerNode)},_setFormTitleAttr:function(a){this.formTitleNode.set("text",this.formTitle=a)},_setHideSubmitTextColumnAttr:function(a){this.submitButton.set("hideTextColumn",this.hideSubmitTextColumn=a)},_setCanChangeDataAttr:function(a){(this.canChangeData=a)?(this.set("submitButtonLabel",
"Office.ChangeData"),n.set(this.button2.domNode,{display:"none"})):(this.set("submitButtonLabel",this.submitApplicationLabel),n.set(this.button2.domNode,{display:"inline-block"}))},_setDataChangingModeAttr:function(a){(this._dataChangingMode=this.dataChangingMode=a)?w.remove(this.domNode,"hideForValue"):this.dataChangingMode||w.add(this.domNode,"hideForValue")},startup:function(){this.inherited(arguments);"button"===this.submitButtonType&&this.submitButton.controlNode.set("onClick",d.hitch(this,this.submitForm));
r.subscribe("office.form._FormContent/checkTimePoint",d.hitch(this,function(){this.timePointIdent&&p.regDepartment[this.statusClassName]&&z(k.getRequestUrl(p.mainHandler,"execute.xml"),{headers:{"Disable-Basic-Auth":"yes"},method:"POST",handleAs:"xml",sync:!1,preventCache:!0,data:k.buildQueryParams({className:"TTimeLine",methodName:"WhenReg",params:{TimeLineName:p.timeLineName,TimePointIdents:this.timePointIdent,RegDepartment:p.regDepartment[this.statusClassName]}})}).then(d.hitch(this,function(a){k.parseErrorMessage(a)&&
(this.createErrorMessage(k.parseErrorMessage(a)),this.submitButton.set("disabled",!0));"1"===k.fieldValue(a.childNodes[0].childNodes[0],"Result")&&(this.hideForValue(),this.submitButton.set("disabled",!0))}),d.hitch(this,function(a){this.createErrorMessage(a.message);this.submitButton.set("disabled",!0)}))}));this.own(r.subscribe("office.form._FormContent/preventModerationRequest",d.hitch(this,function(){this.preventModerationRequest&&(this._dataChangingMode&&this.hideForValue(),this.hideActions({preventModerationRequest:!1,
notPrimary:!0,hideForNode:!0,hideForNodeText:"* ;Office.PreventModerationRequestInfo"}))})))},_disabledState:null,_disabledStateBoolean:!1,toggleDisabledState:function(){var a=null;if(this._disabledState){a={};for(var b in this._disabledState)this._disabledState.hasOwnProperty(b)&&this.formWidgets[b]&&this.formWidgets[b].widget&&this.formWidgets[b].widget.focusNode&&(a[b]=this._disabledState[b])}this._disabledState=this.disable(a);this._disabledStateBoolean=!this._disabledStateBoolean},_isAttachment:function(a){return a.isInstanceOf(office.form.Attachment)||
a.isInstanceOf(mill.uploader)},resetAttachment:function(){this.inspectFormWidgets(function(a,b){!window.xwz&&this._isAttachment(b)&&b.reset()},null,null)},resetForm:function(){this.inspectFormWidgets(function(a,b,c){!window.xwz&&this._isAttachment(b)||this.formWidgetValue(a,c)},null,null);this.resetAttachment()},postForm:function(){this._announcementWidget=null},submitForm:function(){if(this._dataChangingMode){if(!this.validate())return!1;var a={state:0,formContent:this,isValid:!0,result:[]};r.publish("office.form.MultipleAttachment/byState",
a);0<a.result.length?x.scrollIntoView(a.result[0].domNode):(this.submitButton.set("disabled",!0),this.set("submitButtonLabel",this.submittingApplicationLabel),n.set(this.button2.domNode,{display:"none"}),this.toggleDisabledState(),this._announcementWidget?this._announcementWidget.hide().then(d.hitch(this,this.postForm)):this.postForm())}else this.unhideForValue()},postRequest:function(a){var b=new q;if(!window.FormData)return this.createErrorMessage(D.oldBrowser),b.reject(Error(D.oldBrowser)),b.promise;
z(a.url,{headers:{"Disable-Basic-Auth":"yes"},method:"POST",handleAs:"xml",sync:!1,preventCache:!0,data:a.data}).then(function(c){var e=function(){this.submitButton.set("disabled",!1);this.set("submitButtonLabel",this.submitApplicationLabel);this.toggleDisabledState()}.bind(this);if(k.parseErrorMessage(c))e.bind(this)(),this.set("submitButtonLabel",this.retrySubmitApplicationLabel),this.createErrorMessage(k.parseErrorMessage(c)),this.resetAttachment(),b.reject(c);else{var f=this.postRequestAwaitHandler;
d.isFunction(f)&&(f=f.call(this,c));u(f,function(){e.bind(this)();b.resolve(c)},function(h){e.bind(this)();this.set("submitButtonLabel",this.retrySubmitApplicationLabel);this.createErrorMessage(k.parseErrorMessage(h));this.resetAttachment();b.reject(h)}.bind(this))}}.bind(this),d.hitch(this,function(c){this.submitButton.set("disabled",!1);this.set("submitButtonLabel",this.retrySubmitApplicationLabel);this.toggleDisabledState();c.response.status!==a.skipErrorStatus&&this.createErrorMessage(c.message+
(403===c.response.status?";Office.Error403":0===c.response.status?";Office.Error0":""));this.resetAttachment();b.reject(c)}));return b.promise},queryArgs:function(){return{}},processWebAnalytics:function(){if("TForeignAbitStatusRequest"===this.executeClassName&&"Finalize"===this.executeMethodName&&window.ym&&window.webAnalyticsConfig.WebAnalyticsYandexID)if("acForeignAbiturient"===p.accessCategory)try{ym(window.webAnalyticsConfig.WebAnalyticsYandexID,"reachGoal","ADM_APPLY_BA")}catch(a){}else if("acForeignMagAbiturient"===
p.accessCategory)try{ym(window.webAnalyticsConfig.WebAnalyticsYandexID,"reachGoal","ADM_APPLY_MA")}catch(a){}},createTModerationRequest:function(){var a=new q;if(this.executeClassName&&this.executeMethodName){var b={className:this.executeClassName,methodName:this.executeMethodName,params:[]},c={};this._preventInspectFormWidgets||this.inspectFormWidgets(function(f,h){if(!this._isAttachment(h)){var g=this.formWidgetValue(f);"boolean"===typeof g&&(g=!0===g?"1":"0");c[f]=g}},null,null);d.mixin(c,{IPAddress:(E||
mill.session).ipAddress,RemoteUser:(E||mill.session).getRemoteUserID(),ReferText:mill.getReferText()});var e=this.queryArgs();d.isArray(e)?d.isArray(e)&&t.forEach(e,function(f,h){var g=d.mixin({},c);d.mixin(g,e[h]);b.params.push(d.mixin({},g))}):(d.mixin(c,e),b.params.push(d.mixin({},c)));this.inspectFormWidgets(function(f,h){if(office.form.FileUploader&&h.isInstanceOf(office.form.FileUploader))for(var g=t.filter(h.getChildren(),function(m){return m.validateFile()}),l=0;l<g.length;)b.params[l]||b.params.push(d.mixin({},
c)),d.mixin(b.params[l],g[l].queryArgs()),l++},null,null);b=k.buildQueryParams(b,!1);this.processWebAnalytics();this.postRequest({url:k.getRequestUrl(p.mainHandler,"execute.xml"),data:b}).then(d.hitch(this,function(f){var h=k.fieldValue(f.childNodes[0].childNodes[0],"Result"),g={};this.inspectFormWidgets(function(l,m){g[l]=this._isAttachment(m)?{hasData:0<m._uploadState,className:this.executeClassName,propName:l,ID:k.fieldValue(f.childNodes[0].childNodes[0],"Result"),fileName:0<m._uploadState&&m._uploadedFile?
m._uploadedFile.name:null,extension:0<m._uploadState&&m._uploadedFile?"."+m._uploadedFile.name.split(".").pop():null}:this.formWidgetValue(l)},null,null);a.resolve({ID:h,values:g})}),d.hitch(this,function(f){n.set(this.button2.domNode,{display:"inline-block"});a.reject(f)}));return a.promise}a.reject()},executeModerationRequest:function(){this.createTModerationRequest().then(d.hitch(this,function(a){this.callbackFunction?this.callbackFunction(a.values,a):(this.hideForValue(a.values),this.hideActions({hideForNode:!0}))}),
console.error)},_hideNode:null,hideActions:function(a){if(!a||!a.notPrimary||"none"!==n.get(this.submitButton.domNode).display)if(n.set(this.submitButton.domNode,{display:"none"}),(a?"boolean"===typeof a.preventModerationRequest?a.preventModerationRequest:this.preventModerationRequest:this.preventModerationRequest)&&r.publish("office.form._FormContent/preventModerationRequest"),a&&a.hideForNode){var b=this.submitButton.domNode.parentNode;this._hideNode||(this._hideNode=new T({text:a.hideForNodeText||
"* ;Office.RequestOnModeration",className:"small dim text-align-justify margin-1em-0"},b.appendChild(document.createElement("div"))))}else a&&a.clearNode&&this._hideNode&&(this._hideNode.destroyRecursive(),this._hideNode=null)},_createMessage:function(a){this._announcementWidget=new R(a,F.create("div",{},this.messageNode));x.scrollIntoView(this._announcementWidget.domNode);return this._announcementWidget},createSuccessMessage:function(a,b,c,e,f){this._createMessage({text:a,onHide:b||null,icon:c||
"smile",color:e||"blue",readOnly:5===arguments.length?f:!0})},createErrorMessage:function(a,b,c){return this._createMessage({text:a,icon:b||"confused",color:"red",textAlign:"text-align-left",readOnly:3===arguments.length?c:!0})},_hideForValueHandler:null,__hideForValue:new Function,hideForValue:function(a,b){this._preventClearWidgetChildren=!0;var c=new q;a=a||{};this.inspectFormWidgets(d.hitch(this,function(e,f,h){if(!a&&!this._isAttachment(f)||a)try{if(f.hideForValue){this._hideForValueHandler||
(this._hideForValueHandler=[]);var g=this._hideForValueHandler.slice(),l=new q;this._hideForValueHandler.push(l);(new y(g)).then(d.hitch(this,function(){u(f.hideForValue(a[e]),l.resolve)}))}}catch(m){}}),null,null);b&&!0!==b.hideMultiples||this.hideMultipleAttachments();this.set("dataChangingMode",!1);this.set("canChangeData",!0);(new y(this._hideForValueHandler||[])).then(d.hitch(this,function(){u(this.__hideForValue(a,b),d.hitch(this,function(){this._preventClearWidgetChildren=!1;c.resolve()}))}));
return c.promise},unhideForValue:function(){this.set("dataChangingMode",!0);this.inspectFormWidgets(function(a,b,c){b.unhideForValue&&b.unhideForValue()},null,null);this.unhideMultipleAttachments();this.set("canChangeData",!1)},translate:function(){this.inherited(arguments);!this._dataChangingMode&&this.hideForValue(null,{hideMultiples:!1})},_formViewState:1,toggleFormView:function(a,b){this._formViewState=a||-1*this._formViewState;n.set(this[b||"formNode"],{display:0>this._formViewState?"none":"block"})},
getFormWidget:function(a,b){var c=this.formWidgets[a]?this.formWidgets[a].widget:null;c&&d.isFunction(b)&&b.call(this,c);return c},setWidgetAttr:function(a,b,c){var e=null;d.isArray(a)?t.forEach(a,d.hitch(this,function(f){(e=this.getFormWidget(f))&&e.set(b,c)})):(e=this.getFormWidget(a))&&e.set(b,c)},getWidgetAttr:function(a,b){var c=this.getFormWidget(a);return c?c.get(b):""},getStoreFieldValue:function(a,b){var c=this.getFormWidget(a);if(!c)return"";var e=c.item;return e?c.store.getValue(e,b):""},
setStoreFieldValue:function(a,b,c){var e=this.getFormWidget(a);if(e){var f=new q;a={};a[b]=c;e.store.query(a).then(d.hitch(this,function(h){e.set("item",h[0]);f.resolve()}));return f.promise}}}))});