[5592] | 1 | function contentMenu(){ |
---|
| 2 | $('.fullcalendar-not-context-menu').bind('contextmenu', function(event){ |
---|
| 3 | event.preventDefault(); |
---|
| 4 | }); |
---|
| 5 | |
---|
| 6 | $('.fullcalendar-context-menu').bind('contextmenu', function(event){ |
---|
| 7 | event.preventDefault(); |
---|
[5746] | 8 | |
---|
[5592] | 9 | var classes = $(this).attr('class').split(" "); |
---|
[6286] | 10 | var idEvent = false, idRecurrence = false, idCalendar = false; |
---|
[5746] | 11 | |
---|
[5592] | 12 | //recupera o id do calendar eo id do evento para tratamento |
---|
| 13 | for(var i = 0; i < classes.length; i++){ |
---|
[5746] | 14 | if (classes[i].indexOf("event-id-") >= 0 ){ |
---|
| 15 | idEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 16 | continue; |
---|
| 17 | }else if (classes[i].indexOf("Recurrence-id-") >= 0 ){ |
---|
| 18 | idRecurrence = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 19 | continue; |
---|
[6286] | 20 | }else if (classes[i].indexOf("calendar-id-") >= 0 ){ |
---|
| 21 | idCalendar = classes[i].replace(/[a-zA-Z-]+/g, ''); |
---|
| 22 | continue; |
---|
[5746] | 23 | } |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | var schedulable = DataLayer.get('schedulable', idEvent); |
---|
[6286] | 27 | |
---|
[5863] | 28 | var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency; |
---|
[6462] | 29 | |
---|
| 30 | var top; |
---|
| 31 | var elementId = document.getElementById("divAppbox"); |
---|
| 32 | |
---|
| 33 | top = elementId.scrollTop; |
---|
| 34 | |
---|
[5746] | 35 | var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id , |
---|
[6462] | 36 | top: (event.clientY - 135 + top), left: (event.clientX - 445), |
---|
| 37 | signature: Calendar.signatureOf[idCalendar], |
---|
[5863] | 38 | calendars: Calendar.calendars, isRecurrence: isRecurrence == 'none' ? false : true, |
---|
[5746] | 39 | idRecurrence: idRecurrence |
---|
| 40 | }); |
---|
[5592] | 41 | |
---|
| 42 | $('#context-menu-event').html(template); |
---|
[5746] | 43 | |
---|
| 44 | var method = function(value){ |
---|
| 45 | switch (value){ |
---|
| 46 | case "ocurrency": |
---|
| 47 | return '2' |
---|
| 48 | case "copy": |
---|
| 49 | return '1'; |
---|
| 50 | case "move": |
---|
| 51 | return '0'; |
---|
| 52 | } |
---|
| 53 | } |
---|
[5592] | 54 | |
---|
| 55 | $('#context-menu-event').find('li.menu-item').hover( |
---|
| 56 | function () { |
---|
| 57 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 58 | if($(this).hasClass('copy') || $(this).hasClass('move')) { |
---|
| 59 | |
---|
[5746] | 60 | $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( method($(this).attr('class').split(" ")[0])); |
---|
[5592] | 61 | $(this).parents().find('.calendar-copy-move').show(); |
---|
| 62 | |
---|
| 63 | } |
---|
| 64 | }, |
---|
| 65 | function () { |
---|
| 66 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 67 | if(!$(this).hasClass('copy') && !$(this).hasClass('move') ) |
---|
| 68 | $(this).parents().find('.calendar-copy-move').hide() |
---|
| 69 | } |
---|
| 70 | ); |
---|
| 71 | |
---|
| 72 | $('#context-menu-event').find('li.calendar-list').hover( |
---|
| 73 | function () { |
---|
| 74 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 75 | }, |
---|
| 76 | function () { |
---|
| 77 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 78 | } |
---|
| 79 | ); |
---|
| 80 | |
---|
| 81 | event.preventDefault(); |
---|
| 82 | }); |
---|
[6462] | 83 | } |
---|