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.

158 lines
5.3 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.ns('Ext.samples');
  8. (function() {
  9. SamplePanel = Ext.extend(Ext.DataView, {
  10. autoHeight : true,
  11. frame : true,
  12. cls : 'demos',
  13. itemSelector : 'dd',
  14. overClass : 'over',
  15. tpl : new Ext.XTemplate(
  16. '<div id="sample-ct">',
  17. '<tpl for=".">',
  18. '<div><a name="{id}"></a><h2><div>{title}</div></h2>',
  19. '<dl>',
  20. '<tpl for="samples">',
  21. '<dd ext:url="{url}"><img src="shared/screens/{icon}"/>',
  22. '<div><h4>{text}',
  23. '<tpl if="this.isNew(values.status)">',
  24. '<span class="new-sample"> (New)</span>',
  25. '</tpl>',
  26. '<tpl if="this.isUpdated(values.status)">',
  27. '<span class="updated-sample"> (Updated)</span>',
  28. '</tpl>',
  29. '<tpl if="this.isExperimental(values.status)">',
  30. '<span class="new-sample"> (Experimental)</span>',
  31. '</tpl>',
  32. '</h4><p>{desc}</p></div>',
  33. '</dd>',
  34. '</tpl>',
  35. '<div style="clear:left"></div></dl></div>',
  36. '</tpl>',
  37. '</div>', {
  38. isExperimental: function(status){
  39. return status == 'experimental';
  40. },
  41. isNew: function(status){
  42. return status == 'new';
  43. },
  44. isUpdated: function(status){
  45. return status == 'updated';
  46. }
  47. }),
  48. onClick : function(e){
  49. var group = e.getTarget('h2', 3, true);
  50. if(group){
  51. group.up('div').toggleClass('collapsed');
  52. }else {
  53. var t = e.getTarget('dd', 5, true);
  54. if(t && !e.getTarget('a', 2)){
  55. var url = t.getAttributeNS('ext', 'url');
  56. window.open(url);
  57. }
  58. }
  59. return SamplePanel.superclass.onClick.apply(this, arguments);
  60. }
  61. });
  62. Ext.samples.SamplePanel = SamplePanel;
  63. Ext.reg('samplespanel', Ext.samples.SamplePanel);
  64. })();
  65. Ext.onReady(function() {
  66. (function() {
  67. // Instantiate Ext.App instance
  68. App = new Ext.App({});
  69. var catalog = Ext.samples.samplesCatalog;
  70. for (var i = 0, c; c = catalog[i]; i++) {
  71. c.id = 'sample-' + i;
  72. }
  73. var store = new Ext.data.JsonStore({
  74. idProperty : 'id',
  75. fields : ['id', 'title', 'samples'],
  76. data : catalog
  77. });
  78. var panel = new Ext.Panel({
  79. frame : true,
  80. renderTo : Ext.get('all-demos'),
  81. height : 300,
  82. autoScroll : true,
  83. items : new SamplePanel({
  84. store : store
  85. })
  86. });
  87. var tpl = new Ext.XTemplate(
  88. '<tpl for="."><li><a href="#{id}">{title:stripTags}</a></li></tpl>'
  89. );
  90. tpl.overwrite('sample-menu', catalog);
  91. Ext.select('#sample-spacer').remove();
  92. var headerEl = Ext.get('hd'),
  93. footerEl = Ext.get('ft'),
  94. bodyEl = Ext.get('bd'),
  95. sideBoxEl = bodyEl.child('div[class=side-box]'),
  96. titleEl = bodyEl.child('h1#pagetitle');
  97. var doResize = function() {
  98. var windowHeight = Ext.getDoc().getViewSize(false).height;
  99. var footerHeight = footerEl.getHeight() + footerEl.getMargins().top,
  100. titleElHeight = titleEl.getHeight() + titleEl.getMargins().top,
  101. headerHeight = headerEl.getHeight() + titleElHeight;
  102. var warnEl = Ext.get('fb');
  103. var warnHeight = warnEl ? warnEl.getHeight() : 0;
  104. var availHeight = windowHeight - ( footerHeight + headerHeight + 14) - warnHeight;
  105. var sideBoxHeight = sideBoxEl.getHeight();
  106. panel.setHeight((availHeight > sideBoxHeight) ? availHeight : sideBoxHeight);
  107. };
  108. // Resize on demand
  109. Ext.EventManager.onWindowResize(doResize);
  110. var firebugWarning = function () {
  111. var cp = new Ext.state.CookieProvider();
  112. if(window.console && window.console.firebug && ! cp.get('hideFBWarning')){
  113. var tpl = new Ext.Template(
  114. '<div id="fb" style="border: 1px solid #FF0000; background-color:#FFAAAA; display:none; padding:15px; color:#000000;"><b>Warning: </b> Firebug is known to cause performance issues with Ext JS. <a href="#" id="hideWarning">[ Hide ]</a></div>'
  115. );
  116. var newEl = tpl.insertFirst('all-demos');
  117. Ext.fly('hideWarning').on('click', function() {
  118. Ext.fly(newEl).slideOut('t',{remove:true});
  119. cp.set('hideFBWarning', true);
  120. doResize();
  121. });
  122. Ext.fly(newEl).slideIn();
  123. doResize();
  124. }
  125. };
  126. var hideMask = function () {
  127. Ext.get('loading').remove();
  128. Ext.fly('loading-mask').fadeOut({
  129. remove:true,
  130. callback : firebugWarning
  131. });
  132. };
  133. hideMask.defer(250);
  134. doResize();
  135. }).defer(500);
  136. });