+++ /dev/null
-<html>\r
-<head>\r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js">// Grid column plugin that does the complete/active button in the left-most column\r
-CompleteColumn = function(){\r
- var grid;\r
-\r
- function getRecord(t){\r
- var index = grid.getView().findRowIndex(t);\r
- return grid.store.getAt(index);\r
- }\r
-\r
- function onMouseDown(e, t){\r
- if(Ext.fly(t).hasClass('task-check')){\r
- e.stopEvent();\r
- var record = getRecord(t);\r
- record.set('completed', !record.data.completed);\r
- grid.store.applyFilter();\r
- }\r
- }\r
-\r
- function onMouseOver(e, t){\r
- if(Ext.fly(t).hasClass('task-check')){\r
- Ext.fly(t.parentNode).addClass('task-check-over');\r
- }\r
- }\r
-\r
- function onMouseOut(e, t){\r
- if(Ext.fly(t).hasClass('task-check')){\r
- Ext.fly(t.parentNode).removeClass('task-check-over');\r
- }\r
- }\r
-\r
- Ext.apply(this, {\r
- width: 22,\r
- header: '<div class="task-col-hd"></div>',\r
- fixed: true,\r
- menuDisabled: true,\r
- id: 'task-col',\r
- renderer: function(){\r
- return '<div class="task-check"></div>';\r
- },\r
- init : function(xg){\r
- grid = xg;\r
- grid.on('render', function(){\r
- var view = grid.getView();\r
- view.mainBody.on('mousedown', onMouseDown);\r
- view.mainBody.on('mouseover', onMouseOver);\r
- view.mainBody.on('mouseout', onMouseOut);\r
- });\r
- }\r
- });\r
-};\r
-\r
-\r
-ReminderColumn = function(){\r
- var grid, menu, record;\r
-\r
- function getRecord(t){\r
- var index = grid.getView().findRowIndex(t);\r
- return grid.store.getAt(index);\r
- }\r
- \r
- function onMenuCheck(item){\r
- if(item.reminder === false){\r
- record.set('reminder', '');\r
- }else{\r
- var s = record.data.dueDate ? record.data.dueDate.clearTime(true) : new Date().clearTime();\r
- s = s.add('mi', Ext.state.Manager.get('defaultReminder'));\r
- s = s.add('mi', item.reminder*-1);\r
- record.set('reminder', s);\r
- }\r
- }\r
-\r
- function getMenu(){\r
- if(!menu){\r
- menu = new Ext.menu.Menu({\r
- plain: true,\r
- items: [{\r
- text: 'No Reminder',\r
- reminder: false,\r
- handler: onMenuCheck\r
- },'-',{\r
- text: 'On the Due Date',\r
- reminder: 0,\r
- handler: onMenuCheck\r
- },'-',{\r
- text: '1 day before',\r
- reminder: 24*60,\r
- handler: onMenuCheck\r
- },{\r
- text: '2 days before',\r
- reminder: 48*60,\r
- handler: onMenuCheck\r
- },{\r
- text: '3 days before',\r
- reminder: 72*60,\r
- handler: onMenuCheck\r
- },{\r
- text: '1 week before',\r
- reminder: 7*24*60,\r
- handler: onMenuCheck\r
- },{\r
- text: '2 weeks before',\r
- reminder: 14*24*60,\r
- handler: onMenuCheck\r
- },'-',{\r
- text: 'Set Default Time...',\r
- handler: function(){\r
- Ext.air.NativeWindowManager.getPrefWindow();\r
- }\r
- }]\r
- });\r
- }\r
- return menu;\r
- }\r
-\r
- function onMouseDown(e, t){\r
- if(Ext.fly(t).hasClass('reminder')){\r
- e.stopEvent();\r
- record = getRecord(t);\r
- if (!record.data.completed) {\r
- var rmenu = getMenu();\r
- rmenu.show(t, 'tr-br?');\r
- }\r
- }\r
- }\r
-\r
- function onMouseOver(e, t){\r
- if(Ext.fly(t).hasClass('reminder')){\r
- Ext.fly(t.parentNode).addClass('reminder-over');\r
- }\r
- }\r
-\r
- function onMouseOut(e, t){\r
- if(Ext.fly(t).hasClass('reminder')){\r
- Ext.fly(t.parentNode).removeClass('reminder-over');\r
- }\r
- }\r
-\r
- Ext.apply(this, {\r
- width: 26,\r
- header: '<div class="reminder-col-hd"></div>',\r
- fixed: true,\r
- id: 'reminder-col',\r
- menuDisabled: true,\r
- dataIndex:'reminder',\r
- renderer: function(v){\r
- return '<div class="reminder '+(v ? 'reminder-active' : '')+'"></div>';\r
- },\r
- init : function(xg){\r
- grid = xg;\r
- grid.on('render', function(){\r
- var view = grid.getView();\r
- view.mainBody.on('contextmenu', onMouseDown);\r
- view.mainBody.on('mousedown', onMouseDown);\r
- view.mainBody.on('mouseover', onMouseOver);\r
- view.mainBody.on('mouseout', onMouseOut);\r
- });\r
- }\r
- });\r
-};</pre> \r
-</body>\r
-</html>
\ No newline at end of file