/* */ // 2013/05/23 現地時刻対応(3.12) NECSL.PIAO BEGIN Ext.namespace('procenter.common'); procenter.common.fullPattern = 'Y-m-d H:i:s:u'; procenter.common.datetimePattern = 'Y-m-d H:i:s'; procenter.common.datePattern = 'Y-m-d'; // 2013/05/23 現地時刻対応(3.12) NECSL.PIAO END // アプリケーション名の定義 applicationName = '/gdex'; // Ajaxリクエストのタイムアウト時間の設定 Ext.Ajax.timeout = '300000'; procenter.common.exceptionWin = null; // WINDOWリロード処理 (JsNltNodeList.jspで使用) windowReloadCount = 0; // Ajaxリクエスト例外処理 Ext.Ajax.on('requestexception', function(conn, response, options) { procenter.common.UnMaskFullScreen(); if (response.status == 900) { // 2015/07/06 [1502-04] NECSL.cai BEGIN var isNumber = /^\d+$/.test(procenter.common.dispatchId); if (isNumber) { detailurl = '/m.do?i='; procenter.common.redirect(applicationName + detailurl + procenter.common.dispatchId); } else { procenter.common.redirect(applicationName + procenter.common.timeoutforward); } // 2015/07/06 [1502-04] NECSL.cai END } else { // マスクがかかっていれば解除する。 procenter.common.UnMaskForceFullScreen(); if(procenter.common.exceptionWin == null){ procenter.common.exceptionWin = new procenter.common.BaseWindow({ title: 'エラーが発生しました。', layout: 'fit', modal: true, monitorValid: true, width: 500, height: 200, closeAction :'destroy', closable: true, maximizable: true, constrain: true, resizable: true, plain: true, border: false, items:[{ xtype: 'panel', id:'test1', layout: 'fit', autoScroll: true, items:[{ xtype: 'panel', id: 'errorWindowPanel', layout: 'fit', cls: 'exceptionMessageArea', autoScroll: true }] }], buttons:[{ text: '閉じる', handler: function(){ procenter.common.exceptionWin.close(); } }], listeners : { destroy : function ( comp ) { //close:function( panel ){ // 閉じる、closableボタンを押下した時 procenter.common.exceptionWin = null; } } }); } // procenter.common.exceptionWin.show(); var msg = ''; var title = ''; var dateStr = procenter.common.getSysdate(); if (response.status == 901) { msg = Ext.util.Format.htmlEncode(response.responseText); procenter.common.exceptionWin.show(); } else if (response.status == 902) { msg = '想定外の問題です。'; msg += ' ' + Ext.util.Format.htmlEncode(response.responseText); procenter.common.exceptionWin.show(); } else if (response.status == 903) { msg = '致命的な問題です。'; msg += ' ' + Ext.util.Format.htmlEncode(response.responseText); procenter.common.exceptionWin.show(); } else if (response.status == 0) { msg = 'サーバに接続できません。再実行してください。' + ' (' + dateStr + ')'; // 2013/12/04 IE11対応 (1303-33) NECSL.Zhangy BEGIN // if(Ext.isIE) { if(Ext.isIE || Ext.isIE11) { // 2013/12/04 IE11対応 (1303-33) NECSL.Zhangy END procenter.common.exceptionWin.show(); } } else { msg = Ext.util.Format.htmlEncode(response.statusText); procenter.common.exceptionWin.show(); } var msgData = { title: title, status: response.status, contents: msg, date: dateStr } var exceptionTpl = new Ext.XTemplate( '
', '
', '{title}', '

{status} {contents}', '
', '
' ); exceptionTpl.overwrite(Ext.get('errorWindowPanel'), msgData); //Ext.get('errorWindowPanel').update(msg); Ext.get('errorWindowPanel').applyStyles('height:100%'); } }); // TODO Extサンプルで利用するパッケージ名は、元のパッケージに戻す // (FileUploadField 済み) Ext.namespace('procenter.common'); /* --------------------------------------------------------------------- */ /* --------------------- Public methods ------------------------------- */ /* --------------------------------------------------------------------- */ procenter.common.ARegistMenuVisible = true; procenter.common.ARegistWindowVisible = true; procenter.common.ARegistVisible = function() { if (procenter.common.ARegistWindowVisible && procenter.common.ARegistMenuVisible) { if (Ext.get('ARegistMulti')) { Ext.get('ARegistMulti').dom.style.visibility = 'visible'; } var num = 0; while (Ext.get('ARegistSingle_' + num)) { Ext.get('ARegistSingle_' + num).dom.style.visibility = 'visible'; num++; } } else { if (Ext.get('ARegistMulti')) { Ext.get('ARegistMulti').dom.style.visibility = 'hidden'; } var num = 0; while (Ext.get('ARegistSingle_' + num)) { Ext.get('ARegistSingle_' + num).dom.style.visibility = 'hidden'; num++; } } } procenter.common.TreeMenu = Ext.extend(Ext.menu.Menu, { listeners:{ beforeshow : function(component) { procenter.common.ARegistMenuVisible = false; procenter.common.ARegistVisible(); }, hide : function(component) { procenter.common.ARegistMenuVisible = true; procenter.common.ARegistVisible(); } } }); procenter.common.MenuItem = Ext.extend(Ext.menu.Item, { hideDelay: 0 }); /* * Ext JS Library 2.2.1 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ procenter.common.SearchField = Ext.extend(Ext.form.TwinTriggerField, { initComponent : function(){ procenter.common.SearchField.superclass.initComponent.call(this); this.on('specialkey', function(f, e){ if(e.getKey() == e.ENTER){ this.onTrigger2Click(); } }, this); }, validationEvent:false, validateOnBlur:false, trigger1Class:'x-form-clear-trigger', trigger2Class:'x-form-search-trigger', hideTrigger1:true, width:150, hasSearch : false, paramName : 'query', limit : 0, // 利用時に設定してください onTrigger1Click : function(){ if(this.hasSearch){ this.el.dom.value = ''; var o = {start: 0, limit: this.limit}; this.store.baseParams = this.store.baseParams || {}; this.store.baseParams[this.paramName] = ''; this.store.reload({params:o}); this.triggers[0].hide(); this.hasSearch = false; } }, onTrigger2Click : function(){ if (true == this.trigger2Click) { var v = this.getRawValue(); if(v.length < 1){ this.onTrigger1Click(); return; } var o = {start: 0, limit: this.limit}; this.store.baseParams = this.store.baseParams || {}; this.store.baseParams[this.paramName] = v; this.store.reload({params:o}); this.hasSearch = true; this.triggers[0].show(); } } }); /* * Ext JS Library 2.2.1 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ Ext.namespace('Ext.form'); Ext.form.FileUploadField = Ext.extend(Ext.form.TextField, { /** * @cfg {String} buttonText The button text to display on the upload button (defaults to * 'Browse...'). Note that if you supply a value for {@link #buttonCfg}, the buttonCfg.text * value will be used instead if available. */ buttonText: 'Browse...', /** * @cfg {Boolean} buttonOnly True to display the file upload field as a button with no visible * text field (defaults to false). If true, all inherited TextField members will still be available. */ buttonOnly: false, /** * @cfg {Number} buttonOffset The number of pixels of space reserved between the button and the text field * (defaults to 3). Note that this only applies if {@link #buttonOnly} = false. */ buttonOffset: 3, /** * @cfg {Object} buttonCfg A standard {@link Ext.Button} config object. */ // private readOnly: true, /** * @hide * @method autoSize */ autoSize: Ext.emptyFn, // private initComponent: function(){ Ext.form.FileUploadField.superclass.initComponent.call(this); this.addEvents( /** * @event fileselected * Fires when the underlying file input field's value has changed from the user * selecting a new file from the system file selection dialog. * @param {Ext.form.FileUploadField} this * @param {String} value The file value returned by the underlying file input field */ 'fileselected' ); }, // private onRender : function(ct, position){ Ext.form.FileUploadField.superclass.onRender.call(this, ct, position); this.wrap = this.el.wrap({cls:'x-form-field-wrap x-form-file-wrap'}); this.el.addClass('x-form-file-text'); this.el.dom.removeAttribute('name'); this.fileInput = this.wrap.createChild({ id: this.getFileInputId(), name: this.name||this.getId(), cls: 'x-form-file', tag: 'input', type: 'file', size: 1 }); var btnCfg = Ext.applyIf(this.buttonCfg || {}, { text: this.buttonText }); this.button = new Ext.Button(Ext.apply(btnCfg, { renderTo: this.wrap, cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : '') })); if(this.buttonOnly){ this.el.hide(); this.wrap.setWidth(this.button.getEl().getWidth()); } this.fileInput.on('change', function(){ var v = this.fileInput.dom.value; this.setValue(v); this.fireEvent('fileselected', this, v); }, this); }, // private getFileInputId: function(){ return this.id+'-file'; }, // private onResize : function(w, h){ Ext.form.FileUploadField.superclass.onResize.call(this, w, h); this.wrap.setWidth(w); if(!this.buttonOnly){ var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset; this.el.setWidth(w); } }, // private preFocus : Ext.emptyFn, // private getResizeEl : function(){ return this.wrap; }, // private getPositionEl : function(){ return this.wrap; }, // private alignErrorIcon : function(){ this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); } }); Ext.reg('fileuploadfield', Ext.form.FileUploadField); Ext.namespace('procenter.common'); /* * Store関連のベースクラス * * 引数1:コンフィグレーション * */ procenter.common.BaseStore = function( cfg ){ // コンフィグ適用 Ext.applyIf(this,{ proxy : cfg.proxy, url : cfg.url, root : cfg.root, reader : cfg.reader }); // Ext.apply(this, { name: 'BaseStore', listeners:{ beforeload: function(store , options){ procenter.common.MaskFullScreen(); }, load : function( store, record, operation ){ procenter.common.UnMaskFullScreen(); if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } }, loadexception: function(proxytObj, store, callbackObj, ex) { procenter.common.UnMaskFullScreen(); if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } } } }); // 親コンストラクタ呼び出し procenter.common.BaseStore.superclass.constructor.call(this); }; Ext.extend(procenter.common.BaseStore,Ext.data.Store, { jsonStatus : false }); /** * JSONローダーの生成 * * 引数1:コンフィグ設定 */ procenter.common.BaseJsonStore = function(cfg) { // コンフィグ適用 Ext.apply( this, cfg ); // Ext.apply(this, { name: 'BaseJsonStore', listeners:{ beforeload: function(store , options){ procenter.common.MaskFullScreen(); }, load : function( store, record, operation ){ procenter.common.UnMaskFullScreen(); if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } }, loadexception: function(proxytObj, store, callbackObj, ex) { procenter.common.UnMaskFullScreen(); if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } } } }); // 親コンストラクタ呼び出し procenter.common.BaseJsonStore.superclass.constructor.call(this,cfg); } Ext.extend(procenter.common.BaseJsonStore, Ext.data.JsonStore, { jsonStatus : false }); /** * JSONローダーの生成(Jsonデータ読み込み時のマスク処理なし) * * 引数1:コンフィグ設定 */ procenter.common.BaseJsonStoreNoMask = function(cfg) { // コンフィグ適用 Ext.apply( this, cfg ); // Ext.apply(this, { name: 'BaseJsonStore', listeners:{ load : function( store, record, operation ){ if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } }, loadexception: function(proxytObj, store, callbackObj, ex) { if(store.reader != null) { store.jsonStatus = procenter.common.validateJsonData(store.reader.jsonData); } } } }); // 親コンストラクタ呼び出し procenter.common.BaseJsonStore.superclass.constructor.call(this,cfg); } Ext.extend(procenter.common.BaseJsonStoreNoMask, Ext.data.JsonStore, { jsonStatus : false }); /* * ノードを非同期に追加する */ procenter.common.ProcenterAsyncNodeInfoArray = new Array(); procenter.common.ProcenterAsyncNodeAppender = function() { while( procenter.common.ProcenterAsyncNodeInfoArray.length > 0 ) { var obj = procenter.common.ProcenterAsyncNodeInfoArray[0]; if( obj != null ) { obj.parent.beginUpdate(); obj.parent.appendChild(obj.nodes); obj.parent.endUpdate(); // procenter.common.UnMaskFullScreen(); } procenter.common.ProcenterAsyncNodeInfoArray.shift(); } } /** * ツリーローダーの生成 * * 引数1:コンフィグ設定 */ procenter.common.ProcenterTreeLoader = function(cfg) { Ext.applyIf(this,cfg); Ext.apply(this, { name: 'ProcenterTreeLoader', listeners:{ beforeload: function( store, node, callback){ // procenter.common.MaskFullScreen(); }, load : function( store , node, response ){ // procenter.common.UnMaskFullScreen(); this.jsonStatus = procenter.common.validateJson(response.responseText); }, loadexception: function( store , node, response) { //procenter.common.UnMaskFullScreen(); //this.jsonStatus = procenter.common.validateJson(response.responseText); } } }); procenter.common.ProcenterTreeLoader.superclass.constructor.call(this, cfg); } Ext.extend(procenter.common.ProcenterTreeLoader, Ext.tree.TreeLoader, { jsonStatus : false, processResponse : function(response, node, callback){ var responseTxt = response.responseText; var jsonData; try { var json; json = Ext.util.JSON.decode(responseTxt); jsonData = json.data; } catch(e) { this.handleFailure(response); return false; } this.jsonStatus = true; try { o = jsonData; var len = o.length; if( len > 0 ) { var a = new Array(len); var cnt = 0; for(var i = 0, len = o.length; i < len; i++){ var n = this.createNode(o[i]); if( n ) { a[cnt] = n ; cnt++ ; } } if( cnt > 0 ) { // procenter.common.MaskFullScreen(); if( cnt < len ) { a = a.slice(0,cnt); } procenter.common.ProcenterAsyncNodeInfoArray.push({ parent : node , nodes : a }); // if( procenter.common.AsyncNodeAppenderDelayTime > 0 ) { // setTimeout(procenter.common.ProcenterAsyncNodeAppender,procenter.common.AsyncNodeAppenderDelayTime); // } // else { procenter.common.ProcenterAsyncNodeAppender(); // } } } /* * node.beginUpdate(); * for(var i = 0, len = o.length; i < len; i++){ * var n = this.createNode(o[i]); * if(n){ * node.appendChild(n); * } * } * node.endUpdate(); */ if(typeof callback == "function"){ callback(this, node); } }catch(e){ this.handleFailure(response); } }, handleFailure : function(response){ this.transId = false; var a = response.argument; this.fireEvent("loadexception", this, a.node, response); if(typeof a.callback == "function"){ a.callback(this, a.node); } } }); /** * ツリーパネルの生成 * * ドラッグ情報の取得方法: * procenter.common.proTreePanel.dragOverData.target.id で取得 * * 引数1:cfg コンフィグオブジェクト * */ procenter.common.ProcenterTreePanel = function(cfg){ Ext.applyIf(this,cfg); procenter.common.ProcenterTreePanel.superclass.constructor.call(this, cfg); }; Ext.extend(procenter.common.ProcenterTreePanel, Ext.tree.TreePanel, { initComponent: function(cfg) { procenter.common.ProcenterTreePanel.superclass.initComponent.call(this, cfg); }, //width:300, autoheight:true, autoScroll:true, animate:procenter.common.TreePanelAnimate, containerScroll: true, border : false, dragOverData : null, // ドラッグ情報を保持 /** * ツリーパネル上の指定されたノードIDを開く * 引数1:対象ノードID */ treExpandNodeId : function(nodeId) { // このツリーパネルからID指定でNodeを取得する var node = this.getNodeById(nodeId) var result = false; if( node != null ) { //指定ノードIDのノードが存在した場合 if(node.isExpanded() == false){ var path = node.getPath(); this.expandPath(path); } result = true; } return result; }, /** * ツリーパネル上の指定されたノードIDを選択します * 引数1:対象ノードID */ treSelectNodeId : function(nodeId) { // このツリーパネルからID指定でNodeを取得する var node = this.getNodeById(nodeId) var result = false; if( node != null ) { //指定ノードIDのノードが存在した場合 if(node.isSelected() == false){ var path = node.getPath(); this.selectPath(path); } result = true; } return result; }, /** * キャッシュ情報の同期処理を行う * * 引数1:同期対象のID * */ treRefresh : function(node) { var backupParam = this.getLoader().baseParams; var paramData = {refresh : true}; // リフレッシュパレメータの作成 this.getLoader().baseParams = this.addBaseParams(this.getLoader().baseParams, paramData); //ルートノードの取得 var wnode = this.getRootNode(); //リロードする if (typeof wnode.reload === 'function') { // イベントの発生を中断 this.suspendEvents(); wnode.reload(); // イベントの発生を再開 this.resumeEvents(); } //パラメータを元に戻す this.getLoader().baseParams = backupParam; }, /** * ノード配下のデータを取得し直す開く * * 引数1:同期対象のID * */ treUpdateNode : function(nodeId) { // このツリーパネルからID指定でNodeを取得する var node = this.getNodeById(nodeId) if(node != null) { //リロードする if (typeof node.reload === 'function') { // Ext.tree.TreeLoader.doPreload で // node.attributes.children = nullでないとサーバに問い合わせを行わない。 // そのためNullを設定し強制的にサーバに問い合わせを行わせる。 node.attributes.children = null; node.reload(); } // 開く this.expandPath(node.getPath()); } }, /** * パラメータの追加を行う * * prmSrc:baseのパラメータ * prmNew:追加のパラメータ */ addBaseParams : function(prmSrc, prmNew) { return procenter.common.addBaseParams(prmSrc, prmNew); }, /** * データの読み込みが完了しているか確認 */ isNodeLoaded : function(node) { var result = false; if (typeof node.isLoaded === 'function') { if( node.isLoaded() == true){ result = true; } } return result; } }); /* * Procenter独自ComboBox. * IEでComboBoxのアイテム名が部品の幅より長い場合に、高さ計算がおかしくなる問題の修正 */ procenter.common.ProcenterComboBox = function(cfg) { procenter.common.ProcenterComboBox.superclass.constructor.call(this, cfg); }; Ext.extend(procenter.common.ProcenterComboBox, Ext.form.ComboBox, { restrictHeight : function() { if (Ext.isIE) { this.innerList.dom.style.height = ""; var b = this.innerList.dom; var e = this.list.getFrameWidth("tb") + (this.resizable ? this.handleHeight : 0) + this.assetHeight; var c = Math.max(b.clientHeight, b.offsetHeight, b.scrollHeight); var a = this.getPosition()[1] - Ext.getBody().getScroll().top; var g = Ext.lib.Dom.getViewHeight() - a - this.getSize().height; var d = Math.max(a, g, this.minHeight || 0) - this.list.shadowOffset - e - 5; c = Math.min(c, d, this.maxHeight); if (this.store != null && this.store.data != null && this.store.data.length != 0) { // IEで横スクロールバーが出る場合に一行分高さが足りないため調整 // 2013/12/03 IEの場合プルダウンの空白項 NECSL.PIAO BEGIN if(b.clientHeight < b.offsetHeight){ c += (b.scrollHeight / this.store.data.length); } // 2013/12/03 IEの場合プルダウンの空白項 NECSL.PIAO END } this.innerList.setHeight(c); this.list.beginUpdate(); this.list.setHeight(c + e); this.list.alignTo(this.wrap, this.listAlign); this.list.endUpdate() } else { // IE以外はExt.form.ComboBoxと同じ動作とする procenter.common.ProcenterComboBox.superclass.restrictHeight.call(this); } } }); /** * ページバーの拡張 * * 引数1:cfg コンフィグオブジェクト * */ procenter.common.ProcenterPagingToolBar = function(cfg){ Ext.applyIf(this,cfg); procenter.common.ProcenterPagingToolBar.superclass.constructor.call(this, cfg); }; Ext.extend(procenter.common.ProcenterPagingToolBar, Ext.PagingToolbar, { paramNames : {start: 'start', limit: 'limit', reload: 'reload'}, initComponent: function(cfg) { procenter.common.ProcenterPagingToolBar.superclass.initComponent.call(this, cfg); }, // private doReload : function(start){ var o = {}, pn = this.paramNames; o[pn.start] = start; o[pn.limit] = this.pageSize; o[pn.reload] = true; if(this.fireEvent('beforechange', this, o) !== false){ this.store.load({params:o}); } }, // private onClick : function(which){ var store = this.store; switch(which){ case "first": this.doLoad(0); break; case "prev": this.doLoad(Math.max(0, this.cursor-this.pageSize)); break; case "next": this.doLoad(this.cursor+this.pageSize); break; case "last": var total = store.getTotalCount(); var extra = total % this.pageSize; var lastStart = extra ? (total - extra) : total-this.pageSize; this.doLoad(lastStart); break; case "refresh": this.doReload(this.cursor); break; } }, // private onRender : function(ct, position){ Ext.PagingToolbar.superclass.onRender.call(this, ct, position); this.first = this.addButton({ tooltip: this.firstText, iconCls: "x-tbar-page-first", disabled: true, handler: this.onClick.createDelegate(this, ["first"]) }); this.prev = this.addButton({ tooltip: this.prevText, iconCls: "x-tbar-page-prev", disabled: true, handler: this.onClick.createDelegate(this, ["prev"]) }); this.addSeparator(); this.add(this.beforePageText); this.field = Ext.get(this.addDom({ tag: "input", type: "text", size: "3", value: "1", cls: "x-tbar-page-number" }).el); this.field.on("keydown", this.onPagingKeydown, this); this.field.on("focus", function(){this.dom.select();}); this.field.on("blur", this.onPagingBlur, this); this.afterTextEl = this.addText(String.format(this.afterPageText, 1)); this.field.setHeight(18); this.addSeparator(); this.next = this.addButton({ tooltip: this.nextText, iconCls: "x-tbar-page-next", disabled: true, handler: this.onClick.createDelegate(this, ["next"]) }); this.last = this.addButton({ tooltip: this.lastText, iconCls: "x-tbar-page-last", disabled: true, handler: this.onClick.createDelegate(this, ["last"]) }); // リフレッシュボタンの前のセパレータをつけるかどうか if (false == this.refreshButton) { // do nothing } else { this.addSeparator(); } this.loading = this.addButton({ tooltip: this.refreshText, iconCls: "x-tbar-loading", handler: this.onClick.createDelegate(this, ["refresh"]) }); // リフレッシュボタンを見せるかどうか if (false == this.refreshButton) { this.loading.hide(); } if(this.displayInfo){ this.displayEl = Ext.fly(this.el.dom).createChild({cls:'x-paging-info'}); } if(this.dsLoaded){ this.onLoad.apply(this, this.dsLoaded); } } }); /* * Ext JS Library 2.2.1 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* * Software License Agreement (BSD License) * Copyright (c) 2008, Nige "Animal" White * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the original author nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @class Ext.ux.DDView *

A DnD-enabled version of {@link Ext.DataView}. Drag/drop is implemented by adding * {@link Ext.data.Record}s to the target DDView. If copying is not being performed, * the original {@link Ext.data.Record} is removed from the source DDView.

* @constructor * Create a new DDView * @param {Object} config The configuration properties. */ procenter.common.DDView = function(config) { if (!config.itemSelector) { var tpl = config.tpl; if (this.classRe.test(tpl)) { config.tpl = tpl.replace(this.classRe, 'class=$1x-combo-list-item $2$1'); } else { config.tpl = tpl.replace(this.tagRe, '$1 class="x-combo-list-item" $2'); } config.itemSelector = ".x-combo-list-item"; } procenter.common.DDView.superclass.constructor.call(this, Ext.apply(config, { border: false })); }; Ext.extend(procenter.common.DDView, Ext.DataView, { /** * @cfg {String/Array} dragGroup The ddgroup name(s) for the View's DragZone (defaults to undefined). */ /** * @cfg {String/Array} dropGroup The ddgroup name(s) for the View's DropZone (defaults to undefined). */ /** * @cfg {Boolean} copy Causes drag operations to copy nodes rather than move (defaults to false). */ /** * @cfg {Boolean} allowCopy Causes ctrl/drag operations to copy nodes rather than move (defaults to false). */ /** * @cfg {String} sortDir Sort direction for the view, 'ASC' or 'DESC' (defaults to 'ASC'). */ sortDir: 'ASC', // private isFormField: true, classRe: /class=(['"])(.*)\1/, tagRe: /(<\w*)(.*?>)/, reset: Ext.emptyFn, clearInvalid: Ext.form.Field.prototype.clearInvalid, // private afterRender: function() { procenter.common.DDView.superclass.afterRender.call(this); if (this.dragGroup) { this.setDraggable(this.dragGroup.split(",")); } if (this.dropGroup) { this.setDroppable(this.dropGroup.split(",")); } if (this.deletable) { this.setDeletable(); } this.isDirtyFlag = false; this.addEvents( "drop" ); }, // private validate: function() { return true; }, // private destroy: function() { this.purgeListeners(); this.getEl().removeAllListeners(); this.getEl().remove(); if (this.dragZone) { if (this.dragZone.destroy) { this.dragZone.destroy(); } } if (this.dropZone) { if (this.dropZone.destroy) { this.dropZone.destroy(); } } }, /** * Allows this class to be an Ext.form.Field so it can be found using {@link Ext.form.BasicForm#findField}. */ getName: function() { return this.name; }, /** * Loads the View from a JSON string representing the Records to put into the Store. * @param {String} value The JSON string */ setValue: function(v) { if (!this.store) { throw "DDView.setValue(). DDView must be constructed with a valid Store"; } var data = {}; data[this.store.reader.meta.root] = v ? [].concat(v) : []; this.store.proxy = new Ext.data.MemoryProxy(data); this.store.load(); }, /** * Returns the view's data value as a list of ids. * @return {String} A parenthesised list of the ids of the Records in the View, e.g. (1,3,8). */ getValue: function() { var result = '('; this.store.each(function(rec) { result += rec.id + ','; }); return result.substr(0, result.length - 1) + ')'; }, getIds: function() { var i = 0, result = new Array(this.store.getCount()); this.store.each(function(rec) { result[i++] = rec.id; }); return result; }, /** * Returns true if the view's data has changed, else false. * @return {Boolean} */ isDirty: function() { return this.isDirtyFlag; }, /** * Part of the Ext.dd.DropZone interface. If no target node is found, the * whole Element becomes the target, and this causes the drop gesture to append. */ getTargetFromEvent : function(e) { var target = e.getTarget(); while ((target !== null) && (target.parentNode != this.el.dom)) { target = target.parentNode; } if (!target) { target = this.el.dom.lastChild || this.el.dom; } return target; }, /** * Create the drag data which consists of an object which has the property "ddel" as * the drag proxy element. */ getDragData : function(e) { var target = this.findItemFromChild(e.getTarget()); if(target) { if (!this.isSelected(target)) { delete this.ignoreNextClick; this.onItemClick(target, this.indexOf(target), e); this.ignoreNextClick = true; } var dragData = { sourceView: this, viewNodes: [], records: [], copy: this.copy || (this.allowCopy && e.ctrlKey) }; if (this.getSelectionCount() == 1) { var i = this.getSelectedIndexes()[0]; var n = this.getNode(i); dragData.viewNodes.push(dragData.ddel = n); dragData.records.push(this.store.getAt(i)); dragData.repairXY = Ext.fly(n).getXY(); } else { dragData.ddel = document.createElement('div'); dragData.ddel.className = 'multi-proxy'; this.collectSelection(dragData); } return dragData; } return false; }, // override the default repairXY. getRepairXY : function(e){ return this.dragData.repairXY; }, // private collectSelection: function(data) { data.repairXY = Ext.fly(this.getSelectedNodes()[0]).getXY(); if (this.preserveSelectionOrder === true) { Ext.each(this.getSelectedIndexes(), function(i) { var n = this.getNode(i); var dragNode = n.cloneNode(true); dragNode.id = Ext.id(); data.ddel.appendChild(dragNode); data.records.push(this.store.getAt(i)); data.viewNodes.push(n); }, this); } else { var i = 0; this.store.each(function(rec){ if (this.isSelected(i)) { var n = this.getNode(i); var dragNode = n.cloneNode(true); dragNode.id = Ext.id(); data.ddel.appendChild(dragNode); data.records.push(this.store.getAt(i)); data.viewNodes.push(n); } i++; }, this); } }, /** * Specify to which ddGroup items in this DDView may be dragged. * @param {String} ddGroup The DD group name to assign this view to. */ setDraggable: function(ddGroup) { if (ddGroup instanceof Array) { Ext.each(ddGroup, this.setDraggable, this); return; } if (this.dragZone) { this.dragZone.addToGroup(ddGroup); } else { this.dragZone = new Ext.dd.DragZone(this.getEl(), { containerScroll: true, ddGroup: ddGroup }); // Draggability implies selection. DragZone's mousedown selects the element. if (!this.multiSelect) { this.singleSelect = true; } // Wire the DragZone's handlers up to methods in *this* this.dragZone.getDragData = this.getDragData.createDelegate(this); this.dragZone.getRepairXY = this.getRepairXY; this.dragZone.onEndDrag = this.onEndDrag; } }, /** * Specify from which ddGroup this DDView accepts drops. * @param {String} ddGroup The DD group name from which to accept drops. */ setDroppable: function(ddGroup) { if (ddGroup instanceof Array) { Ext.each(ddGroup, this.setDroppable, this); return; } if (this.dropZone) { this.dropZone.addToGroup(ddGroup); } else { this.dropZone = new Ext.dd.DropZone(this.getEl(), { owningView: this, containerScroll: true, ddGroup: ddGroup }); // Wire the DropZone's handlers up to methods in *this* this.dropZone.getTargetFromEvent = this.getTargetFromEvent.createDelegate(this); this.dropZone.onNodeEnter = this.onNodeEnter.createDelegate(this); this.dropZone.onNodeOver = this.onNodeOver.createDelegate(this); this.dropZone.onNodeOut = this.onNodeOut.createDelegate(this); this.dropZone.onNodeDrop = this.onNodeDrop.createDelegate(this); } }, // private getDropPoint : function(e, n, dd){ if (n == this.el.dom) { return "above"; } var t = Ext.lib.Dom.getY(n), b = t + n.offsetHeight; var c = t + (b - t) / 2; var y = Ext.lib.Event.getPageY(e); if(y <= c) { return "above"; }else{ return "below"; } }, // private isValidDropPoint: function(pt, n, data) { if (!data.viewNodes || (data.viewNodes.length != 1)) { return true; } var d = data.viewNodes[0]; if (d == n) { return false; } if ((pt == "below") && (n.nextSibling == d)) { return false; } if ((pt == "above") && (n.previousSibling == d)) { return false; } return true; }, // private onNodeEnter : function(n, dd, e, data){ if (this.highlightColor && (data.sourceView != this)) { this.el.highlight(this.highlightColor); } return false; }, // private onNodeOver : function(n, dd, e, data){ var dragElClass = this.dropNotAllowed; var pt = this.getDropPoint(e, n, dd); if (this.isValidDropPoint(pt, n, data)) { if (this.appendOnly || this.sortField) { return "x-tree-drop-ok-below"; } // set the insert point style on the target node if (pt) { var targetElClass; if (pt == "above"){ dragElClass = n.previousSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-above"; targetElClass = "x-view-drag-insert-above"; } else { dragElClass = n.nextSibling ? "x-tree-drop-ok-between" : "x-tree-drop-ok-below"; targetElClass = "x-view-drag-insert-below"; } if (this.lastInsertClass != targetElClass){ Ext.fly(n).replaceClass(this.lastInsertClass, targetElClass); this.lastInsertClass = targetElClass; } } } return dragElClass; }, // private onNodeOut : function(n, dd, e, data){ this.removeDropIndicators(n); }, // private onNodeDrop : function(n, dd, e, data){ if (this.fireEvent("drop", this, n, dd, e, data) === false) { return false; } var pt = this.getDropPoint(e, n, dd); var insertAt = (this.appendOnly || (n == this.el.dom)) ? this.store.getCount() : n.viewIndex; if (pt == "below") { insertAt++; } // Validate if dragging within a DDView if (data.sourceView == this) { // If the first element to be inserted below is the target node, remove it if (pt == "below") { if (data.viewNodes[0] == n) { data.viewNodes.shift(); } } else { // If the last element to be inserted above is the target node, remove it if (data.viewNodes[data.viewNodes.length - 1] == n) { data.viewNodes.pop(); } } // Nothing to drop... if (!data.viewNodes.length) { return false; } // If we are moving DOWN, then because a store.remove() takes place first, // the insertAt must be decremented. if (insertAt > this.store.indexOf(data.records[0])) { insertAt--; } } // Dragging from a Tree. Use the Tree's recordFromNode function. if (data.node instanceof Ext.tree.TreeNode) { var r = data.node.getOwnerTree().recordFromNode(data.node); if (r) { data.records = [ r ]; } } if (!data.records) { alert("Programming problem. Drag data contained no Records"); return false; } for (var i = 0; i < data.records.length; i++) { var r = data.records[i]; var dup = this.store.getById(r.id); if (dup && (dd != this.dragZone)) { if(!this.allowDup && !this.allowTrash){ Ext.fly(this.getNode(this.store.indexOf(dup))).frame("red", 1); return true } var x=new Ext.data.Record(); r.id=x.id; delete x; } if (data.copy) { this.store.insert(insertAt++, r.copy()); } else { if (data.sourceView) { data.sourceView.isDirtyFlag = true; data.sourceView.store.remove(r); } if(!this.allowTrash)this.store.insert(insertAt++, r); } if(this.sortField){ this.store.sort(this.sortField, this.sortDir); } this.isDirtyFlag = true; } this.dragZone.cachedTarget = null; return true; }, // private onEndDrag: function(data, e) { var d = Ext.get(this.dragData.ddel); if (d && d.hasClass("multi-proxy")) { d.remove(); //delete this.dragData.ddel; } }, // private removeDropIndicators : function(n){ if(n){ Ext.fly(n).removeClass([ "x-view-drag-insert-above", "x-view-drag-insert-left", "x-view-drag-insert-right", "x-view-drag-insert-below"]); this.lastInsertClass = "_noclass"; } }, /** * Add a delete option to the DDView's context menu. * @param {String} imageUrl The URL of the "delete" icon image. */ setDeletable: function(imageUrl) { if (!this.singleSelect && !this.multiSelect) { this.singleSelect = true; } var c = this.getContextMenu(); this.contextMenu.on("itemclick", function(item) { switch (item.id) { case "delete": this.remove(this.getSelectedIndexes()); break; } }, this); this.contextMenu.add({ icon: imageUrl || AU.resolveUrl("/images/delete.png"), id: "delete", text: AU.getMessage("deleteItem") }); }, /** * Return the context menu for this DDView. * @return {Ext.menu.Menu} The context menu */ getContextMenu: function() { if (!this.contextMenu) { // Create the View's context menu this.contextMenu = new Ext.menu.Menu({ id: this.id + "-contextmenu" }); this.el.on("contextmenu", this.showContextMenu, this); } return this.contextMenu; }, /** * Disables the view's context menu. */ disableContextMenu: function() { if (this.contextMenu) { this.el.un("contextmenu", this.showContextMenu, this); } }, // private showContextMenu: function(e, item) { item = this.findItemFromChild(e.getTarget()); if (item) { e.stopEvent(); this.select(this.getNode(item), this.multiSelect && e.ctrlKey, true); this.contextMenu.showAt(e.getXY()); } }, /** * Remove {@link Ext.data.Record}s at the specified indices. * @param {Array/Number} selectedIndices The index (or Array of indices) of Records to remove. */ remove: function(selectedIndices) { selectedIndices = [].concat(selectedIndices); for (var i = 0; i < selectedIndices.length; i++) { var rec = this.store.getAt(selectedIndices[i]); this.store.remove(rec); } }, /** * Double click fires the {@link #dblclick} event. Additionally, if this DDView is draggable, and there is only one other * related DropZone that is in another DDView, it drops the selected node on that DDView. */ onDblClick : function(e){ var item = this.findItemFromChild(e.getTarget()); if(item){ if (this.fireEvent("dblclick", this, this.indexOf(item), item, e) === false) { return false; } if (this.dragGroup) { var targets = Ext.dd.DragDropMgr.getRelated(this.dragZone, true); // Remove instances of this View's DropZone while (targets.indexOf(this.dropZone) !== -1) { targets.remove(this.dropZone); } // If there's only one other DropZone, and it is owned by a DDView, then drop it in if ((targets.length == 1) && (targets[0].owningView)) { this.dragZone.cachedTarget = null; var el = Ext.get(targets[0].getEl()); var box = el.getBox(true); targets[0].onNodeDrop(el.dom, { target: el.dom, xy: [box.x, box.y + box.height - 1] }, null, this.getDragData(e)); } } } }, // private onItemClick : function(item, index, e){ // The DragZone's mousedown->getDragData already handled selection if (this.ignoreNextClick) { delete this.ignoreNextClick; return; } if(this.fireEvent("beforeclick", this, index, item, e) === false){ return false; } if(this.multiSelect || this.singleSelect){ if(this.multiSelect && e.shiftKey && this.lastSelection){ this.select(this.getNodes(this.indexOf(this.lastSelection), index), false); } else if (this.isSelected(item) && e.ctrlKey) { this.deselect(item); }else{ this.deselect(item); this.select(item, this.multiSelect && e.ctrlKey); this.lastSelection = item; } e.preventDefault(); } return true; } }); /* * Ext JS Library 2.2.1 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /* * Note that this control should still be treated as an example and that the API will most likely * change once it is ported into the Ext core as a standard form control. This is still planned * for a future release, so this should not yet be treated as a final, stable API at this time. */ /** * @class Ext.ux.MultiSelect * @extends Ext.form.Field * A control that allows selection and form submission of multiple list items. The MultiSelect control * depends on the Ext.ux.DDView class to provide drag/drop capability both within the list and also * between multiple MultiSelect controls (see the Ext.ux.ItemSelector). * * @history * 2008-06-19 bpm Original code contributed by Toby Stuart (with contributions from Robert Williams) * 2008-06-19 bpm Docs and demo code clean up * * @constructor * Create a new MultiSelect * @param {Object} config Configuration options */ procenter.common.Multiselect = Ext.extend(Ext.form.Field, { /** * @cfg {String} legend Wraps the object with a fieldset and specified legend. */ /** * @cfg {Store} store The {@link Ext.data.Store} used by the underlying procenter.common.DDView. */ /** * @cfg {procenter.common.DDView} view The procenter.common.DDView used to render the multiselect list. */ /** * @cfg {String/Array} dragGroup The ddgroup name(s) for the DDView's DragZone (defaults to undefined). */ /** * @cfg {String/Array} dropGroup The ddgroup name(s) for the DDView's DropZone (defaults to undefined). */ /** * @cfg {Object/Array} tbar The top toolbar of the control. This can be a {@link Ext.Toolbar} object, a * toolbar config, or an array of buttons/button configs to be added to the toolbar. */ /** * @cfg {String} fieldName The name of the field to sort by when sorting is enabled. */ /** * @cfg {String} appendOnly True if the list should only allow append drops when drag/drop is enabled * (use for lists which are sorted, defaults to false). */ appendOnly:false, /** * @cfg {Array} dataFields Inline data definition when not using a pre-initialised store. Known to cause problems * in some browswers for very long lists. Use store for large datasets. */ dataFields:[], /** * @cfg {Array} data Inline data when not using a pre-initialised store. Known to cause problems in some * browswers for very long lists. Use store for large datasets. */ data:[], /** * @cfg {Number} width Width in pixels of the control (defaults to 100). */ width:100, /** * @cfg {Number} height Height in pixels of the control (defaults to 100). */ height:100, /** * @cfg {String/Number} displayField Name/Index of the desired display field in the dataset (defaults to 0). */ displayField:0, /** * @cfg {String/Number} valueField Name/Index of the desired value field in the dataset (defaults to 1). */ valueField:1, /** * @cfg {Boolean} allowBlank True to require at least one item in the list to be selected, false to allow no * selection (defaults to true). */ allowBlank:true, /** * @cfg {Number} minLength Minimum number of selections allowed (defaults to 0). */ minLength:0, /** * @cfg {Number} maxLength Maximum number of selections allowed (defaults to Number.MAX_VALUE). */ maxLength:Number.MAX_VALUE, /** * @cfg {String} blankText Default text displayed when the control contains no items (defaults to the same value as * {@link Ext.form.TextField#blankText}. */ blankText:Ext.form.TextField.prototype.blankText, /** * @cfg {String} minLengthText Validation message displayed when {@link #minLength} is not met (defaults to 'Minimum {0} * item(s) required'). The {0} token will be replaced by the value of {@link #minLength}. */ minLengthText:'Minimum {0} item(s) required', /** * @cfg {String} maxLengthText Validation message displayed when {@link #maxLength} is not met (defaults to 'Maximum {0} * item(s) allowed'). The {0} token will be replaced by the value of {@link #maxLength}. */ maxLengthText:'Maximum {0} item(s) allowed', /** * @cfg {String} delimiter The string used to delimit between items when set or returned as a string of values * (defaults to ','). */ delimiter:',', // DDView settings copy:false, allowDup:false, allowTrash:false, focusClass:undefined, sortDir:'ASC', // private defaultAutoCreate : {tag: "div"}, // private initComponent: function(){ procenter.common.Multiselect.superclass.initComponent.call(this); this.addEvents({ 'dblclick' : true, 'click' : true, 'change' : true, 'drop' : true }); }, // private onRender: function(ct, position){ procenter.common.Multiselect.superclass.onRender.call(this, ct, position); var cls = 'ux-mselect'; var fs = new Ext.form.FieldSet({ renderTo:this.el, title:this.legend, height:this.height, width:this.width, style:"padding:0;", tbar:this.tbar }); //if(!this.legend)fs.el.down('.'+fs.headerCls).remove(); fs.body.addClass(cls); var tpl = '
'; if(!this.store){ this.store = new Ext.data.SimpleStore({ fields: this.dataFields, data : this.data }); } this.view = new procenter.common.DDView({ multiSelect: true, store: this.store, selectedClass: cls+"-selected", tpl:tpl, allowDup:this.allowDup, copy: this.copy, allowTrash: this.allowTrash, dragGroup: this.dragGroup, dropGroup: this.dropGroup, itemSelector:"."+cls+"-item", isFormField:false, applyTo:fs.body, appendOnly:this.appendOnly, sortField:this.sortField, sortDir:this.sortDir }); fs.add(this.view); this.view.on('click', this.onViewClick, this); this.view.on('beforeClick', this.onViewBeforeClick, this); this.view.on('dblclick', this.onViewDblClick, this); this.view.on('drop', function(ddView, n, dd, e, data){ return this.fireEvent("drop", ddView, n, dd, e, data); }, this); this.hiddenName = this.name; var hiddenTag={tag: "input", type: "hidden", value: "", name:this.name}; if (this.isFormField) { this.hiddenField = this.el.createChild(hiddenTag); } else { this.hiddenField = Ext.get(document.body).createChild(hiddenTag); } fs.doLayout(); }, // private initValue:Ext.emptyFn, // private onViewClick: function(vw, index, node, e) { var arrayIndex = this.preClickSelections.indexOf(index); if (arrayIndex != -1) { this.preClickSelections.splice(arrayIndex, 1); this.view.clearSelections(true); this.view.select(this.preClickSelections); } this.fireEvent('change', this, this.getValue(), this.hiddenField.dom.value); this.hiddenField.dom.value = this.getValue(); this.fireEvent('click', this, e); this.validate(); }, // private onViewBeforeClick: function(vw, index, node, e) { this.preClickSelections = this.view.getSelectedIndexes(); if (this.disabled) {return false;} }, // private onViewDblClick : function(vw, index, node, e) { return this.fireEvent('dblclick', vw, index, node, e); }, /** * Returns an array of data values for the selected items in the list. The values will be separated * by {@link #delimiter}. * @return {Array} value An array of string data values */ getValue: function(valueField){ var returnArray = []; var selectionsArray = this.view.getSelectedIndexes(); if (selectionsArray.length == 0) {return '';} for (var i=0; i< selectionsArray.length; i++) { returnArray.push(this.store.getAt(selectionsArray[i]).get(((valueField != null)? valueField : this.valueField))); } return returnArray.join(this.delimiter); }, /** * Sets a delimited string (using {@link #delimiter}) or array of data values into the list. * @param {String/Array} values The values to set */ setValue: function(values) { var index; var selections = []; this.view.clearSelections(); this.hiddenField.dom.value = ''; if (!values || (values == '')) { return; } if (!(values instanceof Array)) { values = values.split(this.delimiter); } for (var i=0; i< values.length; i++) { index = this.view.store.indexOf(this.view.store.query(this.valueField, new RegExp('^' + values[i] + '$', "i")).itemAt(0)); selections.push(index); } this.view.select(selections); this.hiddenField.dom.value = this.getValue(); this.validate(); }, // inherit docs reset : function() { this.setValue(''); }, // inherit docs getRawValue: function(valueField) { var tmp = this.getValue(valueField); if (tmp.length) { tmp = tmp.split(this.delimiter); } else{ tmp = []; } return tmp; }, // inherit docs setRawValue: function(values){ setValue(values); }, // inherit docs validateValue : function(value){ if (value.length < 1) { // if it has no value if (this.allowBlank) { this.clearInvalid(); return true; } else { this.markInvalid(this.blankText); return false; } } if (value.length < this.minLength) { this.markInvalid(String.format(this.minLengthText, this.minLength)); return false; } if (value.length > this.maxLength) { this.markInvalid(String.format(this.maxLengthText, this.maxLength)); return false; } return true; } }); Ext.reg("multiselect", procenter.common.Multiselect); // IEでGridのレイアウトが崩れる問題の修正コード // 参考:http://extjs.com/forum/showthread.php?p=297096#post297096 Ext.override(Ext.grid.GridView, { initTemplates : function(){ var ts = this.templates || {}; if(!ts.master){ ts.master = new Ext.Template( '
', '
', '
{header}
', '
{body}
', '
', '
 
', '
 
', '
' ); } if(!ts.header){ ts.header = new Ext.Template( '', '{cells}', '
' ); } if(!ts.hcell){ ts.hcell = new Ext.Template( '
', this.grid.enableHdMenu ? '' : '', '{value}', '
' ); } if(!ts.body){ ts.body = new Ext.Template('{rows}'); } if(!ts.row){ ts.row = new Ext.Template( '
', '{cells}', (this.enableRowBody ? '' : ''), '
{body}
' ); } if(!ts.cell){ ts.cell = new Ext.Template( '', '
{value}
', '' ); } for(var k in ts){ var t = ts[k]; if(t && typeof t.compile == 'function' && !t.compiled){ t.disableFormats = true; t.compile(); } } this.templates = ts; this.colRe = new RegExp("x-grid3-td-([^\\s]+)", ""); }, updateAllColumnWidths : function(){ var tw = this.getTotalWidth(); var clen = this.cm.getColumnCount(); var ws = []; for(var i = 0; i < clen; i++){ ws[i] = this.getColumnWidth(i); } this.innerHd.firstChild.style.width = this.getOffsetWidth(); this.innerHd.firstChild.firstChild.style.width = tw; this.mainBody.dom.style.width = tw; for(var i = 0; i < clen; i++){ var hd = this.getHeaderCell(i); hd.style.width = ws[i]; } var ns = this.getRows(), row, trow; for(var i = 0, len = ns.length; i < len; i++){ row = ns[i]; row.style.width = tw; if(row.firstChild){ row.firstChild.style.width = tw; trow = row.firstChild.rows[0]; for (var j = 0; j < clen; j++) { trow.childNodes[j].style.width = ws[j]; } } } this.onAllColumnWidthsUpdated(ws, tw); }, updateColumnWidth : function(col, width){ var w = this.getColumnWidth(col); var tw = this.getTotalWidth(); this.innerHd.firstChild.style.width = this.getOffsetWidth(); this.innerHd.firstChild.firstChild.style.width = tw; this.mainBody.dom.style.width = tw; var hd = this.getHeaderCell(col); hd.style.width = w; var ns = this.getRows(), row; for(var i = 0, len = ns.length; i < len; i++){ row = ns[i]; row.style.width = tw; if(row.firstChild){ row.firstChild.style.width = tw; row.firstChild.rows[0].childNodes[col].style.width = w; } } this.onColumnWidthUpdated(col, w, tw); }, updateColumnHidden : function(col, hidden){ var tw = this.getTotalWidth(); this.innerHd.firstChild.style.width = this.getOffsetWidth(); this.innerHd.firstChild.firstChild.style.width = tw; this.mainBody.dom.style.width = tw; var display = hidden ? 'none' : ''; var hd = this.getHeaderCell(col); hd.style.display = display; var ns = this.getRows(), row; for(var i = 0, len = ns.length; i < len; i++){ row = ns[i]; row.style.width = tw; if(row.firstChild){ row.firstChild.style.width = tw; row.firstChild.rows[0].childNodes[col].style.display = display; } } this.onColumnHiddenUpdated(col, hidden, tw); delete this.lastViewWidth; this.layout(); }, afterRender: function(){ this.mainBody.dom.innerHTML = this.renderRows() || ' '; this.processRows(0, true); if(this.deferEmptyText !== true){ this.applyEmptyText(); } }, renderUI : function(){ var header = this.renderHeaders(); var body = this.templates.body.apply({rows: ' '}); var html = this.templates.master.apply({ body: body, header: header, ostyle: 'width:'+this.getOffsetWidth()+';', bstyle: 'width:'+this.getTotalWidth()+';' }); var g = this.grid; g.getGridEl().dom.innerHTML = html; this.initElements(); Ext.fly(this.innerHd).on("click", this.handleHdDown, this); this.mainHd.on("mouseover", this.handleHdOver, this); this.mainHd.on("mouseout", this.handleHdOut, this); this.mainHd.on("mousemove", this.handleHdMove, this); this.scroller.on('scroll', this.syncScroll, this); if(g.enableColumnResize !== false){ this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom); } if(g.enableColumnMove){ this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd); this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom); } if(g.enableHdMenu !== false){ if(g.enableColumnHide !== false){ this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"}); this.colMenu.on("beforeshow", this.beforeColMenuShow, this); this.colMenu.on("itemclick", this.handleHdMenuClick, this); } this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"}); this.hmenu.add( {id:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"}, {id:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"} ); if(g.enableColumnHide !== false){ this.hmenu.add('-', {id:"columns", text: this.columnsText, menu: this.colMenu, iconCls: 'x-cols-icon'} ); } this.hmenu.on("itemclick", this.handleHdMenuClick, this); } if(g.trackMouseOver){ this.mainBody.on("mouseover", this.onRowOver, this); this.mainBody.on("mouseout", this.onRowOut, this); } if(g.enableDragDrop || g.enableDrag){ this.dragZone = new Ext.grid.GridDragZone(g, { ddGroup : g.ddGroup || 'GridDD' }); } this.updateHeaderSortState(); }, onColumnWidthUpdated : function(col, w, tw){ // empty }, onAllColumnWidthsUpdated : function(ws, tw){ // empty }, onColumnHiddenUpdated : function(col, hidden, tw){ // empty }, getOffsetWidth: function() { return (this.cm.getTotalWidth() + this.scrollOffset) + 'px'; }, renderBody : function(){ var markup = this.renderRows() || ' '; return this.templates.body.apply({rows: markup}); }, hasRows : function(){ var fc = this.mainBody.dom.firstChild; return fc && fc.nodeType == 1 && fc.className != 'x-grid-empty'; }, updateHeaders : function(){ this.innerHd.firstChild.innerHTML = this.renderHeaders(); this.innerHd.firstChild.style.width = this.getOffsetWidth(); this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth(); } }); Ext.override(Ext.grid.GridView, { hasRows : function(){ var fc = this.mainBody.dom.firstChild; return fc && fc.nodeType == 1 && fc.className != 'x-grid-empty'; } }); Ext.override(Ext.grid.GridView, { initTemplates : function(){ var ts = this.templates || {}; if(!ts.master){ ts.master = new Ext.Template( '
', '
', '
{header}
', '
{body}
', '
', '
 
', '
 
', '
' ); } if(!ts.header){ ts.header = new Ext.Template( '', '{cells}', '
' ); } if(!ts.hcell){ ts.hcell = new Ext.Template( '
', this.grid.enableHdMenu ? '' : '', '{value}', '
' ); } if(!ts.body){ ts.body = new Ext.Template('{rows}'); } if(!ts.row){ ts.row = new Ext.Template( '
', '{cells}', (this.enableRowBody ? '' : ''), '
{body}
' ); } if(!ts.cell){ ts.cell = new Ext.Template( '', '
{value}
', '' ); } for(var k in ts){ var t = ts[k]; if(t && typeof t.compile == 'function' && !t.compiled){ t.disableFormats = true; t.compile(); } } this.templates = ts; this.colRe = new RegExp("x-grid3-td-([^\\s]+)", ""); }, updateHeaders : function(){ this.innerHd.firstChild.innerHTML = this.renderHeaders(); this.innerHd.firstChild.style.width = this.getOffsetWidth(); this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth(); } }); // IEでGridのレイアウトが崩れる問題の修正コード ここまで /** * ベースパラメータの追加 * * prmSrc:ベースパラメータ * prmNew:追加パラメータ */ procenter.common.addBaseParams = function(prmSrc, prmNew) { var ret = {}; for( keys in prmSrc ) { ret[keys] = prmSrc[keys]; } for( keys in prmNew ) { ret[keys] = prmNew[keys]; } return ret; } /** * ベースWindowの定義 * */ procenter.common.BaseWindow = function(config) { procenter.common.BaseWindow.superclass.constructor.call(this, Ext.applyIf(config,{ closeAction :"destroy", modal :true })); if(procenter.common.isDisableAllBaseWindow == true){ this.on({ beforeshow : function( comp ) { if(this.isOpen == true){ return false; } //自Windowは、まだ表示されていないのでここでDisable //ユーザのパスワード変更が動作しないため this.disable(); // WindowにaddButtonしたボタンをDisable if (typeof this.buttons != 'undefined'){ Ext.each(this.buttons, function(item, index, allItems){ item.disable(); }); } //全てのBaseWindowをDisable化 procenter.common.disableAllBaseWindow(); }, show : function( comp ) { // Windowの表示時 //WindowのOpenをTrueに設定 this.isOpen = true; procenter.common.openBaseWindow(); procenter.common.ARegistWindowVisible = false; procenter.common.ARegistVisible(); }, activate : function( win ) { if(procenter.common.isMaskFullScreen() == false){ // 現在ActiveなWindowをEnable化 procenter.common.enableActiveBaseWindow(); } }, //render : function( comp ) { // this.isOpen = true; //}, //afterlayout : function( contain , layout ){ // this.isOpen = true; //}, beforeclose :function( panel ){ if(this.isOpen == false){ return false; } }, close:function( panel ){ // WindowのClose時 if(this.isOpen == true){ procenter.common.closeBaseWindow(); } //WindowのOpenをFalseに設定 this.isOpen = false; procenter.common.ARegistWindowVisible = true; procenter.common.ARegistVisible(); }, destroy:function( comp ) { // Windowのdestroy時 if(this.isOpen == true){ procenter.common.closeBaseWindow(); } //WindowのOpenをFalseに設定 this.isOpen = false; procenter.common.ARegistWindowVisible = true; procenter.common.ARegistVisible(); }, hide :function( comp ) { // Windowのdestroy時 if(this.isOpen == true){ procenter.common.closeBaseWindow(); } //WindowのOpenをFalseに設定 this.isOpen = false; procenter.common.ARegistWindowVisible = true; procenter.common.ARegistVisible(); } }); } } Ext.extend(procenter.common.BaseWindow, Ext.Window, { isOpen : false }); /* * Ext JS Library 2.2.1 * Copyright(c) 2006-2009, Ext JS, LLC. * licensing@extjs.com * * http://extjs.com/license */ /** * @class Ext.MessageBox *

Utility class for generating different styles of message boxes. The alias Ext.Msg can also be used.

*

Note that the MessageBox is asynchronous. Unlike a regular JavaScript alert (which will halt * browser execution), showing a MessageBox will not cause the code to stop. For this reason, if you have code * that should only run after some user feedback from the MessageBox, you must use a callback function * (see the function parameter for {@link #show} for more details).

*

Example usage:

*

// Basic alert:
Ext.Msg.alert('Status', 'Changes saved successfully.');

// Prompt for user data and process the result using a callback:
Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
    if (btn == 'ok'){
        // process text value and close...
    }
});

// Show a dialog using config options:
Ext.Msg.show({
   title:'Save Changes?',
   msg: 'You are closing a tab that has unsaved changes. Would you like to save your changes?',
   buttons: Ext.Msg.YESNOCANCEL,
   fn: processResult,
   animEl: 'elId',
   icon: Ext.MessageBox.QUESTION
});
* @singleton */ Ext.MessageBox = function(){ var dlg, opt, mask, waitTimer; var bodyEl, msgEl, textboxEl, textareaEl, progressBar, pp, iconEl, spacerEl; var buttons, activeTextEl, bwidth, iconCls = ''; // private var handleButton = function(button){ if(dlg.isVisible()){ dlg.hide(); Ext.callback(opt.fn, opt.scope||window, [button, activeTextEl.dom.value, opt], 1); } }; // private var handleHide = function(){ if(opt && opt.cls){ dlg.el.removeClass(opt.cls); } progressBar.reset(); }; // private var handleEsc = function(d, k, e){ if(opt && opt.closable !== false){ dlg.hide(); } if(e){ e.stopEvent(); } }; // private var updateButtons = function(b){ var width = 0; if(!b){ buttons["ok"].hide(); buttons["cancel"].hide(); buttons["yes"].hide(); buttons["no"].hide(); return width; } dlg.footer.dom.style.display = ''; for(var k in buttons){ if(typeof buttons[k] != "function"){ if(b[k]){ buttons[k].show(); buttons[k].setText(typeof b[k] == "string" ? b[k] : Ext.MessageBox.buttonText[k]); width += buttons[k].el.getWidth()+15; }else{ buttons[k].hide(); } } } return width; }; return { /** * Returns a reference to the underlying {@link Ext.Window} element * @return {Ext.Window} The window */ getDialog : function(titleText){ if(!dlg){ dlg = new procenter.common.BaseWindow({ autoCreate : true, title:titleText, resizable:false, constrain:true, constrainHeader:true, minimizable : false, maximizable : false, stateful: false, modal: true, shim:true, buttonAlign:"center", width:400, height:100, minHeight: 80, plain:true, closeAction :'close',//J.Mikasa Add footer:true, closable:true, close : function(){ if(opt && opt.buttons && opt.buttons.no && !opt.buttons.cancel){ handleButton("no"); }else{ handleButton("cancel"); } } }); buttons = {}; var bt = this.buttonText; //TODO: refactor this block into a buttons config to pass into the Window constructor buttons["ok"] = dlg.addButton(bt["ok"], handleButton.createCallback("ok")); buttons["yes"] = dlg.addButton(bt["yes"], handleButton.createCallback("yes")); buttons["no"] = dlg.addButton(bt["no"], handleButton.createCallback("no")); buttons["cancel"] = dlg.addButton(bt["cancel"], handleButton.createCallback("cancel")); buttons["ok"].hideMode = buttons["yes"].hideMode = buttons["no"].hideMode = buttons["cancel"].hideMode = 'offsets'; dlg.render(document.body); dlg.getEl().addClass('x-window-dlg'); mask = dlg.mask; bodyEl = dlg.body.createChild({ html:'

' }); iconEl = Ext.get(bodyEl.dom.firstChild); var contentEl = bodyEl.dom.childNodes[1]; msgEl = Ext.get(contentEl.firstChild); textboxEl = Ext.get(contentEl.childNodes[2].firstChild); textboxEl.enableDisplayMode(); textboxEl.addKeyListener([10,13], function(){ if(dlg.isVisible() && opt && opt.buttons){ if(opt.buttons.ok){ handleButton("ok"); }else if(opt.buttons.yes){ handleButton("yes"); } } }); textareaEl = Ext.get(contentEl.childNodes[2].childNodes[1]); textareaEl.enableDisplayMode(); progressBar = new Ext.ProgressBar({ renderTo:bodyEl }); bodyEl.createChild({cls:'x-clear'}); } return dlg; }, /** * Updates the message box body text * @param {String} text (optional) Replaces the message box element's innerHTML with the specified string (defaults to * the XHTML-compliant non-breaking space character '&#160;') * @return {Ext.MessageBox} this */ updateText : function(text){ if(!dlg.isVisible() && !opt.width){ dlg.setSize(this.maxWidth, 100); // resize first so content is never clipped from previous shows } msgEl.update(text || ' '); var iw = iconCls != '' ? (iconEl.getWidth() + iconEl.getMargins('lr')) : 0; var mw = msgEl.getWidth() + msgEl.getMargins('lr'); var fw = dlg.getFrameWidth('lr'); var bw = dlg.body.getFrameWidth('lr'); if (Ext.isIE && iw > 0){ //3 pixels get subtracted in the icon CSS for an IE margin issue, //so we have to add it back here for the overall width to be consistent iw += 3; } var w = Math.max(Math.min(opt.width || iw+mw+fw+bw, this.maxWidth), Math.max(opt.minWidth || this.minWidth, bwidth || 0)); if(opt.prompt === true){ activeTextEl.setWidth(w-iw-fw-bw); } if(opt.progress === true || opt.wait === true){ progressBar.setSize(w-iw-fw-bw); } if(Ext.isIE && w == bwidth){ w += 4; //Add offset when the content width is smaller than the buttons. } dlg.setSize(w, 'auto').center(); return this; }, /** * Updates a progress-style message box's text and progress bar. Only relevant on message boxes * initiated via {@link Ext.MessageBox#progress} or {@link Ext.MessageBox#wait}, * or by calling {@link Ext.MessageBox#show} with progress: true. * @param {Number} value Any number between 0 and 1 (e.g., .5, defaults to 0) * @param {String} progressText The progress text to display inside the progress bar (defaults to '') * @param {String} msg The message box's body text is replaced with the specified string (defaults to undefined * so that any existing body text will not get overwritten by default unless a new value is passed in) * @return {Ext.MessageBox} this */ updateProgress : function(value, progressText, msg){ progressBar.updateProgress(value, progressText); if(msg){ this.updateText(msg); } return this; }, /** * Returns true if the message box is currently displayed * @return {Boolean} True if the message box is visible, else false */ isVisible : function(){ return dlg && dlg.isVisible(); }, /** * Hides the message box if it is displayed * @return {Ext.MessageBox} this */ hide : function(){ var proxy = dlg.activeGhost; if(this.isVisible() || proxy) { dlg.hide(); handleHide(); if (proxy) { proxy.hide(); } } return this; }, /** * Displays a new message box, or reinitializes an existing message box, based on the config options * passed in. All display functions (e.g. prompt, alert, etc.) on MessageBox call this function internally, * although those calls are basic shortcuts and do not support all of the config options allowed here. * @param {Object} config The following config options are supported: * Example usage: *

Ext.Msg.show({
   title: 'Address',
   msg: 'Please enter your address:',
   width: 300,
   buttons: Ext.MessageBox.OKCANCEL,
   multiline: true,
   fn: saveAddress,
   animEl: 'addAddressBtn',
   icon: Ext.MessageBox.INFO
});
* @return {Ext.MessageBox} this */ show : function(options){ if(this.isVisible()){ this.hide(); } opt = options; var d = this.getDialog(opt.title || " "); d.setTitle(opt.title || " "); var allowClose = (opt.closable !== false && opt.progress !== true && opt.wait !== true); d.tools.close.setDisplayed(allowClose); activeTextEl = textboxEl; opt.prompt = opt.prompt || (opt.multiline ? true : false); if(opt.prompt){ if(opt.multiline){ textboxEl.hide(); textareaEl.show(); textareaEl.setHeight(typeof opt.multiline == "number" ? opt.multiline : this.defaultTextHeight); activeTextEl = textareaEl; }else{ textboxEl.show(); textareaEl.hide(); } }else{ textboxEl.hide(); textareaEl.hide(); } activeTextEl.dom.value = opt.value || ""; if(opt.prompt){ d.focusEl = activeTextEl; }else{ var bs = opt.buttons; var db = null; if(bs && bs.ok){ db = buttons["ok"]; }else if(bs && bs.yes){ db = buttons["yes"]; } if (db){ d.focusEl = db; } } if(opt.iconCls){ d.setIconClass(opt.iconCls); } this.setIcon(opt.icon); bwidth = updateButtons(opt.buttons); progressBar.setVisible(opt.progress === true || opt.wait === true); this.updateProgress(0, opt.progressText); this.updateText(opt.msg); if(opt.cls){ d.el.addClass(opt.cls); } d.proxyDrag = opt.proxyDrag === true; d.modal = opt.modal !== false; d.mask = opt.modal !== false ? mask : false; if(!d.isVisible()){ // force it to the end of the z-index stack so it gets a cursor in FF document.body.appendChild(dlg.el.dom); d.setAnimateTarget(opt.animEl); d.show(opt.animEl); } //workaround for window internally enabling keymap in afterShow d.on('show', function(){ if(allowClose === true){ d.keyMap.enable(); }else{ d.keyMap.disable(); } }, this, {single:true}); if(opt.wait === true){ progressBar.wait(opt.waitConfig); } return this; }, /** * Adds the specified icon to the dialog. By default, the class 'ext-mb-icon' is applied for default * styling, and the class passed in is expected to supply the background image url. Pass in empty string ('') * to clear any existing icon. The following built-in icon classes are supported, but you can also pass * in a custom class name: *
Ext.MessageBox.INFO
Ext.MessageBox.WARNING
Ext.MessageBox.QUESTION
Ext.MessageBox.ERROR
         *
* @param {String} icon A CSS classname specifying the icon's background image url, or empty string to clear the icon * @return {Ext.MessageBox} this */ setIcon : function(icon){ if(icon && icon != ''){ iconEl.removeClass('x-hidden'); iconEl.replaceClass(iconCls, icon); iconCls = icon; }else{ iconEl.replaceClass(iconCls, 'x-hidden'); iconCls = ''; } return this; }, /** * Displays a message box with a progress bar. This message box has no buttons and is not closeable by * the user. You are responsible for updating the progress bar as needed via {@link Ext.MessageBox#updateProgress} * and closing the message box when the process is complete. * @param {String} title The title bar text * @param {String} msg The message box body text * @param {String} progressText (optional) The text to display inside the progress bar (defaults to '') * @return {Ext.MessageBox} this */ progress : function(title, msg, progressText){ this.show({ title : title, msg : msg, buttons: false, progress:true, closable:false, minWidth: this.minProgressWidth, progressText: progressText }); return this; }, /** * Displays a message box with an infinitely auto-updating progress bar. This can be used to block user * interaction while waiting for a long-running process to complete that does not have defined intervals. * You are responsible for closing the message box when the process is complete. * @param {String} msg The message box body text * @param {String} title (optional) The title bar text * @param {Object} config (optional) A {@link Ext.ProgressBar#waitConfig} object * @return {Ext.MessageBox} this */ wait : function(msg, title, config){ this.show({ title : title, msg : msg, buttons: false, closable:false, wait:true, modal:true, minWidth: this.minProgressWidth, waitConfig: config }); return this; }, /** * Displays a standard read-only message box with an OK button (comparable to the basic JavaScript alert prompt). * If a callback function is passed it will be called after the user clicks the button, and the * id of the button that was clicked will be passed as the only parameter to the callback * (could also be the top-right close button). * @param {String} title The title bar text * @param {String} msg The message box body text * @param {Function} fn (optional) The callback function invoked after the message box is closed * @param {Object} scope (optional) The scope of the callback function * @return {Ext.MessageBox} this */ alert : function(title, msg, fn, scope){ this.show({ title : title, msg : msg, buttons: this.OK, fn: fn, scope : scope }); return this; }, /** * Displays a confirmation message box with Yes and No buttons (comparable to JavaScript's confirm). * If a callback function is passed it will be called after the user clicks either button, * and the id of the button that was clicked will be passed as the only parameter to the callback * (could also be the top-right close button). * @param {String} title The title bar text * @param {String} msg The message box body text * @param {Function} fn (optional) The callback function invoked after the message box is closed * @param {Object} scope (optional) The scope of the callback function * @return {Ext.MessageBox} this */ confirm : function(title, msg, fn, scope){ this.show({ title : title, msg : msg, buttons: this.YESNO, fn: fn, scope : scope, icon: this.QUESTION }); return this; }, /** * Displays a message box with OK and Cancel buttons prompting the user to enter some text (comparable to JavaScript's prompt). * The prompt can be a single-line or multi-line textbox. If a callback function is passed it will be called after the user * clicks either button, and the id of the button that was clicked (could also be the top-right * close button) and the text that was entered will be passed as the two parameters to the callback. * @param {String} title The title bar text * @param {String} msg The message box body text * @param {Function} fn (optional) The callback function invoked after the message box is closed * @param {Object} scope (optional) The scope of the callback function * @param {Boolean/Number} multiline (optional) True to create a multiline textbox using the defaultTextHeight * property, or the height in pixels to create the textbox (defaults to false / single-line) * @param {String} value (optional) Default value of the text input element (defaults to '') * @return {Ext.MessageBox} this */ prompt : function(title, msg, fn, scope, multiline, value){ this.show({ title : title, msg : msg, buttons: this.OKCANCEL, fn: fn, minWidth:250, scope : scope, prompt:true, multiline: multiline, value: value }); return this; }, /** * Button config that displays a single OK button * @type Object */ OK : {ok:true}, /** * Button config that displays a single Cancel button * @type Object */ CANCEL : {cancel:true}, /** * Button config that displays OK and Cancel buttons * @type Object */ OKCANCEL : {ok:true, cancel:true}, /** * Button config that displays Yes and No buttons * @type Object */ YESNO : {yes:true, no:true}, /** * Button config that displays Yes, No and Cancel buttons * @type Object */ YESNOCANCEL : {yes:true, no:true, cancel:true}, /** * The CSS class that provides the INFO icon image * @type String */ INFO : 'ext-mb-info', /** * The CSS class that provides the WARNING icon image * @type String */ WARNING : 'ext-mb-warning', /** * The CSS class that provides the QUESTION icon image * @type String */ QUESTION : 'ext-mb-question', /** * The CSS class that provides the ERROR icon image * @type String */ ERROR : 'ext-mb-error', /** * The default height in pixels of the message box's multiline textarea if displayed (defaults to 75) * @type Number */ defaultTextHeight : 75, /** * The maximum width in pixels of the message box (defaults to 600) * @type Number */ maxWidth : 600, /** * The minimum width in pixels of the message box (defaults to 100) * @type Number */ minWidth : 100, /** * The minimum width in pixels of the message box if it is a progress-style dialog. This is useful * for setting a different minimum width than text-only dialogs may need (defaults to 250) * @type Number */ minProgressWidth : 250, /** * An object containing the default button text strings that can be overriden for localized language support. * Supported properties are: ok, cancel, yes and no. Generally you should include a locale-specific * resource file for handling language support across the framework. * Customize the default text like so: Ext.MessageBox.buttonText.yes = "oui"; //french * @type Object */ buttonText : { ok : "OK", cancel : "Cancel", yes : "Yes", no : "No" } }; }(); /** * Shorthand for {@link Ext.MessageBox} */ Ext.Msg = Ext.MessageBox; var ghostCreatedFlg = false; Ext.extend(Ext.Window.DD, Ext.dd.DD, { moveOnly:true, headerOffsets:[100, 25], startDrag : function(){ var w = this.win; if (!ghostCreatedFlg) { this.proxy = w.ghost(); ghostCreatedFlg = true; } else { return; } if(w.constrain !== false){ var so = w.el.shadowOffset; this.constrainTo(w.container, {right: so, left: so, bottom: so}); }else if(w.constrainHeader !== false){ var s = this.proxy.getSize(); this.constrainTo(w.container, {right: -(s.width-this.headerOffsets[0]), bottom: -(s.height-this.headerOffsets[1])}); } }, b4Drag : Ext.emptyFn, onDrag : function(e){ this.alignElWithMouse(this.proxy, e.getPageX(), e.getPageY()); }, endDrag : function(e){ ghostCreatedFlg = false; this.win.unghost(); this.win.saveState(); } }); Ext.override( Ext.DatePicker, { onRender : function(container, position){ //--- Updated below to add width 130px .. was not working correct in Chrome var m = [ '', '', '', this.showToday ? '' : '', '
  
']; var dn = this.dayNames; for(var i = 0; i < 7; i++){ var d = this.startDay+i; if(d > 6){ d = d-7; } m.push(""); } m[m.length] = ""; for(var i = 0; i < 42; i++) { if(i % 7 == 0 && i != 0){ m[m.length] = ""; } m[m.length] = ''; } m.push('
", dn[d].substr(0,1), "
'); var el = document.createElement("div"); el.className = "x-date-picker"; el.innerHTML = m.join(""); container.dom.insertBefore(el, position); this.el = Ext.get(el); this.eventEl = Ext.get(el.firstChild); this.leftClickRpt = new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"), { handler: this.showPrevMonth, scope: this, preventDefault:true, stopDefault:true }); this.rightClickRpt = new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"), { handler: this.showNextMonth, scope: this, preventDefault:true, stopDefault:true }); this.eventEl.on("mousewheel", this.handleMouseWheel, this); this.monthPicker = this.el.down('div.x-date-mp'); this.monthPicker.enableDisplayMode('block'); var kn = new Ext.KeyNav(this.eventEl, { "left" : function(e){ e.ctrlKey ? this.showPrevMonth() : this.update(this.activeDate.add("d", -1)); }, "right" : function(e){ e.ctrlKey ? this.showNextMonth() : this.update(this.activeDate.add("d", 1)); }, "up" : function(e){ e.ctrlKey ? this.showNextYear() : this.update(this.activeDate.add("d", -7)); }, "down" : function(e){ e.ctrlKey ? this.showPrevYear() : this.update(this.activeDate.add("d", 7)); }, "pageUp" : function(e){ this.showNextMonth(); }, "pageDown" : function(e){ this.showPrevMonth(); }, "enter" : function(e){ e.stopPropagation(); return true; }, scope : this }); this.eventEl.on("click", this.handleDateClick, this, {delegate: "a.x-date-date"}); this.el.unselectable(); this.cells = this.el.select("table.x-date-inner tbody td"); this.textNodes = this.el.query("table.x-date-inner tbody span"); this.mbtn = new Ext.Button({ text: " ", tooltip: this.monthYearText, renderTo: this.el.child("td.x-date-middle", true) }); this.mbtn.on('click', this.showMonthPicker, this); this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu"); if(this.showToday){ this.todayKeyListener = this.eventEl.addKeyListener(Ext.EventObject.SPACE, this.selectToday, this); var today = (new Date()).dateFormat(this.format); this.todayBtn = new Ext.Button({ renderTo: this.el.child("td.x-date-bottom", true), text: String.format(this.todayText, today), tooltip: String.format(this.todayTip, today), handler: this.selectToday, scope: this }); } if(Ext.isIE){ this.el.repaint(); } this.update(this.value); } });