Web Interface For Lite Argus Control modules
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
2.0 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*!
  2. * Ext JS Library 3.3.1
  3. * Copyright(c) 2006-2010 Sencha Inc.
  4. * licensing@sencha.com
  5. * http://www.sencha.com/license
  6. */
  7. Ext.onReady(function(){
  8. var xd = Ext.data;
  9. var store = new Ext.data.JsonStore({
  10. url: 'get-images.php',
  11. root: 'images',
  12. fields: ['name', 'url', {name:'size', type: 'float'}, {name:'lastmod', type:'date', dateFormat:'timestamp'}]
  13. });
  14. store.load();
  15. var tpl = new Ext.XTemplate(
  16. '<tpl for=".">',
  17. '<div class="thumb-wrap" id="{name}">',
  18. '<div class="thumb"><img src="{url}" title="{name}"></div>',
  19. '<span class="x-editable">{shortName}</span></div>',
  20. '</tpl>',
  21. '<div class="x-clear"></div>'
  22. );
  23. var panel = new Ext.Panel({
  24. id:'images-view',
  25. frame:true,
  26. width:535,
  27. autoHeight:true,
  28. collapsible:true,
  29. layout:'fit',
  30. title:'Simple DataView (0 items selected)',
  31. items: new Ext.DataView({
  32. store: store,
  33. tpl: tpl,
  34. autoHeight:true,
  35. multiSelect: true,
  36. overClass:'x-view-over',
  37. itemSelector:'div.thumb-wrap',
  38. emptyText: 'No images to display',
  39. plugins: [
  40. new Ext.DataView.DragSelector(),
  41. new Ext.DataView.LabelEditor({dataIndex: 'name'})
  42. ],
  43. prepareData: function(data){
  44. data.shortName = Ext.util.Format.ellipsis(data.name, 15);
  45. data.sizeString = Ext.util.Format.fileSize(data.size);
  46. data.dateString = data.lastmod.format("m/d/Y g:i a");
  47. return data;
  48. },
  49. listeners: {
  50. selectionchange: {
  51. fn: function(dv,nodes){
  52. var l = nodes.length;
  53. var s = l != 1 ? 's' : '';
  54. panel.setTitle('Simple DataView ('+l+' item'+s+' selected)');
  55. }
  56. }
  57. }
  58. })
  59. });
  60. panel.render(document.body);
  61. });