source: trunk/prototype/modules/calendar/js/calendar.contentMenu.js @ 5746

Revision 5746, 2.7 KB checked in by acoutinho, 12 years ago (diff)

Ticket #2434 - Suporte copia/edicao/remocao de ocorrencias de repeticao

Line 
1function 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();
8               
9                var classes = $(this).attr('class').split(" ");
10                var idEvent = false;
11                var idRecurrence = false;
12               
13                //recupera o id do calendar eo id do evento para tratamento
14                for(var i = 0; i < classes.length; i++){
15                    if (classes[i].indexOf("event-id-") >= 0 ){
16                        idEvent = classes[i].replace(/[a-zA-Z-]+/g, '');
17                        continue;
18                    }else if (classes[i].indexOf("Recurrence-id-") >= 0 ){
19                        idRecurrence = classes[i].replace(/[a-zA-Z-]+/g, '');
20                        continue;
21                    }
22                }
23
24                var schedulable = DataLayer.get('schedulable', idEvent);
25               
26                var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id ,
27                    top: (event.clientY - 135), left: (event.clientX - 445),
28                    signature: Calendar.signatureOf[schedulable.calendar],
29                    calendars: Calendar.calendars, isRecurrence: (!!parseInt(schedulable.repeat)),
30                    idRecurrence: idRecurrence
31                });
32               
33                $('#context-menu-event').html(template);
34               
35                var method = function(value){
36                    switch (value){
37                        case "ocurrency":
38                            return '2'
39                        case "copy":
40                            return '1';
41                        case "move":
42                            return '0';
43                    }
44                }
45               
46                $('#context-menu-event').find('li.menu-item').hover(
47                        function () {
48                                $(this).addClass("li-hover").find('a').addClass('ui-state-hover');
49                                if($(this).hasClass('copy') || $(this).hasClass('move')) {
50                                       
51                                        $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( method($(this).attr('class').split(" ")[0]));
52                                        $(this).parents().find('.calendar-copy-move').show();
53                               
54                                }       
55                        },
56                        function () {
57                                $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover');
58                                if(!$(this).hasClass('copy') && !$(this).hasClass('move') )
59                                        $(this).parents().find('.calendar-copy-move').hide()
60                        }
61                );     
62               
63                $('#context-menu-event').find('li.calendar-list').hover(
64                        function () {
65                                $(this).addClass("li-hover").find('a').addClass('ui-state-hover');
66                        },
67                        function () {
68                                $(this).removeClass("li-hover").find('a').removeClass('ui-state-hover');
69                        }
70                );     
71       
72                event.preventDefault();
73        });
74}
Note: See TracBrowser for help on using the repository browser.