~crf-team/crf-irp/crf-irp

« back to all changes in this revision

Viewing changes to WebContent/js/extjs-2/air/samples/tasks/reminder.js

  • Committer: Thomas
  • Date: 2010-03-10 23:55:46 UTC
  • Revision ID: thomas@daisybox-port-20100310235546-23635dk6x5asb1ca
Upgrade ExtJs 3.1.1
Upgrade Spring 3.0.1 + dependencies
Change Jawr JS post processor : YUI
Upgrade to last build of dwr 3 trunk 69 revision 3019(after build 116), upgrade jawr-dwr plugin 1.4 unofficiale from jose noheda, Jawr 3.2.1

Show diffs side-by-side

added added

removed removed

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