var Jsw={version:"1.0",baseUrl:"",ctxIdName:"",ctxId:"",uiContext:$H(),_registeredComponents:{},_firedOnReady:!1,_onReadyEvents:null,priority:{high:"high",normal:"normal",low:"low"},isRtl:function(){return"rtl"===document.documentElement.dir},registerComponent:function(a,b){Jsw._registeredComponents[a]=b},getComponent:function(a){return Jsw._registeredComponents[a]},createComponent:function(a){if(!a.componentType||a instanceof Jsw.Component)return a;var b=Jsw.namespace(a.componentType,!1);if(!b)throw new Error("Unrecognized class name: "+a.componentType);return new b(a)},clearStatusMessages:function(){var a=$("main");a&&[".msg-error",".msg-info",".msg-warning"].each(function(b){a.select(b).each(function(a){a.remove()})})},addStatusMessage:function(a,b,c){c="undefined"!=typeof c?c:{};var d={"class":"msg-box msg-"+a};c.id&&(d.id=c.id),c.title&&(b=""+c.title+": "+b);var e=new Element("div",d);if(e.update('
'+this._getConfigParam("title","")+' |
'+this.lmsg("noEntriesFound")+"
"},_onSearchClick:function(a){this.reload("?"+a.serialize())},_onResetSearchClick:function(){this.reload("/reset-search/true/")},_addSelectionHandlers:function(){var a,b=this,c=this._componentElement.select(".actions-box").first();c&&(a=new Element("li",{"class":"r-actions-item r-actions-select"}).update("").observe("click",this.onSelectButtonClick.bindAsEventListener(this)),this._componentElement.down(".actions-box .r-actions-list").insert({top:a}));var d=this._componentElement.select('input[name="listGlobalCheckbox"]').first();d.observe("click",this.onListGlobalCheckboxClick.bind(this)),this._componentElement.select('input[name="listCheckbox[]"]').each(function(b){b.observe("click",function(){b.checked?b.up("tr").addClassName("selected"):(b.up("tr").removeClassName("selected"),d.checked=!1,a&&a.removeClassName("r-actions-item-active"))})}),$(document).observe("click",function(a){a.findElement(".objects-toolbar")||b._hideItemsNotSelectedWarning()}),$(document).observe("touchstart",function(){list._hideItemsNotSelectedWarning()})},_addPathbar:function(){this._pathbar&&Jsw.render($(this._id+"-pathbar"),Jsw.createComponent(this._pathbar))},disable:function(){this._disablerOverlay.show(),this._disablerOverlay.clonePosition(this._componentElement)},enable:function(){this._disablerOverlay.hide()},getSelectedItemsIds:function(){return this._componentElement.select('input[name="listCheckbox[]"]').filter(function(a){return a.checked}).map(function(a){return a.value})},getSelectedItems:function(){var a=[],b=[];return this.getSelectedItemsIds().each(function(b){a.push(b)}),this._data.each(function(c){var d=a.indexOf(c.id);0>d||b.push(c)}),b},checkNonEmptySelection:function(){return this.getSelectedItemsIds().length?(this._hideItemsNotSelectedWarning(),!0):(this._showItemsNotSelectedWarning(),!1)},execLongGroupOperation:function(a,b){var c;a.onSuccess=function(){var a=Jsw.getComponent("asyncProgressBarWrapper");a.removePreparingItem(c),a.update()},a.beforeSendRequest=function(d){var e=b.target.cumulativeOffset();c=Jsw.getComponent("asyncProgressBarWrapper").fly(e,a.taskName,function(){d()})},this.execGroupOperation(a)},execGroupOperation:function(a){var b=this,c=$H(),d=0,e=a.submitVarName?a.submitVarName:"ids",f=a.selectedItems?a.selectedItems:this.getSelectedItemsIds();if(f.each(function(a){c.set(e+"["+d+"]",a),d++}),a.checkSelection){if(!a.checkSelection())return}else{if(!d)return void this._showItemsNotSelectedWarning();this._hideItemsNotSelectedWarning()}var g=this._submit,h=a.submitHandler?a.submitHandler:function(c,d){g(Jsw.prepareUrl(c),{method:"post",parameters:d,reloading:!1,context:b,onSuccess:function(c){try{var d=c.responseText.evalJSON()}catch(e){return void Jsw.showInternalError(c.responseText)}d.redirect?Jsw.redirect(d.redirect):d.noReload||(this.reloading=!0,b.reload()),b._clearStatusOnReload&&Jsw.clearStatusMessages(),$A(d.statusMessages).each(function(a){Jsw.addStatusMessage(a.status,a.content)}),a.onSuccess&&a.onSuccess(d)},onCreate:function(){b.disable()},onComplete:function(){this.reloading||b.enable()},onFailure:function(a){504===a.status?Jsw.addStatusMessage("error",b.lmsg("timeoutMessage")):Jsw.showInternalError(a.responseText),b.enable()}})},i=function(){a.beforeSendRequest?a.beforeSendRequest(function(){h(a.url,c)}):h(a.url,c)},j=a.skipConfirmation,k=a.mouseEvent;k&&!j&&(k.preventDefault(),j=k.shiftKey),j?i():(a.confirmationPopup=a.confirmationPopup||this._confirmationPopup.bind(this,a,i),a.confirmationPopup(c))},_submit:function(a,b){new Ajax.Request(a,b)},_confirmationPopup:function(a,b,c){Jsw.messageBox.show({type:Jsw.messageBox.TYPE_YESNO,buttonTitles:{yes:this.lmsg("messageBoxButtonYes"),no:this.lmsg("messageBoxButtonNo"),wait:this.lmsg("messageBoxButtonWait")},text:a.getConfirmOnGroupOperation?a.getConfirmOnGroupOperation():a.locale.confirmOnGroupOperation,subtype:a.subtype,needAttention:a.needAttention?a.needAttention:!1,needAttentionText:a.needAttentionText?a.needAttentionText:"",needAttentionBlockSubmit:a.needAttentionBlockSubmit?a.needAttentionBlockSubmit:!1,onYesClick:b,isAjax:a.isAjax,requestUrl:a.requestUrl,requestParams:c,loadingTitle:a.loadingTitle})},_showItemsNotSelectedWarning:function(){this._hideItemsNotSelectedWarning();var a=this._componentElement.down("items-not-selected-warning");a?a.show():this._componentElement.down(".actions-box").insert({top:'":'
'+this._needAttentionText+"
",a+="'+b.description+"
");var f="";b.confirmation&&(f='"),$(this._contentContainerId).update(""+d+e+f);var g=this._componentElement.select('input[type="checkbox"]'),h=this;g.each(function(a){Event.stopObserving(a,"click"),Event.observe(a,"click",function(){var a=!0;h._componentElement.select('input[type="checkbox"]').each(function(b){$F(b)||(a=!1)}),a?h._enableYesButton():h._disableYesButton()})}),g.length||this._enableYesButton()}}),Jsw.WebspaceFoldersMessageBox=Class.create(Jsw.AjaxMessageBox,{_initConfiguration:function($super,a){$super(a),this._successDescription=this._getConfigParam("successDescription",""),this._failureDescription=this._getConfigParam("failureDescription","")},initialize:function($super,a){$super(a),this._setDescription([])},_setDescription:function(a){var b=a.map(function(a){return"
'+this._captions.get("selectedImage").escapeHTML()+'
"+this._hint+'
"),this.addOkButton(),this.addCancelButton()},addOkButton:function(){this.addRightButton(this.lmsg("buttonOk"),this._onOkClick,!0,!0,{id:this._sendButtonId})},addCancelButton:function(){this.addRightButton(this.lmsg("buttonCancel"),this._onCancelClick,!1,!1,{id:this._cancelButtonId})},_onOkClick:function(){this._handler($(this._id+"-description").value),this.hide()},_onCancelClick:function(){this.hide()}}),Jsw.namespace("Jsw.ConfirmationPopupManager"),Jsw.ConfirmationPopupManager.PopupForm=Class.create(Jsw.PopupForm,{_sendButtonTitle:"",_initConfiguration:function($super,a){a=Object.extend({singleRowButtons:!0},a||{}),$super(a),this._prepareUrl=this._getConfigParam("prepareUrl",""),this._handlerUrl=this._getConfigParam("handlerUrl",""),this._ids=this._getConfigParam("ids",""),this._formListItemsAreaId=this._id+"-form-list-items",this._formListAreaId=this._id+"-form-list",this._formBoxAreaId=this._id+"-form-box",this._sendButtonId=this._getConfigParam("sendButtonId","btn-send"),this._cancelButtonId=this._getConfigParam("cancelButtonId","btn-cancel"),this._formDescriptionId=this._id+"-form-desc",this._longtask=this._getConfigParam("longtask",!1),this._autoload=this._getConfigParam("autoload",!0)},render:function($super){$super(),this.setBoxType("form-box"),this._setTitle(),$(this._contentAreaId).update(this._getHeadDescription()+''+this._getBottomDescription());var a=$(this._id+"-form");a._formSubmit=a.submit,a.submit=this._onSubmit.bind(this),a.observe("submit",this._onSubmitEvent.bind(this)),$(this._formBoxAreaId).insert(''+this.lmsg("description")+"
"},_onException:function(a,b){this._addErrorMessage("Internal error: "+b),this.enable()},_onOkClick:function(a){this._onSubmit(a)},_onCancelClick:function(){this.hide()},_preparePopup:function(){var a=$H(),b=0;this._ids.each(function(c){a.set("ids["+b+"]",c),b++}),new Ajax.Request(Jsw.prepareUrl(this._prepareUrl),{method:"post",parameters:a,onSuccess:this._onSuccessPreparePopup.bind(this),onException:this._onException.bind(this)})},_renderPreparePopup:function(){this._preparePopup()},_onSubmitEvent:function(a){return this._onSubmit(),Event.stop(a),!1},_onSuccessResponse:function(a){this.hide(),Jsw.redirect(a.redirect)},_onSuccess:function(a){this._clearMessages();try{var b=a.responseText.evalJSON();if("success"==b.status)this._onSuccessResponse(b);else{if(b.redirect)return void Jsw.redirect(b.redirect);this._addErrorMessage(b.message),this.enable()}}catch(c){this._addErrorMessage(c.message),this._addErrorMessage("Internal error: "+a.responseText),this.enable()}},disable:function(){var a=$(this._sendButtonId);if(a){var b=a.down("button");b.disabled=!0,a.addClassName("disabled"),this._sendButtonTitle||(this._sendButtonTitle=b.innerHTML),b.update(''+this.lmsg("loading")+"")}var c=$(this._cancelButtonId);c&&(c.down("button").disabled=!0,c.addClassName("disabled"))},enable:function(){var a=$(this._sendButtonId);if(a){var b=a.down("button");b.disabled=!1,b.update(this._sendButtonTitle),a.removeClassName("disabled")}var c=$(this._cancelButtonId);c&&(c.down("button").disabled=!1,c.removeClassName("disabled"))},_onSuccessPreparePopup:function(){return!0},_getLoadingIndicatorItems:function(){return[]},_addLoadingIndicator:function(){},_getAdditionalParams:function(a){return a},_isValid:function(){return!0},_onSubmit:function(a){if(this._clearMessages(),this._isValid()){var b=$H(),c=0;if(this._ids.each(function(a){b.set("ids["+c+"]",a),c++}),b=this._getAdditionalParams(b),this.disable(),this._addLoadingIndicator(this._getLoadingIndicatorItems()),this._needFlyEffect()){var d=this,e=a.target.cumulativeOffset();Jsw.getComponent("asyncProgressBarWrapper").fly(e,this._longtask,function(){d._sendRequest(b)})}else this._sendRequest(b)}},_needFlyEffect:function(){return!1!==this._longtask},_sendRequest:function(a){new Ajax.Request(this._handlerUrl,{method:"post",parameters:a,onSuccess:this._onSuccess.bind(this),onException:this._onException.bind(this)})}}),Jsw.LookUp=Class.create(Jsw.Component,{_initConfiguration:function($super,a){$super(a),this._name=this._getConfigParam("name",null),this._cls=this._getConfigParam("cls","lookup"),this._data=this._getConfigParam("data",[]),this._currentValue=this._getConfigParam("value",null),this._newItemValue=this._getConfigParam("newItemValue",null),this._dataUrl=this._getConfigParam("dataUrl",null),this._copyTitleValue=this._getConfigParam("copyTitleValue",!1),this._limit=this._getConfigParam("limit",this._dataUrl?10:Jsw.list.ITEMS_UNLIMITED),this._lookUpParams=this._getConfigParam("lookUpParams",{}),!this._currentValue&&this._newItemValue&&(this._currentValue=this._newItemValue)},_initComponentElement:function($super){$super(),this._valueField=new Element("input",{type:"hidden",name:this._name}),this._componentElement.insert(this._valueField),this._inputField=new Element("input",{type:"text","class":"form-control"}),this._lookUpButton=new Element("span",{"class":"form-control-icon form-control-icon-action"}).insert(new Element("i",{"class":"icon-form-control-search"})),this._lookUpControl=new Element("div",{"class":"form-control-group"}).insert(this._inputField).insert(this._lookUpButton),this._dropdownList=new Element("ul",{"class":"dropdown-menu lookup-dropdown-menu"}),this._initCustomLookUpComponent(),this._customLookUpComponent?(this._dropdownList.insert(new Element("li",{"class":"dropdown-header"}).update(this.lmsg("label"))),this._dropdownList.insert(new Element("li").insert(new Element("div",{"class":"dropdown-menu-content"}).insert(this._lookUpControl)))):(this._lookUpControl.addClassName("f-large-size"),this._componentElement.insert(this._lookUpControl)),this._emptyElement=new Element("li").insert(new Element("div",{"class":"dropdown-menu-content"}).update(this.lmsg("nothingFound"))),this._dropdownList.insert(this._emptyElement),this._componentElement.insert(this._dropdownList),this._updateValue(),0'+d.escapeHTML().replace(/\n/gm,"
")+"
'+b+"
'+this.lmsg("collecting")+this._getTooltip()+"
"),this._addTooltips();var a=this;new Ajax.Request(Jsw.prepareUrl("/admin/report/collect/"),{method:"post",onException:this._onException.bind(this),onSuccess:function(b){var c=b.responseText.evalJSON();if(a._checkResponseStatus(c)){Jsw.DynamicPopupHint.unset();var d=''+a.lmsg("downloadLink")+"";$(a._contentAreaId).update(""+a.lmsg("collectedDescription")+"
"+a.lmsg("collectedDownload",{link:d})+"
"+a.lmsg("collectedConsent")+"
"),a._enableSendButton(a.lmsg("buttonSend"),a._onSendClick.bind(a,c.file))}}})},_onSendClick:function(a){this._disableSendButton(this.lmsg("buttonSending"));var b=this;new Ajax.Request(Jsw.prepareUrl("/admin/report/send/"),{method:"post",parameters:{file:a},onException:this._onException.bind(this),onSuccess:function(a){var c=a.responseText.evalJSON();b._checkResponseStatus(c)&&($(b._contentAreaId).update(""+b.lmsg("sentInfo",{id:c.reportId.escapeHTML()})+"
"),b._enableSendButton(b.lmsg("buttonToSupport"),b._onSupportClick.bind(b,!1)))}})},_onCancelClick:function(){this.hide()},_onShowReportsClick:function(a){if(a.preventDefault(),this._componentElement.down(".js-show-previous-reports").addClassName("hidden"),Jsw.getComponent("reports-list")&&this._componentElement.down(".list-box"))return this._componentElement.down(".list-box").removeClassName("hidden"),void this._componentElement.down(".js-hide-previous-reports").removeClassName("hidden");this._componentElement.down(".ajax-loading").removeClassName("hidden");var b=this._componentElement.getHeight(),c=new Jsw.List({id:"reports-list",dataUrl:Jsw.prepareUrl("/admin/report/list-data"),pageable:!1,columns:[{header:this.lmsg("date"),dataIndex:"date"},{header:this.lmsg("reportId"),dataIndex:"id"}],onRedraw:function(){this._componentElement.down(".js-hide-previous-reports").removeClassName("hidden"),this._componentElement.down(".ajax-loading").addClassName("hidden");var a=Math.max(document.viewport.getScrollOffsets().top+document.viewport.getHeight()-1.5*parseInt(this._componentElement.getStyle("top"))-b,100);this._componentElement.down(".list").setStyle({"max-height":parseInt(a)+"px"})}.bind(this)});new Jsw.Panel({cls:"list-box",renderTo:"js-reports",items:[c]})},_onHideReportsClick:function(a){a.preventDefault(),this._componentElement.down(".list-box").addClassName("hidden"),this._componentElement.down(".js-show-previous-reports").removeClassName("hidden"),this._componentElement.down(".js-hide-previous-reports").addClassName("hidden")},_addEvents:function($super){$super(),$(this._actionCollectId).observe("click",function(){this._enableSendButton(this.lmsg("buttonCollect"),this._onCollectClick.bind(this))}.bind(this)),$(this._actionToSupportId).observe("click",function(){this._enableSendButton(this.lmsg("buttonToSupport"),this._onSupportClick.bind(this,!0))}.bind(this)),this._componentElement.down(".js-show-previous-reports").observe("click",this._onShowReportsClick.bind(this)),this._componentElement.down(".js-hide-previous-reports").observe("click",this._onHideReportsClick.bind(this))},_addTooltips:function($super){$super(),new Jsw.DynamicPopupHint.Instance({title:this.lmsg("hintTitle"),target:$("tooltip"),placement:"right",content:this.lmsg("hintText")})},_getTooltip:function(){return this._tooltip||(this._tooltip=' '+this.lmsg("hintLink")+""),this._tooltip},_disableSendButton:function(a){$(this._sendButtonId).firstDescendant().disable(),$(this._sendButtonId).addClassName("disabled"),a&&$(this._sendButtonId).down("button").update(''+a+"")},_enableSendButton:function(a,b){b&&($(this._sendButtonId).down("button").stopObserving("click"),$(this._sendButtonId).down("button").observe("click",b)),a&&$(this._sendButtonId).down("button").update(a),$(this._sendButtonId).firstDescendant().enable(),$(this._sendButtonId).removeClassName("disabled")},_checkResponseStatus:function(a){return a.redirect&&Jsw.redirect(a.redirect),a.status&&"success"!=a.status?($A(a.statusMessages).each(function(a){Jsw.addStatusMessage(a.status,a.content)}),this.hide(),!1):!0},_onException:function(a,b){Jsw.addStatusMessage("error","Internal error: "+b),this.hide()}}),Jsw.namespace("Jsw.ListContextMenu"),Jsw.ListContextMenu=Class.create(Jsw.Container,{_initConfiguration:function($super,a){$super(a),this._cls="popup-box popup-menu collapsed",this._list=this._getConfigParam("list")},_initComponentElement:function($super){$super(),this._componentElement.update(''+this.lmsg("title")+''+this.lmsg("currentViewMessage",{view:this.lmsg(this._isPowerUserPanel?"powerUserView":"serviceProviderView")})+" "+this.lmsg("actionMessage",{switchLink:''+this.lmsg("switchView",{view:this.lmsg(this._isPowerUserPanel?"serviceProviderView":"powerUserView")})+"",helpLink:''+this.lmsg("learnMore")+""})+" "+(this._showPowerUserViewWarning?' '+this.lmsg("powerUserViewWarning"):"")+" |