| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <%@ page language="java" contentType="text/html; charset=utf-8"
- pageEncoding="utf-8"%>
- <%
- String path = request.getContextPath();
- String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
- %>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <link rel="stylesheet" type="text/css" href="<%=basePath %>resource/ext/4.2/resources/ext-theme-gray/ext-theme-gray-all.css"/>
- <link rel="stylesheet" href="<%=basePath %>resource/css/search.css" type="text/css"></link>
- <script type="text/javascript" src="<%=basePath %>resource/ext/4.2/ext-all.js"></script>
- <script type="text/javascript" src="<%=basePath %>resource/i18n/i18n.js"></script>
- <script type="text/javascript">
- // ghost
- Ext.example = function() {
- var b;
- function a(t, c, d) {
- return '<div class="msg x-message-box-' + t + '"><h3>' + c + "</h3><p>" + d + "</p></div>"
- }
- return {
- msg: function(t, g, e, y) {
- if (!b) {
- b = Ext.DomHelper.insertFirst(document.body, {
- id: "msg-div"
- }, true);
- }
- var d = Ext.String.format.apply(String, Array.prototype.slice.call(arguments, 2));
- var c = Ext.DomHelper.append(b, a((t || 'info'), g, d), true);
- c.hide();
- c.slideIn("t").ghost("t", {
- delay: y || 1000,
- remove: true
- });
- },
- init: function() {
- if (!b) {
- b = Ext.DomHelper.insertFirst(document.body, {
- id: "msg-div"
- }, true);
- }
- }
- };
- } ();
- Ext.onReady(Ext.example.init, Ext.example);
-
- // override remote queryStr length
- Ext.override(Ext.form.field.ComboBox, {
- beforeQuery: function(queryPlan) {
- var me = this;
- // Allow beforequery event to veto by returning false
- if (me.fireEvent('beforequery', queryPlan) === false) {
- queryPlan.cancel = true;
- }
- // Allow beforequery event to veto by returning setting the cancel flag
- else if (!queryPlan.cancel) {
- // If the minChars threshold has not been met, and we're not forcing an "all" query, cancel the query
- if (me.getCharLength(queryPlan.query) < me.minChars && !queryPlan.forceAll) {
- queryPlan.cancel = true;
- }
- }
- return queryPlan;
- },
- getCharLength: function(str) {
- for (var len = str.length, c = 0, i = 0; i < len; i++)
- str.charCodeAt(i) < 27 || str.charCodeAt(i) > 126 ? c += 2 : c++;
- return c;
- }
- });
- // override fieldset, toggle others when checked
- Ext.override(Ext.form.FieldSet, {
- onCheckChange: function(cmp, checked) {
- this.setExpanded(checked);
- if (checked) {
- var id = this.id, cmps = this.ownerCt.query('fieldset[name=' + this.name + ']');
- Ext.Array.each(cmps, function(c){
- if (c.id !== id)
- c.setExpanded(false);
- });
- }
- }
- });
- // split by regexp without remove
- String.prototype._split = function(regexp) {
- if (regexp instanceof RegExp) {
- var arr = this.split(""), _arr = [], temp = '';
- for (var i in arr) {
- if (regexp.test(arr[i])) {
- if (temp.length > 0)
- _arr.push(temp);
- _arr.push(arr[i]);
- temp = '';
- } else
- temp += arr[i];
- }
- if (temp.length > 0)
- _arr.push(temp);
- return _arr;
- }
- return this.split(regexp);
- };
- // Math functions
- Math._abs = function() {
- if(arguments.length != 1)
- throw new Error('wrong number of arguments, expected 1, acctually ' + arguments.length);
- return Math.abs(arguments[0]);
- };
- Math._ceil = function() {
- if(arguments.length != 1)
- throw new Error('wrong number of arguments, expected 1, acctually ' + arguments.length);
- return Math.ceil(arguments[0]);
- };
- Math._floor = function() {
- if(arguments.length != 1)
- throw new Error('wrong number of arguments, expected 1, acctually ' + arguments.length);
- return Math.floor(arguments[0]);
- };
- Math._round = function() {
- if(arguments.length != 1 && arguments.length != 2)
- throw new Error('wrong number of arguments, expected 1 or 2, acctually ' + arguments.length);
- var a = arguments[0], b = arguments[1] || 0;
- return Math.round(a*Math.pow(10,b))/Math.pow(10,b);
- };
- // test formula with eval
- Ext.Test = {};
- Ext.Test.eval = function(code){
- code = 'var abs=' + Math._abs + ',ceil=' + Math._ceil + ',floor=' + Math._floor + ',round=' + Math._round + ';' + code;
- if (Ext.isIE){
- return execScript(code);
- } else {
- return window.eval(code);
- }
- };
- //is number(Ext.isNumber doesn't work)
- var isNumber = function(n) {
- return !isNaN(parseFloat(n)) && isFinite(n);
- };
- //
- Ext.Loader.setConfig({
- enabled: true
- });//开启动态加载
- Ext.application({
- name: 'erp',//为应用程序起一个名字,相当于命名空间
- appFolder: '<%=basePath %>'+'app',//app文件夹所在路径
- controllers: [//声明所用到的控制层
- 'common.Search'
- ],
- launch: function() {
- Ext.create('erp.view.common.search.Viewport');
- }
- });
- var caller = getUrlParam('whoami');
- </script>
- </head>
- <body >
- </body>
- </html>
|