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.

112 lines
3.6 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. Ext.get('mb1').on('click', function(e){
  9. Ext.MessageBox.confirm('Confirm', 'Are you sure you want to do that?', showResult);
  10. });
  11. Ext.get('mb2').on('click', function(e){
  12. Ext.MessageBox.prompt('Name', 'Please enter your name:', showResultText);
  13. });
  14. Ext.get('mb3').on('click', function(e){
  15. Ext.MessageBox.show({
  16. title: 'Address',
  17. msg: 'Please enter your address:',
  18. width:300,
  19. buttons: Ext.MessageBox.OKCANCEL,
  20. multiline: true,
  21. fn: showResultText,
  22. animEl: 'mb3'
  23. });
  24. });
  25. Ext.get('mb4').on('click', function(e){
  26. Ext.MessageBox.show({
  27. title:'Save Changes?',
  28. msg: 'You are closing a tab that has unsaved changes. <br />Would you like to save your changes?',
  29. buttons: Ext.MessageBox.YESNOCANCEL,
  30. fn: showResult,
  31. animEl: 'mb4',
  32. icon: Ext.MessageBox.QUESTION
  33. });
  34. });
  35. Ext.get('mb6').on('click', function(){
  36. Ext.MessageBox.show({
  37. title: 'Please wait',
  38. msg: 'Loading items...',
  39. progressText: 'Initializing...',
  40. width:300,
  41. progress:true,
  42. closable:false,
  43. animEl: 'mb6'
  44. });
  45. // this hideous block creates the bogus progress
  46. var f = function(v){
  47. return function(){
  48. if(v == 12){
  49. Ext.MessageBox.hide();
  50. Ext.example.msg('Done', 'Your fake items were loaded!');
  51. }else{
  52. var i = v/11;
  53. Ext.MessageBox.updateProgress(i, Math.round(100*i)+'% completed');
  54. }
  55. };
  56. };
  57. for(var i = 1; i < 13; i++){
  58. setTimeout(f(i), i*500);
  59. }
  60. });
  61. Ext.get('mb7').on('click', function(){
  62. Ext.MessageBox.show({
  63. msg: 'Saving your data, please wait...',
  64. progressText: 'Saving...',
  65. width:300,
  66. wait:true,
  67. waitConfig: {interval:200},
  68. icon:'ext-mb-download', //custom class in msg-box.html
  69. animEl: 'mb7'
  70. });
  71. setTimeout(function(){
  72. //This simulates a long-running operation like a database save or XHR call.
  73. //In real code, this would be in a callback function.
  74. Ext.MessageBox.hide();
  75. Ext.example.msg('Done', 'Your fake data was saved!');
  76. }, 8000);
  77. });
  78. Ext.get('mb8').on('click', function(){
  79. Ext.MessageBox.alert('Status', 'Changes saved successfully.', showResult);
  80. });
  81. //Add these values dynamically so they aren't hard-coded in the html
  82. Ext.fly('info').dom.value = Ext.MessageBox.INFO;
  83. Ext.fly('question').dom.value = Ext.MessageBox.QUESTION;
  84. Ext.fly('warning').dom.value = Ext.MessageBox.WARNING;
  85. Ext.fly('error').dom.value = Ext.MessageBox.ERROR;
  86. Ext.get('mb9').on('click', function(){
  87. Ext.MessageBox.show({
  88. title: 'Icon Support',
  89. msg: 'Here is a message with an icon!',
  90. buttons: Ext.MessageBox.OK,
  91. animEl: 'mb9',
  92. fn: showResult,
  93. icon: Ext.get('icons').dom.value
  94. });
  95. });
  96. function showResult(btn){
  97. Ext.example.msg('Button Click', 'You clicked the {0} button', btn);
  98. };
  99. function showResultText(btn, text){
  100. Ext.example.msg('Button Click', 'You clicked the {0} button and entered the text "{1}".', btn, text);
  101. };
  102. });