reminder_wev8.js
1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Ext JS Library 0.20
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
Ext.onReady(function(){
var win = window.nativeWindow;
var opener = Ext.air.NativeWindow.getRootHtmlWindow();
var taskId = String(window.location).split('=')[1];
var store = opener.tx.data.tasks;
var task = store.lookup(taskId);
win.title = 'Reminder - ' + Ext.util.Format.ellipsis(task.data.title, 40);
bulkUpdate({
'task-title' : Ext.util.Format.ellipsis(task.data.title, 80),
'task-due' : task.data.dueDate ? task.data.dueDate.format('F d, Y') : 'None'
});
function bulkUpdate(o){
for(var id in o){
Ext.fly(id).update(o[id]);
}
}
var dismiss = new Ext.Button({
text: 'Dismiss',
minWidth: 80,
renderTo: 'btns',
handler: function(){
win.close();
}
});
var snooze = new Ext.Button({
text: 'Snooze',
minWidth: 80,
renderTo: 'btns',
handler: function(){
var min = parseInt(Ext.get('snooze-time').getValue(), 10);
var reminder = new Date().add('mi', min);
var o = store.getById(taskId);
if(o){
o.set('reminder', reminder);
}else{
store.proxy.table.updateBy({reminder: reminder}, 'where taskId = ?', [taskId]);
}
win.close();
}
});
win.visible = true;
win.activate();
win.notifyUser('informational');
Ext.air.Sound.play('beep.mp3', 10500);
});