File manager - Edit - /home/web/vm-3fadc827.na4u.ru/www/bitrix/modules/calendar/install/js/calendar/sectionmanager/dist/sectionmanager.bundle.min.js
Back
this.BX=this.BX||{};(function(exports,calendar_entry,calendar_util,main_core,main_core_events){"use strict";var CalendarSection=function(){function CalendarSection(e){babelHelpers.classCallCheck(this,CalendarSection);this.updateData(e);this.calendarContext=calendar_util.Util.getCalendarContext()}babelHelpers.createClass(CalendarSection,[{key:"getId",value:function e(){return this.id}},{key:"updateData",value:function e(t){this.data=t||{};this.type=t.CAL_TYPE||"";this.ownerId=parseInt(t.OWNER_ID)||0;this.id=parseInt(t.ID);this.color=this.data.COLOR;this.name=this.data.NAME}},{key:"isShown",value:function e(){return this.calendarContext.sectionManager.sectionIsShown(this.id)}},{key:"show",value:function e(){var t=this;if(!this.isShown()){var n=this.calendarContext.sectionManager.getHiddenSections();n=n.filter((function(e){return e!==t.id}),this);this.calendarContext.sectionManager.setHiddenSections(n);this.calendarContext.sectionManager.saveHiddenSections()}}},{key:"hide",value:function e(){if(this.isShown()){var t=this.calendarContext.sectionManager.getHiddenSections();t.push(this.id);this.calendarContext.sectionManager.setHiddenSections(t);this.calendarContext.sectionManager.saveHiddenSections()}}},{key:"remove",value:function e(){var t=this;if(confirm(BX.message("EC_SEC_DELETE_CONFIRM"))){var n=calendar_util.Util.getBX().Event;n.EventEmitter.emit("BX.Calendar.Section:delete",new n.BaseEvent({data:{sectionId:this.id}}));BX.ajax.runAction("calendar.api.calendarajax.deleteCalendarSection",{data:{id:this.id}}).then((function(e){var n=calendar_util.Util.getCalendarContext().sectionManager;var i=true;var a;for(var s=0;s<n.sections.length;s++){a=n.sections[s];if(a.id!==t.id&&a.belongsToView()){i=false;break}}var r=calendar_util.Util.getCalendarContext();if(!r||i){return calendar_util.Util.getBX().reload()}r.reload()}),(function(e){}))}}},{key:"hideGoogle",value:function e(){var t=this;if(confirm(BX.message("EC_CAL_GOOGLE_HIDE_CONFIRM"))){this.hide();BX.onCustomEvent(this.calendar,"BXCalendar:onSectionDelete",[this.id]);calendar_util.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Section:delete",new main_core.Event.BaseEvent({data:{sectionId:this.id}}));BX.ajax.runAction("calendar.api.calendarajax.hideExternalCalendarSection",{data:{id:this.id}}).then((function(){var e=calendar_util.Util.getCalendarContext().sectionManager;var n=true;var i;for(var a=0;a<e.sections.length;a++){i=e.sections[a];if(i.id!==t.id&&i.belongsToView()){n=false;break}}var s=calendar_util.Util.getCalendarContext();if(!s||n){return calendar_util.Util.getBX().reload()}s.reload()}),(function(e){}))}}},{key:"getLink",value:function e(){return this.data&&this.data.LINK?this.data.LINK:""}},{key:"canBeConnectedToOutlook",value:function e(){return!this.isPseudo()&&this.data.OUTLOOK_JS&&!(this.data.CAL_DAV_CAL&&this.data.CAL_DAV_CON)&&!BX.browser.IsMac()}},{key:"connectToOutlook",value:function connectToOutlook(){if(!window.jsOutlookUtils){BX.loadScript("/bitrix/js/calendar/outlook.js",BX.delegate((function(){try{eval(this.data.OUTLOOK_JS)}catch(e){}}),this))}else{try{eval(this.data.OUTLOOK_JS)}catch(e){}}}},{key:"canDo",value:function e(t){if(this.isVirtual()&&["access","add","edit"].includes(t)){return false}if(t==="view_event"){t="view_time"}if(!this.data.PERM[t]){return false}return this.data.PERM&&this.data.PERM[t]}},{key:"isSuperposed",value:function e(){return!this.isPseudo()&&!!this.data.SUPERPOSED}},{key:"isPseudo",value:function e(){return false}},{key:"isVirtual",value:function e(){return this.data.CAL_DAV_CAL&&this.data.CAL_DAV_CAL.indexOf("@virtual/events/")!==-1||this.data.GAPI_CALENDAR_ID&&this.data.GAPI_CALENDAR_ID.indexOf("@group.v.calendar.google.com")!==-1||this.data.EXTERNAL_TYPE==="google_readonly"||this.data.EXTERNAL_TYPE==="google_freebusy"}},{key:"isGoogle",value:function e(){return!!this.data.GAPI_CALENDAR_ID}},{key:"isCalDav",value:function e(){return!this.isPseudo()&&this.data.CAL_DAV_CAL&&this.data.CAL_DAV_CON}},{key:"isCompanyCalendar",value:function e(){return!this.isPseudo()&&this.type!=="user"&&this.type!=="group"&&!this.ownerId}},{key:"isLocationRoom",value:function e(){return this.type==="location"}},{key:"belongsToView",value:function e(){var t=calendar_util.Util.getCalendarContext();return this.type===t.getCalendarType()&&this.ownerId===t.getOwnerId()}},{key:"belongsToOwner",value:function e(){return this.belongsToUser(calendar_util.Util.getCalendarContext().getUserId())}},{key:"belongsToUser",value:function e(t){return this.type==="user"&&this.ownerId===parseInt(t)&&this.data.ACTIVE!=="N"}},{key:"isActive",value:function e(){return this.data.ACTIVE!=="N"}},{key:"getType",value:function e(){return this.type}},{key:"getOwnerId",value:function e(){return this.ownerId}}]);return CalendarSection}();var CalendarTaskSection=function(e){babelHelpers.inherits(t,e);function t(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var n=arguments.length>1?arguments[1]:undefined,i=n.type,a=n.userId,s=n.ownerId;babelHelpers.classCallCheck(this,t);var r="#ff5b55";var o=main_core.Loc.getMessage("EC_SEC_MY_TASK_DEFAULT");if(i==="user"&&a!==s){o=main_core.Loc.getMessage("EC_SEC_USER_TASK_DEFAULT")}else if(i==="group"){o=main_core.Loc.getMessage("EC_SEC_GROUP_TASK_DEFAULT")}return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,{ID:"tasks",NAME:e.name||o,COLOR:e.color||r,PERM:{edit_section:true,view_full:true,view_time:true,view_title:true}}))}babelHelpers.createClass(t,[{key:"isPseudo",value:function e(){return true}},{key:"updateData",value:function e(n){babelHelpers.get(babelHelpers.getPrototypeOf(t.prototype),"updateData",this).call(this,n);this.id=n.ID}}]);return t}(CalendarSection);var SectionManager=function(){function e(t,n){babelHelpers.classCallCheck(this,e);this.setSections(t.sections);this.setConfig(n);this.addTaskSection();this.sortSections();main_core_events.EventEmitter.subscribeOnce("BX.Calendar.Section:delete",this.deleteSectionHandler.bind(this))}babelHelpers.createClass(e,[{key:"setSections",value:function e(){var t=this;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];this.sections=[];this.sectionIndex={};n.forEach((function(e){var n=new CalendarSection(e);if(n.canDo("view_time")){t.sections.push(n);t.sectionIndex[n.getId()]=t.sections.length-1}}))}},{key:"sortSections",value:function e(){var t=this;this.sectionIndex={};this.sections=this.sections.sort((function(e,t){if(main_core.Type.isFunction(e.isPseudo)&&e.isPseudo()){return 1}else if(main_core.Type.isFunction(t.isPseudo)&&t.isPseudo()){return-1}return e.name.localeCompare(t.name)}));this.sections.forEach((function(e,n){t.sectionIndex[e.getId()]=n}))}},{key:"setConfig",value:function e(t){this.setHiddenSections(t.hiddenSections);this.calendarType=t.type;this.ownerId=t.ownerId;this.ownerName=t.ownerName||"";this.userId=t.userId;this.defaultSectionAccess=t.new_section_access||{};this.sectionAccessTasks=t.sectionAccessTasks;this.showTasks=t.showTasks;this.customizationData=t.sectionCustomization||{}}},{key:"addTaskSection",value:function e(){if(this.showTasks){var t=new CalendarTaskSection(this.customizationData["tasks"+this.ownerId],{type:this.calendarType,userId:this.userId,ownerId:this.ownerId});this.sections.push(t);this.sectionIndex[t.id]=this.sections.length-1}}},{key:"getCalendarType",value:function e(){return this.calendarType}},{key:"handlePullChanges",value:function e(t){if(t.command==="delete_section"){var n=parseInt(t.fields.ID,10);if(this.sectionIndex[n]){this.deleteSectionHandler(n);calendar_util.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Section:pull-delete",new main_core.Event.BaseEvent({data:{sectionId:n}}))}else{this.reloadData()}}else if(t.command==="edit_section"){this.reloadData().then((function(){calendar_util.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Section:pull-edit")}));calendar_util.Util.getBX().Event.EventEmitter.emit("BX.Calendar:doRefresh")}else{this.reloadData()}}},{key:"reloadData",value:function e(){var t=this;return new Promise((function(e){BX.ajax.runAction("calendar.api.calendarajax.getSectionList",{data:{type:t.calendarType,ownerId:t.ownerId}}).then((function(n){t.setSections(n.data.sections||[]);if(n.data.config){t.setConfig(config)}t.addTaskSection();e(n.data)}),(function(t){e(t.data)}))}))}},{key:"getSections",value:function e(){return this.sections}},{key:"getSuperposedSectionList",value:function e(){var t,n=[];for(t=0;t<this.sections.length;t++){if(this.sections[t].isSuperposed()&&this.sections[t].isActive()){n.push(this.sections[t])}}return n}},{key:"getSectionListForEdit",value:function e(){var t=[];for(var n=0;n<this.sections.length;n++){if(this.sections[n].canDo("add")&&!this.sections[n].isPseudo()&&this.sections[n].isActive()&&!this.sections[n].isLocationRoom()){t.push(this.sections[n])}}return t}},{key:"getSection",value:function e(t){return this.sections[this.sectionIndex[t]]||{}}},{key:"getDefaultSectionName",value:function e(){return main_core.Loc.getMessage("EC_DEFAULT_SECTION_NAME")}},{key:"getDefaultSectionAccess",value:function e(){return this.defaultSectionAccess}},{key:"saveSection",value:function e(t,n,i,a){var s=this;return new Promise((function(e){t=main_core.Type.isString(t)&&t.trim()?t.trim():main_core.Loc.getMessage("EC_SEC_SLIDER_NEW_SECTION");if(a.section.id);var r=a.section.id&&a.section.isPseudo();BX.ajax.runAction("calendar.api.calendarajax.editCalendarSection",{data:{analyticsLabel:{action:a.section.id?"editSection":"newSection",type:a.section.type||s.calendarType},id:a.section.id||0,name:t,type:a.section.type||s.calendarType,ownerId:a.section.ownerId||s.ownerId,color:n,access:i||null,userId:s.userId,customization:r?"Y":"N"}}).then((function(t){if(r){BX.reload();return}var n=t.data.sectionList||[];s.setSections(n);s.sortSections();calendar_util.Util.getBX().Event.EventEmitter.emit("BX.Calendar.Section:edit",new main_core.Event.BaseEvent({data:{sectionList:n}}));e(t.data)}),(function(t){BX.Calendar.Util.displayError(t.errors);e(t.data)}))}))}},{key:"sectionIsShown",value:function e(t){return!BX.util.in_array(t,this.hiddenSections)}},{key:"getHiddenSections",value:function e(){return this.hiddenSections}},{key:"setHiddenSections",value:function e(t){var n=this;this.hiddenSections=[];if(main_core.Type.isArray(t)){t.forEach((function(e){n.hiddenSections.push(e==="tasks"?e:parseInt(e))}))}}},{key:"saveHiddenSections",value:function e(){var t=calendar_util.Util.getCalendarContext();var n=t.util.userIsOwner()?"hidden_sections":"hidden_sections_"+t.util.type;BX.userOptions.save("calendar",n,n,this.hiddenSections)}},{key:"getSectionsInfo",value:function e(){var t=this;var n=[];var i=[];var a=[];var s=[];this.sections.forEach((function(e){if(e.isShown()&&t.calendarType==="location"&&e.type==="location"){if(e.isSuperposed()){i.push(e.id)}else{a.push(e.id)}n.push(e.id)}else if(e.isShown()&&t.calendarType!=="location"){if(e.isSuperposed()){i.push(e.id)}else{a.push(e.id)}n.push(e.id)}else{s.push(e.id)}}));return{superposed:i,active:a,hidden:s,allActive:n}}},{key:"deleteSectionHandler",value:function e(t){if(this.sectionIndex[t]!==undefined){this.sections=BX.util.deleteFromArray(this.sections,this.sectionIndex[t]);for(var n=0;n<this.sections.length;n++){this.sectionIndex[this.sections[n].id]=n}}}},{key:"getSectionAccessTasks",value:function e(){return this.sectionAccessTasks}},{key:"getDefaultSection",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var n=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;t=main_core.Type.isString(t)?t:this.calendarType;n=main_core.Type.isNumber(n)?n:this.ownerId;var i=calendar_util.Util.getUserSettings();var a=t+n;var s=i.defaultSections[a]||i.lastUsedSection;var r=this.getSectionListForEdit();var o=r.find((function(e){return e.type===t&&e.ownerId===n&&e.id===s}));if(!o){o=r.find((function(e){return e.type===t&&e.ownerId===n}))}return o}},{key:"setDefaultSection",value:function e(t){var n=this.getSection(parseInt(t,10));if(n&&n.type===this.calendarType&&n.ownerId===this.ownerId){var i=calendar_util.Util.getUserSettings();var a=this.calendarType+this.ownerId;if(i.defaultSections[a]!==n.id){i.defaultSections[a]=n.id;calendar_util.Util.setUserSettings(i);BX.ajax.runAction("calendar.api.calendarajax.updateDefaultSectionId",{data:{key:a,sectionId:t}})}}}}],[{key:"getNewEntrySectionId",value:function t(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null;var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;var a=calendar_util.Util.getCalendarContext();if(a&&!a.isExternalMode()){n=n||a.util.type;if(n==="location"){var s=a.sectionManager.getDefaultSection("user",a.util.userId);return parseInt(s.id,10)}else{var r=a.sectionManager.getDefaultSection(n,i);return parseInt(r.id,10)}}return e.newEntrySectionId}},{key:"setNewEntrySectionId",value:function t(n){e.newEntrySectionId=parseInt(n)}},{key:"getSectionGroupList",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var n=t.type,i=t.ownerId,a=t.userId,s=t.trackingUsersList||calendar_util.Util.getFollowedUserList(a),r=[],o;if(n==="user"){if(a===i){o=main_core.Loc.getMessage("EC_SEC_SLIDER_MY_CALENDARS_LIST")}else{o=main_core.Loc.getMessage("EC_SEC_SLIDER_USER_CALENDARS_LIST")}}else if(n==="group"){o=main_core.Loc.getMessage("EC_SEC_SLIDER_GROUP_CALENDARS_LIST")}else if(n==="location"){o=main_core.Loc.getMessage("EC_SEC_SLIDER_TYPE_LOCATION_LIST")}else if(n==="resource"){o=main_core.Loc.getMessage("EC_SEC_SLIDER_TYPE_RESOURCE_LIST")}else{o=main_core.Loc.getMessage("EC_SEC_SLIDER_TITLE_COMP_CAL")}r.push({title:o,type:n,belongsToView:true});if(n!=="user"||a!==i){r.push({title:main_core.Loc.getMessage("EC_SEC_SLIDER_MY_CALENDARS_LIST"),type:"user",ownerId:a})}if(n!=="company"&&n!=="company_calendar"&&n!=="calendar_company"){r.push({title:main_core.Loc.getMessage("EC_SEC_SLIDER_TITLE_COMP_CAL"),type:"company"})}if(main_core.Type.isArray(s)){s.forEach((function(e){if(parseInt(e.ID)!==i||n!=="user"){r.push({title:BX.util.htmlspecialchars(e.FORMATTED_NAME),type:"user",ownerId:parseInt(e.ID)})}}))}r.push({title:main_core.Loc.getMessage("EC_SEC_SLIDER_POPUP_MENU_ADD_GROUP"),type:"group"});r.push({title:main_core.Loc.getMessage("EC_SEC_SLIDER_TITLE_RESOURCE_CAL"),type:"resource"});r.push({title:main_core.Loc.getMessage("EC_SEC_SLIDER_TITLE_LOCATION_CAL"),type:"location"});return r}},{key:"saveDefaultSectionId",value:function t(n){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var a=calendar_util.Util.getCalendarContext();if(a){a.sectionManager.setDefaultSection(n)}else{if(main_core.Type.isArray(i.sections)&&i.calendarType&&i.ownerId){var s=i.sections.find((function(e){var t=parseInt(e.ID||e.id,10);var a=parseInt(e.OWNER_ID||e.ownerId,10);var s=e.CAL_TYPE||e.type;return t===parseInt(n,10)&&a===parseInt(i.ownerId,10)&&s===i.calendarType}));if(s){var r=calendar_util.Util.getUserSettings();var o=i.calendarType+i.ownerId;if(r&&r.defaultSections[o]!==n){r.defaultSections[o]=n;calendar_util.Util.setUserSettings(r);e.newEntrySectionId=n;BX.ajax.runAction("calendar.api.calendarajax.updateDefaultSectionId",{data:{key:o,sectionId:n}})}}}}}}]);return e}();babelHelpers.defineProperty(SectionManager,"newEntrySectionId",null);exports.CalendarSection=CalendarSection;exports.SectionManager=SectionManager})(this.BX.Calendar=this.BX.Calendar||{},BX.Calendar,BX.Calendar,BX,BX.Event); //# sourceMappingURL=sectionmanager.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.26 |
proxy
|
phpinfo
|
Settings