source: branches/2.4/prototype/modules/calendar/js/calendar.alarms.js @ 7228

Revision 7228, 1.5 KB checked in by douglas, 12 years ago (diff)

Ticket #0000 - Copiadas as alterações do Trunk. Versão final da 2.4.2.

  • 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                                window.focus();
30                                this.cancel();
31                        });
32
33                }else{
34
35                    var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';
36                    DataLayer.render(path+'templates/alarm.ejs',{
37                        event: eventDay
38                    }, function( html ){                               
39                        $.Zebra_Dialog(html , {
40                            'type':     'question',
41                            'overlay_opacity': '0.5',
42                            'buttons':  ['Fechar'],
43                            'onClose':  function(clicked) {}
44                        });
45                    });
46                }
47
48            });
49        }
50    }
51}
52Alarms.load();
Note: See TracBrowser for help on using the repository browser.