Advertisement
Guest User

Untitled

a guest
Mar 31st, 2014
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.74 KB | None | 0 0
  1. console.debug("Defining NOC.sa.INTERNET.Application");
  2.  
  3. Ext.define("NOC.sa.INTERNET.Application", {
  4. extend: "NOC.core.Application",
  5. requires: ["NOC.sa.managedobject.LookupField", "Ext.ux.form.UCField"],
  6. layout: { type: 'vbox', align: 'stretch' },
  7. border: 0,
  8. items : [{
  9. xtype: "container",
  10. items: [{
  11. xtype: 'form',
  12. border: 0,
  13. url: "/sa/INTERNET/",
  14. padding: 0,
  15. bodyPadding: 0,
  16. waitMsgTarget : true,
  17. defaults: {
  18. enableKeyEvents: true,
  19. listeners: {
  20. specialkey: function(field, key) {
  21. if (field.xtype != "textfield")
  22. return;
  23. var get_button = function(scope, name) {
  24. return scope.ownerCt.down("toolbar").getComponent(name);
  25. }
  26. switch(key.getKey()) {
  27. case Ext.EventObject.ENTER:
  28. var b = get_button(field, "prepare");
  29. key.stopEvent();
  30. b.handler.call(b);
  31. break;
  32. }
  33. }
  34. },
  35. xtype: "textfield",
  36. msgTarget : "side",
  37. size: 30
  38. },
  39. items: [
  40. {
  41. xtype: 'textfield',
  42. width: 400,
  43. margin: '10 0 4 20',
  44. fieldLabel: 'Customer',
  45. name: 'customer',
  46. emptyText: "Client name or any other info",
  47. regex: /^[ 0-9a-zA-Z_\-]*$/,
  48. invalidText: "Customer name must contains only 0-9,a-z,A-Z,'-','_'"
  49. },
  50. {
  51. xtype: 'textfield',
  52. name: 'project',
  53. width: 400,
  54. margin: '0 0 4 20',
  55. emptyText: "Project number, ex. 123456",
  56. regex: /^[0-9]*$/,
  57. fieldLabel: 'Project'
  58. },
  59. {
  60. xtype: 'fieldset',
  61. title: 'Billing',
  62. margin: '0 0 4 10',
  63. width: 450,
  64. items: [
  65. {
  66. xtype: 'textfield',
  67. name: 'bid',
  68. width: 400,
  69. margin: '0 0 4 0',
  70. regex: /^[0-9]*$/,
  71. emptyText: "Billing/Channel ID nubmer, ex. 123456",
  72. fieldLabel: 'Billing ID'
  73. },
  74. {
  75. xtype: 'textfield',
  76. name: 'login',
  77. width: 400,
  78. margin: '0 0 8 0',
  79. emptyText: "Login",
  80. regex: /^[0-9a-zA-Z]*$/,
  81. fieldLabel: 'Login'
  82. }
  83. ]
  84. },
  85. {
  86. xtype: 'textfield',
  87. name: 'speed',
  88. width: 400,
  89. margin: '0 0 4 20',
  90. fieldLabel: 'Speed'
  91. },
  92. {
  93. xtype: 'sa.managedobject.LookupField',
  94. name: 'managedobject',
  95. allowBlank: 1,
  96. margin: '0 0 4 20',
  97. fieldLabel: 'Managed object'
  98. },
  99. {
  100. xtype: 'button',
  101. text: 'GO',
  102. itemId: 'prepare',
  103. margin: '10 3 0 20',
  104. handler : function() {
  105. var form = this.up("form").getForm();
  106. form.submit({
  107. method: "POST",
  108. submitEmptyText : false,
  109. params : { __format: "ext" },
  110. waitMsg: "Wait",
  111. success: function(form, action) {
  112. form.owner.up("panel").down("textarea").setValue(action.result.config);
  113. }
  114. });
  115. }
  116. }]},
  117. {
  118. xtype: "textarea",
  119. name: 'config',
  120. margin: '10 0 4 20',
  121. fieldStyle: {"padding-left": "7px"},
  122. flex: 1
  123. }
  124.  
  125. ]
  126. }]
  127. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement