3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">// Unique task ids, if the time isn't unique enough, the addition
\r
9 // of random chars should be
\r
10 Ext.uniqueId = function(){
\r
11 var t = String(new Date().getTime()).substr(4);
\r
12 var s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
\r
13 for(var i = 0; i < 4; i++){
\r
14 t += s.charAt(Math.floor(Math.random()*26));
\r
19 // Define the Task data type
\r
20 tx.data.Task = Ext.data.Record.create([
\r
21 {name: 'taskId', type:'string'},
\r
22 {name: 'listId', type:'string'},
\r
23 {name: 'title', type:'string'},
\r
24 {name: 'description', type:'string'},
\r
25 {name: 'dueDate', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
\r
26 {name: 'completed', type:'boolean'},
\r
27 {name: 'completedDate', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''},
\r
28 {name: 'reminder', type:'date', dateFormat: Ext.sql.Proxy.DATE_FORMAT, defaultValue: ''}
\r
31 // Define the List data type
\r
32 tx.data.List = Ext.data.Record.create([
\r
33 {name: 'listId', type:'string'},
\r
34 {name: 'parentId', type:'string'},
\r
35 {name: 'listName', type:'string'},
\r
36 {name: 'isFolder', type:'boolean'}
\r
39 tx.data.conn = Ext.sql.Connection.getInstance();
\r
41 tx.data.tasks = new tx.data.TaskStore();
\r
42 tx.data.lists = new tx.data.ListStore();
\r
45 tx.data.getDefaultReminder = function(task){
\r
46 var s = task.data.dueDate ? task.data.dueDate.clearTime(true) : new Date().clearTime();
\r
47 s = s.add('mi', Ext.state.Manager.get('defaultReminder'));
\r
52 tx.data.getActiveListId = function(){
\r
53 var id = tx.data.tasks.activeList;
\r
55 var first = tx.data.lists.getAt(0);
\r
59 id = tx.data.lists.newList().id;
\r