source: sandbox/2.4.2-expresso1/prototype/modules/calendar/js/calendar.alarms.js @ 6788

Revision 6788, 1.5 KB checked in by acoutinho, 12 years ago (diff)

Ticket #2951 - Correcoes de bugs e melhorias e finalizacao de codificacao

  • Property svn:executable set to *
Line 
1Alarms = {
2    load: function(){
3        var eventsDay = DataLayer.get('alarm:schedulable',['=', 'date', Date.today().getTime()]);
4        if(eventsDay)
5            for(var i = 0; i < eventsDay.length; i++){
6                this.addAlarm( eventsDay[i] );
7            }
8    },
9
10    addAlarm: function( eventDay ){           
11        if(!DataLayer.tasks[parseInt(eventDay.sendTime)]){
12            DataLayer.task( parseInt(eventDay.sendTime) , function( timestamp ){
13
14                if(!activePage && useDesktopNotification() && desktopNotification.verifyComplement()){
15
16                    desktopNotification.sentNotification(
17                        '../expressoCalendar/templates/default/images/navbar.png',
18                        'Você possui um compromisso agendado:',
19                        eventDay.event_start + ' ' + eventDay.schedulable.startTime + ' - ' + eventDay.schedulable.summary
20                        );
21
22                /* TODO
23                    var onClose = function(){
24                        if(window.location.pathname.indexoOf('expressoCalendar') >= 0)
25                            window.location = url_host + '/expressoCalendar';
26                    };
27                */
28                    desktopNotification.showNotification(false, function(){
29                            console.log('nice');
30                                window.focus();
31                                this.cancel();
32                        });
33
34                }else{
35
36                    var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';
37                    DataLayer.render(path+'templates/alarm.ejs',{
38                        event: eventDay
39                    }, function( html ){                               
40                        $.Zebra_Dialog(html , {
41                            'type':     'question',
42                            'overlay_opacity': '0.5',
43                            'buttons':  ['Fechar'],
44                            'onClose':  function(clicked) {}
45                        });
46                    });
47                }
48
49            });
50        }
51    }
52}
53Alarms.load();
Note: See TracBrowser for help on using the repository browser.