$(document).ready(function(){esconderCapasAgendarEventoSeccion();$(".seccionAgendar a.agendar").click(function(){mostrarOpcionesAgendarSeccion($(this).attr("href"))});$(".seccionAgendar a.agendar").bind("keypress",function(e){var code=e.keyCode?e.keyCode:e.which;if(code===13)mostrarOpcionesAgendarSeccion($(this).attr("href"))});$(".colIzq").text(function(){return $(this).text().length>6?$(this).text().substr(0,6):$(this).text()});$(".colDer").text(function(){return $(this).text().length>6?$(this).text().substr(0,
6):$(this).text()});$(".colDerec").text(function(){return $(this).text().length>4?$(this).text().substr(0,4):$(this).text()})});function eventosMostrarOpcionesAgendarSeccion(){$("div.seccionAgendar .agendarEventosSeccion .labelRadio span").bind("keypress",function(e){var code=e.keyCode?e.keyCode:e.which;if(code===13)$(this).click()})}function esconderCapasAgendarEventoSeccion(){$(".agendarEventosSeccion").hide()}
function agendarEventoSeccion(idEvento,idRegistro){var calendario=$("#agendarEventoSeccion"+idEvento+" input:radio:checked").val();calendario=unescape(encodeURIComponent(calendario));if(calendario.indexOf("google")>=0||calendario.indexOf("yahoo")>=0)window.open(calendario,"left\x3d20,top\x3d20,width\x3d550,height\x3d400,toolbar\x3d0,menubar\x3d0,scrollbars\x3d0,location\x3d0,resizable\x3d1");if(calendario.indexOf("google")<0&&calendario.indexOf("yahoo")<0)document.location.href=calendario}
function mostrarOpcionesAgendarSeccion(indice){if(!$("#agendarEventoSeccion"+indice.substring(1,indice.length)).is(":visible")){esconderCapasAgendarEventoSeccion();$("#agendarEventoSeccion"+indice.substring(1,indice.length)).show()}else esconderCapasAgendarEventoSeccion();eventosMostrarOpcionesAgendarSeccion()}
function changecode(t){while(t.search("/n")!==-1)t=t.replace("/n","%0A");while(t.search("/r")!==-1)t=t.replace("/r","%0D");while(t.search(":")!==-1)t=t.replace(":","%3A");while(t.search(" ")!==-1)t=t.replace(" ","%20");return t};
AUI.add("liferay-staging",function(A){var StagingBar={init:function init(config){var instance=this;var namespace=config.namespace;instance.markAsReadyForPublicationURL=config.markAsReadyForPublicationURL;instance.layoutRevisionStatusURL=config.layoutRevisionStatusURL;instance._namespace=namespace;instance.viewHistoryURL=config.viewHistoryURL;Liferay.publish({fireOnce:true});Liferay.after("initStagingBar",function(){var body=A.getBody();if(body.hasClass("has-staging-bar")){var stagingLevel3=A.one(".staging-bar-level-3-message");
body.addClass(stagingLevel3===null?"staging-ready":"staging-ready-level-3")}});Liferay.fire("initStagingBar",config)}};Liferay.StagingBar=StagingBar},"",{requires:["aui-io-plugin-deprecated","aui-modal"]});
AUI.add("liferay-staging-branch",function(A){var Lang=A.Lang;var StagingBar=Liferay.StagingBar;A.mix(StagingBar,{_getBranchDialog:function _getBranchDialog(){var instance=this;var branchDialog=instance._branchDialog;if(!branchDialog){var namespace=instance._namespace;branchDialog=Liferay.Util.Window.getWindow({dialog:{bodyContent:A.one("#"+namespace+"addBranch").show()},title:"Rama"});instance._branchDialog=branchDialog}return branchDialog},addBranch:function addBranch(dialogTitle){var instance=this;
var branchDialog=instance._getBranchDialog();if(Lang.isValue(dialogTitle))branchDialog.set("title",dialogTitle);branchDialog.show()}})},"",{requires:["liferay-staging"]});
AUI.add("liferay-staging-version",function(A){var StagingBar=Liferay.StagingBar;var MAP_CMD_REVISION={redo:"redo_layout_revision",undo:"undo_layout_revision"};var MAP_TEXT_REVISION={redo:"\u00bfEst\u00e1 seguro de que quiere rehacer sus \u00faltimos cambios?",undo:"\u00bfEst\u00e1 seguro de que desea deshacer sus \u00faltimos cambios?"};A.mix(StagingBar,{_cleanup:function _cleanup(){var instance=this;if(instance._eventHandles)A.Array.invoke(instance._eventHandles,"detach")},_getNotification:function _getNotification(){var instance=
this;var notification=instance._notification;if(!notification){notification=new Liferay.Notice({closeText:false,content:"Se ha producido un error inesperado. Por favor, refresque la p\u00e1gina actual.",noticeClass:"hide",timeout:1E4,toggleText:false,type:"warning",useAnimation:true});instance._notification=notification}return notification},_onInit:function _onInit(){var instance=this;instance._cleanup();var namespace=instance._namespace;var eventHandles=[Liferay.on(namespace+"redo",instance._onRevisionChange,
instance,"redo"),Liferay.on(namespace+"submit",instance._onSubmit,instance),Liferay.on(namespace+"undo",instance._onRevisionChange,instance,"undo"),Liferay.on(namespace+"viewHistory",instance._onViewHistory,instance)];var layoutRevisionDetails=A.one("#"+namespace+"layoutRevisionDetails");var layoutRevisionStatus=A.one("#"+namespace+"layoutRevisionStatus");if(layoutRevisionDetails)eventHandles.push(Liferay.after("updatedLayout",function(){Liferay.Util.fetch(instance.markAsReadyForPublicationURL).then(function(response){return response.text()}).then(function(response){layoutRevisionDetails.plug(A.Plugin.ParseContent);
layoutRevisionDetails.setContent(response);Liferay.fire("updatedStatus")})["catch"](function(){layoutRevisionDetails.setContent("Se ha producido un error inesperado. Por favor, refresque la p\u00e1gina actual.")})}));if(layoutRevisionStatus)Liferay.after("updatedStatus",function(){Liferay.Util.fetch(instance.layoutRevisionStatusURL).then(function(response){return response.text()}).then(function(response){layoutRevisionStatus.plug(A.Plugin.ParseContent);layoutRevisionStatus.setContent(response)})["catch"](function(){layoutRevisionStatus.setContent("Se ha producido un error inesperado. Por favor, refresque la p\u00e1gina actual.")})});
instance._eventHandles=eventHandles},_onRevisionChange:function _onRevisionChange(event,type){var instance=this;var cmd=MAP_CMD_REVISION[type];var confirmText=MAP_TEXT_REVISION[type];if(confirm(confirmText))instance._updateRevision(cmd,event.layoutRevisionId,event.layoutSetBranchId)},_onSubmit:function _onSubmit(event){var instance=this;var namespace=instance._namespace;var layoutRevisionDetails=A.one("#"+namespace+"layoutRevisionDetails");var layoutRevisionInfo=layoutRevisionDetails.one(".layout-revision-info");
if(layoutRevisionInfo)layoutRevisionInfo.addClass("loading");var submitLink=A.one("#"+namespace+"submitLink");if(submitLink)submitLink.html("Cargando"+"...");Liferay.Util.fetch(event.publishURL).then(function(){if(event.incomplete)location.href=event.currentURL;else Liferay.fire("updatedLayout")})["catch"](function(){layoutRevisionDetails.addClass("alert alert-danger");layoutRevisionDetails.setContent("Se ha producido un error inesperado. Por favor, refresque la p\u00e1gina actual.")})},_onViewHistory:function _onViewHistory(){Liferay.Util.openWindow({dialog:{after:{destroy:function destroy(){window.location.reload()}},
destroyOnHide:true},title:"Historia",uri:StagingBar.viewHistoryURL})},_updateRevision:function _updateRevision(cmd,layoutRevisionId,layoutSetBranchId){var instance=this;var updateLayoutData={cmd:cmd,doAsUserId:themeDisplay.getDoAsUserIdEncoded(),layoutRevisionId:layoutRevisionId,layoutSetBranchId:layoutSetBranchId,p_auth:Liferay.authToken,p_l_id:themeDisplay.getPlid(),p_v_l_s_g_id:themeDisplay.getSiteGroupId()};Liferay.Util.fetch(themeDisplay.getPathMain()+"/portal/update_layout",{body:Liferay.Util.objectToFormData(updateLayoutData),
method:"POST"}).then(function(){window.location.reload()})["catch"](function(){instance._getNotification().show()})},destructor:function destructor(){var instance=this;instance._cleanup()}});Liferay.on("initStagingBar",StagingBar._onInit,StagingBar)},"",{requires:["aui-button","liferay-staging"]});
