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.

147 lines
5.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. /**
  16. * @class Ext.Template
  17. */
  18. Ext.apply(Ext.Template.prototype, {
  19. <div id="cfg-Ext.Template-disableFormats"></div>/**
  20. * @cfg {Boolean} disableFormats Specify <tt>true</tt> to disable format
  21. * functions in the template. If the template does not contain
  22. * {@link Ext.util.Format format functions}, setting <code>disableFormats</code>
  23. * to true will reduce <code>{@link #apply}</code> time. Defaults to <tt>false</tt>.
  24. * <pre><code>
  25. var t = new Ext.Template(
  26. '&lt;div name="{id}"&gt;',
  27. '&lt;span class="{cls}"&gt;{name} {value}&lt;/span&gt;',
  28. '&lt;/div&gt;',
  29. {
  30. compiled: true, // {@link #compile} immediately
  31. disableFormats: true // reduce <code>{@link #apply}</code> time since no formatting
  32. }
  33. );
  34. * </code></pre>
  35. * For a list of available format functions, see {@link Ext.util.Format}.
  36. */
  37. disableFormats : false,
  38. <div id="prop-Ext.Template-disableFormats"></div>/**
  39. * See <code>{@link #disableFormats}</code>.
  40. * @type Boolean
  41. * @property disableFormats
  42. */
  43. <div id="prop-Ext.Template-re"></div>/**
  44. * The regular expression used to match template variables
  45. * @type RegExp
  46. * @property
  47. * @hide repeat doc
  48. */
  49. re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
  50. argsRe : /^\s*['"](.*)["']\s*$/,
  51. compileARe : /\\/g,
  52. compileBRe : /(\r\n|\n)/g,
  53. compileCRe : /'/g,
  54. <div id="method-Ext.Template-applyTemplate"></div>/**
  55. * Returns an HTML fragment of this template with the specified values applied.
  56. * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
  57. * @return {String} The HTML fragment
  58. * @hide repeat doc
  59. */
  60. applyTemplate : function(values){
  61. var me = this,
  62. useF = me.disableFormats !== true,
  63. fm = Ext.util.Format,
  64. tpl = me;
  65. if(me.compiled){
  66. return me.compiled(values);
  67. }
  68. function fn(m, name, format, args){
  69. if (format && useF) {
  70. if (format.substr(0, 5) == "this.") {
  71. return tpl.call(format.substr(5), values[name], values);
  72. } else {
  73. if (args) {
  74. // quoted values are required for strings in compiled templates,
  75. // but for non compiled we need to strip them
  76. // quoted reversed for jsmin
  77. var re = me.argsRe;
  78. args = args.split(',');
  79. for(var i = 0, len = args.length; i < len; i++){
  80. args[i] = args[i].replace(re, "$1");
  81. }
  82. args = [values[name]].concat(args);
  83. } else {
  84. args = [values[name]];
  85. }
  86. return fm[format].apply(fm, args);
  87. }
  88. } else {
  89. return values[name] !== undefined ? values[name] : "";
  90. }
  91. }
  92. return me.html.replace(me.re, fn);
  93. },
  94. <div id="method-Ext.Template-compile"></div>/**
  95. * Compiles the template into an internal function, eliminating the RegEx overhead.
  96. * @return {Ext.Template} this
  97. * @hide repeat doc
  98. */
  99. compile : function(){
  100. var me = this,
  101. fm = Ext.util.Format,
  102. useF = me.disableFormats !== true,
  103. sep = Ext.isGecko ? "+" : ",",
  104. body;
  105. function fn(m, name, format, args){
  106. if(format && useF){
  107. args = args ? ',' + args : "";
  108. if(format.substr(0, 5) != "this."){
  109. format = "fm." + format + '(';
  110. }else{
  111. format = 'this.call("'+ format.substr(5) + '", ';
  112. args = ", values";
  113. }
  114. }else{
  115. args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
  116. }
  117. return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
  118. }
  119. // branched to use + in gecko and [].join() in others
  120. if(Ext.isGecko){
  121. body = "this.compiled = function(values){ return '" +
  122. me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn) +
  123. "';};";
  124. }else{
  125. body = ["this.compiled = function(values){ return ['"];
  126. body.push(me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn));
  127. body.push("'].join('');};");
  128. body = body.join('');
  129. }
  130. eval(body);
  131. return me;
  132. },
  133. // private function used to call members
  134. call : function(fnName, value, allValues){
  135. return this[fnName](value, allValues);
  136. }
  137. });
  138. Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
  139. </pre>
  140. </body>
  141. </html>