[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 | |
---|
[6533] | 28 | var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency || false; |
---|
| 29 | |
---|
| 30 | var top = $('#divAppbox').scrollTop(); |
---|
| 31 | |
---|
[5746] | 32 | var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id , |
---|
[6451] | 33 | top: (event.clientY - 135 + top), left: (event.clientX - 445), |
---|
[6533] | 34 | signature: Calendar.signatureOf[idCalendar], |
---|
| 35 | calendars: Calendar.calendars, isRecurrence: (!isRecurrence || isRecurrence == 'none') ? false : true, |
---|
[5746] | 36 | idRecurrence: idRecurrence |
---|
| 37 | }); |
---|
[6533] | 38 | |
---|
[5592] | 39 | $('#context-menu-event').html(template); |
---|
[6533] | 40 | |
---|
[5746] | 41 | var method = function(value){ |
---|
| 42 | switch (value){ |
---|
| 43 | case "ocurrency": |
---|
| 44 | return '2' |
---|
| 45 | case "copy": |
---|
| 46 | return '1'; |
---|
| 47 | case "move": |
---|
| 48 | return '0'; |
---|
| 49 | } |
---|
| 50 | } |
---|
[5592] | 51 | |
---|
| 52 | $('#context-menu-event').find('li.menu-item').hover( |
---|
| 53 | function () { |
---|
| 54 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 55 | if($(this).hasClass('copy') || $(this).hasClass('move')) { |
---|
| 56 | |
---|
[5746] | 57 | $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( method($(this).attr('class').split(" ")[0])); |
---|
[5592] | 58 | $(this).parents().find('.calendar-copy-move').show(); |
---|
| 59 | |
---|
| 60 | } |
---|
| 61 | }, |
---|
| 62 | function () { |
---|
| 63 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 64 | if(!$(this).hasClass('copy') && !$(this).hasClass('move') ) |
---|
| 65 | $(this).parents().find('.calendar-copy-move').hide() |
---|
| 66 | } |
---|
| 67 | ); |
---|
| 68 | |
---|
| 69 | $('#context-menu-event').find('li.calendar-list').hover( |
---|
| 70 | function () { |
---|
| 71 | $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); |
---|
| 72 | }, |
---|
| 73 | function () { |
---|
| 74 | $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover'); |
---|
| 75 | } |
---|
| 76 | ); |
---|
| 77 | |
---|
| 78 | event.preventDefault(); |
---|
| 79 | }); |
---|
| 80 | } |
---|