[kune-commits] r865 - in trunk: .
src/main/java/org/ourproject/kune/app
src/main/java/org/ourproject/kune/app/public
src/main/java/org/ourproject/kune/app/public/css
src/main/java/org/ourproject/kune/app/public/js
src/main/java/org/ourproject/kune/app/public/js/UploadDialog
src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css
src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox
src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images
src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale
src/main/java/org/ourproject/kune/docs/client
src/main/java/org/ourproject/kune/docs/server
src/main/java/org/ourproject/kune/platf/client/services
src/main/java/org/ourproject/kune/platf/client/ui/dialogs
src/main/java/org/ourproject/kune/platf/server/manager/impl
src/main/java/org/ourproject/kune/workspace/client/ctxnav
src/main/java/org/ourproject/kune/workspace/client/signin
src/main/java/org/ourproject/kune/workspace/client/socialnet
vjrj
vjrj at ourproject.org
Tue Sep 9 20:00:53 CEST 2008
Author: vjrj
Date: 2008-09-09 20:00:21 +0200 (Tue, 09 Sep 2008)
New Revision: 865
Added:
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.js
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.packed.js
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css/
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css/Ext.ux.UploadDialog.css
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.dia
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.jpeg
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/check.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/done.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/failed.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-add.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-remove.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-uploading.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/loading.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/reset.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/uncheck.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-start.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-stop.gif
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale/
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale/ru.utf-8.js
trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/readme.txt
trunk/src/main/java/org/ourproject/kune/app/public/js/ext-ux-all-min.js
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java
trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
Modified:
trunk/pom.xml
trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerDefault.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
Log:
new gwt-ext 2.0.5 (gwt 1.5.2 compatible), new UploadDialog, new gwtcomp file servlet, other bug/issues
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/pom.xml 2008-09-09 18:00:21 UTC (rev 865)
@@ -31,16 +31,14 @@
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
- <version>1.5.0</version>
+ <version>1.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
- <version>1.5.0</version>
+ <version>1.5.2</version>
</dependency>
- <!-- Use new repo -->
- <!-- http://code.google.com/p/gwt-ext/issues/detail?id=180 -->
<!--
<dependency>
<groupId>com.extjs</groupId>
@@ -51,9 +49,14 @@
<dependency>
<groupId>com.gwtext</groupId>
<artifactId>gwtext</artifactId>
- <version>2.0.4</version>
+ <version>2.0.5</version>
</dependency>
<dependency>
+ <groupId>com.gwtextux</groupId>
+ <artifactId>gwtextux</artifactId>
+ <version>0.3.0</version>
+ </dependency>
+ <dependency>
<groupId>com.allen_sauer.gwt.log.gwt-log</groupId>
<artifactId>gwt-log</artifactId>
<version>2.5.2</version>
@@ -196,12 +199,12 @@
<dependency>
<groupId>org.cafesip.gwtcomp</groupId>
<artifactId>gwtcomp</artifactId>
- <version>0.0.2b</version>
+ <version>0.0.3b</version>
</dependency>
<dependency>
<groupId>org.cafesip.gwtcomp</groupId>
<artifactId>gwtcomp-servlet</artifactId>
- <version>0.0.2b</version>
+ <version>0.0.3b</version>
</dependency>
<!-- db upgrades -->
Modified: trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/Kune.gwt.xml 2008-09-09 18:00:21 UTC (rev 865)
@@ -17,6 +17,12 @@
<inherits name='com.gwtext.GwtExt' />
<script src="js/ext/adapter/ext/ext-base.js" />
<script src="js/ext/ext-all.js" />
+
+ <inherits name="com.gwtextux.GwtExtUx" />
+ <inherits name="com.gwtextux.UploadDialog"/>
+ <script src="js/UploadDialog/Ext.ux.UploadDialog.packed.js" />
+ <stylesheet src="js/UploadDialog/css/Ext.ux.UploadDialog.css" />
+ <script src="js/ext-ux-all-min.js" />
<!-- kune css -->
<stylesheet src="css/all.css" />
Modified: trunk/src/main/java/org/ourproject/kune/app/public/Kune.html
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/Kune.html 2008-09-09 18:00:21 UTC (rev 865)
@@ -25,7 +25,6 @@
top: 2px;
left: 2px;
z-index: 30000;
- font-family: arial,sans;
}
.kune-Progress {
@@ -34,6 +33,7 @@
white-space: nowrap;
height: 16px;
padding: 0 3px;
+ font-family: arial,sans;
}
</style>
@@ -57,7 +57,7 @@
src="images/spin-kune-thund-green.gif"
style="height: 16px; width: 16px;" /></td>
<td align="left" style="vertical-align: top;" class="kune-Progress">
- <div class="kune-SiteBarPanel gwt-Label" id="kuneprogresstext">Starting</div>
+ <div class="k-sitebar gwt-Label" id="kuneprogresstext">Starting</div>
</td>
<td width="100%" height="16" align="left"
style="vertical-align: top;"></td>
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/all.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/all.css 2008-09-09 18:00:21 UTC (rev 865)
@@ -2897,7 +2897,7 @@
border-left-width: 5px;
}
-.k-EntityTextLogo {
+.k-entitytextlogo {
border: 2px solid #F2F2F2;
height: 60px;
margin: 0 0 4px -1px;
Modified: trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/css/kune-new.css 2008-09-09 18:00:21 UTC (rev 865)
@@ -62,7 +62,7 @@
border-left-width: 5px;
}
-.k-EntityTextLogo {
+.k-entitytextlogo {
border: 2px solid #F2F2F2;
height: 60px;
margin: 0 0 4px -1px;
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.js
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.js 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.js 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,1540 @@
+/**
+ * This namespace should be in another file but I dicided to put it here for consistancy.
+ */
+Ext.namespace('Ext.ux.Utils');
+
+/**
+ * This class implements event queue behaviour.
+ *
+ * @class Ext.ux.Utils.EventQueue
+ * @param function handler Event handler.
+ * @param object scope Handler scope.
+ */
+Ext.ux.Utils.EventQueue = function(handler, scope)
+{
+ if (!handler) {
+ throw 'Handler is required.';
+ }
+ this.handler = handler;
+ this.scope = scope || window;
+ this.queue = [];
+ this.is_processing = false;
+
+ /**
+ * Posts event into the queue.
+ *
+ * @access public
+ * @param mixed event Event identificator.
+ * @param mixed data Event data.
+ */
+ this.postEvent = function(event, data)
+ {
+ data = data || null;
+ this.queue.push({event: event, data: data});
+ if (!this.is_processing) {
+ this.process();
+ }
+ }
+
+ this.flushEventQueue = function()
+ {
+ this.queue = [];
+ },
+
+ /**
+ * @access private
+ */
+ this.process = function()
+ {
+ while (this.queue.length > 0) {
+ this.is_processing = true;
+ var event_data = this.queue.shift();
+ this.handler.call(this.scope, event_data.event, event_data.data);
+ }
+ this.is_processing = false;
+ }
+}
+
+/**
+ * This class implements Mili's finite state automata behaviour.
+ *
+ * Transition / output table format:
+ * {
+ * 'state_1' : {
+ * 'event_1' : [
+ * {
+ * p|predicate: function, // Transition predicate, optional, default to true.
+ * // If array then conjunction will be applyed to the operands.
+ * // Predicate signature is (data, event, this).
+ * a|action: function|array, // Transition action, optional, default to Ext.emptyFn.
+ * // If array then methods will be called sequentially.
+ * // Action signature is (data, event, this).
+ * s|state: 'state_x', // New state - transition destination, optional, default to
+ * // current state.
+ * scope: object // Predicate and action scope, optional, default to
+ * // trans_table_scope or window.
+ * }
+ * ]
+ * },
+ *
+ * 'state_2' : {
+ * ...
+ * }
+ * ...
+ * }
+ *
+ * @param mixed initial_state Initial state.
+ * @param object trans_table Transition / output table.
+ * @param trans_table_scope Transition / output table's methods scope.
+ */
+Ext.ux.Utils.FSA = function(initial_state, trans_table, trans_table_scope)
+{
+ this.current_state = initial_state;
+ this.trans_table = trans_table || {};
+ this.trans_table_scope = trans_table_scope || window;
+ Ext.ux.Utils.FSA.superclass.constructor.call(this, this.processEvent, this);
+}
+
+Ext.extend(Ext.ux.Utils.FSA, Ext.ux.Utils.EventQueue, {
+
+ current_state : null,
+ trans_table : null,
+ trans_table_scope : null,
+
+ /**
+ * Returns current state
+ *
+ * @access public
+ * @return mixed Current state.
+ */
+ state : function()
+ {
+ return this.current_state;
+ },
+
+ /**
+ * @access public
+ */
+ processEvent : function(event, data)
+ {
+ var transitions = this.currentStateEventTransitions(event);
+ if (!transitions) {
+ throw "State '" + this.current_state + "' has no transition for event '" + event + "'.";
+ }
+ for (var i = 0, len = transitions.length; i < len; i++) {
+ var transition = transitions[i];
+
+ var predicate = transition.predicate || transition.p || true;
+ var action = transition.action || transition.a || Ext.emptyFn;
+ var new_state = transition.state || transition.s || this.current_state;
+ var scope = transition.scope || this.trans_table_scope;
+
+ if (this.computePredicate(predicate, scope, data, event)) {
+ this.callAction(action, scope, data, event);
+ this.current_state = new_state;
+ return;
+ }
+ }
+
+ throw "State '" + this.current_state + "' has no transition for event '" + event + "' in current context";
+ },
+
+ /**
+ * @access private
+ */
+ currentStateEventTransitions : function(event)
+ {
+ return this.trans_table[this.current_state] ?
+ this.trans_table[this.current_state][event] || false
+ :
+ false;
+ },
+
+ /**
+ * @access private
+ */
+ computePredicate : function(predicate, scope, data, event)
+ {
+ var result = false;
+
+ switch (Ext.type(predicate)) {
+ case 'function':
+ result = predicate.call(scope, data, event, this);
+ break;
+ case 'array':
+ result = true;
+ for (var i = 0, len = predicate.length; result && (i < len); i++) {
+ if (Ext.type(predicate[i]) == 'function') {
+ result = predicate[i].call(scope, data, event, this);
+ }
+ else {
+ throw [
+ 'Predicate: ',
+ predicate[i],
+ ' is not callable in "',
+ this.current_state,
+ '" state for event "',
+ event
+ ].join('');
+ }
+ }
+ break;
+ case 'boolean':
+ result = predicate;
+ break;
+ default:
+ throw [
+ 'Predicate: ',
+ predicate,
+ ' is not callable in "',
+ this.current_state,
+ '" state for event "',
+ event
+ ].join('');
+ }
+ return result;
+ },
+
+ /**
+ * @access private
+ */
+ callAction : function(action, scope, data, event)
+ {
+ switch (Ext.type(action)) {
+ case 'array':
+ for (var i = 0, len = action.length; i < len; i++) {
+ if (Ext.type(action[i]) == 'function') {
+ action[i].call(scope, data, event, this);
+ }
+ else {
+ throw [
+ 'Action: ',
+ action[i],
+ ' is not callable in "',
+ this.current_state,
+ '" state for event "',
+ event
+ ].join('');
+ }
+ }
+ break;
+ case 'function':
+ action.call(scope, data, event, this);
+ break;
+ default:
+ throw [
+ 'Action: ',
+ action,
+ ' is not callable in "',
+ this.current_state,
+ '" state for event "',
+ event
+ ].join('');
+ }
+ }
+});
+
+// ---------------------------------------------------------------------------------------------- //
+
+/**
+ * Ext.ux.UploadDialog namespace.
+ */
+Ext.namespace('Ext.ux.UploadDialog');
+
+/**
+ * File upload browse button.
+ *
+ * @class Ext.ux.UploadDialog.BrowseButton
+ */
+Ext.ux.UploadDialog.BrowseButton = Ext.extend(Ext.Button,
+{
+ input_name : 'file',
+
+ input_file : null,
+
+ original_handler : null,
+
+ original_scope : null,
+
+ /**
+ * @access private
+ */
+ initComponent : function()
+ {
+ Ext.ux.UploadDialog.BrowseButton.superclass.initComponent.call(this);
+ this.original_handler = this.handler || null;
+ this.original_scope = this.scope || window;
+ this.handler = null;
+ this.scope = null;
+ },
+
+ /**
+ * @access private
+ */
+ onRender : function(ct, position)
+ {
+ Ext.ux.UploadDialog.BrowseButton.superclass.onRender.call(this, ct, position);
+ this.createInputFile();
+ },
+
+ /**
+ * @access private
+ */
+ createInputFile : function()
+ {
+ var button_container = this.el.child('.x-btn-center');
+ button_container.position('relative');
+ this.input_file = Ext.DomHelper.append(
+ button_container,
+ {
+ tag: 'input',
+ type: 'file',
+ size: 1,
+ name: this.input_name || Ext.id(this.el),
+ style: 'position: absolute; display: block; border: none; cursor: pointer'
+ },
+ true
+ );
+
+ var button_box = button_container.getBox();
+ this.input_file.setStyle('font-size', (button_box.width * 0.5) + 'px');
+
+ var input_box = this.input_file.getBox();
+ var adj = {x: 3, y: 3}
+ if (Ext.isIE) {
+ adj = {x: 0, y: 3}
+ }
+
+ this.input_file.setLeft(button_box.width - input_box.width + adj.x + 'px');
+ this.input_file.setTop(button_box.height - input_box.height + adj.y + 'px');
+ this.input_file.setOpacity(0.0);
+
+ if (this.handleMouseEvents) {
+ this.input_file.on('mouseover', this.onMouseOver, this);
+ this.input_file.on('mousedown', this.onMouseDown, this);
+ }
+
+ if(this.tooltip){
+ if(typeof this.tooltip == 'object'){
+ Ext.QuickTips.register(Ext.apply({target: this.input_file}, this.tooltip));
+ }
+ else {
+ this.input_file.dom[this.tooltipType] = this.tooltip;
+ }
+ }
+
+ this.input_file.on('change', this.onInputFileChange, this);
+ this.input_file.on('click', function(e) { e.stopPropagation(); });
+ },
+
+ /**
+ * @access public
+ */
+ detachInputFile : function(no_create)
+ {
+ var result = this.input_file;
+
+ no_create = no_create || false;
+
+ if (typeof this.tooltip == 'object') {
+ Ext.QuickTips.unregister(this.input_file);
+ }
+ else {
+ this.input_file.dom[this.tooltipType] = null;
+ }
+ this.input_file.removeAllListeners();
+ this.input_file = null;
+
+ if (!no_create) {
+ this.createInputFile();
+ }
+ return result;
+ },
+
+ /**
+ * @access public
+ */
+ getInputFile : function()
+ {
+ return this.input_file;
+ },
+
+ /**
+ * @access public
+ */
+ disable : function()
+ {
+ Ext.ux.UploadDialog.BrowseButton.superclass.disable.call(this);
+ this.input_file.dom.disabled = true;
+ },
+
+ /**
+ * @access public
+ */
+ enable : function()
+ {
+ Ext.ux.UploadDialog.BrowseButton.superclass.enable.call(this);
+ this.input_file.dom.disabled = false;
+ },
+
+ /**
+ * @access public
+ */
+ destroy : function()
+ {
+ var input_file = this.detachInputFile(true);
+ input_file.remove();
+ input_file = null;
+ Ext.ux.UploadDialog.BrowseButton.superclass.destroy.call(this);
+ },
+
+ /**
+ * @access private
+ */
+ onInputFileChange : function()
+ {
+ if (this.original_handler) {
+ this.original_handler.call(this.original_scope, this);
+ }
+ }
+});
+
+/**
+ * Toolbar file upload browse button.
+ *
+ * @class Ext.ux.UploadDialog.TBBrowseButton
+ */
+Ext.ux.UploadDialog.TBBrowseButton = Ext.extend(Ext.ux.UploadDialog.BrowseButton,
+{
+ hideParent : true,
+
+ onDestroy : function()
+ {
+ Ext.ux.UploadDialog.TBBrowseButton.superclass.onDestroy.call(this);
+ if(this.container) {
+ this.container.remove();
+ }
+ }
+});
+
+/**
+ * Record type for dialogs grid.
+ *
+ * @class Ext.ux.UploadDialog.FileRecord
+ */
+Ext.ux.UploadDialog.FileRecord = Ext.data.Record.create([
+ {name: 'filename'},
+ {name: 'state', type: 'int'},
+ {name: 'note'},
+ {name: 'input_element'}
+]);
+
+Ext.ux.UploadDialog.FileRecord.STATE_QUEUE = 0;
+Ext.ux.UploadDialog.FileRecord.STATE_FINISHED = 1;
+Ext.ux.UploadDialog.FileRecord.STATE_FAILED = 2;
+Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING = 3;
+
+/**
+ * Dialog class.
+ *
+ * @class Ext.ux.UploadDialog.Dialog
+ */
+Ext.ux.UploadDialog.Dialog = function(config)
+{
+ var default_config = {
+ border: false,
+ width: 450,
+ height: 300,
+ minWidth: 450,
+ minHeight: 300,
+ plain: true,
+ constrainHeader: true,
+ draggable: true,
+ closable: true,
+ maximizable: false,
+ minimizable: false,
+ resizable: true,
+ autoDestroy: true,
+ closeAction: 'hide',
+ title: this.i18n.title,
+ cls: 'ext-ux-uploaddialog-dialog',
+ // --------
+ url: '',
+ base_params: {},
+ permitted_extensions: [],
+ reset_on_hide: true,
+ allow_close_on_upload: false,
+ upload_autostart: false,
+ post_var_name: 'file'
+ }
+ config = Ext.applyIf(config || {}, default_config);
+ config.layout = 'absolute';
+
+ Ext.ux.UploadDialog.Dialog.superclass.constructor.call(this, config);
+}
+
+Ext.extend(Ext.ux.UploadDialog.Dialog, Ext.Window, {
+
+ fsa : null,
+
+ state_tpl : null,
+
+ form : null,
+
+ grid_panel : null,
+
+ progress_bar : null,
+
+ is_uploading : false,
+
+ initial_queued_count : 0,
+
+ upload_frame : null,
+
+ /**
+ * @access private
+ */
+ //--------------------------------------------------------------------------------------------- //
+ initComponent : function()
+ {
+ Ext.ux.UploadDialog.Dialog.superclass.initComponent.call(this);
+
+ // Setting automata protocol
+ var tt = {
+ // --------------
+ 'created' : {
+ // --------------
+ 'window-render' : [
+ {
+ action: [this.createForm, this.createProgressBar, this.createGrid],
+ state: 'rendering'
+ }
+ ],
+ 'destroy' : [
+ {
+ action: this.flushEventQueue,
+ state: 'destroyed'
+ }
+ ]
+ },
+ // --------------
+ 'rendering' : {
+ // --------------
+ 'grid-render' : [
+ {
+ action: [this.fillToolbar, this.updateToolbar],
+ state: 'ready'
+ }
+ ],
+ 'destroy' : [
+ {
+ action: this.flushEventQueue,
+ state: 'destroyed'
+ }
+ ]
+ },
+ // --------------
+ 'ready' : {
+ // --------------
+ 'file-selected' : [
+ {
+ predicate: [this.fireFileTestEvent, this.isPermittedFile],
+ action: this.addFileToUploadQueue,
+ state: 'adding-file'
+ },
+ {
+ // If file is not permitted then do nothing.
+ }
+ ],
+ 'grid-selection-change' : [
+ {
+ action: this.updateToolbar
+ }
+ ],
+ 'remove-files' : [
+ {
+ action: [this.removeFiles, this.fireFileRemoveEvent]
+ }
+ ],
+ 'reset-queue' : [
+ {
+ action: [this.resetQueue, this.fireResetQueueEvent]
+ }
+ ],
+ 'start-upload' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.setUploadingFlag, this.saveInitialQueuedCount, this.updateToolbar,
+ this.updateProgressBar, this.prepareNextUploadTask, this.fireUploadStartEvent
+ ],
+ state: 'uploading'
+ },
+ {
+ // Has nothing to upload, do nothing.
+ }
+ ],
+ 'stop-upload' : [
+ {
+ // We are not uploading, do nothing. Can be posted by user only at this state.
+ }
+ ],
+ 'hide' : [
+ {
+ predicate: [this.isNotEmptyQueue, this.getResetOnHide],
+ action: [this.resetQueue, this.fireResetQueueEvent]
+ },
+ {
+ // Do nothing
+ }
+ ],
+ 'destroy' : [
+ {
+ action: this.flushEventQueue,
+ state: 'destroyed'
+ }
+ ]
+ },
+ // --------------
+ 'adding-file' : {
+ // --------------
+ 'file-added' : [
+ {
+ predicate: this.isUploading,
+ action: [this.incInitialQueuedCount, this.updateProgressBar, this.fireFileAddEvent],
+ state: 'uploading'
+ },
+ {
+ predicate: this.getUploadAutostart,
+ action: [this.startUpload, this.fireFileAddEvent],
+ state: 'ready'
+ },
+ {
+ action: [this.updateToolbar, this.fireFileAddEvent],
+ state: 'ready'
+ }
+ ]
+ },
+ // --------------
+ 'uploading' : {
+ // --------------
+ 'file-selected' : [
+ {
+ predicate: [this.fireFileTestEvent, this.isPermittedFile],
+ action: this.addFileToUploadQueue,
+ state: 'adding-file'
+ },
+ {
+ // If file is not permitted then do nothing.
+ }
+ ],
+ 'grid-selection-change' : [
+ {
+ // Do nothing.
+ }
+ ],
+ 'start-upload' : [
+ {
+ // Can be posted only by user in this state.
+ }
+ ],
+ 'stop-upload' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.resetUploadingFlag, this.abortUpload, this.updateToolbar,
+ this.updateProgressBar, this.fireUploadStopEvent
+ ],
+ state: 'ready'
+ },
+ {
+ action: [
+ this.resetUploadingFlag, this.abortUpload, this.updateToolbar,
+ this.updateProgressBar, this.fireUploadStopEvent, this.fireUploadCompleteEvent
+ ],
+ state: 'ready'
+ }
+ ],
+ 'file-upload-start' : [
+ {
+ action: [this.uploadFile, this.findUploadFrame, this.fireFileUploadStartEvent]
+ }
+ ],
+ 'file-upload-success' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.resetUploadFrame, this.updateRecordState, this.updateProgressBar,
+ this.prepareNextUploadTask, this.fireUploadSuccessEvent
+ ]
+ },
+ {
+ action: [
+ this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState,
+ this.updateToolbar, this.updateProgressBar, this.fireUploadSuccessEvent,
+ this.fireUploadCompleteEvent
+ ],
+ state: 'ready'
+ }
+ ],
+ 'file-upload-error' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.resetUploadFrame, this.updateRecordState, this.updateProgressBar,
+ this.prepareNextUploadTask, this.fireUploadErrorEvent
+ ]
+ },
+ {
+ action: [
+ this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState,
+ this.updateToolbar, this.updateProgressBar, this.fireUploadErrorEvent,
+ this.fireUploadCompleteEvent
+ ],
+ state: 'ready'
+ }
+ ],
+ 'file-upload-failed' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.resetUploadFrame, this.updateRecordState, this.updateProgressBar,
+ this.prepareNextUploadTask, this.fireUploadFailedEvent
+ ]
+ },
+ {
+ action: [
+ this.resetUploadFrame, this.resetUploadingFlag, this.updateRecordState,
+ this.updateToolbar, this.updateProgressBar, this.fireUploadFailedEvent,
+ this.fireUploadCompleteEvent
+ ],
+ state: 'ready'
+ }
+ ],
+ 'hide' : [
+ {
+ predicate: this.getResetOnHide,
+ action: [this.stopUpload, this.repostHide]
+ },
+ {
+ // Do nothing.
+ }
+ ],
+ 'destroy' : [
+ {
+ predicate: this.hasUnuploadedFiles,
+ action: [
+ this.resetUploadingFlag, this.abortUpload,
+ this.fireUploadStopEvent, this.flushEventQueue
+ ],
+ state: 'destroyed'
+ },
+ {
+ action: [
+ this.resetUploadingFlag, this.abortUpload,
+ this.fireUploadStopEvent, this.fireUploadCompleteEvent, this.flushEventQueue
+ ],
+ state: 'destroyed'
+ }
+ ]
+ },
+ // --------------
+ 'destroyed' : {
+ // --------------
+ }
+ }
+ this.fsa = new Ext.ux.Utils.FSA('created', tt, this);
+
+ // Registering dialog events.
+ this.addEvents({
+ 'filetest': true,
+ 'fileadd' : true,
+ 'fileremove' : true,
+ 'resetqueue' : true,
+ 'uploadsuccess' : true,
+ 'uploaderror' : true,
+ 'uploadfailed' : true,
+ 'uploadstart' : true,
+ 'uploadstop' : true,
+ 'uploadcomplete' : true,
+ 'fileuploadstart' : true
+ });
+
+ // Attaching to window events.
+ this.on('render', this.onWindowRender, this);
+ this.on('beforehide', this.onWindowBeforeHide, this);
+ this.on('hide', this.onWindowHide, this);
+ this.on('destroy', this.onWindowDestroy, this);
+
+ // Compiling state template.
+ this.state_tpl = new Ext.Template(
+ "<div class='ext-ux-uploaddialog-state ext-ux-uploaddialog-state-{state}'> </div>"
+ ).compile();
+ },
+
+ createForm : function()
+ {
+ this.form = Ext.DomHelper.append(this.body, {
+ tag: 'form',
+ method: 'post',
+ action: this.url,
+ style: 'position: absolute; left: -100px; top: -100px; width: 100px; height: 100px'
+ });
+ },
+
+ createProgressBar : function()
+ {
+ this.progress_bar = this.add(
+ new Ext.ProgressBar({
+ x: 0,
+ y: 0,
+ anchor: '0',
+ value: 0.0,
+ text: this.i18n.progress_waiting_text
+ })
+ );
+ },
+
+ createGrid : function()
+ {
+ var store = new Ext.data.Store({
+ proxy: new Ext.data.MemoryProxy([]),
+ reader: new Ext.data.JsonReader({}, Ext.ux.UploadDialog.FileRecord),
+ sortInfo: {field: 'state', direction: 'DESC'},
+ pruneModifiedRecords: true
+ });
+
+ var cm = new Ext.grid.ColumnModel([
+ {
+ header: this.i18n.state_col_title,
+ width: this.i18n.state_col_width,
+ resizable: false,
+ dataIndex: 'state',
+ sortable: true,
+ renderer: this.renderStateCell.createDelegate(this)
+ },
+ {
+ header: this.i18n.filename_col_title,
+ width: this.i18n.filename_col_width,
+ dataIndex: 'filename',
+ sortable: true,
+ renderer: this.renderFilenameCell.createDelegate(this)
+ },
+ {
+ header: this.i18n.note_col_title,
+ width: this.i18n.note_col_width,
+ dataIndex: 'note',
+ sortable: true,
+ renderer: this.renderNoteCell.createDelegate(this)
+ }
+ ]);
+
+ this.grid_panel = new Ext.grid.GridPanel({
+ ds: store,
+ cm: cm,
+
+ x: 0,
+ y: 22,
+ anchor: '0 -22',
+ border: true,
+
+ viewConfig: {
+ autoFill: true,
+ forceFit: true
+ },
+
+ bbar : new Ext.Toolbar()
+ });
+ this.grid_panel.on('render', this.onGridRender, this);
+
+ this.add(this.grid_panel);
+
+ this.grid_panel.getSelectionModel().on('selectionchange', this.onGridSelectionChange, this);
+ },
+
+ fillToolbar : function()
+ {
+ var tb = this.grid_panel.getBottomToolbar();
+ tb.x_buttons = {}
+
+ tb.x_buttons.add = tb.addItem(new Ext.ux.UploadDialog.TBBrowseButton({
+ input_name: this.post_var_name,
+ text: this.i18n.add_btn_text,
+ tooltip: this.i18n.add_btn_tip,
+ iconCls: 'ext-ux-uploaddialog-addbtn',
+ handler: this.onAddButtonFileSelected,
+ scope: this
+ }));
+
+ tb.x_buttons.remove = tb.addButton({
+ text: this.i18n.remove_btn_text,
+ tooltip: this.i18n.remove_btn_tip,
+ iconCls: 'ext-ux-uploaddialog-removebtn',
+ handler: this.onRemoveButtonClick,
+ scope: this
+ });
+
+ tb.x_buttons.reset = tb.addButton({
+ text: this.i18n.reset_btn_text,
+ tooltip: this.i18n.reset_btn_tip,
+ iconCls: 'ext-ux-uploaddialog-resetbtn',
+ handler: this.onResetButtonClick,
+ scope: this
+ });
+
+ tb.add('-');
+
+ tb.x_buttons.upload = tb.addButton({
+ text: this.i18n.upload_btn_start_text,
+ tooltip: this.i18n.upload_btn_start_tip,
+ iconCls: 'ext-ux-uploaddialog-uploadstartbtn',
+ handler: this.onUploadButtonClick,
+ scope: this
+ });
+
+ tb.add('-');
+
+ tb.x_buttons.indicator = tb.addItem(
+ new Ext.Toolbar.Item(
+ Ext.DomHelper.append(tb.getEl(), {
+ tag: 'div',
+ cls: 'ext-ux-uploaddialog-indicator-stoped',
+ html: ' '
+ })
+ )
+ );
+
+ tb.add('->');
+
+ tb.x_buttons.close = tb.addButton({
+ text: this.i18n.close_btn_text,
+ tooltip: this.i18n.close_btn_tip,
+ handler: this.onCloseButtonClick,
+ scope: this
+ });
+ },
+
+ renderStateCell : function(data, cell, record, row_index, column_index, store)
+ {
+ return this.state_tpl.apply({state: data});
+ },
+
+ renderFilenameCell : function(data, cell, record, row_index, column_index, store)
+ {
+ var view = this.grid_panel.getView();
+ var f = function() {
+ try {
+ Ext.fly(
+ view.getCell(row_index, column_index)
+ ).child('.x-grid3-cell-inner').dom['qtip'] = data;
+ }
+ catch (e)
+ {}
+ }
+ f.defer(1000);
+ return data;
+ },
+
+ renderNoteCell : function(data, cell, record, row_index, column_index, store)
+ {
+ var view = this.grid_panel.getView();
+ var f = function() {
+ try {
+ Ext.fly(
+ view.getCell(row_index, column_index)
+ ).child('.x-grid3-cell-inner').dom['qtip'] = data;
+ }
+ catch (e)
+ {}
+ }
+ f.defer(1000);
+ return data;
+ },
+
+ getFileExtension : function(filename)
+ {
+ var result = null;
+ var parts = filename.split('.');
+ if (parts.length > 1) {
+ result = parts.pop();
+ }
+ return result;
+ },
+
+ isPermittedFileType : function(filename)
+ {
+ var result = true;
+ if (this.permitted_extensions.length > 0) {
+ result = this.permitted_extensions.indexOf(this.getFileExtension(filename)) != -1;
+ }
+ return result;
+ },
+
+ isPermittedFile : function(browse_btn)
+ {
+ var result = false;
+ var filename = browse_btn.getInputFile().dom.value;
+
+ if (this.isPermittedFileType(filename)) {
+ result = true;
+ }
+ else {
+ Ext.Msg.alert(
+ this.i18n.error_msgbox_title,
+ String.format(
+ this.i18n.err_file_type_not_permitted,
+ filename,
+ this.permitted_extensions.join(this.i18n.permitted_extensions_join_str)
+ )
+ );
+ result = false;
+ }
+
+ return result;
+ },
+
+ fireFileTestEvent : function(browse_btn)
+ {
+ return this.fireEvent('filetest', this, browse_btn.getInputFile().dom.value) !== false;
+ },
+
+ addFileToUploadQueue : function(browse_btn)
+ {
+ var input_file = browse_btn.detachInputFile();
+
+ input_file.appendTo(this.form);
+ input_file.setStyle('width', '100px');
+ input_file.dom.disabled = true;
+
+ var store = this.grid_panel.getStore();
+ store.add(
+ new Ext.ux.UploadDialog.FileRecord({
+ state: Ext.ux.UploadDialog.FileRecord.STATE_QUEUE,
+ filename: input_file.dom.value,
+ note: this.i18n.note_queued_to_upload,
+ input_element: input_file
+ })
+ );
+ this.fsa.postEvent('file-added', input_file.dom.value);
+ },
+
+ fireFileAddEvent : function(filename)
+ {
+ this.fireEvent('fileadd', this, filename);
+ },
+
+ updateProgressBar : function()
+ {
+ if (this.is_uploading) {
+ var queued = this.getQueuedCount(true);
+ var value = 1 - queued / this.initial_queued_count;
+ this.progress_bar.updateProgress(
+ value,
+ String.format(
+ this.i18n.progress_uploading_text,
+ this.initial_queued_count - queued,
+ this.initial_queued_count
+ )
+ );
+ }
+ else {
+ this.progress_bar.updateProgress(0, this.i18n.progress_waiting_text);
+ }
+ },
+
+ updateToolbar : function()
+ {
+ var tb = this.grid_panel.getBottomToolbar();
+ if (this.is_uploading) {
+ tb.x_buttons.remove.disable();
+ tb.x_buttons.reset.disable();
+ tb.x_buttons.upload.enable();
+ if (!this.getAllowCloseOnUpload()) {
+ tb.x_buttons.close.disable();
+ }
+ Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass(
+ 'ext-ux-uploaddialog-indicator-stoped',
+ 'ext-ux-uploaddialog-indicator-processing'
+ );
+ tb.x_buttons.upload.setIconClass('ext-ux-uploaddialog-uploadstopbtn');
+ tb.x_buttons.upload.setText(this.i18n.upload_btn_stop_text);
+ tb.x_buttons.upload.getEl()
+ .child(tb.x_buttons.upload.buttonSelector)
+ .dom[tb.x_buttons.upload.tooltipType] = this.i18n.upload_btn_stop_tip;
+ }
+ else {
+ tb.x_buttons.remove.enable();
+ tb.x_buttons.reset.enable();
+ tb.x_buttons.close.enable();
+ Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass(
+ 'ext-ux-uploaddialog-indicator-processing',
+ 'ext-ux-uploaddialog-indicator-stoped'
+ );
+ tb.x_buttons.upload.setIconClass('ext-ux-uploaddialog-uploadstartbtn');
+ tb.x_buttons.upload.setText(this.i18n.upload_btn_start_text);
+ tb.x_buttons.upload.getEl()
+ .child(tb.x_buttons.upload.buttonSelector)
+ .dom[tb.x_buttons.upload.tooltipType] = this.i18n.upload_btn_start_tip;
+
+ if (this.getQueuedCount() > 0) {
+ tb.x_buttons.upload.enable();
+ }
+ else {
+ tb.x_buttons.upload.disable();
+ }
+
+ if (this.grid_panel.getSelectionModel().hasSelection()) {
+ tb.x_buttons.remove.enable();
+ }
+ else {
+ tb.x_buttons.remove.disable();
+ }
+
+ if (this.grid_panel.getStore().getCount() > 0) {
+ tb.x_buttons.reset.enable();
+ }
+ else {
+ tb.x_buttons.reset.disable();
+ }
+ }
+ },
+
+ saveInitialQueuedCount : function()
+ {
+ this.initial_queued_count = this.getQueuedCount();
+ },
+
+ incInitialQueuedCount : function()
+ {
+ this.initial_queued_count++;
+ },
+
+ setUploadingFlag : function()
+ {
+ this.is_uploading = true;
+ },
+
+ resetUploadingFlag : function()
+ {
+ this.is_uploading = false;
+ },
+
+ prepareNextUploadTask : function()
+ {
+ // Searching for first unuploaded file.
+ var store = this.grid_panel.getStore();
+ var record = null;
+
+ store.each(function(r) {
+ if (!record && r.get('state') == Ext.ux.UploadDialog.FileRecord.STATE_QUEUE) {
+ record = r;
+ }
+ else {
+ r.get('input_element').dom.disabled = true;
+ }
+ });
+
+ record.get('input_element').dom.disabled = false;
+ record.set('state', Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING);
+ record.set('note', this.i18n.note_processing);
+ record.commit();
+
+ this.fsa.postEvent('file-upload-start', record);
+ },
+
+ fireUploadStartEvent : function()
+ {
+ this.fireEvent('uploadstart', this);
+ },
+
+ removeFiles : function(file_records)
+ {
+ var store = this.grid_panel.getStore();
+ for (var i = 0, len = file_records.length; i < len; i++) {
+ var r = file_records[i];
+ r.get('input_element').remove();
+ store.remove(r);
+ }
+ },
+
+ fireFileRemoveEvent : function(file_records)
+ {
+ for (var i = 0, len = file_records.length; i < len; i++) {
+ this.fireEvent('fileremove', this, file_records[i].get('filename'));
+ }
+ },
+
+ resetQueue : function()
+ {
+ var store = this.grid_panel.getStore();
+ store.each(
+ function(r) {
+ r.get('input_element').remove();
+ }
+ );
+ store.removeAll();
+ },
+
+ fireResetQueueEvent : function()
+ {
+ this.fireEvent('resetqueue', this);
+ },
+
+ uploadFile : function(record)
+ {
+ Ext.Ajax.request({
+ url : this.url,
+ params : this.base_params || this.baseParams || this.params,
+ method : 'POST',
+ form : this.form,
+ isUpload : true,
+ success : this.onAjaxSuccess,
+ failure : this.onAjaxFailure,
+ scope : this,
+ record: record
+ });
+ },
+
+ fireFileUploadStartEvent : function(record)
+ {
+ this.fireEvent('fileuploadstart', this, record.get('filename'));
+ },
+
+ updateRecordState : function(data)
+ {
+ if ('success' in data.response && data.response.success) {
+ data.record.set('state', Ext.ux.UploadDialog.FileRecord.STATE_FINISHED);
+ data.record.set(
+ 'note', data.response.message || data.response.error || this.i18n.note_upload_success
+ );
+ }
+ else {
+ data.record.set('state', Ext.ux.UploadDialog.FileRecord.STATE_FAILED);
+ data.record.set(
+ 'note', data.response.message || data.response.error || this.i18n.note_upload_error
+ );
+ }
+
+ data.record.commit();
+ },
+
+ fireUploadSuccessEvent : function(data)
+ {
+ this.fireEvent('uploadsuccess', this, data.record.get('filename'), data.response);
+ },
+
+ fireUploadErrorEvent : function(data)
+ {
+ this.fireEvent('uploaderror', this, data.record.get('filename'), data.response);
+ },
+
+ fireUploadFailedEvent : function(data)
+ {
+ this.fireEvent('uploadfailed', this, data.record.get('filename'));
+ },
+
+ fireUploadCompleteEvent : function()
+ {
+ this.fireEvent('uploadcomplete', this);
+ },
+
+ findUploadFrame : function()
+ {
+ this.upload_frame = Ext.getBody().child('iframe.x-hidden:last');
+ },
+
+ resetUploadFrame : function()
+ {
+ this.upload_frame = null;
+ },
+
+ removeUploadFrame : function()
+ {
+ if (this.upload_frame) {
+ this.upload_frame.removeAllListeners();
+ this.upload_frame.dom.src = 'about:blank';
+ this.upload_frame.remove();
+ }
+ this.upload_frame = null;
+ },
+
+ abortUpload : function()
+ {
+ this.removeUploadFrame();
+
+ var store = this.grid_panel.getStore();
+ var record = null;
+ store.each(function(r) {
+ if (r.get('state') == Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING) {
+ record = r;
+ return false;
+ }
+ });
+
+ record.set('state', Ext.ux.UploadDialog.FileRecord.STATE_FAILED);
+ record.set('note', this.i18n.note_aborted);
+ record.commit();
+ },
+
+ fireUploadStopEvent : function()
+ {
+ this.fireEvent('uploadstop', this);
+ },
+
+ repostHide : function()
+ {
+ this.fsa.postEvent('hide');
+ },
+
+ flushEventQueue : function()
+ {
+ this.fsa.flushEventQueue();
+ },
+
+ /**
+ * @access private
+ */
+ // -------------------------------------------------------------------------------------------- //
+ onWindowRender : function()
+ {
+ this.fsa.postEvent('window-render');
+ },
+
+ onWindowBeforeHide : function()
+ {
+ return this.isUploading() ? this.getAllowCloseOnUpload() : true;
+ },
+
+ onWindowHide : function()
+ {
+ this.fsa.postEvent('hide');
+ },
+
+ onWindowDestroy : function()
+ {
+ this.fsa.postEvent('destroy');
+ },
+
+ onGridRender : function()
+ {
+ this.fsa.postEvent('grid-render');
+ },
+
+ onGridSelectionChange : function()
+ {
+ this.fsa.postEvent('grid-selection-change');
+ },
+
+ onAddButtonFileSelected : function(btn)
+ {
+ this.fsa.postEvent('file-selected', btn);
+ },
+
+ onUploadButtonClick : function()
+ {
+ if (this.is_uploading) {
+ this.fsa.postEvent('stop-upload');
+ }
+ else {
+ this.fsa.postEvent('start-upload');
+ }
+ },
+
+ onRemoveButtonClick : function()
+ {
+ var selections = this.grid_panel.getSelectionModel().getSelections();
+ this.fsa.postEvent('remove-files', selections);
+ },
+
+ onResetButtonClick : function()
+ {
+ this.fsa.postEvent('reset-queue');
+ },
+
+ onCloseButtonClick : function()
+ {
+ this[this.closeAction].call(this);
+ },
+
+ onAjaxSuccess : function(response, options)
+ {
+ var json_response = {
+ 'success' : false,
+ 'error' : this.i18n.note_upload_error
+ }
+ try {
+ var rt = response.responseText;
+ var filter = rt.match(/^<[^>]+>((?:.|\n)*)<\/[^>]+>$/);
+ if (filter) {
+ rt = filter[1];
+ }
+ json_response = Ext.util.JSON.decode(rt);
+ }
+ catch (e) {}
+
+ var data = {
+ record: options.record,
+ response: json_response
+ }
+
+ if ('success' in json_response && json_response.success) {
+ this.fsa.postEvent('file-upload-success', data);
+ }
+ else {
+ this.fsa.postEvent('file-upload-error', data);
+ }
+ },
+
+ onAjaxFailure : function(response, options)
+ {
+ var data = {
+ record : options.record,
+ response : {
+ 'success' : false,
+ 'error' : this.i18n.note_upload_failed
+ }
+ }
+
+ this.fsa.postEvent('file-upload-failed', data);
+ },
+
+ /**
+ * @access public
+ */
+ // -------------------------------------------------------------------------------------------- //
+ startUpload : function()
+ {
+ this.fsa.postEvent('start-upload');
+ },
+
+ stopUpload : function()
+ {
+ this.fsa.postEvent('stop-upload');
+ },
+
+ getUrl : function()
+ {
+ return this.url;
+ },
+
+ setUrl : function(url)
+ {
+ this.url = url;
+ },
+
+ getBaseParams : function()
+ {
+ return this.base_params;
+ },
+
+ setBaseParams : function(params)
+ {
+ this.base_params = params;
+ },
+
+ getUploadAutostart : function()
+ {
+ return this.upload_autostart;
+ },
+
+ setUploadAutostart : function(value)
+ {
+ this.upload_autostart = value;
+ },
+
+ getAllowCloseOnUpload : function()
+ {
+ return this.allow_close_on_upload;
+ },
+
+ setAllowCloseOnUpload : function(value)
+ {
+ this.allow_close_on_upload;
+ },
+
+ getResetOnHide : function()
+ {
+ return this.reset_on_hide;
+ },
+
+ setResetOnHide : function(value)
+ {
+ this.reset_on_hide = value;
+ },
+
+ getPermittedExtensions : function()
+ {
+ return this.permitted_extensions;
+ },
+
+ setPermittedExtensions : function(value)
+ {
+ this.permitted_extensions = value;
+ },
+
+ isUploading : function()
+ {
+ return this.is_uploading;
+ },
+
+ isNotEmptyQueue : function()
+ {
+ return this.grid_panel.getStore().getCount() > 0;
+ },
+
+ getQueuedCount : function(count_processing)
+ {
+ var count = 0;
+ var store = this.grid_panel.getStore();
+ store.each(function(r) {
+ if (r.get('state') == Ext.ux.UploadDialog.FileRecord.STATE_QUEUE) {
+ count++;
+ }
+ if (count_processing && r.get('state') == Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING) {
+ count++;
+ }
+ });
+ return count;
+ },
+
+ hasUnuploadedFiles : function()
+ {
+ return this.getQueuedCount() > 0;
+ }
+});
+
+// ---------------------------------------------------------------------------------------------- //
+
+var p = Ext.ux.UploadDialog.Dialog.prototype;
+p.i18n = {
+ title: 'File upload dialog',
+ state_col_title: 'State',
+ state_col_width: 70,
+ filename_col_title: 'Filename',
+ filename_col_width: 230,
+ note_col_title: 'Note',
+ note_col_width: 150,
+ add_btn_text: 'Add',
+ add_btn_tip: 'Add file into upload queue.',
+ remove_btn_text: 'Remove',
+ remove_btn_tip: 'Remove file from upload queue.',
+ reset_btn_text: 'Reset',
+ reset_btn_tip: 'Reset queue.',
+ upload_btn_start_text: 'Upload',
+ upload_btn_stop_text: 'Abort',
+ upload_btn_start_tip: 'Upload queued files to the server.',
+ upload_btn_stop_tip: 'Stop upload.',
+ close_btn_text: 'Close',
+ close_btn_tip: 'Close the dialog.',
+ progress_waiting_text: 'Waiting...',
+ progress_uploading_text: 'Uploading: {0} of {1} files complete.',
+ error_msgbox_title: 'Error',
+ permitted_extensions_join_str: ',',
+ err_file_type_not_permitted: 'Selected file extension isn\'t permitted.<br/>Please select files with following extensions: {1}',
+ note_queued_to_upload: 'Queued for upload.',
+ note_processing: 'Uploading...',
+ note_upload_failed: 'Server is unavailable or internal server error occured.',
+ note_upload_success: 'OK.',
+ note_upload_error: 'Upload error.',
+ note_aborted: 'Aborted by user.'
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.packed.js
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.packed.js 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/Ext.ux.UploadDialog.packed.js 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1 @@
+Ext.namespace("Ext.ux.Utils");Ext.ux.Utils.EventQueue=function(handler,scope){if(!handler){throw"Handler is required."}this.handler=handler;this.scope=scope||window;this.queue=[];this.is_processing=false;this.postEvent=function(event,data){data=data||null;this.queue.push({event:event,data:data});if(!this.is_processing){this.process()}};this.flushEventQueue=function(){this.queue=[]},this.process=function(){while(this.queue.length>0){this.is_processing=true;var event_data=this.queue.shift();this.handler.call(this.scope,event_data.event,event_data.data)}this.is_processing=false}};Ext.ux.Utils.FSA=function(initial_state,trans_table,trans_table_scope){this.current_state=initial_state;this.trans_table=trans_table||{};this.trans_table_scope=trans_table_scope||window;Ext.ux.Utils.FSA.superclass.constructor.call(this,this.processEvent,this)};Ext.extend(Ext.ux.Utils.FSA,Ext.ux.Utils.EventQueue,{current_state:null,trans_table:null,trans_table_scope:null,state:function(){return this.current_state},processEvent:function(event,data){var transitions=this.currentStateEventTransitions(event);if(!transitions){throw"State '"+this.current_state+"' has no transition for event '"+event+"'."}for(var i=0,len=transitions.length;i<len;i++){var transition=transitions[i];var predicate=transition.predicate||transition.p||true;var action=transition.action||transition.a||Ext.emptyFn;var new_state=transition.state||transition.s||this.current_state;var scope=transition.scope||this.trans_table_scope;if(this.computePredicate(predicate,scope,data,event)){this.callAction(action,scope,data,event);this.current_state=new_state;return }}throw"State '"+this.current_state+"' has no transition for event '"+event+"' in current context"},currentStateEventTransitions:function(event){return this.trans_table[this.current_state]?this.trans_table[this.current_state][event]||false:false},computePredicate:function(predicate,scope,data,event){var result=false;switch(Ext.type(predicate)){case"function":result=predicate.call(scope,data,event,this);break;case"array":result=true;for(var i=0,len=predicate.length;result&&(i<len);i++){if(Ext.type(predicate[i])=="function"){result=predicate[i].call(scope,data,event,this)}else{throw ["Predicate: ",predicate[i],' is not callable in "',this.current_state,'" state for event "',event].join("")}}break;case"boolean":result=predicate;break;default:throw ["Predicate: ",predicate,' is not callable in "',this.current_state,'" state for event "',event].join("")}return result},callAction:function(action,scope,data,event){switch(Ext.type(action)){case"array":for(var i=0,len=action.length;i<len;i++){if(Ext.type(action[i])=="function"){action[i].call(scope,data,event,this)}else{throw ["Action: ",action[i],' is not callable in "',this.current_state,'" state for event "',event].join("")}}break;case"function":action.call(scope,data,event,this);break;default:throw ["Action: ",action,' is not callable in "',this.current_state,'" state for event "',event].join("")}}});Ext.namespace("Ext.ux.UploadDialog");Ext.ux.UploadDialog.BrowseButton=Ext.extend(Ext.Button,{input_name:"file",input_file:null,original_handler:null,original_scope:null,initComponent:function(){Ext.ux.UploadDialog.BrowseButton.superclass.initComponent.call(this);this.original_handler=this.handler||null;this.original_scope=this.scope||window;this.handler=null;this.scope=null},onRender:function(ct,position){Ext.ux.UploadDialog.BrowseButton.superclass.onRender.call(this,ct,position);this.createInputFile()},createInputFile:function(){var button_container=this.el.child(".x-btn-center");button_container.position("relative");this.input_file=Ext.DomHelper.append(button_container,{tag:"input",type:"file",size:1,name:this.input_name||Ext.id(this.el),style:"position: absolute; display: block; border: none; cursor: pointer"},true);var button_box=button_container.getBox();this.input_file.setStyle("font-size",(button_box.width*0.5)+"px");var input_box=this.input_file.getBox();var adj={x:3,y:3};if(Ext.isIE){adj={x:0,y:3}}this.input_file.setLeft(button_box.width-input_box.width+adj.x+"px");this.input_file.setTop(button_box.height-input_box.height+adj.y+"px");this.input_file.setOpacity(0);if(this.handleMouseEvents){this.input_file.on("mouseover",this.onMouseOver,this);this.input_file.on("mousedown",this.onMouseDown,this)}if(this.tooltip){if(typeof this.tooltip=="object"){Ext.QuickTips.register(Ext.apply({target:this.input_file},this.tooltip))}else{this.input_file.dom[this.tooltipType]=this.tooltip}}this.input_file.on("change",this.onInputFileChange,this);this.input_file.on("click",function(e){e.stopPropagation()})},detachInputFile:function(no_create){var result=this.input_file;no_create=no_create||false;if(typeof this.tooltip=="object"){Ext.QuickTips.unregister(this.input_file)}else{this.input_file.dom[this.tooltipType]=null}this.input_file.removeAllListeners();this.input_file=null;if(!no_create){this.createInputFile()}return result},getInputFile:function(){return this.input_file},disable:function(){Ext.ux.UploadDialog.BrowseButton.superclass.disable.call(this);this.input_file.dom.disabled=true},enable:function(){Ext.ux.UploadDialog.BrowseButton.superclass.enable.call(this);this.input_file.dom.disabled=false},destroy:function(){var input_file=this.detachInputFile(true);input_file.remove();input_file=null;Ext.ux.UploadDialog.BrowseButton.superclass.destroy.call(this)},onInputFileChange:function(){if(this.original_handler){this.original_handler.call(this.original_scope,this)}}});Ext.ux.UploadDialog.TBBrowseButton=Ext.extend(Ext.ux.UploadDialog.BrowseButton,{hideParent:true,onDestroy:function(){Ext.ux.UploadDialog.TBBrowseButton.superclass.onDestroy.call(this);if(this.container){this.container.remove()}}});Ext.ux.UploadDialog.FileRecord=Ext.data.Record.create([{name:"filename"},{name:"state",type:"int"},{name:"note"},{name:"input_element"}]);Ext.ux.UploadDialog.FileRecord.STATE_QUEUE=0;Ext.ux.UploadDialog.FileRecord.STATE_FINISHED=1;Ext.ux.UploadDialog.FileRecord.STATE_FAILED=2;Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING=3;Ext.ux.UploadDialog.Dialog=function(config){var default_config={border:false,width:450,height:300,minWidth:450,minHeight:300,plain:true,constrainHeader:true,draggable:true,closable:true,maximizable:false,minimizable:false,resizable:true,autoDestroy:true,closeAction:"hide",title:this.i18n.title,cls:"ext-ux-uploaddialog-dialog",url:"",base_params:{},permitted_extensions:[],reset_on_hide:true,allow_close_on_upload:false,upload_autostart:false,post_var_name:"file"};config=Ext.applyIf(config||{},default_config);config.layout="absolute";Ext.ux.UploadDialog.Dialog.superclass.constructor.call(this,config)};Ext.extend(Ext.ux.UploadDialog.Dialog,Ext.Window,{fsa:null,state_tpl:null,form:null,grid_panel:null,progress_bar:null,is_uploading:false,initial_queued_count:0,upload_frame:null,initComponent:function(){Ext.ux.UploadDialog.Dialog.superclass.initComponent.call(this);var tt={created:{"window-render":[{action:[this.createForm,this.createProgressBar,this.createGrid],state:"rendering"}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},rendering:{"grid-render":[{action:[this.fillToolbar,this.updateToolbar],state:"ready"}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},ready:{"file-selected":[{predicate:[this.fireFileTestEvent,this.isPermittedFile],action:this.addFileToUploadQueue,state:"adding-file"},{}],"grid-selection-change":[{action:this.updateToolbar}],"remove-files":[{action:[this.removeFiles,this.fireFileRemoveEvent]}],"reset-queue":[{action:[this.resetQueue,this.fireResetQueueEvent]}],"start-upload":[{predicate:this.hasUnuploadedFiles,action:[this.setUploadingFlag,this.saveInitialQueuedCount,this.updateToolbar,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadStartEvent],state:"uploading"},{}],"stop-upload":[{}],hide:[{predicate:[this.isNotEmptyQueue,this.getResetOnHide],action:[this.resetQueue,this.fireResetQueueEvent]},{}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},"adding-file":{"file-added":[{predicate:this.isUploading,action:[this.incInitialQueuedCount,this.updateProgressBar,this.fireFileAddEvent],state:"uploading"},{predicate:this.getUploadAutostart,action:[this.startUpload,this.fireFileAddEvent],state:"ready"},{action:[this.updateToolbar,this.fireFileAddEvent],state:"ready"}]},uploading:{"file-selected":[{predicate:[this.fireFileTestEvent,this.isPermittedFile],action:this.addFileToUploadQueue,state:"adding-file"},{}],"grid-selection-change":[{}],"start-upload":[{}],"stop-upload":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadingFlag,this.abortUpload,this.updateToolbar,this.updateProgressBar,this.fireUploadStopEvent],state:"ready"},{action:[this.resetUploadingFlag,this.abortUpload,this.updateToolbar,this.updateProgressBar,this.fireUploadStopEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-start":[{action:[this.uploadFile,this.findUploadFrame,this.fireFileUploadStartEvent]}],"file-upload-success":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadSuccessEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadSuccessEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-error":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadErrorEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadErrorEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-failed":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadFailedEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadFailedEvent,this.fireUploadCompleteEvent],state:"ready"}],hide:[{predicate:this.getResetOnHide,action:[this.stopUpload,this.repostHide]},{}],destroy:[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadingFlag,this.abortUpload,this.fireUploadStopEvent,this.flushEventQueue],state:"destroyed"},{action:[this.resetUploadingFlag,this.abortUpload,this.fireUploadStopEvent,this.fireUploadCompleteEvent,this.flushEventQueue],state:"destroyed"}]},destroyed:{}};this.fsa=new Ext.ux.Utils.FSA("created",tt,this);this.addEvents({filetest:true,fileadd:true,fileremove:true,resetqueue:true,uploadsuccess:true,uploaderror:true,uploadfailed:true,uploadstart:true,uploadstop:true,uploadcomplete:true,fileuploadstart:true});this.on("render",this.onWindowRender,this);this.on("beforehide",this.onWindowBeforeHide,this);this.on("hide",this.onWindowHide,this);this.on("destroy",this.onWindowDestroy,this);this.state_tpl=new Ext.Template("<div class='ext-ux-uploaddialog-state ext-ux-uploaddialog-state-{state}'> </div>").compile()},createForm:function(){this.form=Ext.DomHelper.append(this.body,{tag:"form",method:"post",action:this.url,style:"position: absolute; left: -100px; top: -100px; width: 100px; height: 100px"})},createProgressBar:function(){this.progress_bar=this.add(new Ext.ProgressBar({x:0,y:0,anchor:"0",value:0,text:this.i18n.progress_waiting_text}))},createGrid:function(){var store=new Ext.data.Store({proxy:new Ext.data.MemoryProxy([]),reader:new Ext.data.JsonReader({},Ext.ux.UploadDialog.FileRecord),sortInfo:{field:"state",direction:"DESC"},pruneModifiedRecords:true});var cm=new Ext.grid.ColumnModel([{header:this.i18n.state_col_title,width:this.i18n.state_col_width,resizable:false,dataIndex:"state",sortable:true,renderer:this.renderStateCell.createDelegate(this)},{header:this.i18n.filename_col_title,width:this.i18n.filename_col_width,dataIndex:"filename",sortable:true,renderer:this.renderFilenameCell.createDelegate(this)},{header:this.i18n.note_col_title,width:this.i18n.note_col_width,dataIndex:"note",sortable:true,renderer:this.renderNoteCell.createDelegate(this)}]);this.grid_panel=new Ext.grid.GridPanel({ds:store,cm:cm,x:0,y:22,anchor:"0 -22",border:true,viewConfig:{autoFill:true,forceFit:true},bbar:new Ext.Toolbar()});this.grid_panel.on("render",this.onGridRender,this);this.add(this.grid_panel);this.grid_panel.getSelectionModel().on("selectionchange",this.onGridSelectionChange,this)},fillToolbar:function(){var tb=this.grid_panel.getBottomToolbar();tb.x_buttons={};tb.x_buttons.add=tb.addItem(new Ext.ux.UploadDialog.TBBrowseButton({input_name:this.post_var_name,text:this.i18n.add_btn_text,tooltip:this.i18n.add_btn_tip,iconCls:"ext-ux-uploaddialog-addbtn",handler:this.onAddButtonFileSelected,scope:this}));tb.x_buttons.remove=tb.addButton({text:this.i18n.remove_btn_text,tooltip:this.i18n.remove_btn_tip,iconCls:"ext-ux-uploaddialog-removebtn",handler:this.onRemoveButtonClick,scope:this});tb.x_buttons.reset=tb.addButton({text:this.i18n.reset_btn_text,tooltip:this.i18n.reset_btn_tip,iconCls:"ext-ux-uploaddialog-resetbtn",handler:this.onResetButtonClick,scope:this});tb.add("-");tb.x_buttons.upload=tb.addButton({text:this.i18n.upload_btn_start_text,tooltip:this.i18n.upload_btn_start_tip,iconCls:"ext-ux-uploaddialog-uploadstartbtn",handler:this.onUploadButtonClick,scope:this});tb.add("-");tb.x_buttons.indicator=tb.addItem(new Ext.Toolbar.Item(Ext.DomHelper.append(tb.getEl(),{tag:"div",cls:"ext-ux-uploaddialog-indicator-stoped",html:" "})));tb.add("->");tb.x_buttons.close=tb.addButton({text:this.i18n.close_btn_text,tooltip:this.i18n.close_btn_tip,handler:this.onCloseButtonClick,scope:this})},renderStateCell:function(data,cell,record,row_index,column_index,store){return this.state_tpl.apply({state:data})},renderFilenameCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();var f=function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}};f.defer(1000);return data},renderNoteCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();var f=function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}};f.defer(1000);return data},getFileExtension:function(filename){var result=null;var parts=filename.split(".");if(parts.length>1){result=parts.pop()}return result},isPermittedFileType:function(filename){var result=true;if(this.permitted_extensions.length>0){result=this.permitted_extensions.indexOf(this.getFileExtension(filename))!=-1}return result},isPermittedFile:function(browse_btn){var result=false;var filename=browse_btn.getInputFile().dom.value;if(this.isPermittedFileType(filename)){result=true}else{Ext.Msg.alert(this.i18n.error_msgbox_title,String.format(this.i18n.err_file_type_not_permitted,filename,this.permitted_extensions.join(this.i18n.permitted_extensions_join_str)));result=false}return result},fireFileTestEvent:function(browse_btn){return this.fireEvent("filetest",this,browse_btn.getInputFile().dom.value)!==false},addFileToUploadQueue:function(browse_btn){var input_file=browse_btn.detachInputFile();input_file.appendTo(this.form);input_file.setStyle("width","100px");input_file.dom.disabled=true;var store=this.grid_panel.getStore();store.add(new Ext.ux.UploadDialog.FileRecord({state:Ext.ux.UploadDialog.FileRecord.STATE_QUEUE,filename:input_file.dom.value,note:this.i18n.note_queued_to_upload,input_element:input_file}));this.fsa.postEvent("file-added",input_file.dom.value)},fireFileAddEvent:function(filename){this.fireEvent("fileadd",this,filename)},updateProgressBar:function(){if(this.is_uploading){var queued=this.getQueuedCount(true);var value=1-queued/this.initial_queued_count;this.progress_bar.updateProgress(value,String.format(this.i18n.progress_uploading_text,this.initial_queued_count-queued,this.initial_queued_count))}else{this.progress_bar.updateProgress(0,this.i18n.progress_waiting_text)}},updateToolbar:function(){var tb=this.grid_panel.getBottomToolbar();if(this.is_uploading){tb.x_buttons.remove.disable();tb.x_buttons.reset.disable();tb.x_buttons.upload.enable();if(!this.getAllowCloseOnUpload()){tb.x_buttons.close.disable()}Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass("ext-ux-uploaddialog-indicator-stoped","ext-ux-uploaddialog-indicator-processing");tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstopbtn");tb.x_buttons.upload.setText(this.i18n.upload_btn_stop_text);tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_stop_tip}else{tb.x_buttons.remove.enable();tb.x_buttons.reset.enable();tb.x_buttons.close.enable();Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass("ext-ux-uploaddialog-indicator-processing","ext-ux-uploaddialog-indicator-stoped");tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstartbtn");tb.x_buttons.upload.setText(this.i18n.upload_btn_start_text);tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_start_tip;if(this.getQueuedCount()>0){tb.x_buttons.upload.enable()}else{tb.x_buttons.upload.disable()}if(this.grid_panel.getSelectionModel().hasSelection()){tb.x_buttons.remove.enable()}else{tb.x_buttons.remove.disable()}if(this.grid_panel.getStore().getCount()>0){tb.x_buttons.reset.enable()}else{tb.x_buttons.reset.disable()}}},saveInitialQueuedCount:function(){this.initial_queued_count=this.getQueuedCount()},incInitialQueuedCount:function(){this.initial_queued_count++},setUploadingFlag:function(){this.is_uploading=true},resetUploadingFlag:function(){this.is_uploading=false},prepareNextUploadTask:function(){var store=this.grid_panel.getStore();var record=null;store.each(function(r){if(!record&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE){record=r}else{r.get("input_element").dom.disabled=true}});record.get("input_element").dom.disabled=false;record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING);record.set("note",this.i18n.note_processing);record.commit();this.fsa.postEvent("file-upload-start",record)},fireUploadStartEvent:function(){this.fireEvent("uploadstart",this)},removeFiles:function(file_records){var store=this.grid_panel.getStore();for(var i=0,len=file_records.length;i<len;i++){var r=file_records[i];r.get("input_element").remove();store.remove(r)}},fireFileRemoveEvent:function(file_records){for(var i=0,len=file_records.length;i<len;i++){this.fireEvent("fileremove",this,file_records[i].get("filename"))}},resetQueue:function(){var store=this.grid_panel.getStore();store.each(function(r){r.get("input_element").remove()});store.removeAll()},fireResetQueueEvent:function(){this.fireEvent("resetqueue",this)},uploadFile:function(record){Ext.Ajax.request({url:this.url,params:this.base_params||this.baseParams||this.params,method:"POST",form:this.form,isUpload:true,success:this.onAjaxSuccess,failure:this.onAjaxFailure,scope:this,record:record})},fireFileUploadStartEvent:function(record){this.fireEvent("fileuploadstart",this,record.get("filename"))},updateRecordState:function(data){if("success" in data.response&&data.response.success){data.record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FINISHED);data.record.set("note",data.response.message||data.response.error||this.i18n.note_upload_success)}else{data.record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FAILED);data.record.set("note",data.response.message||data.response.error||this.i18n.note_upload_error)}data.record.commit()},fireUploadSuccessEvent:function(data){this.fireEvent("uploadsuccess",this,data.record.get("filename"),data.response)},fireUploadErrorEvent:function(data){this.fireEvent("uploaderror",this,data.record.get("filename"),data.response)},fireUploadFailedEvent:function(data){this.fireEvent("uploadfailed",this,data.record.get("filename"))},fireUploadCompleteEvent:function(){this.fireEvent("uploadcomplete",this)},findUploadFrame:function(){this.upload_frame=Ext.getBody().child("iframe.x-hidden:last")},resetUploadFrame:function(){this.upload_frame=null},removeUploadFrame:function(){if(this.upload_frame){this.upload_frame.removeAllListeners();this.upload_frame.dom.src="about:blank";this.upload_frame.remove()}this.upload_frame=null},abortUpload:function(){this.removeUploadFrame();var store=this.grid_panel.getStore();var record=null;store.each(function(r){if(r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING){record=r;return false}});record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FAILED);record.set("note",this.i18n.note_aborted);record.commit()},fireUploadStopEvent:function(){this.fireEvent("uploadstop",this)},repostHide:function(){this.fsa.postEvent("hide")},flushEventQueue:function(){this.fsa.flushEventQueue()},onWindowRender:function(){this.fsa.postEvent("window-render")},onWindowBeforeHide:function(){return this.isUploading()?this.getAllowCloseOnUpload():true},onWindowHide:function(){this.fsa.postEvent("hide")},onWindowDestroy:function(){this.fsa.postEvent("destroy")},onGridRender:function(){this.fsa.postEvent("grid-render")},onGridSelectionChange:function(){this.fsa.postEvent("grid-selection-change")},onAddButtonFileSelected:function(btn){this.fsa.postEvent("file-selected",btn)},onUploadButtonClick:function(){if(this.is_uploading){this.fsa.postEvent("stop-upload")}else{this.fsa.postEvent("start-upload")}},onRemoveButtonClick:function(){var selections=this.grid_panel.getSelectionModel().getSelections();this.fsa.postEvent("remove-files",selections)},onResetButtonClick:function(){this.fsa.postEvent("reset-queue")},onCloseButtonClick:function(){this[this.closeAction].call(this)},onAjaxSuccess:function(response,options){var json_response={success:false,error:this.i18n.note_upload_error};try{var rt=response.responseText;var filter=rt.match(/^<[^>]+>((?:.|\n)*)<\/[^>]+>$/);if(filter){rt=filter[1]}json_response=Ext.util.JSON.decode(rt)}catch(e){}var data={record:options.record,response:json_response};if("success" in json_response&&json_response.success){this.fsa.postEvent("file-upload-success",data)}else{this.fsa.postEvent("file-upload-error",data)}},onAjaxFailure:function(response,options){var data={record:options.record,response:{success:false,error:this.i18n.note_upload_failed}};this.fsa.postEvent("file-upload-failed",data)},startUpload:function(){this.fsa.postEvent("start-upload")},stopUpload:function(){this.fsa.postEvent("stop-upload")},getUrl:function(){return this.url},setUrl:function(url){this.url=url},getBaseParams:function(){return this.base_params},setBaseParams:function(params){this.base_params=params},getUploadAutostart:function(){return this.upload_autostart},setUploadAutostart:function(value){this.upload_autostart=value},getAllowCloseOnUpload:function(){return this.allow_close_on_upload},setAllowCloseOnUpload:function(value){this.allow_close_on_upload},getResetOnHide:function(){return this.reset_on_hide},setResetOnHide:function(value){this.reset_on_hide=value},getPermittedExtensions:function(){return this.permitted_extensions},setPermittedExtensions:function(value){this.permitted_extensions=value},isUploading:function(){return this.is_uploading},isNotEmptyQueue:function(){return this.grid_panel.getStore().getCount()>0},getQueuedCount:function(count_processing){var count=0;var store=this.grid_panel.getStore();store.each(function(r){if(r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE){count++}if(count_processing&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING){count++}});return count},hasUnuploadedFiles:function(){return this.getQueuedCount()>0}});var p=Ext.ux.UploadDialog.Dialog.prototype;p.i18n={title:"File upload dialog",state_col_title:"State",state_col_width:70,filename_col_title:"Filename",filename_col_width:230,note_col_title:"Note",note_col_width:150,add_btn_text:"Add",add_btn_tip:"Add file into upload queue.",remove_btn_text:"Remove",remove_btn_tip:"Remove file from upload queue.",reset_btn_text:"Reset",reset_btn_tip:"Reset queue.",upload_btn_start_text:"Upload",upload_btn_stop_text:"Abort",upload_btn_start_tip:"Upload queued files to the server.",upload_btn_stop_tip:"Stop upload.",close_btn_text:"Close",close_btn_tip:"Close the dialog.",progress_waiting_text:"Waiting...",progress_uploading_text:"Uploading: {0} of {1} files complete.",error_msgbox_title:"Error",permitted_extensions_join_str:",",err_file_type_not_permitted:"Selected file extension isn't permitted.<br/>Please select files with following extensions: {1}",note_queued_to_upload:"Queued for upload.",note_processing:"Uploading...",note_upload_failed:"Server is unavailable or internal server error occured.",note_upload_success:"OK.",note_upload_error:"Upload error.",note_aborted:"Aborted by user."};
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css/Ext.ux.UploadDialog.css
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css/Ext.ux.UploadDialog.css 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/css/Ext.ux.UploadDialog.css 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,90 @@
+ at CHARSET "UTF-8";
+
+.ext-ux-uploaddialog-addbtn
+{
+ background: url('../images/file-add.gif') no-repeat left center !important;
+}
+
+.ext-ux-uploaddialog-removebtn
+{
+ background: url('../images/file-remove.gif') no-repeat left center !important;
+}
+
+.ext-ux-uploaddialog-resetbtn
+{
+ background: url('../images/reset.gif') no-repeat left center !important;
+}
+
+.ext-ux-uploaddialog-uploadstartbtn
+{
+ background: url('../images/upload-start.gif') no-repeat left center !important;
+}
+
+.ext-ux-uploaddialog-uploadstopbtn
+{
+ background: url('../images/upload-stop.gif') no-repeat left center !important;
+}
+
+.ext-ux-uploaddialog-indicator-stoped
+{
+ width: 16px;
+ height: 16px;
+ background: url('../images/done.gif') no-repeat center center;
+}
+
+.ext-ux-uploaddialog-indicator-processing
+{
+ width: 16px;
+ height: 16px;
+ background: url('../images/loading.gif') no-repeat center center;
+}
+
+.ext-ux-uploaddialog-state
+{
+ text-align: center;
+ background-position: center center;
+ background-repeat: no-repeat;
+}
+
+/* Queued */
+.ext-ux-uploaddialog-state-0
+{
+ background-image: url('../images/uncheck.gif');
+}
+
+/* Finished */
+.ext-ux-uploaddialog-state-1
+{
+ background-image: url('../images/check.gif');
+}
+
+/* Failed */
+.ext-ux-uploaddialog-state-2
+{
+ background-image: url('../images/failed.gif');
+}
+
+/* Processing */
+.ext-ux-uploaddialog-state-3
+{
+ background-image: url('../images/file-uploading.gif');
+}
+
+/* Progress bar fix */
+.ext-ie7 .ext-ux-uploaddialog-dialog .x-progress-bar .x-progress-text div
+{
+ display: none;
+}
+
+.ext-ie7 .ext-ux-uploaddialog-dialog .x-progress-text-back
+{
+ position: absolute;
+ left: 0px;
+ right: 0px;
+}
+
+.ext-ie7 .ext-ux-uploaddialog-dialog .x-progress-text-back div
+{
+ width: auto !important;
+ white-space: nowrap;
+}
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.dia
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.dia
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.jpeg
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/dox/automata-protocol.jpeg
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/check.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/check.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/done.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/done.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/failed.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/failed.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-add.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-add.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-remove.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-remove.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-uploading.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/file-uploading.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/loading.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/loading.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/reset.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/reset.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/uncheck.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/uncheck.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-start.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-start.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-stop.gif
===================================================================
(Binary files differ)
Property changes on: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/images/upload-stop.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale/ru.utf-8.js
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale/ru.utf-8.js 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/locale/ru.utf-8.js 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,35 @@
+Ext.apply(
+ Ext.ux.UploadDialog.Dialog.prototype.i18n,
+ {
+ title: 'Загрузка файлов на сервер.',
+ state_col_title: 'Статус',
+ state_col_width: 70,
+ filename_col_title: 'Имя файла',
+ filename_col_width: 230,
+ note_col_title: 'Пояснение',
+ note_col_width: 150,
+ add_btn_text: 'Добавить',
+ add_btn_tip: 'Добавить файл в очередь загрузки.',
+ remove_btn_text: 'Удалить',
+ remove_btn_tip: 'Удалить файл из очереди загрузки.',
+ reset_btn_text: 'Очистить',
+ reset_btn_tip: 'Очистить очередь загрузки.',
+ upload_btn_start_text: 'Загрузить',
+ upload_btn_stop_text: 'Отменить',
+ upload_btn_start_tip: 'Загрузить файлы на сервер.',
+ upload_btn_stop_tip: 'Отменить загрузку.',
+ close_btn_text: 'Закрыть',
+ close_btn_tip: 'Закрыть диалог загрузки.',
+ progress_waiting_text: 'Жду...',
+ progress_uploading_text: 'Загружаю: {0} из {1} файлов загружено.',
+ error_msgbox_title: 'Ошибка',
+ permitted_extensions_join_str: ',',
+ err_file_type_not_permitted: 'Файлы с таким расширением запрещено загружать.<br/>Пожалуйста выбирайте файлы с одним из следующий расширений: {1}',
+ note_queued_to_upload: 'Поставлен в очередь.',
+ note_processing: 'Загружается...',
+ note_upload_failed: 'Сервер недоступен, либо на сервере произошла ошибка.',
+ note_upload_success: 'Загружен.',
+ note_upload_error: 'Ошибка загрузки.',
+ note_aborted: 'Загрузка прервана пользователем.',
+ }
+);
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/readme.txt
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/readme.txt 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/UploadDialog/readme.txt 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,4 @@
+Extension Page : http://max-bazhenov.com/dev/upload-dialog-2.0/index.php
+Author : Maxim Bazhenov (aka MaximGB)
+v 2.0 (12.04.2008)
+License : respectoware
\ No newline at end of file
Added: trunk/src/main/java/org/ourproject/kune/app/public/js/ext-ux-all-min.js
===================================================================
--- trunk/src/main/java/org/ourproject/kune/app/public/js/ext-ux-all-min.js 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/app/public/js/ext-ux-all-min.js 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1 @@
+Ext.ux.FileTreeMenu=function(config){config=config||{};var uploadPanelConfig={contextmenu:this,buttonsAt:config.buttonsAt||"tbar",singleUpload:config.singleUpload||false,maxFileSize:config.maxFileSize,enableProgress:config.enableProgress};if(config.baseParams){config.baseParams.cmd=config.baseParams.cmd||"upload";config.baseParams.dir=config.baseParams.dir||".";uploadPanelConfig.baseParams=config.baseParams}Ext.apply(config,{items:[{text:" ",cls:"ux-ftm-nodename",disabledClass:"",disabled:true,cmd:"nodename"},{text:this.openText+" (Enter)",iconCls:this.openIconCls,cmd:"open",menu:{items:[{text:this.openSelfText,iconCls:this.openSelfIconCls,cmd:"open-self"},{text:this.openPopupText,iconCls:this.openPopupIconCls,cmd:"open-popup"},{text:this.openBlankText,iconCls:this.openBlankIconCls,cmd:"open-blank"},{text:this.openDwnldText,iconCls:this.openDwnldIconCls,cmd:"open-dwnld"}]}},new Ext.menu.Separator({cmd:"sep-open"}),{text:this.reloadText+" (Ctrl+E)",iconCls:this.reloadIconCls,cmd:"reload"},{text:this.expandText+" (Ctrl+ →)",iconCls:this.expandIconCls,cmd:"expand"},{text:this.collapseText+" (Ctrl+ ←)",iconCls:this.collapseIconCls,cmd:"collapse"},new Ext.menu.Separator({cmd:"sep-collapse"}),{text:this.renameText+" (F2)",iconCls:this.renameIconCls,cmd:"rename"},{text:this.deleteText+" ("+this.deleteKeyName+")",iconCls:this.deleteIconCls,cmd:"delete"},{text:this.newdirText+"... (Ctrl+N)",iconCls:this.newdirIconCls,cmd:"newdir"},new Ext.menu.Separator({cmd:"sep-upload"}),{text:this.uploadFileText+" (Ctrl+U)",iconCls:this.uploadIconCls,hideOnClick:false,cmd:"upload"},new Ext.menu.Adapter(new Ext.ux.UploadPanel(uploadPanelConfig),{hideOnClick:false,cmd:"upload-panel"})]});Ext.ux.FileTreeMenu.superclass.constructor.call(this,config);this.relayEvents(this.getItemByCmd("open").menu,["click","itemclick"])};Ext.extend(Ext.ux.FileTreeMenu,Ext.menu.Menu,{collapseIconCls:"icon-collapse-all",collapseText:"Collapse all",deleteIconCls:"icon-cross",deleteKeyName:"Delete Key",deleteText:"Delete",expandIconCls:"icon-expand-all",expandText:"Expand all",newdirIconCls:"icon-folder-add",newdirText:"New folder",openBlankIconCls:"icon-open-blank",openBlankText:"Open in new window",openDwnldIconCls:"icon-open-download",openDwnldText:"Download",openIconCls:"icon-open",openPopupIconCls:"icon-open-popup",openPopupText:"Open in popup",openSelfIconCls:"icon-open-self",openSelfText:"Open in this window",openText:"Open",reloadIconCls:"icon-refresh",reloadText:'R<span style="text-decoration:underline">e</span>load',renameIconCls:"icon-pencil",renameText:"Rename",uploadFileText:'<span style="text-decoration:underline">U</span>pload file',uploadIconCls:"icon-upload",uploadText:"Upload",width:190,getItemByCmd:function(cmd){var open;var item=this.items.find(function(i){return cmd===i.cmd});if(!item){open=this.items.find(function(i){return"open"===i.cmd});if(!open){return null}item=open.menu.items.find(function(i){return cmd===i.cmd})}return item},setItemDisabled:function(cmd,disabled){var item=this.getItemByCmd(cmd);if(item){item.setDisabled(disabled)}},beforeDestroy:function(){var uploadPanel=this.getItemByCmd("upload-panel");if(uploadPanel&&uploadPanel.component){uploadPanel.component.purgeListeners();uploadPanel.component.destroy();uploadPanel.component=null}}});Ext.reg("filetreemenu",Ext.ux.FileTreeMenu);Ext.ux.FileTreePanel=Ext.extend(Ext.tree.TreePanel,{confirmText:"Confirm",containerScroll:true,deleteText:"Delete",enableDD:true,enableDelete:true,enableNewDir:true,enableOpen:true,enableProgress:true,enableRename:true,enableSort:true,enableUpload:true,errorText:"Error",existsText:"File <b>{0}</b> already exists",expandOnRender:true,fileCls:"file",fileText:"File",focusPopup:true,folderSort:true,hrefPrefix:"",hrefSuffix:"",layout:"fit",loadingText:"Loading",loadMask:false,maxFileSize:524288,maxMsgLen:2000,method:"post",newdirText:"New Folder",openMode:"popup",overwriteText:"Do you want to overwrite it?",popupFeatures:"width=800,height=600,dependent=1,scrollbars=1,resizable=1,toolbar=1",readOnly:false,reallyWantText:"Do you really want to",rootPath:"root",rootText:"Tree Root",selectOnEdit:true,singleUpload:false,topMenu:false,url:"filetree.php",initComponent:function(){Ext.apply(this,{root:new Ext.tree.AsyncTreeNode({text:this.rootText,path:this.rootPath,allowDrag:false}),treeEditor:!this.readOnly?new Ext.tree.TreeEditor(this,{allowBlank:false,cancelOnEsc:true,completeOnEnter:true,ignoreNoChange:true,selectOnFocus:this.selectOnEdit}):undefined,dropConfig:this.dropConfig?this.dropConfig:{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.enableSort,expandDelay:3600000},treeSorter:this.enableSort?new Ext.tree.TreeSorter(this,{folderSort:this.folderSort}):undefined,keys:[{key:Ext.EventObject.ENTER,scope:this,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node&&0!==node.getDepth()&&node.isLeaf()){this.openNode(node)}}},{key:113,scope:this,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node&&0!==node.getDepth()&&this.enableRename&&this.readOnly!==true){this.treeEditor.triggerEdit(node)}}},{key:46,stopEvent:true,scope:this,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node&&0!==node.getDepth()&&this.enableDelete&&this.readOnly!==true){this.deleteNode(node)}}},{key:69,ctrl:true,stopEvent:true,scope:this,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node){node=node.isLeaf()?node.parentNode:node;sm.select(node);node.reload()}}},{key:39,ctrl:true,stopEvent:true,scope:this,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node&&!node.isLeaf()){sm.select(node);node.expand.defer(1,node,[true])}}},{key:37,ctrl:true,scope:this,stopEvent:true,fn:function(key,e){var sm=this.getSelectionModel();var node=sm.getSelectedNode();if(node&&!node.isLeaf()){sm.select(node);node.collapse.defer(1,node,[true])}}},{key:78,ctrl:true,scope:this,stopEvent:true,fn:function(key,e){var sm,node;sm=this.getSelectionModel();node=sm.getSelectedNode();if(node&&this.enableNewDir&&this.readOnly!==true){node=node.isLeaf()?node.parentNode:node;this.createNewDir(node)}}}]});if(!this.loader){this.loader=new Ext.tree.TreeLoader({url:this.url,baseParams:{cmd:"get"},listeners:{beforeload:{scope:this,fn:function(loader,node){loader.baseParams.path=this.getPath(node);loader.baseParams.cmd="get"}}}})}if(true===this.topMenu){this.tbar=[{text:this.fileText,disabled:true,scope:this,menu:this.getContextMenu()}]}Ext.ux.FileTreePanel.superclass.initComponent.apply(this,arguments);if(this.treeEditor){this.treeEditor.beforeNodeClick=function(node,e){return true};this.treeEditor.on({complete:{scope:this,fn:this.onEditComplete},beforecomplete:{scope:this,fn:this.onBeforeEditComplete}})}this.on({contextmenu:{scope:this,fn:this.onContextMenu,stopEvent:true},dblclick:{scope:this,fn:this.onDblClick},beforenodedrop:{scope:this,fn:this.onBeforeNodeDrop},nodedrop:{scope:this,fn:this.onNodeDrop},nodedragover:{scope:this,fn:this.onNodeDragOver}});this.addEvents("beforeopen","open","beforerename","rename","renamefailure","beforedelete","delete","deletefailure","beforenewdir","newdir","newdirfailure")},onRender:function(){Ext.ux.FileTreePanel.superclass.onRender.apply(this,arguments);if(true===this.topMenu){this.topMenu=Ext.getCmp(this.getTopToolbar().items.itemAt(0).id);this.getSelectionModel().on({scope:this,selectionchange:function(sm,node){var disable=node?false:true;disable=disable||this.readOnly;this.topMenu.setDisabled(disable)}});Ext.apply(this.topMenu,{showMenu:function(){this.showContextMenu(false)}.createDelegate(this)})}if(this.expandOnRender){this.root.expand()}this.el.on({contextmenu:{fn:function(){return false},stopEvent:true}});if(true===this.loadMask){this.loader.on({scope:this.el,beforeload:this.el.mask.createDelegate(this.el,[this.loadingText+"..."]),load:this.el.unmask,loadexception:this.el.unmask})}},cmdCallback:function(options,success,response){var i,o,node;var showMsg=true;if(true===success){try{o=Ext.decode(response.responseText)}catch(ex){this.showError(response.responseText)}if(true===o.success){switch(options.params.cmd){case"delete":if(true!==this.eventsSuspended){this.fireEvent("delete",this,this.getPath(options.node))}options.node.parentNode.removeChild(options.node);break;case"newdir":if(true!==this.eventsSuspended){this.fireEvent("newdir",this,options.node)}break;case"rename":this.updateCls(options.node,options.params.oldname);if(true!==this.eventsSuspended){this.fireEvent("rename",this,options.node,options.params.newname,options.params.oldname)}break}}else{switch(options.params.cmd){case"rename":if(options.oldParent){options.oldParent.appendChild(options.node)}else{options.node.setText(options.oldName)}if(options.e){options.e.failure=true}if(true!==this.eventsSuspended){this.fireEvent("renamefailure",this,options.node,options.params.newname,options.params.oldname)}break;case"newdir":if(false!==this.eventsSuspended){this.fireEvent("newdirfailure",this,options.params.dir)}options.node.parentNode.removeChild(options.node);break;case"delete":if(true!==this.eventsSuspended){this.fireEvent("deletefailure",this,options.node)}options.node.parentNode.reload.defer(1,options.node.parentNode);break;default:this.root.reload();break}this.showError(o.error||response.responseText)}}else{this.showError(response.responseText)}},confirmOverwrite:function(filename,callback,scope){Ext.Msg.show({title:this.confirmText,msg:String.format(this.existsText,filename)+". "+this.overwriteText,icon:Ext.Msg.QUESTION,buttons:Ext.Msg.YESNO,fn:callback.createDelegate(scope||this)})},createNewDir:function(node){if(true!==this.eventsSuspended&&false===this.fireEvent("beforenewdir",this,node)){return }var treeEditor=this.treeEditor;var newNode;var appendNode=node.isLeaf()?node.parentNode:node;appendNode.expand(false,false,function(n){newNode=n.appendChild(new Ext.tree.AsyncTreeNode({text:this.newdirText,iconCls:"folder"}));treeEditor.on({complete:{scope:this,single:true,fn:this.onNewDir}});treeEditor.creatingNewDir=true;(function(){treeEditor.triggerEdit(newNode)}.defer(10))}.createDelegate(this))},deleteNode:function(node){if(true!==this.eventsSuspended&&false===this.fireEvent("beforedelete",this,node)){return }Ext.Msg.show({title:this.deleteText,msg:this.reallyWantText+" "+this.deleteText.toLowerCase()+" <b>"+node.text+"</b>?",icon:Ext.Msg.WARNING,buttons:Ext.Msg.YESNO,scope:this,fn:function(response){if("yes"!==response){this.getEl().dom.focus();return }var options={url:this.deleteUrl||this.url,method:this.method,scope:this,callback:this.cmdCallback,node:node,params:{cmd:"delete",file:this.getPath(node)}};Ext.Ajax.request(options)}})},downloadFile:function(path){var id=Ext.id();var frame=document.createElement("iframe");frame.id=id;frame.name=id;frame.className="x-hidden";if(Ext.isIE){frame.src=Ext.SSL_SECURE_URL}document.body.appendChild(frame);if(Ext.isIE){document.frames[id].name=id}var form=Ext.DomHelper.append(document.body,{tag:"form",method:"post",action:this.downloadUrl||this.url,target:id});document.body.appendChild(form);var hidden;hidden=document.createElement("input");hidden.type="hidden";hidden.name="cmd";hidden.value="download";form.appendChild(hidden);hidden=document.createElement("input");hidden.type="hidden";hidden.name="path";hidden.value=path;form.appendChild(hidden);var callback=function(){Ext.EventManager.removeListener(frame,"load",callback,this);setTimeout(function(){document.body.removeChild(form)},100);setTimeout(function(){document.body.removeChild(frame)},110)};Ext.EventManager.on(frame,"load",callback,this);form.submit()},getContextMenu:function(){if(!this.contextmenu){var config={singleUpload:this.singleUpload,maxFileSize:this.maxFileSize,enableProgress:this.enableProgress};if(this.baseParams){config.baseParams=this.baseParams}this.contextmenu=new Ext.ux.FileTreeMenu(config);this.contextmenu.on({click:{scope:this,fn:this.onContextClick}});this.uploadPanel=this.contextmenu.getItemByCmd("upload-panel").component;this.uploadPanel.on({beforeupload:{scope:this,fn:this.onBeforeUpload},allfinished:{scope:this,fn:this.onAllFinished}});this.uploadPanel.setUrl(this.uploadUrl||this.url);this.relayEvents(this.uploadPanel,["beforefileadd","fileadd","beforefileremove","fileremove","beforequeueclear","queueclear","beforeupload","beforeallstart","allfinished","progress"])}return this.contextmenu},getFileCls:function(name){var atmp=name.split(".");if(1===atmp.length){return this.fileCls}else{return this.fileCls+"-"+atmp.pop().toLowerCase()}},getPath:function(node){var path,p,a;if(node!==this.root){p=node.parentNode;a=[node.text];while(p&&p!==this.root){a.unshift(p.text);p=p.parentNode}a.unshift(this.root.attributes.path||"");path=a.join(this.pathSeparator)}else{path=node.attributes.path||""}path=path.replace(/^[\/\.]*/,"");return path},hasChild:function(node,childName){return(node.isLeaf()?node.parentNode:node).findChild("text",childName)!==null},hideContextMenu:function(){if(this.contextmenu&&this.contextmenu.isVisible()){this.contextmenu.hide()}return this},onBeforeEditComplete:function(editor,newName,oldName){if(editor.cancellingEdit){editor.cancellingEdit=false;return }var oldPath=this.getPath(editor.editNode);var newPath=oldPath.replace(/\/[^\\]+$/,"/"+newName);if(false===this.fireEvent("beforerename",this,editor.editNode,newPath,oldPath)){editor.cancellingEdit=true;editor.cancelEdit();return false}},onBeforeNodeDrop:function(e){var s=e.dropNode;var d=e.target.leaf?e.target.parentNode:e.target;if(s.parentNode===d){return false}if(this.hasChild(d,s.text)&&undefined===e.confirmed){this.confirmOverwrite(s.text,function(response){e.confirmed="yes"===response;this.onBeforeNodeDrop(e)});return false}if(false===e.confirmed){return false}e.confirmed=undefined;e.oldParent=s.parentNode;var oldName=this.getPath(s);var newName=this.getPath(d)+"/"+s.text;if(true!==this.eventsSuspended&&false===this.fireEvent("beforerename",this,s,newName,oldName)){return false}var options={url:this.renameUrl||this.url,method:this.method,scope:this,callback:this.cmdCallback,node:s,oldParent:s.parentNode,e:e,params:{cmd:"rename",oldname:oldName,newname:newName}};Ext.Ajax.request(options);return true},onBeforeUpload:function(uploadPanel){var menu=this.getContextMenu();var path=this.getPath(menu.node);if(menu.node.isLeaf()){path=path.replace(/\/[^\/]+$/,"",path)}uploadPanel.setPath(path)},onAllFinished:function(uploader){var menu=this.getContextMenu();(menu.node.isLeaf()?menu.node.parentNode:menu.node).reload()},onContextClick:function(menu,item,e){if(item.disabled){return }var node=menu.node;if(!node){node=menu.parentMenu.node}switch(item.cmd){case"reload":node.reload();break;case"expand":node.expand(true);break;case"collapse":node.collapse(true);break;case"open":this.openNode(node);break;case"open-self":this.openNode(node,"_self");break;case"open-popup":this.openNode(node,"popup");break;case"open-blank":this.openNode(node,"_blank");break;case"open-dwnld":this.openNode(node,"download");break;case"rename":this.treeEditor.triggerEdit(node);break;case"delete":this.deleteNode(node);break;case"newdir":this.createNewDir(node);break;default:break}},onContextMenu:function(node,e){if(this.readOnly){return false}this.showContextMenu(node);return false},onDblClick:function(node,e){this.openNode(node)},onDestroy:function(){if(this.contextmenu){this.contextmenu.purgeListeners();this.contextmenu.destroy();this.contextmenu=null}if(this.treeEditor){this.treeEditor.purgeListeners();this.treeEditor.destroy();this.treeEditor=null}if(this.treeSorter){this.treeSorter=null}Ext.ux.FileTreePanel.superclass.onDestroy.call(this)},onEditComplete:function(editor,newName,oldName){var node=editor.editNode;if(newName===oldName||editor.creatingNewDir){editor.creatingNewDir=false;return }var path=this.getPath(node.parentNode);var options={url:this.renameUrl||this.url,method:this.method,scope:this,callback:this.cmdCallback,node:node,oldName:oldName,params:{cmd:"rename",oldname:path+"/"+oldName,newname:path+"/"+newName}};Ext.Ajax.request(options)},onNewDir:function(editor){var path=this.getPath(editor.editNode);var options={url:this.newdirUrl||this.url,method:this.method,scope:this,node:editor.editNode,callback:this.cmdCallback,params:{cmd:"newdir",dir:path}};Ext.Ajax.request(options)},onNodeDragOver:function(e){e.cancel=e.target.disabled||e.dropNode.parentNode===e.target.parentNode&&e.target.isLeaf()},onNodeDrop:function(e){if(true===e.failure){e.oldParent.appendChild(e.dropNode);return }var sameNode=e.dropNode.parentNode.findChild("text",e.dropNode.text);if(sameNode&&sameNode!==e.dropNode){sameNode.parentNode.removeChild(sameNode)}},openNode:function(node,mode){if(!this.enableOpen){return }mode=mode||this.openMode;var url;var path;var newpath;if(node.isLeaf()){path=this.getPath(node);newpath=this.opennodepath(this,node,path,mode);if(newpath!==undefined&&newpath!=null&&newpath.length>0){path=newpath}url=this.hrefPrefix+path+this.hrefSuffix;if(true!==this.eventsSuspended&&false===this.fireEvent("beforeopen",this,node.text,url,mode)){return }switch(mode){case"popup":if(!this.popup||this.popup.closed){this.popup=window.open(url,this.hrefTarget,this.popupFeatures)}this.popup.location=url;if(this.focusPopup){this.popup.focus()}break;case"_self":window.location=url;break;case"_blank":window.open(url);break;case"download":this.downloadFile(path);break}if(true!==this.eventsSuspended){this.fireEvent("open",this,node.text,url,mode)}}},setDeleteDisabled:function(disabled){disabled=!(!disabled);if(!this.enableDelete===disabled){return this}this.hideContextMenu();this.enableDelete=!disabled},setNewdirDisabled:function(disabled){disabled=!(!disabled);if(!this.enableNewDir===disabled){return this}this.hideContextMenu();this.enableNewDir=!disabled},setOpenDisabled:function(disabled){disabled=!(!disabled);if(!this.enableOpen===disabled){return this}this.hideContextMenu();this.enableOpen=!disabled;return this},setReadOnly:function(readOnly){readOnly=!(!readOnly);if(this.readOnly===readOnly){return this}this.hideContextMenu();if(this.dragZone){this.dragZone.locked=readOnly}this.readOnly=readOnly;return this},setRenameDisabled:function(disabled){disabled=!(!disabled);if(!this.enableRename===disabled){return this}this.hideContextMenu();if(this.dragZone){this.dragZone.locked=disabled}this.enableRename=!disabled;return this},setUploadDisabled:function(disabled){disabled=!(!disabled);if(!this.enableUpload===disabled){return this}this.hideContextMenu();this.enableUpload=!disabled;return this},showContextMenu:function(node){var topAlign=false;var alignEl=this.topMenu?this.topMenu.getEl():this.body;if(!node){node=this.getSelectionModel().getSelectedNode();topAlign=true}else{alignEl=node.getUI().getEl()}if(!node){return }var menu=this.getContextMenu();menu.node=node;menu.getItemByCmd("nodename").setText(Ext.util.Format.ellipsis(node.text,22));menu.setItemDisabled("open",!node.isLeaf());menu.setItemDisabled("reload",node.isLeaf());menu.setItemDisabled("expand",node.isLeaf());menu.setItemDisabled("collapse",node.isLeaf());menu.setItemDisabled("delete",node===this.root||node.disabled);menu.setItemDisabled("rename",this.readOnly||node===this.root||node.disabled);menu.setItemDisabled("newdir",this.readOnly||(node.isLeaf()?node.parentNode.disabled:node.disabled));menu.setItemDisabled("upload",node.isLeaf()?node.parentNode.disabled:node.disabled);menu.setItemDisabled("upload-panel",node.isLeaf()?node.parentNode.disabled:node.disabled);menu.getItemByCmd("open").setVisible(this.enableOpen);menu.getItemByCmd("delete").setVisible(this.enableDelete);menu.getItemByCmd("newdir").setVisible(this.enableNewDir);menu.getItemByCmd("rename").setVisible(this.enableRename);menu.getItemByCmd("upload").setVisible(this.enableUpload);menu.getItemByCmd("upload-panel").setVisible(this.enableUpload);menu.getItemByCmd("sep-upload").setVisible(this.enableUpload);menu.getItemByCmd("sep-collapse").setVisible(this.enableNewDir||this.enableDelete||this.enableRename);node.select();if(topAlign){menu.showAt(menu.getEl().getAlignToXY(alignEl,"tl-bl?"))}else{menu.showAt(menu.getEl().getAlignToXY(alignEl,"tl-tl?",[0,18]))}},showError:function(msg,title){Ext.Msg.show({title:title||this.errorText,msg:Ext.util.Format.ellipsis(msg,this.maxMsgLen),fixCursor:true,icon:Ext.Msg.ERROR,buttons:Ext.Msg.OK,minWidth:1200>String(msg).length?360:600})},updateCls:function(node,oldName){if(node.isLeaf()){Ext.fly(node.getUI().iconNode).removeClass(this.getFileCls(oldName));Ext.fly(node.getUI().iconNode).addClass(this.getFileCls(node.text))}}});Ext.reg("filetreepanel",Ext.ux.FileTreePanel);Ext.ux.FileUploader=function(config){Ext.apply(this,config);Ext.ux.FileUploader.superclass.constructor.apply(this,arguments);this.addEvents("beforeallstart","allfinished","beforefilestart","filefinished","progress")};Ext.extend(Ext.ux.FileUploader,Ext.util.Observable,{baseParams:{cmd:"upload",dir:"."},concurrent:true,enableProgress:true,jsonErrorText:"Cannot decode JSON object",maxFileSize:524288,progressIdName:"UPLOAD_IDENTIFIER",progressInterval:2000,progressUrl:"progress.php",progressMap:{bytes_total:"bytesTotal",bytes_uploaded:"bytesUploaded",est_sec:"estSec",files_uploaded:"filesUploaded",speed_average:"speedAverage",speed_last:"speedLast",time_last:"timeLast",time_start:"timeStart"},singleUpload:false,unknownErrorText:"Unknown error",upCount:0,createForm:function(record){var progressId=parseInt(Math.random()*10000000000,10);var form=Ext.getBody().createChild({tag:"form",action:this.url,method:"post",cls:"x-hidden",id:Ext.id(),cn:[{tag:"input",type:"hidden",name:"APC_UPLOAD_PROGRESS",value:progressId},{tag:"input",type:"hidden",name:this.progressIdName,value:progressId},{tag:"input",type:"hidden",name:"MAX_FILE_SIZE",value:this.maxFileSize}]});if(record){record.set("form",form);record.set("progressId",progressId)}else{this.progressId=progressId}return form},deleteForm:function(form,record){form.remove();if(record){record.set("form",null)}},fireFinishEvents:function(options){if(true!==this.eventsSuspended&&!this.singleUpload){this.fireEvent("filefinished",this,options&&options.record)}if(true!==this.eventsSuspended&&0===this.upCount){this.stopProgress();this.fireEvent("allfinished",this)}},getIframe:function(record){var iframe=null;var form=record.get("form");if(form&&form.dom&&form.dom.target){iframe=Ext.get(form.dom.target)}return iframe},getOptions:function(record,params){var o={url:this.url,method:"post",isUpload:true,scope:this,callback:this.uploadCallback,record:record,params:this.getParams(record,params)};return o},getParams:function(record,params){var p={path:this.path};Ext.apply(p,this.baseParams||{},params||{});return p},processSuccess:function(options,response,o){var record=false;if(this.singleUpload){this.store.each(function(r){r.set("state","done");r.set("error","");r.commit()})}else{record=options.record;record.set("state","done");record.set("error","");record.commit()}this.deleteForm(options.form,record)},processFailure:function(options,response,error){var record=options.record;var records;if(this.singleUpload){records=this.store.queryBy(function(r){return"done"!==r.get("state")});records.each(function(record){var e=error.errors?error.errors[record.id]:this.unknownErrorText;if(e){record.set("state","failed");record.set("error",e);Ext.getBody().appendChild(record.get("input"))}else{record.set("state","done");record.set("error","")}record.commit()},this);this.deleteForm(options.form)}else{if(error&&"object"===Ext.type(error)){record.set("error",error.errors&&error.errors[record.id]?error.errors[record.id]:this.unknownErrorText)}else{if(error){record.set("error",error)}else{if(response&&response.responseText){record.set("error",response.responseText)}else{record.set("error",this.unknownErrorText)}}}record.set("state","failed");record.commit()}},requestProgress:function(){var records,p;var o={url:this.progressUrl,method:"post",params:{},scope:this,callback:function(options,success,response){var o;if(true!==success){return }try{o=Ext.decode(response.responseText)}catch(e){return }if("object"!==Ext.type(o)||true!==o.success){return }if(this.singleUpload){this.progress={};for(p in o){if(this.progressMap[p]){this.progress[this.progressMap[p]]=parseInt(o[p],10)}}if(true!==this.eventsSuspended){this.fireEvent("progress",this,this.progress)}}else{for(p in o){if(this.progressMap[p]&&options.record){options.record.set(this.progressMap[p],parseInt(o[p],10))}}if(options.record){options.record.commit();if(true!==this.eventsSuspended){this.fireEvent("progress",this,options.record.data,options.record)}}}this.progressTask.delay(this.progressInterval)}};if(this.singleUpload){o.params[this.progressIdName]=this.progressId;o.params.APC_UPLOAD_PROGRESS=this.progressId;Ext.Ajax.request(o)}else{records=this.store.query("state","uploading");records.each(function(r){o.params[this.progressIdName]=r.get("progressId");o.params.APC_UPLOAD_PROGRESS=o.params[this.progressIdName];o.record=r;(function(){Ext.Ajax.request(o)}).defer(250)},this)}},setPath:function(path){this.path=path},setUrl:function(url){this.url=url},startProgress:function(){if(!this.progressTask){this.progressTask=new Ext.util.DelayedTask(this.requestProgress,this)}this.progressTask.delay.defer(this.progressInterval/2,this.progressTask,[this.progressInterval])},stopProgress:function(){if(this.progressTask){this.progressTask.cancel()}},stopAll:function(){var records=this.store.query("state","uploading");records.each(this.stopUpload,this)},stopUpload:function(record){var iframe=false;if(record){iframe=this.getIframe(record);this.stopIframe(iframe);this.upCount--;this.upCount=0>this.upCount?0:this.upCount;record.set("state","stopped");this.fireFinishEvents({record:record})}else{if(this.form){iframe=Ext.fly(this.form.dom.target);this.stopIframe(iframe);this.upCount=0;this.fireFinishEvents()}}},stopIframe:function(iframe){if(iframe){try{iframe.dom.contentWindow.stop();iframe.remove.defer(250,iframe)}catch(e){}}},upload:function(){var records=this.store.queryBy(function(r){return"done"!==r.get("state")});if(!records.getCount()){return }if(true!==this.eventsSuspended&&false===this.fireEvent("beforeallstart",this)){return }if(this.singleUpload){this.uploadSingle()}else{records.each(this.uploadFile,this)}if(true===this.enableProgress){this.startProgress()}},uploadCallback:function(options,success,response){var o;this.upCount--;this.form=false;if(true===success){try{o=Ext.decode(response.responseText)}catch(e){this.processFailure(options,response,this.jsonErrorText);this.fireFinishEvents(options);return }if(true===o.success){this.processSuccess(options,response,o)}else{this.processFailure(options,response,o)}}else{this.processFailure(options,response)}this.fireFinishEvents(options)},uploadFile:function(record,params){if(true!==this.eventsSuspended&&false===this.fireEvent("beforefilestart",this,record)){return }var form=this.createForm(record);var inp=record.get("input");inp.set({name:inp.id});form.appendChild(inp);var o=this.getOptions(record,params);o.form=form;record.set("state","uploading");record.set("pctComplete",0);this.upCount++;Ext.Ajax.request(o);this.getIframe.defer(100,this,[record])},uploadSingle:function(){var records=this.store.queryBy(function(r){return"done"!==r.get("state")});if(!records.getCount()){return }var form=this.createForm();records.each(function(record){var inp=record.get("input");inp.set({name:inp.id});form.appendChild(inp);record.set("state","uploading")},this);var o=this.getOptions();o.form=form;this.form=form;this.upCount++;Ext.Ajax.request(o)}});Ext.reg("fileuploader",Ext.ux.FileUploader);Ext.namespace("Ext.ux.form");Ext.ux.form.BrowseButton=Ext.extend(Ext.Button,{inputFileName:"file",debug:false,FLOAT_EL_WIDTH:60,FLOAT_EL_HEIGHT:18,buttonCt:null,clipEl:null,floatEl:null,inputFileEl:null,originalHandler:null,originalScope:null,initComponent:function(){Ext.ux.form.BrowseButton.superclass.initComponent.call(this);this.originalHandler=this.handler||null;this.originalScope=this.scope||window;this.handler=null;this.scope=null},onRender:function(ct,position){Ext.ux.form.BrowseButton.superclass.onRender.call(this,ct,position);this.buttonCt=this.el.child(".x-btn-center em");this.buttonCt.position("relative");var styleCfg={position:"absolute",overflow:"hidden",top:"0px",left:"0px"};if(Ext.isIE){Ext.apply(styleCfg,{left:"-3px",top:"-3px"})}else{if(Ext.isGecko){Ext.apply(styleCfg,{left:"-3px",top:"-3px"})}else{if(Ext.isSafari){Ext.apply(styleCfg,{left:"-4px",top:"-2px"})}}}this.clipEl=this.buttonCt.createChild({tag:"div",style:styleCfg});this.setClipSize();this.clipEl.on({mousemove:this.onButtonMouseMove,mouseover:this.onButtonMouseMove,scope:this});this.floatEl=this.clipEl.createChild({tag:"div",style:{position:"absolute",width:this.FLOAT_EL_WIDTH+"px",height:this.FLOAT_EL_HEIGHT+"px",overflow:"hidden"}});if(this.debug){this.clipEl.applyStyles({"background-color":"green"});this.floatEl.applyStyles({"background-color":"red"})}else{this.clipEl.setOpacity(0)}this.createInputFile()},setClipSize:function(){if(this.clipEl){var width=this.buttonCt.getWidth();var height=this.buttonCt.getHeight();if(Ext.isIE){width=width+5;height=height+5}else{if(Ext.isGecko){width=width+6;height=height+6}else{if(Ext.isSafari){width=width+6;height=height+6}}}this.clipEl.setSize(width,height)}},createInputFile:function(){this.inputFileEl=this.floatEl.createChild({tag:"input",type:"file",size:1,name:this.inputFileName||Ext.id(this.el),style:{position:"absolute",cursor:"pointer",right:"0px",top:"0px"}});this.inputFileEl=this.inputFileEl.child("input")||this.inputFileEl;this.inputFileEl.on({click:this.onInputFileClick,change:this.onInputFileChange,scope:this});if(this.tooltip){if(typeof this.tooltip=="object"){Ext.QuickTips.register(Ext.apply({target:this.inputFileEl},this.tooltip))}else{this.inputFileEl.dom[this.tooltipType]=this.tooltip}}},onButtonMouseMove:function(e){var xy=e.getXY();xy[0]-=this.FLOAT_EL_WIDTH/2;xy[1]-=this.FLOAT_EL_HEIGHT/2;this.floatEl.setXY(xy)},onInputFileClick:function(e){e.stopPropagation()},onInputFileChange:function(){if(this.originalHandler){this.originalHandler.call(this.originalScope,this)}},detachInputFile:function(noCreate){var result=this.inputFileEl;if(typeof this.tooltip=="object"){Ext.QuickTips.unregister(this.inputFileEl)}else{this.inputFileEl.dom[this.tooltipType]=null}this.inputFileEl.removeAllListeners();this.inputFileEl=null;if(!noCreate){this.createInputFile()}return result},getInputFile:function(){return this.inputFileEl},disable:function(){Ext.ux.form.BrowseButton.superclass.disable.call(this);this.inputFileEl.dom.disabled=true},enable:function(){Ext.ux.form.BrowseButton.superclass.enable.call(this);this.inputFileEl.dom.disabled=false}});Ext.reg("browsebutton",Ext.ux.form.BrowseButton);Ext.ux.IconCombo=Ext.extend(Ext.form.ComboBox,{initComponent:function(){Ext.apply(this,{tpl:'<tpl for="."><div class="x-combo-list-item ux-icon-combo-item {'+this.iconClsField+'}">{'+this.displayField+"}</div></tpl>"});Ext.ux.IconCombo.superclass.initComponent.apply(this,arguments)},onRender:function(ct,position){Ext.ux.IconCombo.superclass.onRender.apply(this,arguments);this.wrap.applyStyles({position:"relative"});this.el.addClass("ux-icon-combo-input");this.icon=Ext.DomHelper.append(this.el.up("div.x-form-field-wrap"),{tag:"div",style:"position:absolute"})},afterRender:function(){Ext.ux.IconCombo.superclass.afterRender.apply(this,arguments);if(undefined!==this.value){this.setValue(this.value)}},setIconCls:function(){var rec=this.store.query(this.valueField,this.getValue()).itemAt(0);if(rec&&this.icon){this.icon.className="ux-icon-combo-icon "+rec.get(this.iconClsField)}},setValue:function(value){Ext.ux.IconCombo.superclass.setValue.call(this,value);this.setIconCls()},clearValue:function(){Ext.ux.IconCombo.superclass.clearValue.call(this);if(this.icon){this.icon.className=""}}});Ext.reg("iconcombo",Ext.ux.IconCombo);Ext.ux.LangSelectCombo=Ext.extend(Ext.ux.IconCombo,{selectLangText:"Select Language",lazyRender:true,lazyInit:true,langVariable:"locale",typeAhead:true,initComponent:function(){var langCode=Ext.state.Manager.getProvider()?Ext.state.Manager.get(this.langVariable):"en_US";langCode=langCode?langCode:"en_US";Ext.apply(this,{store:new Ext.data.SimpleStore({id:0,fields:[{name:"langCode",type:"string"},{name:"langName",type:"string"},{name:"langCls",type:"string"}],data:[["cs_CZ","Český","ux-flag-cz"],["de_DE","Deutsch","ux-flag-de"],["en_US","English","ux-flag-us"],["ru_RU","Russian","ux-flag-ru"],["sk_SK","Slovenský","ux-flag-sk"],["es_ES","Spanish","ux-flag-es"],["tr_TR","Turkish","ux-flag-tr"]]}),valueField:"langCode",displayField:"langName",iconClsField:"langCls",triggerAction:"all",mode:"local",forceSelection:true,value:langCode});Ext.ux.LangSelectCombo.superclass.initComponent.apply(this,arguments)},onSelect:function(record){Ext.ux.LangSelectCombo.superclass.onSelect.apply(this,arguments);var langCode=record.get("langCode");if(Ext.state.Manager.getProvider()){Ext.state.Manager.set(this.langVariable,langCode)}window.location.search=this.langVariable+"="+langCode}});Ext.ux.ThemeCombo=Ext.extend(Ext.form.ComboBox,{themeBlueText:"Ext Blue Theme",themeGrayText:"Gray Theme",themeBlackText:"Black Theme",themeOliveText:"Olive Theme",themePurpleText:"Purple Theme",themeDarkGrayText:"Dark Gray Theme",themeSlateText:"Slate Theme",themeVistaText:"Vista Theme",themePeppermintText:"Peppermint Theme",themeChocolateText:"Chocolate Theme",themeGreenText:"Green Theme",themeIndigoText:"Indigo Theme",themeMidnightText:"Midnight Theme",themeSilverCherryText:"Silver Cherry Theme",themeSlicknessText:"Slickness Theme",themeVar:"theme",selectThemeText:"Select Theme",themeGrayExtndText:"Gray-Extended Theme",lazyRender:true,lazyInit:true,cssPath:"../ext/resources/css/",initComponent:function(){Ext.apply(this,{store:new Ext.data.SimpleStore({fields:["themeFile",{name:"themeName",type:"string"}],data:[["xtheme-default.css",this.themeBlueText],["xtheme-gray.css",this.themeGrayText],["xtheme-darkgray.css",this.themeDarkGrayText],["xtheme-black.css",this.themeBlackText],["xtheme-olive.css",this.themeOliveText],["xtheme-purple.css",this.themePurpleText],["xtheme-slate.css",this.themeSlateText],["xtheme-peppermint.css",this.themePeppermintText],["xtheme-chocolate.css",this.themeChocolateText],["xtheme-green.css",this.themeGreenText],["xtheme-indigo.css",this.themeIndigoText],["xtheme-midnight.css",this.themeMidnightText],["xtheme-silverCherry.css",this.themeSilverCherryText],["xtheme-slickness.css",this.themeSlicknessText],["xtheme-gray-extend.css",this.themeGrayExtndText]]}),valueField:"themeFile",displayField:"themeName",triggerAction:"all",mode:"local",forceSelection:true,editable:false,fieldLabel:this.selectThemeText});this.store.sort("themeName");Ext.ux.ThemeCombo.superclass.initComponent.apply(this,arguments);this.setValue(Ext.state.Manager.get(this.themeVar)||"xtheme-default.css")},setValue:function(val){Ext.ux.ThemeCombo.superclass.setValue.apply(this,arguments);Ext.util.CSS.swapStyleSheet(this.themeVar,this.cssPath+val);if(Ext.state.Manager.getProvider()){Ext.state.Manager.set(this.themeVar,val)}}});Ext.reg("themecombo",Ext.ux.ThemeCombo);Ext.ux.UploadPanel=Ext.extend(Ext.Panel,{addIconCls:"icon-plus",addText:"Add",bodyStyle:"padding:2px",buttonsAt:"tbar",clickRemoveText:"Click to remove",clickStopText:"Click to stop",emptyText:"No files",enableProgress:true,errorText:"Error",fileCls:"file",fileQueuedText:"File <b>{0}</b> is queued for upload",fileDoneText:"File <b>{0}</b> has been successfully uploaded",fileFailedText:"File <b>{0}</b> failed to upload",fileStoppedText:"File <b>{0}</b> stopped by user",fileUploadingText:"Uploading file <b>{0}</b>",maxFileSize:524288,maxLength:18,removeAllIconCls:"icon-cross",removeAllText:"Remove All",removeIconCls:"icon-minus",removeText:"Remove",selectedClass:"ux-up-item-selected",singleUpload:false,stopAllText:"Stop All",stopIconCls:"icon-stop",uploadText:"Upload",uploadIconCls:"icon-upload",workingIconCls:"icon-working",initComponent:function(){var addCfg={xtype:"browsebutton",text:this.addText+"...",iconCls:this.addIconCls,scope:this,handler:this.onAddFile};var upCfg={xtype:"button",iconCls:this.uploadIconCls,text:this.uploadText,scope:this,handler:this.onUpload,disabled:true};var removeAllCfg={xtype:"button",iconCls:this.removeAllIconCls,tooltip:this.removeAllText,scope:this,handler:this.onRemoveAllClick,disabled:true};if("body"!==this.buttonsAt){this[this.buttonsAt]=[addCfg,upCfg,"->",removeAllCfg]}var fields=[{name:"id",type:"text",system:true},{name:"shortName",type:"text",system:true},{name:"fileName",type:"text",system:true},{name:"filePath",type:"text",system:true},{name:"fileCls",type:"text",system:true},{name:"input",system:true},{name:"form",system:true},{name:"state",type:"text",system:true},{name:"error",type:"text",system:true},{name:"progressId",type:"int",system:true},{name:"bytesTotal",type:"int",system:true},{name:"bytesUploaded",type:"int",system:true},{name:"estSec",type:"int",system:true},{name:"filesUploaded",type:"int",system:true},{name:"speedAverage",type:"int",system:true},{name:"speedLast",type:"int",system:true},{name:"timeLast",type:"int",system:true},{name:"timeStart",type:"int",system:true},{name:"pctComplete",type:"int",system:true}];if(Ext.isArray(this.customFields)){fields.push(this.customFields)}this.store=new Ext.data.SimpleStore({id:0,fields:fields,data:[]});Ext.apply(this,{items:[{xtype:"dataview",itemSelector:"div.ux-up-item",store:this.store,selectedClass:this.selectedClass,singleSelect:true,emptyText:this.emptyText,tpl:this.tpl||new Ext.XTemplate('<tpl for="."><div class="ux-up-item"><div class="ux-up-icon-file {fileCls}"> </div><div class="ux-up-text x-unselectable" qtip="{fileName}">{shortName}</div><div id="remove-{[values.input.id]}" class="ux-up-icon-state ux-up-icon-{state}"qtip="{[this.scope.getQtip(values)]}"> </div></div></tpl>',{scope:this}),listeners:{click:{scope:this,fn:this.onViewClick}}}]});Ext.ux.UploadPanel.superclass.initComponent.apply(this,arguments);this.view=this.items.itemAt(0);this.addEvents("beforefileadd","fileadd","beforefileremove","fileremove","beforequeueclear","queueclear","beforeupload");this.relayEvents(this.view,["beforeclick","beforeselect","click","containerclick","contextmenu","dblclick","selectionchange"]);var config={store:this.store,singleUpload:this.singleUpload,maxFileSize:this.maxFileSize,enableProgress:this.enableProgress,url:this.url,path:this.path};if(this.baseParams){config.baseParams=this.baseParams}this.uploader=new Ext.ux.FileUploader(config);this.relayEvents(this.uploader,["beforeallstart","allfinished","progress"]);this.on({beforeallstart:{scope:this,fn:function(){this.uploading=true;this.updateButtons()}},allfinished:{scope:this,fn:function(){this.uploading=false;this.updateButtons()}},progress:{fn:this.onProgress.createDelegate(this)}})},onRender:function(){Ext.ux.UploadPanel.superclass.onRender.apply(this,arguments);var tb="tbar"===this.buttonsAt?this.getTopToolbar():this.getBottomToolbar();this.addBtn=Ext.getCmp(tb.items.first().id);this.uploadBtn=Ext.getCmp(tb.items.itemAt(1).id);this.removeAllBtn=Ext.getCmp(tb.items.last().id)},getQtip:function(values){var qtip="";switch(values.state){case"queued":qtip=String.format(this.fileQueuedText,values.fileName);qtip+="<br>"+this.clickRemoveText;break;case"uploading":qtip=String.format(this.fileUploadingText,values.fileName);qtip+="<br>"+values.pctComplete+"% done";qtip+="<br>"+this.clickStopText;break;case"done":qtip=String.format(this.fileDoneText,values.fileName);qtip+="<br>"+this.clickRemoveText;break;case"failed":qtip=String.format(this.fileFailedText,values.fileName);qtip+="<br>"+this.errorText+":"+values.error;qtip+="<br>"+this.clickRemoveText;break;case"stopped":qtip=String.format(this.fileStoppedText,values.fileName);qtip+="<br>"+this.clickRemoveText;break}return qtip},getFileName:function(inp){return inp.getValue().split(/[\/\\]/).pop()},getFilePath:function(inp){return inp.getValue().replace(/[^\/\\]+$/,"")},getFileCls:function(name){var atmp=name.split(".");if(1===atmp.length){return this.fileCls}else{return this.fileCls+"-"+atmp.pop().toLowerCase()}},onAddFile:function(bb){if(true!==this.eventsSuspended&&false===this.fireEvent("beforefileadd",this,bb.getInputFile())){return }var inp=bb.detachInputFile();inp.addClass("x-hidden");var fileName=this.getFileName(inp);var rec=new this.store.recordType({input:inp,fileName:fileName,filePath:this.getFilePath(inp),shortName:Ext.util.Format.ellipsis(fileName,this.maxLength),fileCls:this.getFileCls(fileName),state:"queued"},inp.id);rec.commit();this.store.add(rec);this.syncShadow();this.uploadBtn.enable();this.removeAllBtn.enable();if(true!==this.eventsSuspended){this.fireEvent("fileadd",this,this.store,rec)}},onDestroy:function(){if(this.uploader){this.uploader.stopAll();this.uploader.purgeListeners();this.uploader=null}if(this.view){this.view.purgeListeners();this.view.destroy();this.view=null}if(this.store){this.store.purgeListeners();this.store.destroy();this.store=null}},onProgress:function(uploader,data,record){var bytesTotal,bytesUploaded,pctComplete,state,idx,item,width,pgWidth;if(record){state=record.get("state");bytesTotal=record.get("bytesTotal")||1;bytesUploaded=record.get("bytesUploaded")||0;if("uploading"===state){pctComplete=Math.round(1000*bytesUploaded/bytesTotal)/10}else{if("done"==="state"){pctComplete=100}else{pctComplete=0}}record.set("pctComplete",pctComplete);idx=this.store.indexOf(record);item=Ext.get(this.view.getNode(idx));if(item){width=item.getWidth();item.applyStyles({"background-position":width*pctComplete/100+"px"})}}},onRemoveFile:function(record){if(true!==this.eventsSuspended&&false===this.fireEvent("beforefileremove",this,this.store,record)){return }var inp=record.get("input");var wrap=inp.up("em");inp.remove();if(wrap){wrap.remove()}this.store.remove(record);var count=this.store.getCount();this.uploadBtn.setDisabled(!count);this.removeAllBtn.setDisabled(!count);if(true!==this.eventsSuspended){this.fireEvent("fileremove",this,this.store);this.syncShadow()}},onRemoveAllClick:function(btn){if(true===this.uploading){this.stopAll()}else{this.removeAll()}},stopAll:function(){this.uploader.stopAll()},onViewClick:function(view,index,node,e){var t=e.getTarget("div:any(.ux-up-icon-queued|.ux-up-icon-failed|.ux-up-icon-done|.ux-up-icon-stopped)");if(t){this.onRemoveFile(this.store.getAt(index))}t=e.getTarget("div.ux-up-icon-uploading");if(t){this.uploader.stopUpload(this.store.getAt(index))}},onUpload:function(){if(true!==this.eventsSuspended&&false===this.fireEvent("beforeupload",this)){return false}this.uploader.upload()},setUrl:function(url){this.url=url;this.uploader.setUrl(url)},setPath:function(path){this.uploader.setPath(path)},updateButtons:function(){if(true===this.uploading){this.addBtn.disable();this.uploadBtn.disable();this.removeAllBtn.setIconClass(this.stopIconCls);this.removeAllBtn.getEl().child(this.removeAllBtn.buttonSelector).dom[this.removeAllBtn.tooltipType]=this.stopAllText}else{this.addBtn.enable();this.uploadBtn.enable();this.removeAllBtn.setIconClass(this.removeAllIconCls);this.removeAllBtn.getEl().child(this.removeAllBtn.buttonSelector).dom[this.removeAllBtn.tooltipType]=this.removeAllText}},removeAll:function(){var suspendState=this.eventsSuspended;if(false!==this.eventsSuspended&&false===this.fireEvent("beforequeueclear",this,this.store)){return false}this.suspendEvents();this.store.each(this.onRemoveFile,this);this.eventsSuspended=suspendState;if(true!==this.eventsSuspended){this.fireEvent("queueclear",this,this.store)}this.syncShadow()},syncShadow:function(){if(this.contextmenu&&this.contextmenu.shadow){this.contextmenu.getEl().shadow.show(this.contextmenu.getEl())}}});Ext.reg("uploadpanel",Ext.ux.UploadPanel);Ext.ns("Ext.ux.grid");Ext.ux.grid.CellActions=function(config){Ext.apply(this,config);this.addEvents("action","beforeaction");Ext.ux.grid.CellActions.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.CellActions,Ext.util.Observable,{actionEvent:"click",actionWidth:20,tpl:'<div class="ux-cell-value" style="padding-left:{padding}px"><tpl if="\'left\'!==align">{value}</tpl><div class="ux-cell-actions<tpl if="\'left\'===align"> ux-cell-actions-left</tpl>" style="width:{width}px"><tpl for="actions"><div class="ux-cell-action {cls}" qtip="{qtip}" style="{style}"> </div></tpl></div><tpl if="\'left\'===align">{value}</tpl><div>',userProcessing:Ext.emptyFn,init:function(grid){this.grid=grid;grid.afterRender=grid.afterRender.createSequence(this.onRenderGrid,this);var cm=this.grid.getColumnModel();Ext.each(cm.config,function(c,idx){if("object"===typeof c.cellActions){c.origRenderer=cm.getRenderer(idx);c.renderer=this.renderActions.createDelegate(this)}},this)},onRenderGrid:function(){this.view=this.grid.getView();var cfg={scope:this};cfg[this.actionEvent]=this.onClick;this.view.mainBody.on(cfg)},getData:function(value,cell,record,row,col,store){return record.data||{}},renderActions:function(value,cell,record,row,col,store){var c=this.grid.getColumnModel().config[col];var val=c.origRenderer(value,cell,record,row,col,store);if(c.cellActions&&!c.actionsTpl){c.actionsTpl=this.processActions(c);c.actionsTpl.compile()}else{if(!c.cellActions){return val}}var data=this.getData.apply(this,arguments);data.value=val;return c.actionsTpl.apply(data)},processActions:function(c){this.callbacks=this.callbacks||{};var data={align:this.align||"right",width:this.actionWidth*c.cellActions.length,padding:"left"===this.align?this.actionWidth*c.cellActions.length:0,value:"{value}",actions:[]};Ext.each(c.cellActions,function(a,i){if(a.iconCls&&"function"===typeof (a.callback||a.cb)){this.callbacks[a.iconCls]=a.callback||a.cb}var o={cls:a.iconIndex?"{"+a.iconIndex+"}":(a.iconCls?a.iconCls:""),qtip:a.qtipIndex?"{"+a.qtipIndex+"}":(a.tooltip||a.qtip?a.tooltip||a.qtip:""),style:a.style?a.style:""};data.actions.push(o)},this);this.userProcessing(c,data);var xt=new Ext.XTemplate(this.tpl);return new Ext.Template(xt.apply(data))},onClick:function(e,target){var t=e.getTarget("div.ux-cell-action");var row=e.getTarget(".x-grid3-row");var col=this.view.findCellIndex(target.parentNode.parentNode);var c=this.grid.getColumnModel().config[col];var record,dataIndex,value,action;if(t){record=this.grid.store.getAt(row.rowIndex);dataIndex=c.dataIndex;value=record.get(dataIndex);action=t.className.replace(/ux-cell-action /,"")}if(false!==row&&false!==col&&record&&dataIndex&&action){if(this.callbacks&&"function"===typeof this.callbacks[action]){this.callbacks[action](this.grid,record,action,value,row.rowIndex,col)}if(true!==this.eventsSuspended&&false===this.fireEvent("beforeaction",this.grid,record,action,value,dataIndex,row.rowIndex,col)){return }else{if(true!==this.eventsSuspended){this.fireEvent("action",this.grid,record,action,value,dataIndex,row.rowIndex,col)}}}}});Ext.reg("cellactions",Ext.ux.grid.CellActions);Ext.namespace("Ext.ux","Ext.ux.grid");Ext.ux.grid.Search=function(config){Ext.apply(this,config);Ext.ux.grid.Search.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.Search,Ext.util.Observable,{searchText:"Search",searchTipText:"Type a text to search and press Enter",position:"bottom",iconCls:false,checkIndexes:"all",disableIndexes:[],dateFormat:undefined,mode:"remote",xtype:"gridsearch",paramNames:{fields:"fields",query:"query"},init:function(grid){this.grid=grid;grid.onRender=grid.onRender.createSequence(this.onRender,this);grid.reconfigure=grid.reconfigure.createSequence(this.reconfigure,this)},onRender:function(){var grid=this.grid;var tb="bottom"==this.position?grid.bottomToolbar:grid.topToolbar;this.menu=new Ext.menu.Menu();tb.add({text:this.searchText,menu:this.menu,iconCls:this.iconCls});this.field=new Ext.form.TwinTriggerField({width:this.width,selectOnFocus:undefined===this.selectOnFocus?true:this.selectOnFocus,trigger1Class:"x-form-clear-trigger",trigger2Class:"x-form-search-trigger",onTrigger1Click:this.onTriggerClear.createDelegate(this),onTrigger2Click:this.onTriggerSearch.createDelegate(this)});this.field.on("render",function(){this.field.el.dom.qtip=this.searchTipText;var map=new Ext.KeyMap(this.field.el,[{key:Ext.EventObject.ENTER,scope:this,fn:this.onTriggerSearch},{key:Ext.EventObject.ESC,scope:this,fn:this.onTriggerClear}]);map.stopEvent=true},this,{single:true});tb.add(this.field);this.reconfigure()},onTriggerClear:function(){this.field.setValue("");this.field.focus();this.onTriggerSearch()},onTriggerSearch:function(){var val=this.field.getValue();var store=this.grid.store;if("local"===this.mode){store.clearFilter();if(val){store.filterBy(function(r){var retval=false;this.menu.items.each(function(item){if(!item.checked||retval){return }var rv=r.get(item.dataIndex);if(!(rv instanceof Date)||(this.dateFormat||r.fields.get(item.dataIndex).dateFormat)){rv=rv instanceof Date?rv.format(this.dateFormat||r.fields.get(item.dataIndex).dateFormat):rv;var re=new RegExp(val,"gi");retval=re.test(rv)}},this);if(retval){return true}return retval},this)}else{}}else{if(store.lastOptions&&store.lastOptions.params){store.lastOptions.params[store.paramNames.start]=0}var fields=[];this.menu.items.each(function(item){if(item.checked){fields.push(item.dataIndex)}});delete (store.baseParams[this.paramNames.fields]);delete (store.baseParams[this.paramNames.query]);if(store.lastOptions&&store.lastOptions.params){delete (store.lastOptions.params[this.paramNames.fields]);delete (store.lastOptions.params[this.paramNames.query])}if(fields.length){store.baseParams[this.paramNames.fields]=Ext.encode(fields);store.baseParams[this.paramNames.query]=val}store.reload()}},setDisabled:function(){this.field.setDisabled.apply(this.field,arguments)},enable:function(){this.setDisabled(false)},disable:function(){this.setDisabled(true)},reconfigure:function(){var menu=this.menu;menu.removeAll();var cm=this.grid.colModel;Ext.each(cm.config,function(config){var disable=false;if(config.header&&config.dataIndex){Ext.each(this.disableIndexes,function(item){disable=disable?disable:item===config.dataIndex});if(!disable){menu.add(new Ext.menu.CheckItem({text:config.header,hideOnClick:false,checked:"all"===this.checkIndexes,dataIndex:config.dataIndex}))}}},this);if(this.checkIndexes instanceof Array){Ext.each(this.checkIndexes,function(di){var item=menu.items.find(function(itm){return itm.dataIndex===di});if(item){item.setChecked(true,true)}},this)}}});Ext.ns("Ext.ux.grid.GridSummary");Ext.ux.grid.GridSummary=function(config){Ext.apply(this,config)};Ext.extend(Ext.ux.grid.GridSummary,Ext.util.Observable,{init:function(grid){this.grid=grid;this.cm=grid.getColumnModel();this.view=grid.getView();var v=this.view;v.onLayout=this.onLayout;v.afterMethod("render",this.refreshSummary,this);v.afterMethod("refresh",this.refreshSummary,this);v.afterMethod("syncScroll",this.syncSummaryScroll,this);v.afterMethod("onColumnWidthUpdated",this.doWidth,this);v.afterMethod("onAllColumnWidthsUpdated",this.doAllWidths,this);v.afterMethod("onColumnHiddenUpdated",this.doHidden,this);v.afterMethod("onUpdate",this.refreshSummary,this);v.afterMethod("onRemove",this.refreshSummary,this);grid.store.on("add",this.refreshSummary,this);grid.store.on("remove",this.refreshSummary,this);grid.store.on("clear",this.refreshSummary,this);if(!this.rowTpl){this.rowTpl=new Ext.Template('<div class="x-grid3-summary-row x-grid3-gridsummary-row-offset">','<table class="x-grid3-summary-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',"<tbody><tr>{cells}</tr></tbody>","</table>","</div>");this.rowTpl.disableFormats=true}this.rowTpl.compile();if(!this.cellTpl){this.cellTpl=new Ext.Template('<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}">','<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on">{value}</div>',"</td>");this.cellTpl.disableFormats=true}this.cellTpl.compile()},calculate:function(rs,cs){var data={},r,c,cfg=this.cm.config,cf;for(var j=0,jlen=rs.length;j<jlen;j++){r=rs[j];for(var i=0,len=cs.length;i<len;i++){c=cs[i];cf=cfg[i];if(cf&&cf.summaryType){data[c.name]=Ext.ux.grid.GridSummary.Calculations[cf.summaryType](data[c.name]||0,r,c.name,data)}}}return data},onLayout:function(vw,vh){if(!this.grid.getGridEl().hasClass("x-grid-hide-gridsummary")){this.scroller.setHeight(vh-this.summary.getHeight())}},syncSummaryScroll:function(){var mb=this.view.scroller.dom;this.view.summaryWrap.dom.scrollLeft=mb.scrollLeft;this.view.summaryWrap.dom.scrollLeft=mb.scrollLeft},doWidth:function(col,w,tw){var s=this.view.summary.dom;s.firstChild.style.width=tw;s.firstChild.rows[0].childNodes[col].style.width=w},doAllWidths:function(ws,tw){var s=this.view.summary.dom,wlen=ws.length;s.firstChild.style.width=tw;cells=s.firstChild.rows[0].childNodes;for(var j=0;j<wlen;j++){cells[j].style.width=ws[j]}},doHidden:function(col,hidden,tw){var s=this.view.summary.dom;var display=hidden?"none":"";s.firstChild.style.width=tw;s.firstChild.rows[0].childNodes[col].style.display=display},renderSummary:function(o,cs){cs=cs||this.view.getColumnData();var cfg=this.cm.config;var buf=[],c,p={},cf,last=cs.length-1;for(var i=0,len=cs.length;i<len;i++){c=cs[i];cf=cfg[i];p.id=c.id;p.style=c.style;p.css=i==0?"x-grid3-cell-first ":(i==last?"x-grid3-cell-last ":"");if(cf.summaryType||cf.summaryRenderer){p.value=(cf.summaryRenderer||c.renderer)(o.data[c.name],p,new Ext.data.Record(o.data),-1,i,this.grid.store)}else{p.value=""}if(p.value==undefined||p.value===""){p.value=" "}buf[buf.length]=this.cellTpl.apply(p)}return this.rowTpl.apply({tstyle:"width:"+this.view.getTotalWidth()+";",cells:buf.join("")})},refreshSummary:function(){if(!this.grid.rendered){return }var g=this.grid,ds=g.store;var cs=this.view.getColumnData();var rs=ds.getRange();var data=this.calculate(rs,cs);var buf=this.renderSummary({data:data},cs);if(!this.view.summaryWrap){this.view.summaryWrap=Ext.DomHelper.insertAfter(this.view.scroller,{tag:"div",cls:"x-grid3-gridsummary-row-inner"},true)}else{this.view.summary.remove()}this.view.summary=this.view.summaryWrap.insertHtml("afterbegin",buf,true)},toggleSummary:function(visible){var el=this.grid.getGridEl();if(el){if(visible===undefined){visible=el.hasClass("x-grid-hide-gridsummary")}el[visible?"removeClass":"addClass"]("x-grid-hide-gridsummary");this.view.layout()}},getSummaryNode:function(){return this.view.summary}});Ext.ux.grid.GridSummary.Calculations={sum:function(v,record,field){return v+Ext.num(record.data[field],0)},count:function(v,record,field,data){return data[field+"count"]?++data[field+"count"]:(data[field+"count"]=1)},max:function(v,record,field,data){var v=record.data[field];var max=data[field+"max"]===undefined?(data[field+"max"]=v):data[field+"max"];return v>max?(data[field+"max"]=v):max},min:function(v,record,field,data){var v=record.data[field];var min=data[field+"min"]===undefined?(data[field+"min"]=v):data[field+"min"];return v<min?(data[field+"min"]=v):min},average:function(v,record,field,data){var c=data[field+"count"]?++data[field+"count"]:(data[field+"count"]=1);var t=(data[field+"total"]=((data[field+"total"]||0)+(record.data[field]||0)));return t===0?0:t/c}};Ext.namespace("Ext.ux.grid");Ext.ux.grid.BufferedGridDragZone=function(grid,config){this.view=grid.getView();Ext.ux.grid.BufferedGridDragZone.superclass.constructor.call(this,this.view.mainBody.dom,config);if(this.view.lockedBody){this.setHandleElId(Ext.id(this.view.mainBody.dom));this.setOuterHandleElId(Ext.id(this.view.lockedBody.dom))}this.scroll=false;this.grid=grid;this.ddel=document.createElement("div");this.ddel.className="x-grid-dd-wrap";this.view.ds.on("beforeselectionsload",this.onBeforeSelectionsLoad,this);this.view.ds.on("selectionsload",this.onSelectionsLoad,this)};Ext.extend(Ext.ux.grid.BufferedGridDragZone,Ext.dd.DragZone,{ddGroup:"GridDD",isDropValid:true,getDragData:function(e){var t=Ext.lib.Event.getTarget(e);var rowIndex=this.view.findRowIndex(t);if(rowIndex!==false){var sm=this.grid.selModel;if(!sm.isSelected(rowIndex)||e.hasModifier()){sm.handleMouseDown(this.grid,rowIndex,e)}return{grid:this.grid,ddel:this.ddel,rowIndex:rowIndex,selections:sm.getSelections()}}return false},onInitDrag:function(e){this.view.ds.loadSelections(this.grid.selModel.getPendingSelections(true));var data=this.dragData;this.ddel.innerHTML=this.grid.getDragDropText();this.proxy.update(this.ddel)},onBeforeSelectionsLoad:function(){this.isDropValid=false;Ext.fly(this.proxy.el.dom.firstChild).addClass("x-dd-drop-waiting")},onSelectionsLoad:function(){this.isDropValid=true;this.ddel.innerHTML=this.grid.getDragDropText();Ext.fly(this.proxy.el.dom.firstChild).removeClass("x-dd-drop-waiting")},afterRepair:function(){this.dragging=false},getRepairXY:function(e,data){return false},onStartDrag:function(){},onEndDrag:function(data,e){},onValidDrop:function(dd,e,id){this.hideProxy()},beforeInvalidDrop:function(e,id){}});Ext.namespace("Ext.ux");Ext.ux.BufferedGridToolbar=Ext.extend(Ext.Toolbar,{displayMsg:"Displaying {0} - {1} of {2}",emptyMsg:"No data to display",refreshText:"Refresh",initComponent:function(){Ext.ux.BufferedGridToolbar.superclass.initComponent.call(this);this.bind(this.view)},updateInfo:function(rowIndex,visibleRows,totalCount){if(this.displayEl){var msg=totalCount==0?this.emptyMsg:String.format(this.displayMsg,rowIndex+1,rowIndex+visibleRows,totalCount);this.displayEl.update(msg)}},unbind:function(view){view.un("rowremoved",this.onRowRemoved,this);view.un("rowsinserted",this.onRowsInserted,this);view.un("beforebuffer",this.beforeBuffer,this);view.un("cursormove",this.onCursorMove,this);view.un("buffer",this.onBuffer,this);this.view=undefined},bind:function(view){view.on("rowremoved",this.onRowRemoved,this);view.on("rowsinserted",this.onRowsInserted,this);view.on("beforebuffer",this.beforeBuffer,this);view.on("cursormove",this.onCursorMove,this);view.on("buffer",this.onBuffer,this);this.view=view},onCursorMove:function(view,rowIndex,visibleRows,totalCount){this.updateInfo(rowIndex,visibleRows,totalCount)},onRowsInserted:function(view,start,end){this.updateInfo(view.rowIndex,Math.min(view.ds.totalLength,view.visibleRows),view.ds.totalLength)},onRowRemoved:function(view,index,record){this.updateInfo(view.rowIndex,Math.min(view.ds.totalLength,view.visibleRows),view.ds.totalLength)},beforeBuffer:function(view,store,rowIndex,visibleRows,totalCount){this.loading.disable();this.updateInfo(rowIndex,visibleRows,totalCount)},onBuffer:function(view,store,rowIndex,visibleRows,totalCount){this.loading.enable();this.updateInfo(rowIndex,visibleRows,totalCount)},onClick:function(type){switch(type){case"refresh":this.view.reset(true);break}},onRender:function(ct,position){Ext.PagingToolbar.superclass.onRender.call(this,ct,position);this.loading=this.addButton({tooltip:this.refreshText,iconCls:"x-tbar-loading",handler:this.onClick.createDelegate(this,["refresh"])});this.addSeparator();if(this.displayInfo){this.displayEl=Ext.fly(this.el.dom).createChild({cls:"x-paging-info"})}}});Ext.namespace("Ext.ux.grid");Ext.ux.grid.BufferedGridView=function(config){this.addEvents({beforebuffer:true,buffer:true,cursormove:true});this.horizontalScrollOffset=16;this.loadMask=false;Ext.apply(this,config);this.bufferRange=[0,-1];this.templates={};this.templates.master=new Ext.Template('<div class="x-grid3" hidefocus="true"><div style="z-index:2000;background:none;position:relative;height:321px; float:right; width: 18px;overflow: scroll;"><div style="background:none;width:1px;overflow:hidden;font-size:1px;height:0px;"></div></div>','<div class="x-grid3-viewport" style="float:left">','<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset">{header}</div></div><div class="x-clear"></div></div>','<div class="x-grid3-scroller" style="overflow-y:hidden !important;"><div class="x-grid3-body" style="position:relative;">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',"</div>",'<div class="x-grid3-resize-marker"> </div>','<div class="x-grid3-resize-proxy"> </div>',"</div>");Ext.ux.grid.BufferedGridView.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.BufferedGridView,Ext.grid.GridView,{liveScroller:null,liveScrollerInset:null,rowHeight:-1,visibleRows:1,lastIndex:-1,lastRowIndex:0,lastScrollPos:0,rowIndex:0,isBuffering:false,requestQueue:-1,loadMask:null,isPrebuffering:false,reset:function(forceReload){if(forceReload===false){this.ds.modified=[];this.grid.selModel.clearSelections(true);this.rowIndex=0;this.lastScrollPos=0;this.lastRowIndex=0;this.lastIndex=0;this.bufferRange=[0,this.ds.bufferSize];this.adjustScrollerPos(-this.liveScroller.dom.scrollTop,true);this.showLoadMask(false);this.refresh(true);this.fireEvent("cursormove",this,0,Math.min(this.ds.totalLength,this.visibleRows),this.ds.totalLength)}else{var params={start:0,limit:this.ds.bufferSize};var sInfo=this.ds.sortInfo;if(sInfo){params.dir=sInfo.direction;params.sort=sInfo.field}this.ds.load({callback:function(){this.reset(false)},scope:this,params:params})}},renderUI:function(){var g=this.grid;var dEnabled=g.enableDragDrop||g.enableDrag;g.enableDragDrop=false;g.enableDrag=false;Ext.ux.grid.BufferedGridView.superclass.renderUI.call(this);var g=this.grid;g.enableDragDrop=dEnabled;g.enableDrag=dEnabled;if(dEnabled){var dd=new Ext.ux.grid.BufferedGridDragZone(g,{ddGroup:g.ddGroup||"GridDD"})}if(this.loadMask){this.loadMask=new Ext.LoadMask(this.mainBody.dom.parentNode.parentNode,this.loadMask)}},init:function(grid){Ext.ux.grid.BufferedGridView.superclass.init.call(this,grid);this.bufferRange=[0,this.ds.bufferSize];this.ds.on("beforeload",this.onBeforeLoad,this)},renderBody:function(){var markup=this.renderRows(0,this.visibleRows-1);return this.templates.body.apply({rows:markup})},initElements:function(){var E=Ext.Element;var el=this.grid.getGridEl().dom.firstChild;var cs=el.childNodes;this.el=new E(el);this.mainWrap=new E(cs[1]);this.liveScroller=new E(cs[0]);this.liveScrollerInset=this.liveScroller.dom.firstChild;this.liveScroller.on("scroll",this.onLiveScroll,this);this.mainHd=new E(this.mainWrap.dom.firstChild);this.innerHd=this.mainHd.dom.firstChild;this.scroller=new E(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new E(this.scroller.dom.firstChild);this.mainBody.on("mousewheel",this.handleWheel,this);this.focusEl=new E(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new E(cs[2]);this.resizeProxy=new E(cs[3])},layout:function(){if(!this.mainBody){return }var g=this.grid;var c=g.getGridEl(),cm=this.cm,expandCol=g.autoExpandColumn,gv=this;var csize=c.getSize(true);var vw=csize.width-this.scrollOffset;if(vw<20||csize.height<20){return }if(g.autoHeight){this.scroller.dom.style.overflow="visible"}else{this.el.setSize(csize.width,csize.height);var hdHeight=this.mainHd.getHeight();var vh=csize.height-(hdHeight);this.scroller.setSize(vw,vh);if(this.innerHd){this.innerHd.style.width=(vw)+"px"}}if(this.forceFit){if(this.lastViewWidth!=vw){this.fitColumns(false,false);this.lastViewWidth=vw}}else{this.autoExpand()}this.adjustVisibleRows();this.adjustBufferInset();this.onLayout(vw,vh)},onColumnWidthUpdated:function(col,w,tw){this.adjustVisibleRows();this.adjustBufferInset()},onAllColumnWidthsUpdated:function(ws,tw){this.adjustVisibleRows();this.adjustBufferInset()},onRowSelect:function(row){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return }var viewIndex=row-this.rowIndex;this.addRowClass(viewIndex,"x-grid3-row-selected")},onRowDeselect:function(row){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return }var viewIndex=row-this.rowIndex;this.removeRowClass(viewIndex,"x-grid3-row-selected")},onCellSelect:function(row,col){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return }var viewIndex=row-this.rowIndex;var cell=this.getCell(viewIndex,col);if(cell){this.fly(cell).addClass("x-grid3-cell-selected")}},onCellDeselect:function(row,col){if(row<this.rowIndex||row>this.rowIndex+this.visibleRows){return }var viewIndex=row-this.rowIndex;var cell=this.getCell(viewIndex,col);if(cell){this.fly(cell).removeClass("x-grid3-cell-selected")}},onRowOver:function(e,t){var row;if((row=this.findRowIndex(t))!==false){var viewIndex=row-this.rowIndex;this.addRowClass(viewIndex,"x-grid3-row-over")}},onRowOut:function(e,t){var row;if((row=this.findRowIndex(t))!==false&&row!==this.findRowIndex(e.getRelatedTarget())){var viewIndex=row-this.rowIndex;this.removeRowClass(viewIndex,"x-grid3-row-over")}},onClear:function(){this.reset(false)},onRemove:function(ds,record,index,isUpdate){if(index==Number.MIN_VALUE||index==Number.MAX_VALUE){this.fireEvent("beforerowremoved",this,index,record);this.fireEvent("rowremoved",this,index,record);this.adjustBufferInset();return }var viewIndex=index+this.bufferRange[0];if(isUpdate!==true){this.fireEvent("beforerowremoved",this,viewIndex,record)}var domLength=this.getRows().length;if(viewIndex<this.rowIndex){this.rowIndex--;this.lastRowIndex=this.rowIndex;this.adjustScrollerPos(-this.rowHeight,true);this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows),this.ds.totalLength)}else{if(viewIndex>=this.rowIndex&&viewIndex<this.rowIndex+domLength){var lastPossibleRIndex=this.rowIndex-this.bufferRange[0]+this.visibleRows;var cInd=viewIndex-this.rowIndex;var rec=this.ds.getAt(lastPossibleRIndex);if(rec==null){if(this.ds.totalLength>this.rowIndex+this.visibleRows){if(isUpdate!==true){this.fireEvent("rowremoved",this,viewIndex,record)}this.updateLiveRows(this.rowIndex,true,true);return }else{if(this.rowIndex==0){this.removeRows(cInd,cInd)}else{this.rowIndex--;if(this.rowIndex<this.bufferRange[0]){if(isUpdate!==true){this.fireEvent("rowremoved",this,viewIndex,record)}this.updateLiveRows(this.rowIndex);return }else{this.replaceLiveRows(this.rowIndex)}}}}else{this.removeRows(cInd,cInd);var html=this.renderRows(lastPossibleRIndex,lastPossibleRIndex);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,html)}}}this.bufferRange[1]--;this.adjustBufferInset();if(isUpdate!==true){this.fireEvent("rowremoved",this,viewIndex,record)}this.processRows(0,undefined,true)},onAdd:function(ds,records,index){var recordLen=records.length;if(index==Number.MAX_VALUE||index==Number.MIN_VALUE){this.fireEvent("beforerowsinserted",this,index,index);if(index==Number.MIN_VALUE){this.rowIndex=this.rowIndex+recordLen;this.lastRowIndex=this.rowIndex;this.bufferRange[0]+=recordLen;this.bufferRange[1]+=recordLen;this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*recordLen,true);this.fireEvent("rowsinserted",this,index,index);this.processRows();this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows),this.ds.totalLength);return }this.adjustBufferInset();this.fireEvent("rowsinserted",this,index,index);return }var start=index+this.bufferRange[0];var end=start+(recordLen-1);var len=this.getRows().length;var firstRow=0;var lastRow=0;if(index>=(this.rowIndex-this.bufferRange[0])+len&&len==this.visibleRows){this.fireEvent("beforerowsinserted",this,start,end);this.fireEvent("rowsinserted",this,start,end);this.adjustVisibleRows();this.adjustBufferInset()}else{if(len==this.visibleRows&&index<=this.rowIndex-this.bufferRange[0]){this.fireEvent("beforerowsinserted",this,start,end);this.liveScroller.un("scroll",this.onLiveScroll,this);this.rowIndex+=recordLen;this.lastRowIndex=this.rowIndex;this.adjustVisibleRows();this.adjustBufferInset();this.adjustScrollerPos(this.rowHeight*recordLen,true);this.fireEvent("rowsinserted",this,start,end);this.processRows();this.fireEvent("cursormove",this,this.rowIndex,Math.min(this.ds.totalLength,this.visibleRows),this.ds.totalLength)}else{if((len<this.visibleRows)||index>this.rowIndex-this.bufferRange[0]){firstRow=index;lastRow=Math.min(end,this.rowIndex+this.visibleRows-1)-this.bufferRange[0];this.insertRows(ds,firstRow,lastRow);this.adjustVisibleRows();this.adjustBufferInset()}}}},onBeforeLoad:function(store,options){if(!options.params){options.params={start:0,limit:this.ds.bufferSize}}else{options.params.start=0;options.params.limit=this.ds.bufferSize}options.scope=this;options.callback=function(){this.reset(false)};return true},onLoad:function(o1,o2,options){this.adjustBufferInset()},onDataChange:function(store){this.updateHeaderSortState()},liveBufferUpdate:function(o1,options,o2){this.fireEvent("buffer",this,this.ds,this.rowIndex,Math.max(this.visibleRows,this.getRows().length),this.ds.getTotalCount());this.isBuffering=false;this.isPrebuffering=false;this.showLoadMask(false);this.bufferRange=[options.params.start,options.params.start+options.params.limit];var pendingSelections=this.grid.selModel.getPendingSelections(false);for(var i=0,max_i=pendingSelections.length;i<max_i;i++){this.grid.selModel.clearPendingSelection(pendingSelections[i])}if(this.isInRange(this.rowIndex)){this.replaceLiveRows(this.rowIndex)}else{this.updateLiveRows(this.rowIndex)}if(this.requestQueue>=0){var offset=this.requestQueue;this.requestQueue=-1;this.updateLiveRows(offset)}},handleWheel:function(e){if(this.rowHeight==-1){e.stopEvent();return }var d=e.getWheelDelta();this.adjustScrollerPos(-(d*this.rowHeight));e.stopEvent()},onLiveScroll:function(){var scrollTop=this.liveScroller.dom.scrollTop;var pixelsSkipped=scrollTop-this.lastScrollPos;var rowsSkipped=Math.floor(pixelsSkipped/this.rowHeight);if(pixelsSkipped==0){return }var cursor=Math.floor((scrollTop)/this.rowHeight);this.rowIndex=cursor;if(cursor==this.lastRowIndex){return }this.updateLiveRows(cursor,rowsSkipped);this.lastScrollPos=this.liveScroller.dom.scrollTop},refreshRow:function(record){var ds=this.ds,index;if(typeof record=="number"){index=record;record=ds.getAt(index)}else{index=ds.indexOf(record)}var viewIndex=index+this.bufferRange[0];if(viewIndex<this.rowIndex||viewIndex>=this.rowIndex+this.visibleRows){this.fireEvent("rowupdated",this,viewIndex,record);return }this.insertRows(ds,index,index,true);this.fireEvent("rowupdated",this,viewIndex,record)},processRows:function(startRow,skipStripe,paintSelections){skipStripe=skipStripe||!this.grid.stripeRows;startRow=0;var rows=this.getRows();var cls=" x-grid3-row-alt ";var cursor=this.rowIndex;var index=0;var selections=this.grid.selModel.selections;var ds=this.ds;for(var i=startRow,len=rows.length;i<len;i++){index=i+cursor;var row=rows[i];row.rowIndex=index;if(paintSelections==true){if(this.grid.selModel.bufferedSelections[index]===true){this.addRowClass(i,"x-grid3-row-selected");selections.add(ds.getAt(index-this.bufferRange[0]))}this.fly(row).removeClass("x-grid3-row-over")}if(!skipStripe){var isAlt=((i+1)%2==0);var hasAlt=(" "+row.className+" ").indexOf(cls)!=-1;if(isAlt==hasAlt){continue}if(isAlt){row.className+=" x-grid3-row-alt"}else{row.className=row.className.replace("x-grid3-row-alt","")}}}},insertRows:function(dm,firstRow,lastRow,isUpdate){var viewIndexFirst=firstRow+this.bufferRange[0];var viewIndexLast=lastRow+this.bufferRange[0];if(!isUpdate){this.fireEvent("beforerowsinserted",this,viewIndexFirst,viewIndexLast)}if(isUpdate!==true&&this.getRows().length==this.visibleRows){this.removeRows((this.visibleRows-1)-(lastRow-firstRow),this.visibleRows-1)}if(isUpdate){this.removeRows(viewIndexFirst-this.rowIndex,viewIndexLast-this.rowIndex)}var html=this.renderRows(firstRow,lastRow);var before=this.getRow(firstRow-(this.rowIndex-this.bufferRange[0]));if(before){Ext.DomHelper.insertHtml("beforeBegin",before,html)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,html)}if(isUpdate===true){var rows=this.getRows();var cursor=this.rowIndex;for(var i=0,max_i=rows.length;i<max_i;i++){rows[i].rowIndex=cursor+i}}if(!isUpdate){this.fireEvent("rowsinserted",this,viewIndexFirst,viewIndexLast);this.processRows(firstRow)}},focusCell:function(row,col,hscroll){var xy=this.ensureVisible(row,col,hscroll);if(!xy){return }this.focusEl.setXY(xy);if(Ext.isGecko){this.focusEl.focus()}else{this.focusEl.focus.defer(1,this.focusEl)}},ensureVisible:function(row,col,hscroll){if(typeof row!="number"){row=row.rowIndex}if(row<0||row>=this.ds.totalLength){return }col=(col!==undefined?col:0);var rowInd=row-this.rowIndex;if(row>=this.rowIndex+this.visibleRows){this.adjustScrollerPos(((row-(this.rowIndex+this.visibleRows))+1)*this.rowHeight)}else{if(row<this.rowIndex){this.adjustScrollerPos((rowInd)*this.rowHeight)}}var rowInd=rowInd<0?row:rowInd;var rowEl=this.getRow(rowInd),cellEl;if(!(hscroll===false&&col===0)){while(this.cm.isHidden(col)){col++}cellEl=this.getCell(row-this.rowIndex,col)}if(!rowEl){return }var c=this.scroller.dom;return cellEl?Ext.fly(cellEl).getXY():[c.scrollLeft,Ext.fly(rowEl).getY()]},isInRange:function(rowIndex){var lastRowIndex=Math.min(this.ds.totalLength-1,rowIndex+this.visibleRows);return(rowIndex>=this.bufferRange[0])&&(lastRowIndex<=this.bufferRange[1])},getPredictedBufferIndex:function(index,inRange,down){if(!inRange){return Math.max(0,index-(2*this.nearLimit))}if(!down){return Math.max(0,(index-this.ds.bufferSize)+this.visibleRows)}if(down){return Math.max(0,Math.min(index,this.ds.totalLength-this.ds.bufferSize))}},updateLiveRows:function(index,forceRepaint,forceReload){this.fireEvent("cursormove",this,index,Math.min(this.ds.totalLength,this.visibleRows),this.ds.totalLength);var inRange=this.isInRange(index);if(this.isBuffering&&this.isPrebuffering){if(inRange){this.replaceLiveRows(index)}else{this.showLoadMask(true)}}if(this.isBuffering){this.requestQueue=index;return }var lastIndex=this.lastIndex;this.lastIndex=index;var inRange=this.isInRange(index);var down=false;if(inRange&&forceReload!==true){this.replaceLiveRows(index,forceRepaint);if(index>lastIndex){down=true;var totalCount=this.ds.totalLength;if(index+this.visibleRows+this.nearLimit<this.bufferRange[1]){return }if(this.bufferRange[1]>=totalCount){return }}else{if(index<lastIndex){down=false;if(this.bufferRange[0]<=0){return }if(index-this.nearLimit>this.bufferRange[0]){return }}else{return }}this.isPrebuffering=true}this.isBuffering=true;var bufferOffset=this.getPredictedBufferIndex(index,inRange,down);var fetchSize=this.ds.bufferSize;if(!inRange){this.showLoadMask(true)}this.fireEvent("beforebuffer",this,this.ds,index,this.visibleRows,this.ds.totalLength);this.ds.suspendEvents();var sInfo=this.ds.sortInfo;var params={};Ext.apply(params,this.ds.lastOptions);params.start=bufferOffset;params.limit=this.ds.bufferSize;if(sInfo){params.dir=sInfo.direction;params.sort=sInfo.field}this.ds.load({callback:this.liveBufferUpdate,scope:this,params:params});this.ds.resumeEvents()},showLoadMask:function(show){if(this.loadMask==null){if(show){this.loadMask=new Ext.LoadMask(this.mainBody.dom.parentNode.parentNode,this.loadMaskConfig)}else{return }}if(show){this.loadMask.show()}else{this.loadMask.hide()}},replaceLiveRows:function(cursor,forceReplace){var spill=cursor-this.lastRowIndex;if(spill==0&&forceReplace!==true){return }var append=spill>0;spill=Math.abs(spill);var cursorBuffer=cursor-this.bufferRange[0];if(spill>=this.visibleRows||spill==0){this.mainBody.update(this.renderRows(cursorBuffer,cursorBuffer+this.visibleRows-1))}else{if(append){this.removeRows(0,spill-1);var html=this.renderRows(cursorBuffer+this.visibleRows-spill,cursorBuffer+this.visibleRows-1);Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,html)}else{this.removeRows(this.visibleRows-spill,this.visibleRows-1);var html=this.renderRows(cursorBuffer,cursorBuffer+spill-1);Ext.DomHelper.insertHtml("beforeBegin",this.mainBody.dom.firstChild,html)}}this.processRows(0,undefined,true);this.lastRowIndex=cursor},adjustBufferInset:function(){var g=this.grid,ds=g.store;var c=g.getGridEl();var scrollbar=this.cm.getTotalWidth()+this.scrollOffset>c.getSize().width;this.liveScroller.dom.style.height=this.liveScroller.dom.parentNode.offsetHeight+(Ext.isGecko?((ds.totalLength>0&&scrollbar)?-this.horizontalScrollOffset:0):(((ds.totalLength>0&&scrollbar)?0:this.horizontalScrollOffset)))+"px";if(this.rowHeight==-1){return }if(ds.totalLength<=this.visibleRows){this.liveScrollerInset.style.height="0px";return }var height=this.rowHeight*ds.totalLength;height+=(c.getSize().height-(this.visibleRows*this.rowHeight));if(scrollbar){height-=this.horizontalScrollOffset}this.liveScrollerInset.style.height=(height)+"px"},adjustVisibleRows:function(){if(this.rowHeight==-1){if(this.getRows()[0]){this.rowHeight=this.getRows()[0].offsetHeight}else{return }}var g=this.grid,ds=g.store;var c=g.getGridEl();var cm=this.cm;var size=c.getSize(true);var vh=size.height;var vw=size.width-this.scrollOffset;if(cm.getTotalWidth()>vw){vh-=this.horizontalScrollOffset}vh-=this.mainHd.getHeight();var visibleRows=Math.max(1,Math.floor(vh/this.rowHeight));if(this.visibleRows==visibleRows){return }this.visibleRows=visibleRows;var totalLength=ds.totalLength;if(this.rowIndex+visibleRows>totalLength){this.rowIndex=Math.max(0,ds.totalLength-this.visibleRows);this.lastRowIndex=this.rowIndex;this.updateLiveRows(this.rowIndex,true)}else{this.updateLiveRows(this.rowIndex,true)}},adjustScrollerPos:function(pixels,suspendEvent){var liveScroller=this.liveScroller;if(suspendEvent===true){liveScroller.un("scroll",this.onLiveScroll,this)}liveScroller.dom.scrollTop+=pixels;if(suspendEvent===true){liveScroller.dom.scrollTop=liveScroller.dom.scrollTop;liveScroller.on("scroll",this.onLiveScroll,this)}}});Ext.namespace("Ext.ux.data");Ext.ux.data.BufferedJsonReader=function(meta,recordType){Ext.ux.data.BufferedJsonReader.superclass.constructor.call(this,meta,recordType)};Ext.extend(Ext.ux.data.BufferedJsonReader,Ext.data.JsonReader,{readRecords:function(o){var s=this.meta;if(!this.ef&&s.versionProperty){this.getVersion=this.getJsonAccessor(s.versionProperty)}if(!this.__readRecords){this.__readRecords=Ext.ux.data.BufferedJsonReader.superclass.readRecords}var intercept=this.__readRecords.call(this,o);if(s.versionProperty){var v=this.getVersion(o);intercept.version=(v===undefined||v==="")?null:v}return intercept}});Ext.namespace("Ext.ux.grid");Ext.ux.grid.BufferedRowSelectionModel=function(config){this.addEvents({selectiondirty:true});Ext.apply(this,config);this.bufferedSelections={};this.pendingSelections={};Ext.ux.grid.BufferedRowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.ux.grid.BufferedRowSelectionModel,Ext.grid.RowSelectionModel,{initEvents:function(){Ext.ux.grid.BufferedRowSelectionModel.superclass.initEvents.call(this);this.grid.store.on("add",this.onAdd,this);this.grid.store.on("selectionsload",this.onSelectionsLoad,this)},onRefresh:function(){this.clearSelections(true)},onRemove:function(v,index,r){if((index==Number.MIN_VALUE||index==Number.MAX_VALUE)){this.selections.remove(r);this.fireEvent("selectiondirty",this,index,r);return }var viewIndex=index;var fire=this.bufferedSelections[viewIndex]===true;var ranges=this.getPendingSelections();var rangesLength=ranges.length;delete this.bufferedSelections[viewIndex];delete this.pendingSelections[viewIndex];if(r){this.selections.remove(r)}if(rangesLength==0){this.shiftSelections(viewIndex,-1);return }var s=ranges[0];var e=ranges[rangesLength-1];if(viewIndex<=e||viewIndex<=s){if(this.fireEvent("selectiondirty",this,viewIndex,-1)!==false){this.shiftSelections(viewIndex,-1)}}if(fire){this.fireEvent("selectionchange",this)}},onAdd:function(store,records,index){var ranges=this.getPendingSelections();var rangesLength=ranges.length;if((index==Number.MIN_VALUE||index==Number.MAX_VALUE)){if(rangesLength==0&&index==Number.MIN_VALUE){this.shiftSelections(this.grid.view.bufferRange[0],records.length)}this.fireEvent("selectiondirty",this,index,records.length);return }if(rangesLength==0){this.shiftSelections(this.grid.view.bufferRange[0]+index,records.length);return }var s=ranges[0];var e=ranges[rangesLength-1];var viewIndex=this.grid.view.bufferRange[0]+index;if(viewIndex<=e||viewIndex<=s){if(this.fireEvent("selectiondirty",this,viewIndex,records.length)!==false){this.shiftSelections(viewIndex,records.length)}}},shiftSelections:function(startRow,length){var index=0;var newSelections={};var newIndex=0;var newRequests={};var totalLength=this.grid.store.totalLength;for(var i in this.bufferedSelections){index=parseInt(i);newIndex=index+length;if(newIndex>=totalLength){break}if(index>=startRow){newSelections[newIndex]=true;if(this.pendingSelections[i]){newRequests[newIndex]=true}}else{newSelections[i]=true;if(this.pendingSelections[i]){newRequests[i]=true}}}this.bufferedSelections=newSelections;this.pendingSelections=newRequests},onSelectionsLoad:function(store,records,ranges){this.pendingSelections={};this.selections.addAll(records)},hasNext:function(){return this.last!==false&&(this.last+1)<this.grid.store.getTotalCount()},getCount:function(){var sels=this.bufferedSelections;var c=0;for(var i in sels){c++}return c},isSelected:function(index){if(typeof index=="number"){return this.bufferedSelections[index]===true}var r=index;return(r&&this.selections.key(r.id)?true:false)},deselectRow:function(index,preventViewNotify){if(this.locked){return }if(this.last==index){this.last=false}if(this.lastActive==index){this.lastActive=false}var r=this.grid.store.getAt(index-this.grid.getView().bufferRange[0]);delete this.pendingSelections[index];delete this.bufferedSelections[index];if(r){this.selections.remove(r)}if(!preventViewNotify){this.grid.getView().onRowDeselect(index)}this.fireEvent("rowdeselect",this,index,r);this.fireEvent("selectionchange",this)},selectRow:function(index,keepExisting,preventViewNotify){if(this.locked||index<0){return }var r=this.grid.store.getAt(index-this.grid.getView().bufferRange[0]);if(this.fireEvent("beforerowselect",this,index,keepExisting,r)!==false){if(!keepExisting||this.singleSelect){this.clearSelections()}if(r){this.selections.add(r);delete this.pendingSelections[index]}else{this.pendingSelections[index]=true}this.bufferedSelections[index]=true;this.last=this.lastActive=index;if(!preventViewNotify){this.grid.getView().onRowSelect(index)}this.fireEvent("rowselect",this,index,r);this.fireEvent("selectionchange",this)}},clearPendingSelection:function(index){var r=this.grid.store.getAt(index-this.grid.getView().bufferRange[0]);if(!r){return }this.selections.add(r);delete this.pendingSelections[index]},getPendingSelections:function(asRange){var index=1;var ranges=[];var currentRange=0;var tmpArray=[];for(var i in this.pendingSelections){tmpArray.push(parseInt(i))}tmpArray.sort(function(o1,o2){if(o1>o2){return 1}else{if(o1<o2){return -1}else{return 0}}});if(asRange===false){return tmpArray}var max_i=tmpArray.length;if(max_i==0){return[]}ranges[currentRange]=[tmpArray[0],tmpArray[0]];for(var i=0,max_i=max_i-1;i<max_i;i++){if(tmpArray[i+1]-tmpArray[i]==1){ranges[currentRange][1]=tmpArray[i+1]}else{currentRange++;ranges[currentRange]=[tmpArray[i+1],tmpArray[i+1]]}}return ranges},clearSelections:function(fast){if(this.locked){return }if(fast!==true){var s=this.selections;s.clear();for(var i in this.bufferedSelections){this.deselectRow(i)}}else{this.selections.clear();this.bufferedSelections={};this.pendingSelections={}}this.last=false},selectRange:function(startRow,endRow,keepExisting){if(this.locked){return }if(!keepExisting){this.clearSelections()}if(startRow<=endRow){for(var i=startRow;i<=endRow;i++){this.selectRow(i,true)}}else{for(var i=startRow;i>=endRow;i--){this.selectRow(i,true)}}}});Ext.namespace("Ext.ux.grid");Ext.ux.grid.BufferedStore=function(config){config=config||{};config.remoteSort=true;Ext.apply(this,config);this.addEvents({versionchange:true,beforeselectionsload:true,selectionsload:true});Ext.ux.grid.BufferedStore.superclass.constructor.call(this,config);if(this.url&&!this.selectionsProxy){this.selectionsProxy=new Ext.data.HttpProxy({url:this.url})}};Ext.extend(Ext.ux.grid.BufferedStore,Ext.data.Store,{version:null,insert:function(index,records){records=[].concat(records);var cRecords=[];var cCount=this.bufferSize-1;var pIndex=(index==Number.MIN_VALUE||index==Number.MAX_VALUE)?0:index;this.totalLength+=records.length;if(index==Number.MIN_VALUE||index==Number.MAX_VALUE||index==this.bufferSize||(index==0&&this.getCount()==this.bufferSize)){var tIndex=(index==this.bufferSize)?Number.MAX_VALUE:((index==Number.MIN_VALUE||index==0)?Number.MIN_VALUE:Number.MAX_VALUE);this.fireEvent("add",this,records,tIndex);return }for(var i=0,max_i=records.length;i<max_i;i++){if(i+pIndex>cCount){break}cRecords.push(records[i])}for(var i=0,len=cRecords.length;i<len;i++){this.data.insert(index+i,cRecords[i]);cRecords[i].join(this)}while(this.getCount()>this.bufferSize){this.data.remove(this.data.last())}this.fireEvent("add",this,cRecords,index)},remove:function(record){var index=this.data.indexOf(record);if(index<0){var ind=this.findInsertIndex(record);this.totalLength-=1;if(this.pruneModifiedRecords){this.modified.remove(record)}this.fireEvent("remove",this,record,ind);return false}this.data.removeAt(index);if(this.pruneModifiedRecords){this.modified.remove(record)}this.totalLength-=1;this.fireEvent("remove",this,record,index);return true},removeAll:function(){this.totalLength=0;this.data.clear();if(this.pruneModifiedRecords){this.modified=[]}this.fireEvent("clear",this)},loadRanges:function(ranges){var max_i=ranges.length;if(max_i>0&&!this.selectionsProxy.activeRequest&&this.fireEvent("beforeselectionsload",this,ranges)!==false){var lParams=this.lastOptions.params;var params={};params.ranges=Ext.encode(ranges);if(lParams){if(lParams.sort){params.sort=lParams.sort}if(lParams.dir){params.dir=lParams.dir}}var options={};for(var i in this.lastOptions){options.i=this.lastOptions.i}options.ranges=params.ranges;this.selectionsProxy.load(params,this.reader,this.selectionsLoaded,this,options)}},loadSelections:function(ranges){this.loadRanges(ranges)},selectionsLoaded:function(o,options,success){if(this.checkVersionChange(o,options,success)!==false){this.fireEvent("selectionsload",this,o.records,Ext.decode(options.ranges))}else{this.fireEvent("selectionsload",this,[],Ext.decode(options.ranges))}},checkVersionChange:function(o,options,success){if(o&&success!==false){if(o.version!==undefined){var old=this.version;this.version=o.version;if(this.version!==old){return this.fireEvent("versionchange",this,old,this.version)}}}},findInsertIndex:function(record){this.suspendEvents();var data=this.data.clone();if(data.getCount()>=this.bufferSize){var first=this.data.first();var last=this.data.last();this.data.clear();this.data.add(record);this.data.add(first);this.data.add(last);this.applySort(true);var index=this.data.indexOf(record);if(index==0||index==2){this.data=data;this.resumeEvents();return index==0?Number.MIN_VALUE:Number.MAX_VALUE}}this.data=data.clone();this.data.add(record);this.applySort(true);var index=this.data.indexOf(record);this.data=data;this.resumeEvents();return index},sortData:function(f,direction){direction=direction||"ASC";var st=this.fields.get(f).sortType;var fn=function(r1,r2){var v1=st(r1.data[f]),v2=st(r2.data[f]);return v1>v2?1:(v1<v2?-1:0)};this.data.sort(direction,fn)},applySort:function(bufferedSort){if(bufferedSort===true&&this.sortInfo){var s=this.sortInfo,f=s.field;this.sortData(f,s.direction)}},onMetaChange:function(meta,rtype,o){this.version=null;Ext.ux.grid.BufferedStore.superclass.onMetaChange.call(this,meta,rtype,o)},loadRecords:function(o,options,success){this.checkVersionChange(o,options,success);Ext.ux.grid.BufferedStore.superclass.loadRecords.call(this,o,options,success)},clearFilter:function(){},isFiltered:function(){},collect:function(){},createFilterFn:function(){},sum:function(){},filter:function(){},filterBy:function(){},query:function(){},queryBy:function(){},find:function(){},findBy:function(){}});Ext.ux.ManagedIFrame=function(){var args=Array.prototype.slice.call(arguments,0),el=Ext.get(args[0]),config=args[0];if(el&&el.dom&&el.dom.tagName=="IFRAME"){config=args[1]||{}}else{config=args[0]||args[1]||{};el=config.autoCreate?Ext.get(Ext.DomHelper.append(document.body,Ext.apply({tag:"iframe",src:(Ext.isIE&&Ext.isSecure)?Ext.SSL_SECURE_URL:""},config.autoCreate))):null}if(!el||el.dom.tagName!="IFRAME"){return el}!!el.dom.name.length||(el.dom.name=el.dom.id);this.addEvents({domready:true,documentloaded:true});if(config.listeners){this.listeners=config.listeners;Ext.ux.ManagedIFrame.superclass.constructor.call(this)}Ext.apply(el,this);el.addClass("x-managed-iframe");el.loadMask=Ext.apply({msg:"Loading..",msgCls:"x-mask-loading",maskEl:null,enabled:!!config.loadMask},config.loadMask);var h=Ext.isIE?"onreadystatechange":"onload";el.dom[h]=el.dom[h]?el.dom[h].createSequence(el.loadHandler,el):el.loadHandler.createDelegate(el);if(config.src){el.setSrc(config.src)}else{el.src=el.dom.src||null;var content=config.html||config.content||false;if(content){el.update(content)}}return el};Ext.extend(Ext.ux.ManagedIFrame,Ext.util.Observable,{setSrc:function(url,discardUrl){var src=url||this.src||(Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"");this.showMask();this._windowContext=null;(function(){var s=typeof src=="function"?src()||"":src;if(Ext.isOpera){this.dom.src=""}this.dom.src=s}).defer(100,this);if(discardUrl!==true){this.src=src}},scriptRE:/(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/gi,update:function(content,loadScripts,callback){loadScripts=loadScripts||this.getUpdateManager().loadScripts||false;this._windowContext=false;content=Ext.DomHelper.markup(content||"");var doc=this.getDocument();if(doc){this._inUpdate=true;this.showMask();doc.open();doc.write(loadScripts===true?content:content.replace(this.scriptRE,""));doc.write('<script type="text/javascript">(function(){var MSIE/*@cc_on =1@*/;parent.Ext.get(\''+this.dom.id+"')._windowContext=MSIE?this:{eval:function(s){return eval(s);}}})();<\/script>");doc.close();if(!!content.length){this.checkDOM(false,callback)}else{if(callback){callback()}}}return this},_windowContext:null,getDocument:function(){return this.getWindow().document},getWindow:function(){var dom=this.dom;return dom?dom.contentWindow||window.frames[dom.name]:window},print:function(){try{var win=this.getWindow();if(Ext.isIE){win.focus()}win.print()}catch(ex){throw"print exception: "+(ex.description||ex)}},destroy:function(){this.removeAllListeners();if(this.dom){this.dom.onreadystatechange=null;this.dom.onload=null;if(this.dom.src){this.dom.src="javascript:false"}Ext.removeNode(this.dom)}this._windowContext=null;Ext.apply(this.loadMask,{masker:null,maskEl:null})},execScript:function(block){if(this._windowContext){return this._windowContext.eval(block)}else{throw"execScript:no script context"}},loadMask:{msg:"Loading..",msgCls:"x-mask-loading",maskEl:null,enabled:false},showMask:function(msg,msgCls,forced){if(this.loadMask&&(this.loadMask.enabled||forced)){var lmask=this.loadMask;lmask.masker||(lmask.masker=Ext.get(lmask.maskEl||this.dom.parentNode||this.wrap({tag:"div",style:{position:"relative"}})));lmask.masker.mask.defer(lmask.defer||150,lmask.masker,[msg||lmask.msg,msgCls||lmask.msgCls])}},hideMask:function(forced){var tlm=this.loadMask;if(tlm&&tlm.masker&&(tlm.enabled||forced)&&(forced||!!this.dom.src.length||this._inUpdate)){tlm.masker.unmask.defer(tlm.defer||150,tlm.masker)}},loadHandler:function(e){var rstatus=this.dom.readyState||e.type;switch(rstatus){case"loading":this.showMask();break;case"load":case"complete":this.fireEvent("documentloaded",this);this.hideMask();this._inUpdate=false;break;default:}},checkDOM:function(win,callback){var n=0,win=win||this.getWindow(),manager=this;var t=function(){var domReady=false;domReady=(win.document&&typeof win.document.getElementsByTagName!="undefined"&&(win.document.getElementsByTagName("body")[0]!=null||win.document.body!=null));if(n++<70&&!domReady){t.defer(50);return }if(callback){callback()}manager.fireEvent("domready",manager)};t()}});Ext.ux.ManagedIframePanel=Ext.extend(Ext.Panel,{defaultSrc:null,bodyStyle:{width:"100%",height:"100%"},iframeStyle:{overflow:"auto"},loadMask:false,animCollapse:false,autoScroll:false,closable:true,ctype:"Ext.ux.ManagedIframePanel",unsupportedText:{tag:"span",cls:"x-error-noframes",html:"Inline frames are NOT enabled/supported by your browser."},initComponent:function(){var unsup=false;if(this.unsupportedText){unsup=typeof this.unsupportedText=="object"?{children:[this.unsupportedText]}:{html:this.unsupportedText}}this.bodyCfg||(this.bodyCfg={tag:"div",cls:"x-panel-body",children:[Ext.apply({tag:"iframe",frameBorder:0,cls:"x-managed-iframe",style:{width:"100%",height:"100%"}},unsup)]});Ext.ux.ManagedIframePanel.superclass.initComponent.call(this);this.addEvents({documentloaded:true,domready:true});if(this.defaultSrc){this.on("render",this.setSrc.createDelegate(this,[this.defaultSrc],0),this,{single:true})}},beforeDestroy:function(){if(this.rendered){if(this.tools){for(var k in this.tools){Ext.destroy(this.tools[k])}}if(this.header&&this.headerAsText){var s;if(s=this.header.child("span")){s.remove()}this.header.update("")}Ext.each(["iframe","header","topToolbar","bottomToolbar","footer","loadMask","body","bwrap"],function(elName){if(this[elName]){if(typeof this[elName].destroy=="function"){this[elName].destroy()}else{Ext.destroy(this[elName])}this[elName]=null;delete this[elName]}},this)}Ext.ux.ManagedIframePanel.superclass.beforeDestroy.call(this)},onDestroy:function(){Ext.Panel.superclass.onDestroy.call(this)},onRender:function(ct,position){Ext.ux.ManagedIframePanel.superclass.onRender.call(this,ct,position);if(this.iframe=this.body.child("iframe.x-managed-iframe")){Ext.each([this[this.collapseEl],this.el],function(el){el.setVisibilityMode(Ext.Element[this.hideMode.toUpperCase()]||1).originalDisplay=(this.hideMode!="display"?"visible":"block")},this);if(this.loadMask){this.loadMask=Ext.apply({enabled:true,maskEl:this.body},this.loadMask)}this.iframe=new Ext.ux.ManagedIFrame(this.iframe,{loadMask:this.loadMask});this.loadMask=this.iframe.loadMask;this.iframe.ownerCt=this;this.relayEvents(this.iframe,["documentloaded","domready"]);if(this.iframeStyle){this.iframe.applyStyles(this.iframeStyle)}this.getUpdater().showLoadIndicator=!this.loadMask.enabled}},afterRender:function(container){var html=this.html;delete this.html;Ext.ux.ManagedIframePanel.superclass.afterRender.call(this);if(html&&this.iframe){this.iframe.update(typeof html=="object"?Ext.DomHelper.markup(html):html)}},setSrc:function(url,discardUrl){var src=url||this.defaultSrc||(Ext.isIE&&Ext.isSecure?Ext.SSL_SECURE_URL:"");if(this.rendered&&this.iframe){this.iframe.setSrc(src,discardUrl)}if(discardUrl!==true){this.defaultSrc=src}this.saveState();return this},getState:function(){return Ext.apply(Ext.ux.ManagedIframePanel.superclass.getState.call(this)||{},{defaultSrc:(typeof this.defaultSrc=="function")?this.defaultSrc():this.defaultSrc})},getUpdater:function(){return this.rendered?(this.iframe||this.body).getUpdater():false},load:function(loadCfg){var um;if(um=this.getUpdater()){if(loadCfg&&loadCfg.renderer){um.setRenderer(loadCfg.renderer);delete loadCfg.renderer}um.update.apply(um,arguments)}return this},doAutoLoad:function(){this.load(typeof this.autoLoad=="object"?this.autoLoad:{url:this.autoLoad})},onShow:function(){this.body.setVisible(true);Ext.ux.ManagedIframePanel.superclass.onShow.call(this)},onHide:function(){this.body.setVisible(false);Ext.ux.ManagedIframePanel.superclass.onHide.call(this)}});Ext.reg("iframepanel",Ext.ux.ManagedIframePanel);Ext.ux.ManagedIframePortlet=Ext.extend(Ext.ux.ManagedIframePanel,{anchor:"100%",frame:true,collapseEl:"bwrap",collapsible:true,draggable:true,cls:"x-portlet"});Ext.reg("iframeportlet",Ext.ux.ManagedIframePortlet);Ext.ux.Multiselect=Ext.extend(Ext.form.Field,{store:null,dataFields:[],data:[],width:100,height:100,displayField:0,valueField:1,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,blankText:Ext.form.TextField.prototype.blankText,minLengthText:"Minimum {0} item(s) required",maxLengthText:"Maximum {0} item(s) allowed",copy:false,allowDup:false,allowTrash:false,legend:null,focusClass:undefined,delimiter:",",view:null,dragGroup:null,dropGroup:null,tbar:null,appendOnly:false,sortField:null,sortDir:"ASC",textDelimiter:"|",defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.Multiselect.superclass.initComponent.call(this);this.addEvents({dblclick:true,click:true,change:true,drop:true})},onRender:function(ct,position){var fs,cls,tpl;Ext.ux.Multiselect.superclass.onRender.call(this,ct,position);cls="ux-mselect";fs=new Ext.form.FieldSet({renderTo:this.el,title:this.legend,height:this.height,width:this.width,style:"padding:1px;",tbar:this.tbar});if(!this.legend){var e=fs.el.down("."+fs.headerCls);if(e){e.remove()}}fs.body.addClass(cls);tpl='<tpl for="."><div class="'+cls+"-item";if(Ext.isIE||Ext.isIE7){tpl+='" unselectable=on'}else{tpl+=' x-unselectable"'}tpl+=">{"+this.displayField+"}</div></tpl>";if(!this.store){this.store=new Ext.data.SimpleStore({fields:this.dataFields,data:this.data})}this.view=new Ext.ux.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()},initValue:Ext.emptyFn,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()},onViewBeforeClick:function(vw,index,node,e){this.preClickSelections=this.view.getSelectedIndexes();if(this.disabled){return false}},onViewDblClick:function(vw,index,node,e){return this.fireEvent("dblclick",vw,index,node,e)},getValue:function(valueField){if(this.view){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)}else{return""}},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()},reset:function(){this.setValue("")},getRawValue:function(valueField){var tmp=this.getValue(valueField);if(tmp.length){tmp=tmp.split(this.delimiter)}else{tmp=[]}return tmp},setRawValue:function(values){setValue(values)},selectAll:function(){var selections=[];for(var i=0;i<this.view.store.getTotalCount();i++){selections.push(i)}this.view.select(selections);this.hiddenField.dom.value=this.getValue();this.validate()},getSelectedTexts:function(){var selectedItems=this.view.getSelectedNodes();var selectedTexts=[];for(var i=0;i<selectedItems.length;i++){selectedTexts.push(selectedItems[i].innerHTML)}return selectedTexts.join(this.textDelimiter)},validateValue:function(value){if(value.length<1){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},onDestroy:function(){if(this.view){this.view.destroy()}Ext.ux.Multiselect.superclass.onDestroy.call(this)}});Ext.reg("multiselect",Ext.ux.Multiselect);Ext.ux.ItemSelector=Ext.extend(Ext.form.Field,{msWidth:200,msHeight:300,hideNavIcons:false,imagePath:"",iconUp:"up2.gif",iconDown:"down2.gif",iconLeft:"left2.gif",iconRight:"right2.gif",iconTop:"top2.gif",iconBottom:"bottom2.gif",drawUpIcon:true,drawDownIcon:true,drawLeftIcon:true,drawRightIcon:true,drawTopIcon:true,drawBotIcon:true,fromStore:null,toStore:null,fromData:null,toData:null,displayField:0,valueField:1,switchToFrom:false,allowDup:false,focusClass:undefined,delimiter:",",readOnly:false,toLegend:null,fromLegend:null,toSortField:null,fromSortField:null,toSortDir:"ASC",fromSortDir:"ASC",toTBar:null,fromTBar:null,bodyStyle:null,border:false,defaultAutoCreate:{tag:"div"},initComponent:function(){Ext.ux.ItemSelector.superclass.initComponent.call(this);this.addEvents({rowdblclick:true,change:true})},onRender:function(ct,position){Ext.ux.ItemSelector.superclass.onRender.call(this,ct,position);this.fromMultiselect=new Ext.ux.Multiselect({legend:this.fromLegend,delimiter:this.delimiter,allowDup:this.allowDup,copy:this.allowDup,allowTrash:this.allowDup,dragGroup:this.readOnly?null:"drop2-"+this.el.dom.id,dropGroup:this.readOnly?null:"drop2-"+this.el.dom.id+",drop1-"+this.el.dom.id,width:this.msWidth,height:this.msHeight,dataFields:this.dataFields,data:this.fromData,displayField:this.displayField,valueField:this.valueField,store:this.fromStore,isFormField:false,tbar:this.fromTBar,appendOnly:true,sortField:this.fromSortField,sortDir:this.fromSortDir});this.fromMultiselect.on("dblclick",this.onRowDblClick,this);if(!this.toStore){this.toStore=new Ext.data.SimpleStore({fields:this.dataFields,data:this.toData})}this.toStore.on("add",this.valueChanged,this);this.toStore.on("remove",this.valueChanged,this);this.toStore.on("load",this.valueChanged,this);this.toMultiselect=new Ext.ux.Multiselect({legend:this.toLegend,delimiter:this.delimiter,allowDup:this.allowDup,dragGroup:this.readOnly?null:"drop1-"+this.el.dom.id,dropGroup:this.readOnly?null:"drop2-"+this.el.dom.id+",drop1-"+this.el.dom.id,width:this.msWidth,height:this.msHeight,displayField:this.displayField,valueField:this.valueField,store:this.toStore,isFormField:false,tbar:this.toTBar,sortField:this.toSortField,sortDir:this.toSortDir});this.toMultiselect.on("dblclick",this.onRowDblClick,this);var p=new Ext.Panel({bodyStyle:this.bodyStyle,border:this.border,layout:"table",layoutConfig:{columns:3}});p.add(this.switchToFrom?this.toMultiselect:this.fromMultiselect);var icons=new Ext.Panel({header:false});p.add(icons);p.add(this.switchToFrom?this.fromMultiselect:this.toMultiselect);p.render(this.el);icons.el.down("."+icons.bwrapCls).remove();if(this.imagePath!=""&&this.imagePath.charAt(this.imagePath.length-1)!="/"){this.imagePath+="/"}this.iconUp=this.imagePath+(this.iconUp||"up2.gif");this.iconDown=this.imagePath+(this.iconDown||"down2.gif");this.iconLeft=this.imagePath+(this.iconLeft||"left2.gif");this.iconRight=this.imagePath+(this.iconRight||"right2.gif");this.iconTop=this.imagePath+(this.iconTop||"top2.gif");this.iconBottom=this.imagePath+(this.iconBottom||"bottom2.gif");var el=icons.getEl();if(!this.toSortField){this.toTopIcon=el.createChild({tag:"img",src:this.iconTop,style:{cursor:"pointer",margin:"2px"}});el.createChild({tag:"br"});this.upIcon=el.createChild({tag:"img",src:this.iconUp,style:{cursor:"pointer",margin:"2px"}});el.createChild({tag:"br"})}this.addIcon=el.createChild({tag:"img",src:this.switchToFrom?this.iconLeft:this.iconRight,style:{cursor:"pointer",margin:"2px"}});el.createChild({tag:"br"});this.removeIcon=el.createChild({tag:"img",src:this.switchToFrom?this.iconRight:this.iconLeft,style:{cursor:"pointer",margin:"2px"}});el.createChild({tag:"br"});if(!this.toSortField){this.downIcon=el.createChild({tag:"img",src:this.iconDown,style:{cursor:"pointer",margin:"2px"}});el.createChild({tag:"br"});this.toBottomIcon=el.createChild({tag:"img",src:this.iconBottom,style:{cursor:"pointer",margin:"2px"}})}if(!this.readOnly){if(!this.toSortField){this.toTopIcon.on("click",this.toTop,this);this.upIcon.on("click",this.up,this);this.downIcon.on("click",this.down,this);this.toBottomIcon.on("click",this.toBottom,this)}this.addIcon.on("click",this.fromTo,this);this.removeIcon.on("click",this.toFrom,this)}if(!this.drawUpIcon||this.hideNavIcons){this.upIcon.dom.style.display="none"}if(!this.drawDownIcon||this.hideNavIcons){this.downIcon.dom.style.display="none"}if(!this.drawLeftIcon||this.hideNavIcons){this.addIcon.dom.style.display="none"}if(!this.drawRightIcon||this.hideNavIcons){this.removeIcon.dom.style.display="none"}if(!this.drawTopIcon||this.hideNavIcons){this.toTopIcon.dom.style.display="none"}if(!this.drawBotIcon||this.hideNavIcons){this.toBottomIcon.dom.style.display="none"}var tb=p.body.first();this.el.setWidth(p.body.first().getWidth());p.body.removeClass();this.hiddenName=this.name;var hiddenTag={tag:"input",type:"hidden",value:"",name:this.name};this.hiddenField=this.el.createChild(hiddenTag);this.valueChanged(this.toStore)},initValue:Ext.emptyFn,toTop:function(){var selectionsArray=this.toMultiselect.view.getSelectedIndexes();var records=[];if(selectionsArray.length>0){selectionsArray.sort();for(var i=0;i<selectionsArray.length;i++){record=this.toMultiselect.view.store.getAt(selectionsArray[i]);records.push(record)}selectionsArray=[];for(var i=records.length-1;i>-1;i--){record=records[i];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.insert(0,record);selectionsArray.push(((records.length-1)-i))}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(selectionsArray)},toBottom:function(){var selectionsArray=this.toMultiselect.view.getSelectedIndexes();var records=[];if(selectionsArray.length>0){selectionsArray.sort();for(var i=0;i<selectionsArray.length;i++){record=this.toMultiselect.view.store.getAt(selectionsArray[i]);records.push(record)}selectionsArray=[];for(var i=0;i<records.length;i++){record=records[i];this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);selectionsArray.push((this.toMultiselect.view.store.getCount())-(records.length-i))}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(selectionsArray)},up:function(){var record=null;var selectionsArray=this.toMultiselect.view.getSelectedIndexes();selectionsArray.sort();var newSelectionsArray=[];if(selectionsArray.length>0){for(var i=0;i<selectionsArray.length;i++){record=this.toMultiselect.view.store.getAt(selectionsArray[i]);if((selectionsArray[i]-1)>=0){this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.insert(selectionsArray[i]-1,record);newSelectionsArray.push(selectionsArray[i]-1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(newSelectionsArray)}},down:function(){var record=null;var selectionsArray=this.toMultiselect.view.getSelectedIndexes();selectionsArray.sort();selectionsArray.reverse();var newSelectionsArray=[];if(selectionsArray.length>0){for(var i=0;i<selectionsArray.length;i++){record=this.toMultiselect.view.store.getAt(selectionsArray[i]);if((selectionsArray[i]+1)<this.toMultiselect.view.store.getCount()){this.toMultiselect.view.store.remove(record);this.toMultiselect.view.store.insert(selectionsArray[i]+1,record);newSelectionsArray.push(selectionsArray[i]+1)}}this.toMultiselect.view.refresh();this.toMultiselect.view.select(newSelectionsArray)}},fromTo:function(){var selectionsArray=this.fromMultiselect.view.getSelectedIndexes();var records=[];if(selectionsArray.length>0){for(var i=0;i<selectionsArray.length;i++){record=this.fromMultiselect.view.store.getAt(selectionsArray[i]);records.push(record)}if(!this.allowDup){selectionsArray=[]}for(var i=0;i<records.length;i++){record=records[i];if(this.allowDup){var x=new Ext.data.Record();record.id=x.id;delete x;this.toMultiselect.view.store.add(record)}else{this.fromMultiselect.view.store.remove(record);this.toMultiselect.view.store.add(record);selectionsArray.push((this.toMultiselect.view.store.getCount()-1))}}}this.toMultiselect.view.refresh();this.fromMultiselect.view.refresh();if(this.toSortField){this.toMultiselect.store.sort(this.toSortField,this.toSortDir)}if(this.allowDup){this.fromMultiselect.view.select(selectionsArray)}else{this.toMultiselect.view.select(selectionsArray)}},toFrom:function(){var selectionsArray=this.toMultiselect.view.getSelectedIndexes();var records=[];if(selectionsArray.length>0){for(var i=0;i<selectionsArray.length;i++){record=this.toMultiselect.view.store.getAt(selectionsArray[i]);records.push(record)}selectionsArray=[];for(var i=0;i<records.length;i++){record=records[i];this.toMultiselect.view.store.remove(record);if(!this.allowDup){this.fromMultiselect.view.store.add(record);selectionsArray.push((this.fromMultiselect.view.store.getCount()-1))}}}this.fromMultiselect.view.refresh();this.toMultiselect.view.refresh();if(this.fromSortField){this.fromMultiselect.store.sort(this.fromSortField,this.fromSortDir)}this.fromMultiselect.view.select(selectionsArray)},valueChanged:function(store){var record=null;var values=[];for(var i=0;i<store.getCount();i++){record=store.getAt(i);values.push(record.get(this.valueField));if(!this.allowDup){var index=this.fromMultiselect.view.store.find(this.valueField,record.get(this.valueField));var rdup=this.fromMultiselect.view.store.getAt(index);if(rdup){this.fromMultiselect.view.store.remove(rdup)}}}this.fromMultiselect.view.refresh();this.fromMultiselect.store.sort(this.displayField,"ASC");this.hiddenField.dom.value=values.join(this.delimiter);this.fireEvent("change",this,this.getValue(),this.hiddenField.dom.value)},getValue:function(){return this.hiddenField.dom.value},onRowDblClick:function(vw,index,node,e){return this.fireEvent("rowdblclick",vw,index,node,e)},reset:function(){range=this.toMultiselect.store.getRange();this.toMultiselect.store.removeAll();if(!this.allowDup){this.fromMultiselect.store.add(range);this.fromMultiselect.store.sort(this.displayField,"ASC")}this.valueChanged(this.toMultiselect.store)},selectAll:function(){var selections=[];for(var i=0;i<this.fromMultiselect.store.getCount();i++){selections.push(i)}this.fromMultiselect.view.select(selections);this.fromTo();this.toMultiselect.view.clearSelections(true)},setValue:function(val){if(!val){return }val=val instanceof Array?val:val.split(",");var rec,i,id;for(i=0;i<val.length;i++){id=val[i];if(this.toStore.find(valueField,id)){continue}index=this.fromStore.find(valueField,id);if(index){rec=this.fromStore.getAt(index);this.toStore.add(rec);this.fromStore.remove(rec)}}},onDestroy:function(){if(this.fromMultiselect){this.fromMultiselect.destroy()}if(this.toMultiselect){this.toMultiselect.destroy()}Ext.ux.ItemSelector.superclass.onDestroy.call(this)}});Ext.reg("itemselector",Ext.ux.ItemSelector);Array.prototype.contains=function(element){return this.indexOf(element)!==-1};Ext.namespace("Ext.ux");Ext.ux.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"}Ext.ux.DDView.superclass.constructor.call(this,Ext.apply(config,{border:false}))};Ext.extend(Ext.ux.DDView,Ext.DataView,{sortDir:"ASC",isFormField:true,classRe:/class=(['"])(.*)\1/,tagRe:/(<\w*)(.*?>)/,reset:Ext.emptyFn,clearInvalid:Ext.form.Field.prototype.clearInvalid,msgTarget:"qtip",afterRender:function(){Ext.ux.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")},validate:function(){return true},destroy:function(){this.purgeListeners();this.getEl().removeAllListeners();this.getEl().remove();if(this.dragZone){Ext.dd.ScrollManager.unregister(this.dragZone.el);if(this.dragZone.destroy){this.dragZone.destroy()}}if(this.dropZone){Ext.dd.ScrollManager.unregister(this.dropZone.el);if(this.dropZone.destroy){this.dropZone.destroy()}}},getName:function(){return this.name},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()},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},isDirty:function(){return this.isDirtyFlag},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},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},getRepairXY:function(e){return this.dragData.repairXY},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)}},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});if(!this.multiSelect){this.singleSelect=true}this.dragZone.getDragData=this.getDragData.createDelegate(this);this.dragZone.getRepairXY=this.getRepairXY;this.dragZone.onEndDrag=this.onEndDrag}},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});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)}},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"}},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},onNodeEnter:function(n,dd,e,data){if(this.highlightColor&&(data.sourceView!=this)){this.el.highlight(this.highlightColor)}return false},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"}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},onNodeOut:function(n,dd,e,data){this.removeDropIndicators(n)},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++}if(data.sourceView==this){if(pt=="below"){if(data.viewNodes[0]==n){data.viewNodes.shift()}}else{if(data.viewNodes[data.viewNodes.length-1]==n){data.viewNodes.pop()}}if(!data.viewNodes.length){return false}if(insertAt>this.store.indexOf(data.records[0])){insertAt--}}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},onEndDrag:function(data,e){var d=Ext.get(this.dragData.ddel);if(d&&d.hasClass("multi-proxy")){d.remove()}},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"}},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.gif"),id:"delete",text:AU.getMessage("deleteItem")})},getContextMenu:function(){if(!this.contextMenu){this.contextMenu=new Ext.menu.Menu({id:this.id+"-contextmenu"});this.el.on("contextmenu",this.showContextMenu,this)}return this.contextMenu},disableContextMenu:function(){if(this.contextMenu){this.el.un("contextmenu",this.showContextMenu,this)}},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:function(selectedIndices){selectedIndices=[].concat(selectedIndices);for(var i=0;i<selectedIndices.length;i++){var rec=this.store.getAt(selectedIndices[i]);this.store.remove(rec)}},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);while(targets.contains(this.dropZone)){targets.remove(this.dropZone)}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))}}}},onItemClick:function(item,index,e){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.ux.MultiMonthCalendar=Ext.extend(Ext.Component,{minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:"Next Month (Control+Right)",prevText:"Previous Month (Control+Left)",startDay:0,noOfMonth:2,eventDates:null,noOfMonthPerRow:3,initComponent:function(){Ext.ux.MultiMonthCalendar.superclass.initComponent.call(this);this.value=this.value?this.value.clearTime():new Date().clearTime();this.initDisabledDays();this.noOfMonthPerRow=this.noOfMonthPerRow>this.noOfMonth?this.noOfMonth:this.noOfMonthPerRow},initDisabledDays:function(){if(!this.disabledDatesRE&&this.disabledDates){var dd=this.disabledDates;var re="(?:";for(var i=0;i<dd.length;i++){re+=dd[i];if(i!=dd.length-1){re+="|"}}this.disabledDatesRE=new RegExp(re+")")}},setValue:function(value){var old=this.value;this.value=value.clearTime(true);if(this.el){this.update(this.value)}},getValue:function(){return this.value},focus:function(){if(this.el){this.update(this.activeDate)}},onRender:function(container,position){var m=["<table cellspacing='0'>"];if(this.noOfMonthPerRow>1){m.push("<tr><td class='x-date-left'><a href='#' title='",this.prevText,"'> </a></td>");m.push("<td class='x-date-left' colspan='"+eval(this.noOfMonthPerRow*2-3)+"'></td>");m.push("<td class='x-date-right'><a href='#' title='",this.nextText,"'> </a></td></tr><tr>")}else{m.push("<tr><td><table cellspacing='0' width='100%'><tr><td class='x-date-left'><a href='#' title='",this.prevText,"'> </a></td>");m.push("<td class='x-date-right'><a href='#' title='",this.nextText,"'> </a></td></tr></table></td></tr><tr>")}for(var x=0;x<this.noOfMonth;x++){m.push("<td><table border='1' cellspacing='0'><tr>");m.push("<td class='x-date-middle' align='center'><span id='monthLabel"+x+"'></span></td>");m.push("</tr><tr><td><table class='x-date-inner' id='inner-date"+x+"' cellspacing='0'><thead><tr>");var dn=this.dayNames;for(var i=0;i<7;i++){var d=this.startDay+i;if(d>6){d=d-7}m.push("<th><span>",dn[d].substr(0,1),"</span></th>")}m[m.length]="</tr></thead><tbody><tr>";for(var i=0;i<42;i++){if(i%7==0&&i!=0){m[m.length]="</tr><tr>"}m[m.length]='<td><a href="#" hidefocus="on" class="x-date-date" tabIndex="1"><em><span></span></em></a></td>'}m[m.length]="</tr></tbody></table></td></tr></table></td>";if(x!=this.noOfMonth-1){m[m.length]="<td width='3'></td>"}if((x+1)%this.noOfMonthPerRow==0&&x!=0){m[m.length]="</tr><tr>"}}m[m.length]="</tr></table>";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);new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});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))},pageUp:function(e){this.showNextMonth()},pageDown:function(e){this.showPrevMonth()},enter:function(e){e.stopPropagation();return true},scope:this});this.cellsArray=new Array();this.textNodesArray=new Array();for(var x=0;x<this.noOfMonth;x++){var cells=Ext.get("inner-date"+x).select("tbody td");var textNodes=Ext.get("inner-date"+x).query("tbody span");this.cellsArray[x]=cells;this.textNodesArray[x]=textNodes}if(Ext.isIE){this.el.repaint()}this.update(this.value)},showPrevMonth:function(e){this.update(this.activeDate.add("mo",-1))},showNextMonth:function(e){this.update(this.activeDate.add("mo",1))},update:function(date){this.activeDate=date;for(var x=0;x<this.noOfMonth;x++){var days=date.getDaysInMonth();var firstOfMonth=date.getFirstDateOfMonth();var startingPos=firstOfMonth.getDay()-this.startDay;if(startingPos<=this.startDay){startingPos+=7}var pm=date.add("mo",-1);var prevStart=pm.getDaysInMonth()-startingPos;var cells=this.cellsArray[x].elements;var textEls=this.textNodesArray[x];days+=startingPos;var day=86400000;var d=(new Date(pm.getFullYear(),pm.getMonth(),prevStart)).clearTime();var min=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var max=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var ddMatch=this.disabledDatesRE;var ddText=this.disabledDatesText;var ddays=this.disabledDays?this.disabledDays.join(""):false;var ddaysText=this.disabledDaysText;var format=this.format;var setCellClass=function(cal,cell){cell.title="";var t=d.getTime();cell.firstChild.dateValue=t;if(t<min){cell.className=" x-date-disabled";cell.title=cal.minText;return }if(t>max){cell.className=" x-date-disabled";cell.title=cal.maxText;return }if(ddays){if(ddays.indexOf(d.getDay())!=-1){cell.title=ddaysText;cell.className=" x-date-disabled"}}if(ddMatch&&format){var fvalue=d.dateFormat(format);if(ddMatch.test(fvalue)){cell.title=ddText.replace("%0",fvalue);cell.className=" x-date-disabled"}}if(cal.eventDates&&(cell.className.indexOf("x-date-active")!=-1)){for(var y=0;y<cal.eventDates.length;y++){var evtDate=cal.eventDates[y].clearTime().getTime();if(t==evtDate){cell.className+=" x-date-selected";break}}}};var i=0;for(;i<startingPos;i++){textEls[i].innerHTML=(++prevStart);d.setDate(d.getDate()+1);cells[i].className="x-date-prevday";setCellClass(this,cells[i])}for(;i<days;i++){intDay=i-startingPos+1;textEls[i].innerHTML=(intDay);d.setDate(d.getDate()+1);cells[i].className="x-date-active";setCellClass(this,cells[i])}var extraDays=0;for(;i<42;i++){textEls[i].innerHTML=(++extraDays);d.setDate(d.getDate()+1);cells[i].className="x-date-nextday";setCellClass(this,cells[i])}var monthLabel=Ext.get("monthLabel"+x);monthLabel.update(this.monthNames[date.getMonth()]+" "+date.getFullYear());if(!this.internalRender){var main=this.el.dom.firstChild;var w=main.offsetWidth;this.el.setWidth(w+this.el.getBorderWidth("lr"));Ext.fly(main).setWidth(w);this.internalRender=true;if(Ext.isOpera&&!this.secondPass){main.rows[0].cells[1].style.width=(w-(main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth))+"px";this.secondPass=true;this.update.defer(10,this,[date])}}date=date.add("mo",1)}}});Ext.reg("mmcalendar",Ext.ux.MultiMonthCalendar);var SWFUpload=function(init_settings){this.initSWFUpload(init_settings)};SWFUpload.prototype.initSWFUpload=function(init_settings){try{document.execCommand("BackgroundImageCache",false,true)}catch(ex1){}try{this.customSettings={};this.settings={};this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings(init_settings);this.loadFlash();this.displayDebugInfo()}catch(ex2){this.debug(ex2)}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.prototype.initSettings=function(init_settings){this.addSetting("upload_url",init_settings.upload_url,"");this.addSetting("file_post_name",init_settings.file_post_name,"Filedata");this.addSetting("post_params",init_settings.post_params,{});this.addSetting("file_types",init_settings.file_types,"*.*");this.addSetting("file_types_description",init_settings.file_types_description,"All Files");this.addSetting("file_size_limit",init_settings.file_size_limit,"1024");this.addSetting("file_upload_limit",init_settings.file_upload_limit,"0");this.addSetting("file_queue_limit",init_settings.file_queue_limit,"0");this.addSetting("flash_url",init_settings.flash_url,"swfupload.swf");this.addSetting("flash_width",init_settings.flash_width,"1px");this.addSetting("flash_height",init_settings.flash_height,"1px");this.addSetting("flash_color",init_settings.flash_color,"#FFFFFF");this.addSetting("debug_enabled",init_settings.debug,false);this.flashReady_handler=SWFUpload.flashReady;this.swfUploadLoaded_handler=this.retrieveSetting(init_settings.swfupload_loaded_handler,SWFUpload.swfUploadLoaded);this.fileDialogStart_handler=this.retrieveSetting(init_settings.file_dialog_start_handler,SWFUpload.fileDialogStart);this.fileQueued_handler=this.retrieveSetting(init_settings.file_queued_handler,SWFUpload.fileQueued);this.fileQueueError_handler=this.retrieveSetting(init_settings.file_queue_error_handler,SWFUpload.fileQueueError);this.fileDialogComplete_handler=this.retrieveSetting(init_settings.file_dialog_complete_handler,SWFUpload.fileDialogComplete);this.uploadStart_handler=this.retrieveSetting(init_settings.upload_start_handler,SWFUpload.uploadStart);this.uploadProgress_handler=this.retrieveSetting(init_settings.upload_progress_handler,SWFUpload.uploadProgress);this.uploadError_handler=this.retrieveSetting(init_settings.upload_error_handler,SWFUpload.uploadError);this.uploadSuccess_handler=this.retrieveSetting(init_settings.upload_success_handler,SWFUpload.uploadSuccess);this.uploadComplete_handler=this.retrieveSetting(init_settings.upload_complete_handler,SWFUpload.uploadComplete);this.debug_handler=this.retrieveSetting(init_settings.debug_handler,SWFUpload.debug);this.customSettings=this.retrieveSetting(init_settings.custom_settings,{})};SWFUpload.prototype.loadFlash=function(){var html,target_element,container;if(document.getElementById(this.movieName)!==null){return false}try{target_element=document.getElementsByTagName("body")[0];if(typeof (target_element)==="undefined"||target_element===null){this.debug("Could not find the BODY element. SWFUpload failed to load.");return false}}catch(ex){return false}container=document.createElement("div");container.style.width=this.getSetting("flash_width");container.style.height=this.getSetting("flash_height");target_element.appendChild(container);container.innerHTML=this.getFlashHTML()};SWFUpload.prototype.getFlashHTML=function(){var html="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" src="'+this.getSetting("flash_url")+'" width="'+this.getSetting("flash_width")+'" height="'+this.getSetting("flash_height")+'"';html+=' id="'+this.movieName+'" name="'+this.movieName+'" ';html+='bgcolor="'+this.getSetting("flash_color")+'" quality="high" menu="false" flashvars="';html+=this.getFlashVars();html+='" />'}else{html='<object id="'+this.movieName+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getSetting("flash_width")+'" height="'+this.getSetting("flash_height")+'">';html+='<param name="movie" value="'+this.getSetting("flash_url")+'">';html+='<param name="bgcolor" value="'+this.getSetting("flash_color")+'" />';html+='<param name="quality" value="high" />';html+='<param name="menu" value="false" />';html+='<param name="flashvars" value="'+this.getFlashVars()+'" />';html+="</object>"}return html};SWFUpload.prototype.getFlashVars=function(){var param_string=this.buildParamString();var html="";html+="movieName="+encodeURIComponent(this.movieName);html+="&uploadURL="+encodeURIComponent(this.getSetting("upload_url"));html+="¶ms="+encodeURIComponent(param_string);html+="&filePostName="+encodeURIComponent(this.getSetting("file_post_name"));html+="&fileTypes="+encodeURIComponent(this.getSetting("file_types"));html+="&fileTypesDescription="+encodeURIComponent(this.getSetting("file_types_description"));html+="&fileSizeLimit="+encodeURIComponent(this.getSetting("file_size_limit"));html+="&fileUploadLimit="+encodeURIComponent(this.getSetting("file_upload_limit"));html+="&fileQueueLimit="+encodeURIComponent(this.getSetting("file_queue_limit"));html+="&debugEnabled="+encodeURIComponent(this.getSetting("debug_enabled"));return html};SWFUpload.prototype.getMovieElement=function(){if(typeof (this.movieElement)==="undefined"||this.movieElement===null){this.movieElement=document.getElementById(this.movieName)}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var post_params=this.getSetting("post_params");var param_string_pairs=[];var i,value,name;if(typeof (post_params)==="object"){for(name in post_params){if(post_params.hasOwnProperty(name)){if(typeof (post_params[name])==="string"){param_string_pairs.push(encodeURIComponent(name)+"="+encodeURIComponent(post_params[name]))}}}}return param_string_pairs.join("&")};SWFUpload.prototype.addSetting=function(name,value,default_value){if(typeof (value)==="undefined"||value===null){this.settings[name]=default_value}else{this.settings[name]=value}return this.settings[name]};SWFUpload.prototype.getSetting=function(name){if(typeof (this.settings[name])==="undefined"){return""}else{return this.settings[name]}};SWFUpload.prototype.retrieveSetting=function(value,default_value){if(typeof (value)==="undefined"||value===null){return default_value}else{return value}};SWFUpload.prototype.displayDebugInfo=function(){var key,debug_message="";debug_message+="----- SWFUPLOAD SETTINGS ----\nID: "+this.moveName+"\n";debug_message+=this.outputObject(this.settings);debug_message+="----- SWFUPLOAD SETTINGS END ----\n";debug_message+="\n";this.debug(debug_message)};SWFUpload.prototype.outputObject=function(object,prefix){var output="",key;if(typeof (prefix)!=="string"){prefix=""}if(typeof (object)!=="object"){return""}for(key in object){if(object.hasOwnProperty(key)){if(typeof (object[key])==="object"){output+=(prefix+key+": { \n"+this.outputObject(object[key],"\t"+prefix)+prefix+"}\n")}else{output+=(prefix+key+": "+object[key]+"\n")}}}return output};SWFUpload.prototype.selectFile=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SelectFile)==="function"){try{movie_element.SelectFile()}catch(ex){this.debug("Could not call SelectFile: "+ex)}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.selectFiles=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SelectFiles)==="function"){try{movie_element.SelectFiles()}catch(ex){this.debug("Could not call SelectFiles: "+ex)}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.startUpload=function(file_id){var self=this;var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.StartUpload)==="function"){setTimeout(function(){try{movie_element.StartUpload(file_id)}catch(ex){self.debug("Could not call StartUpload: "+ex)}},0)}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.cancelUpload=function(file_id){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.CancelUpload)==="function"){try{movie_element.CancelUpload(file_id)}catch(ex){this.debug("Could not call CancelUpload: "+ex)}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.stopUpload=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.StopUpload)==="function"){try{movie_element.StopUpload()}catch(ex){this.debug("Could not call StopUpload: "+ex)}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.getStats=function(){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.GetStats)==="function"){try{return movie_element.GetStats()}catch(ex){this.debug("Could not call GetStats")}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.setStats=function(stats_object){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetStats)==="function"){try{movie_element.SetStats(stats_object)}catch(ex){this.debug("Could not call SetStats")}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.setCredentials=function(name,password){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetCredentials)==="function"){try{return movie_element.SetCredentials(name,password)}catch(ex){this.debug("Could not call SetCredentials")}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.getFile=function(file_id){var movie_element=this.getMovieElement();if(typeof (file_id)==="number"){if(movie_element!==null&&typeof (movie_element.GetFileByIndex)==="function"){try{return movie_element.GetFileByIndex(file_id)}catch(ex){this.debug("Could not call GetFileByIndex")}}else{this.debug("Could not find Flash element")}}else{if(movie_element!==null&&typeof (movie_element.GetFile)==="function"){try{return movie_element.GetFile(file_id)}catch(ex){this.debug("Could not call GetFile")}}else{this.debug("Could not find Flash element")}}};SWFUpload.prototype.addFileParam=function(file_id,name,value){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.AddFileParam)==="function"){try{return movie_element.AddFileParam(file_id,name,value)}catch(ex){this.debug("Could not call AddFileParam")}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.removeFileParam=function(file_id,name){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.RemoveFileParam)==="function"){try{return movie_element.RemoveFileParam(file_id,name)}catch(ex){this.debug("Could not call AddFileParam")}}else{this.debug("Could not find Flash element")}};SWFUpload.prototype.setUploadURL=function(url){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetUploadURL)==="function"){try{this.addSetting("upload_url",url);movie_element.SetUploadURL(this.getSetting("upload_url"))}catch(ex){this.debug("Could not call SetUploadURL")}}else{this.debug("Could not find Flash element in setUploadURL")}};SWFUpload.prototype.setPostParams=function(param_object){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetPostParams)==="function"){try{this.addSetting("post_params",param_object);movie_element.SetPostParams(this.getSetting("post_params"))}catch(ex){this.debug("Could not call SetPostParams")}}else{this.debug("Could not find Flash element in SetPostParams")}};SWFUpload.prototype.setFileTypes=function(types,description){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetFileTypes)==="function"){try{this.addSetting("file_types",types);this.addSetting("file_types_description",description);movie_element.SetFileTypes(this.getSetting("file_types"),this.getSetting("file_types_description"))}catch(ex){this.debug("Could not call SetFileTypes")}}else{this.debug("Could not find Flash element in SetFileTypes")}};SWFUpload.prototype.setFileSizeLimit=function(file_size_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetFileSizeLimit)==="function"){try{this.addSetting("file_size_limit",file_size_limit);movie_element.SetFileSizeLimit(this.getSetting("file_size_limit"))}catch(ex){this.debug("Could not call SetFileSizeLimit")}}else{this.debug("Could not find Flash element in SetFileSizeLimit")}};SWFUpload.prototype.setFileUploadLimit=function(file_upload_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetFileUploadLimit)==="function"){try{this.addSetting("file_upload_limit",file_upload_limit);movie_element.SetFileUploadLimit(this.getSetting("file_upload_limit"))}catch(ex){this.debug("Could not call SetFileUploadLimit")}}else{this.debug("Could not find Flash element in SetFileUploadLimit")}};SWFUpload.prototype.setFileQueueLimit=function(file_queue_limit){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetFileQueueLimit)==="function"){try{this.addSetting("file_queue_limit",file_queue_limit);movie_element.SetFileQueueLimit(this.getSetting("file_queue_limit"))}catch(ex){this.debug("Could not call SetFileQueueLimit")}}else{this.debug("Could not find Flash element in SetFileQueueLimit")}};SWFUpload.prototype.setFilePostName=function(file_post_name){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetFilePostName)==="function"){try{this.addSetting("file_post_name",file_post_name);movie_element.SetFilePostName(this.getSetting("file_post_name"))}catch(ex){this.debug("Could not call SetFilePostName")}}else{this.debug("Could not find Flash element in SetFilePostName")}};SWFUpload.prototype.setDebugEnabled=function(debug_enabled){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.SetDebugEnabled)==="function"){try{this.addSetting("debug_enabled",debug_enabled);movie_element.SetDebugEnabled(this.getSetting("debug_enabled"))}catch(ex){this.debug("Could not call SetDebugEnabled")}}else{this.debug("Could not find Flash element in SetDebugEnabled")}};SWFUpload.prototype.flashReady=function(){var movie_element=this.getMovieElement();if(movie_element===null||typeof (movie_element.StartUpload)!=="function"){this.debug("ExternalInterface methods failed to initialize.");return }var self=this;if(typeof (self.flashReady_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.flashReady_handler()};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("flashReady_handler event not defined")}};SWFUpload.prototype.executeNextEvent=function(){var f=this.eventQueue.shift();if(typeof (f)==="function"){f()}};SWFUpload.prototype.fileDialogStart=function(){var self=this;if(typeof (self.fileDialogStart_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogStart_handler()};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("fileDialogStart event not defined")}};SWFUpload.prototype.fileQueued=function(file){var self=this;if(typeof (self.fileQueued_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueued_handler(file)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("fileQueued event not defined")}};SWFUpload.prototype.fileQueueError=function(file,error_code,message){var self=this;if(typeof (self.fileQueueError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileQueueError_handler(file,error_code,message)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("fileQueueError event not defined")}};SWFUpload.prototype.fileDialogComplete=function(num_files_selected){var self=this;if(typeof (self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.fileDialogComplete_handler(num_files_selected)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("fileDialogComplete event not defined")}};SWFUpload.prototype.uploadStart=function(file){var self=this;if(typeof (self.fileDialogComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.returnUploadStart(self.uploadStart_handler(file))};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("uploadStart event not defined")}};SWFUpload.prototype.returnUploadStart=function(return_value){var movie_element=this.getMovieElement();if(movie_element!==null&&typeof (movie_element.ReturnUploadStart)==="function"){try{movie_element.ReturnUploadStart(return_value)}catch(ex){this.debug("Could not call ReturnUploadStart")}}else{this.debug("Could not find Flash element in returnUploadStart")}};SWFUpload.prototype.uploadProgress=function(file,bytes_complete,bytes_total){var self=this;if(typeof (self.uploadProgress_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadProgress_handler(file,bytes_complete,bytes_total)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("uploadProgress event not defined")}};SWFUpload.prototype.uploadError=function(file,error_code,message){var self=this;if(typeof (this.uploadError_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadError_handler(file,error_code,message)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("uploadError event not defined")}};SWFUpload.prototype.uploadSuccess=function(file,server_data){var self=this;if(typeof (self.uploadSuccess_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadSuccess_handler(file,server_data)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("uploadSuccess event not defined")}};SWFUpload.prototype.uploadComplete=function(file){var self=this;if(typeof (self.uploadComplete_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.uploadComplete_handler(file)};setTimeout(function(){self.executeNextEvent()},0)}else{this.debug("uploadComplete event not defined")}};SWFUpload.prototype.debug=function(message){var self=this;if(typeof (self.debug_handler)==="function"){this.eventQueue[this.eventQueue.length]=function(){self.debug_handler(message)};setTimeout(function(){self.executeNextEvent()},0)}else{this.eventQueue[this.eventQueue.length]=function(){self.debugMessage(message)};setTimeout(function(){self.executeNextEvent()},0)}};SWFUpload.flashReady=function(){try{this.debug("Flash called back and is ready.");if(typeof (this.swfUploadLoaded_handler)==="function"){this.swfUploadLoaded_handler()}}catch(ex){this.debug(ex)}};SWFUpload.swfUploadLoaded=function(){};SWFUpload.fileDialogStart=function(){};SWFUpload.fileQueued=function(file){};SWFUpload.fileQueueError=function(file,error_code,message){try{switch(error_code){case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:this.debug("Error Code: File too big, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:this.debug("Error Code: Zero Byte File, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+message);break;case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:this.debug("Error Code: File extension is not allowed, Message: "+message);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+error_code)}}catch(ex){this.debug(ex)}};SWFUpload.fileDialogComplete=function(num_files_selected){};SWFUpload.uploadStart=function(file){return true};SWFUpload.uploadProgress=function(file,bytes_complete,bytes_total){this.debug("File Progress: "+file.id+", Bytes: "+bytes_complete+". Total: "+bytes_total)};SWFUpload.uploadSuccess=function(file,server_data){};SWFUpload.uploadComplete=function(file){};SWFUpload.debug=function(message){if(this.getSetting("debug_enabled")){this.debugMessage(message)}};SWFUpload.uploadError=function(file,error_code,message){try{switch(errcode){case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:this.debug("Error Code: File ID specified for upload was not found, Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:this.debug("Error Code: HTTP Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:this.debug("Error Code: No backend file, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.IO_ERROR:this.debug("Error Code: IO Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:this.debug("Error Code: Security Error, File name: "+file.name+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:this.debug("Error Code: Upload limit reached, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:this.debug("Error Code: Upload Initialization exception, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:this.debug("Error Code: uploadStart callback returned false, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:this.debug("Error Code: The file upload was cancelled, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:this.debug("Error Code: The file upload was stopped, File name: "+file.name+", File size: "+file.size+", Message: "+msg);break;default:this.debug("Error Code: Unhandled error occured. Errorcode: "+errcode)}}catch(ex){this.debug(ex)}};SWFUpload.prototype.debugMessage=function(message){var exception_message,exception_values;if(typeof (message)==="object"&&typeof (message.name)==="string"&&typeof (message.message)==="string"){exception_message="";exception_values=[];for(var key in message){exception_values.push(key+": "+message[key])}exception_message=exception_values.join("\n");exception_values=exception_message.split("\n");exception_message="EXCEPTION: "+exception_values.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(exception_message)}else{SWFUpload.Console.writeLine(message)}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(message){console.log(message)};Ext.namespace("Ext.ux");Ext.ux.SwfUploadPanel=function(config){if(!config.single_select){config.single_select=false}if(!config.file_types){config.file_types="*.*"}if(!config.file_types_description){config.file_types_description="All Files"}if(!config.file_size_limit){config.file_size_limit="102400"}if(!config.file_upload_limit){config.file_upload_limit="0"}if(!config.file_post_name){config.file_post_name="Filedata"}if(!config.flash_url){config.flash_url="swfupload_f9.swf"}if(!config.debug){config.debug=false}this.rec=Ext.data.Record.create([{name:"name"},{name:"size"},{name:"id"},{name:"type"},{name:"creationdate",type:"date",dateFormat:"m/d/Y"},{name:"status"},{name:"note"}]);var store=new Ext.data.Store({reader:new Ext.data.JsonReader({id:"id"},this.rec)});this.suo=new SWFUpload({upload_url:config.upload_url,post_params:config.post_params,file_post_name:config.file_post_name,file_size_limit:config.file_size_limit,file_types:config.file_types,file_types_description:config.file_types_description,file_upload_limit:config.file_upload_limit,flash_url:config.flash_url,file_queued_handler:this.fileQueue.createDelegate(this),file_queue_error_handler:this.fileQueueError.createDelegate(this),file_dialog_complete_handler:this.fileDialogComplete.createDelegate(this),upload_error_handler:this.uploadError.createDelegate(this),upload_progress_handler:this.uploadProgress.createDelegate(this),upload_complete_handler:this.uploadComplete.createDelegate(this),upload_success_handler:this.fileComplete.createDelegate(this),upload_error_handler:this.fileCancelled.createDelegate(this),swfupload_loaded_handler:this.swfUploadLoaded.createDelegate(this),debug:config.debug});this.progress_bar=new Ext.ProgressBar({text:"Progress Bar"});var cm=new Ext.grid.ColumnModel([{id:"name",header:"Filename",width:150,dataIndex:"name"},{id:"size",header:"Size",width:80,dataIndex:"size",renderer:this.formatBytes},{id:"status",header:"Status",width:80,dataIndex:"status",renderer:this.formatStatus},{id:"note",header:"Note",dataIndex:"note"}]);config=config||{};config=Ext.apply(config||{},{store:store,cm:cm,autoExpandColumn:"note",enableColumnResize:true,enableColumnMove:false,sm:new Ext.grid.RowSelectionModel({singleSelect:config.single_select}),tbar:[{text:"Add File(s)",iconCls:"SwfUploadPanel_iconAdd",scope:this,handler:function(){if(config.single_file_select){this.suo.selectFile()}else{this.suo.selectFiles()}}},"->",{text:"Cancel Upload",id:"cancel",iconCls:"SwfUploadPanel_iconCancel",handler:this.stopUpload.createDelegate(this),hidden:true},{text:"Upload File(s)",iconCls:"SwfUploadPanel_iconUpload",handler:this.uploadFiles.createDelegate(this),hidden:true}],bbar:[this.progress_bar],listeners:{keydown:function(e){function removeRows(grid){var selRecords=grid.getSelections();for(var i=0;i<selRecords.length;i++){if(selRecords[i].data.status!=1){grid.suo.cancelUpload(selRecords[i].id);grid.store.remove(selRecords[i])}}if(grid.suo.getStats().files_queued==0){grid.getTopToolbar().items.get(3).setVisible(false)}}if(config.confirm_delete){if(e.getKey()==e.DELETE){Ext.MessageBox.confirm("Remove File","Are you sure you wish to remove this file from queue?",function(e){if(e=="yes"){removeRows(this)}})}}else{if(e.getKey()==e.DELETE){removeRows(this)}}},contextmenu:function(e){e.stopEvent()}}});cm.defaultSortable=false;Ext.ux.SwfUploadPanel.superclass.constructor.apply(this,arguments);try{this.progress_bar.setWidth(this.bbar.getWidth()-5);Ext.fly(this.progress_bar.el.dom.firstChild.firstChild).applyStyles("height: 16px")}catch(ex1){}this.on("resize",function(){this.progress_bar.setWidth(this.bbar.getWidth()-5);Ext.fly(this.progress_bar.el.dom.firstChild.firstChild).applyStyles("height: 16px")})};Ext.extend(Ext.ux.SwfUploadPanel,Ext.grid.GridPanel,{formatStatus:function(status){switch(status){case 0:return("Ready");case 1:return("Uploading...");case 2:return("Completed");case 3:return("Error");case 4:return("Cancelled")}},formatBytes:function(bytes){if(isNaN(bytes)){return("")}var unit,val;if(bytes<999){unit="B";val=(!bytes&&this.progressRequestCount>=1)?"~":bytes}else{if(bytes<999999){unit="kB";val=Math.round(bytes/1000)}else{if(bytes<999999999){unit="MB";val=Math.round(bytes/100000)/10}else{if(bytes<999999999999){unit="GB";val=Math.round(bytes/100000000)/10}else{unit="TB";val=Math.round(bytes/100000000000)/10}}}}return(val+" "+unit)},uploadError:function(file,error,code){switch(error){case -200:Ext.MessageBox.alert("Error","File not found 404.");break;case -230:Ext.MessageBox.alert("Error","Security Error. Not allowed to post to different url.");break}},fileQueue:function(file){file.status=0;r=new this.rec(file);r.id=file.id;this.store.add(r);this.fireEvent("fileQueued",this,file)},fileQueueError:function(a,code,queue_remaining){switch(code){case -100:Ext.MessageBox.alert("Error","The selected files you wish to add exceedes the remaining allowed files in the queue. There are "+queue_remaining+" remaining slots.");break}},fileComplete:function(file,result){var o=Ext.decode(result);this.fireEvent("fileUploadComplete",this,file,o);if("success" in o&&o.success){this.store.getById(file.id).set("status",2);this.store.getById(file.id).set("note",o.message||o.error);this.store.getById(file.id).commit()}else{this.store.getById(file.id).set("status",3);this.store.getById(file.id).set("note",o.message||o.error);this.store.getById(file.id).commit()}if(this.suo.getStats().files_queued>0){this.uploadFiles()}else{this.getTopToolbar().items.get(2).setVisible(false);this.getTopToolbar().items.get(3).setVisible(false);this.fireEvent("queueUploadComplete",this)}},fileDialogComplete:function(file_count){if(file_count>0){this.getTopToolbar().items.get(3).setVisible(true)}},uploadProgress:function(file,current_size,total_size){this.store.getById(file.id).set("status",1);this.store.getById(file.id).commit();this.progress_bar.updateProgress(current_size/total_size,"Uploading file: "+file.name+" ("+this.formatBytes(current_size)+" of "+this.formatBytes(total_size)+")")},uploadComplete:function(file,result){if(this.cancelled){this.cancelled=false}else{this.progress_bar.reset();this.progress_bar.updateText("Progress Bar");if(this.remove_completed){this.store.remove(this.store.getById(file.id))}}},uploadFiles:function(){this.getTopToolbar().items.get(2).setVisible(true);this.suo.startUpload()},addPostParam:function(name,value){this.suo.settings.post_params[name]=value;this.suo.setPostParams(this.suo.settings.post_params)},stopUpload:function(cancel_btn){this.suo.stopUpload();this.getStore().each(function(){if(this.data.status==1){this.set("status",0);this.commit()}});this.getTopToolbar().items.get(2).setVisible(false);this.progress_bar.reset();this.progress_bar.updateText("Progress Bar")},fileCancelled:function(file,code,b,c,d){if(code==-280){return }this.store.getById(file.id).set("status",4);this.store.getById(file.id).commit();this.progress_bar.reset();this.progress_bar.updateText("Progress Bar");if(this.suo.getStats().files_queued>0){this.getTopToolbar().items.get(2).setVisible(false)}else{this.getTopToolbar().items.get(2).setVisible(false);this.getTopToolbar().items.get(3).setVisible(false)}this.cancelled=true},swfUploadLoaded:function(){this.fireEvent("swfUploadLoaded",this)}});Ext.namespace("Ext.ux.Utils");Ext.ux.Utils.EventQueue=function(handler,scope){if(!handler){throw"Handler is required."}this.handler=handler;this.scope=scope||window;this.queue=[];this.is_processing=false;this.postEvent=function(event,data){data=data||null;this.queue.push({event:event,data:data});if(!this.is_processing){this.process()}};this.flushEventQueue=function(){this.queue=[]},this.process=function(){while(this.queue.length>0){this.is_processing=true;var event_data=this.queue.shift();this.handler.call(this.scope,event_data.event,event_data.data)}this.is_processing=false}};Ext.ux.Utils.FSA=function(initial_state,trans_table,trans_table_scope){this.current_state=initial_state;this.trans_table=trans_table||{};this.trans_table_scope=trans_table_scope||window;Ext.ux.Utils.FSA.superclass.constructor.call(this,this.processEvent,this)};Ext.extend(Ext.ux.Utils.FSA,Ext.ux.Utils.EventQueue,{current_state:null,trans_table:null,trans_table_scope:null,state:function(){return this.current_state},processEvent:function(event,data){var transitions=this.currentStateEventTransitions(event);if(!transitions){throw"State '"+this.current_state+"' has no transition for event '"+event+"'."}for(var i=0,len=transitions.length;i<len;i++){var transition=transitions[i];var predicate=transition.predicate||transition.p||true;var action=transition.action||transition.a||Ext.emptyFn;var new_state=transition.state||transition.s||this.current_state;var scope=transition.scope||this.trans_table_scope;if(this.computePredicate(predicate,scope,data,event)){this.callAction(action,scope,data,event);this.current_state=new_state;return }}throw"State '"+this.current_state+"' has no transition for event '"+event+"' in current context"},currentStateEventTransitions:function(event){return this.trans_table[this.current_state]?this.trans_table[this.current_state][event]||false:false},computePredicate:function(predicate,scope,data,event){var result=false;switch(Ext.type(predicate)){case"function":result=predicate.call(scope,data,event,this);break;case"array":result=true;for(var i=0,len=predicate.length;result&&(i<len);i++){if(Ext.type(predicate[i])=="function"){result=predicate[i].call(scope,data,event,this)}else{throw ["Predicate: ",predicate[i],' is not callable in "',this.current_state,'" state for event "',event].join("")}}break;case"boolean":result=predicate;break;default:throw ["Predicate: ",predicate,' is not callable in "',this.current_state,'" state for event "',event].join("")}return result},callAction:function(action,scope,data,event){switch(Ext.type(action)){case"array":for(var i=0,len=action.length;i<len;i++){if(Ext.type(action[i])=="function"){action[i].call(scope,data,event,this)}else{throw ["Action: ",action[i],' is not callable in "',this.current_state,'" state for event "',event].join("")}}break;case"function":action.call(scope,data,event,this);break;default:throw ["Action: ",action,' is not callable in "',this.current_state,'" state for event "',event].join("")}}});Ext.namespace("Ext.ux.UploadDialog");Ext.ux.UploadDialog.BrowseButton=Ext.extend(Ext.Button,{input_name:"file",input_file:null,original_handler:null,original_scope:null,initComponent:function(){Ext.ux.UploadDialog.BrowseButton.superclass.initComponent.call(this);this.original_handler=this.handler||null;this.original_scope=this.scope||window;this.handler=null;this.scope=null},onRender:function(ct,position){Ext.ux.UploadDialog.BrowseButton.superclass.onRender.call(this,ct,position);this.createInputFile()},createInputFile:function(){var button_container=this.el.child(".x-btn-center");button_container.position("relative");this.input_file=Ext.DomHelper.append(button_container,{tag:"input",type:"file",size:1,name:this.input_name||Ext.id(this.el),style:"position: absolute; display: block; border: none; cursor: pointer"},true);var button_box=button_container.getBox();this.input_file.setStyle("font-size",(button_box.width*0.5)+"px");var input_box=this.input_file.getBox();var adj={x:3,y:3};if(Ext.isIE){adj={x:0,y:3}}this.input_file.setLeft(button_box.width-input_box.width+adj.x+"px");this.input_file.setTop(button_box.height-input_box.height+adj.y+"px");this.input_file.setOpacity(0);if(this.handleMouseEvents){this.input_file.on("mouseover",this.onMouseOver,this);this.input_file.on("mousedown",this.onMouseDown,this)}if(this.tooltip){if(typeof this.tooltip=="object"){Ext.QuickTips.register(Ext.apply({target:this.input_file},this.tooltip))}else{this.input_file.dom[this.tooltipType]=this.tooltip}}this.input_file.on("change",this.onInputFileChange,this);this.input_file.on("click",function(e){e.stopPropagation()})},detachInputFile:function(no_create){var result=this.input_file;no_create=no_create||false;if(typeof this.tooltip=="object"){Ext.QuickTips.unregister(this.input_file)}else{this.input_file.dom[this.tooltipType]=null}this.input_file.removeAllListeners();this.input_file=null;if(!no_create){this.createInputFile()}return result},getInputFile:function(){return this.input_file},disable:function(){Ext.ux.UploadDialog.BrowseButton.superclass.disable.call(this);this.input_file.dom.disabled=true},enable:function(){Ext.ux.UploadDialog.BrowseButton.superclass.enable.call(this);this.input_file.dom.disabled=false},destroy:function(){var input_file=this.detachInputFile(true);input_file.remove();input_file=null;Ext.ux.UploadDialog.BrowseButton.superclass.destroy.call(this)},onInputFileChange:function(){if(this.original_handler){this.original_handler.call(this.original_scope,this)}}});Ext.ux.UploadDialog.TBBrowseButton=Ext.extend(Ext.ux.UploadDialog.BrowseButton,{hideParent:true,onDestroy:function(){Ext.ux.UploadDialog.TBBrowseButton.superclass.onDestroy.call(this);if(this.container){this.container.remove()}}});Ext.ux.UploadDialog.FileRecord=Ext.data.Record.create([{name:"filename"},{name:"state",type:"int"},{name:"note"},{name:"input_element"}]);Ext.ux.UploadDialog.FileRecord.STATE_QUEUE=0;Ext.ux.UploadDialog.FileRecord.STATE_FINISHED=1;Ext.ux.UploadDialog.FileRecord.STATE_FAILED=2;Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING=3;Ext.ux.UploadDialog.Dialog=function(config){var default_config={border:false,width:450,height:300,minWidth:450,minHeight:300,plain:true,constrainHeader:true,draggable:true,closable:true,maximizable:false,minimizable:false,resizable:true,autoDestroy:true,closeAction:"hide",title:this.i18n.title,cls:"ext-ux-uploaddialog-dialog",url:"",base_params:{},permitted_extensions:[],reset_on_hide:true,allow_close_on_upload:false,upload_autostart:false,post_var_name:"file"};config=Ext.applyIf(config||{},default_config);config.layout="absolute";Ext.ux.UploadDialog.Dialog.superclass.constructor.call(this,config)};Ext.extend(Ext.ux.UploadDialog.Dialog,Ext.Window,{fsa:null,state_tpl:null,form:null,grid_panel:null,progress_bar:null,is_uploading:false,initial_queued_count:0,upload_frame:null,initComponent:function(){Ext.ux.UploadDialog.Dialog.superclass.initComponent.call(this);var tt={created:{"window-render":[{action:[this.createForm,this.createProgressBar,this.createGrid],state:"rendering"}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},rendering:{"grid-render":[{action:[this.fillToolbar,this.updateToolbar],state:"ready"}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},ready:{"file-selected":[{predicate:[this.fireFileTestEvent,this.isPermittedFile],action:this.addFileToUploadQueue,state:"adding-file"},{}],"grid-selection-change":[{action:this.updateToolbar}],"remove-files":[{action:[this.removeFiles,this.fireFileRemoveEvent]}],"reset-queue":[{action:[this.resetQueue,this.fireResetQueueEvent]}],"start-upload":[{predicate:this.hasUnuploadedFiles,action:[this.setUploadingFlag,this.saveInitialQueuedCount,this.updateToolbar,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadStartEvent],state:"uploading"},{}],"stop-upload":[{}],hide:[{predicate:[this.isNotEmptyQueue,this.getResetOnHide],action:[this.resetQueue,this.fireResetQueueEvent]},{}],destroy:[{action:this.flushEventQueue,state:"destroyed"}]},"adding-file":{"file-added":[{predicate:this.isUploading,action:[this.incInitialQueuedCount,this.updateProgressBar,this.fireFileAddEvent],state:"uploading"},{predicate:this.getUploadAutostart,action:[this.startUpload,this.fireFileAddEvent],state:"ready"},{action:[this.updateToolbar,this.fireFileAddEvent],state:"ready"}]},uploading:{"file-selected":[{predicate:[this.fireFileTestEvent,this.isPermittedFile],action:this.addFileToUploadQueue,state:"adding-file"},{}],"grid-selection-change":[{}],"start-upload":[{}],"stop-upload":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadingFlag,this.abortUpload,this.updateToolbar,this.updateProgressBar,this.fireUploadStopEvent],state:"ready"},{action:[this.resetUploadingFlag,this.abortUpload,this.updateToolbar,this.updateProgressBar,this.fireUploadStopEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-start":[{action:[this.uploadFile,this.findUploadFrame,this.fireFileUploadStartEvent]}],"file-upload-success":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadSuccessEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadSuccessEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-error":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadErrorEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadErrorEvent,this.fireUploadCompleteEvent],state:"ready"}],"file-upload-failed":[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadFrame,this.updateRecordState,this.updateProgressBar,this.prepareNextUploadTask,this.fireUploadFailedEvent]},{action:[this.resetUploadFrame,this.resetUploadingFlag,this.updateRecordState,this.updateToolbar,this.updateProgressBar,this.fireUploadFailedEvent,this.fireUploadCompleteEvent],state:"ready"}],hide:[{predicate:this.getResetOnHide,action:[this.stopUpload,this.repostHide]},{}],destroy:[{predicate:this.hasUnuploadedFiles,action:[this.resetUploadingFlag,this.abortUpload,this.fireUploadStopEvent,this.flushEventQueue],state:"destroyed"},{action:[this.resetUploadingFlag,this.abortUpload,this.fireUploadStopEvent,this.fireUploadCompleteEvent,this.flushEventQueue],state:"destroyed"}]},destroyed:{}};this.fsa=new Ext.ux.Utils.FSA("created",tt,this);this.addEvents({filetest:true,fileadd:true,fileremove:true,resetqueue:true,uploadsuccess:true,uploaderror:true,uploadfailed:true,uploadstart:true,uploadstop:true,uploadcomplete:true,fileuploadstart:true});this.on("render",this.onWindowRender,this);this.on("beforehide",this.onWindowBeforeHide,this);this.on("hide",this.onWindowHide,this);this.on("destroy",this.onWindowDestroy,this);this.state_tpl=new Ext.Template("<div class='ext-ux-uploaddialog-state ext-ux-uploaddialog-state-{state}'> </div>").compile()},createForm:function(){this.form=Ext.DomHelper.append(this.body,{tag:"form",method:"post",action:this.url,style:"position: absolute; left: -100px; top: -100px; width: 100px; height: 100px"})},createProgressBar:function(){this.progress_bar=this.add(new Ext.ProgressBar({x:0,y:0,anchor:"0",value:0,text:this.i18n.progress_waiting_text}))},createGrid:function(){var store=new Ext.data.Store({proxy:new Ext.data.MemoryProxy([]),reader:new Ext.data.JsonReader({},Ext.ux.UploadDialog.FileRecord),sortInfo:{field:"state",direction:"DESC"},pruneModifiedRecords:true});var cm=new Ext.grid.ColumnModel([{header:this.i18n.state_col_title,width:this.i18n.state_col_width,resizable:false,dataIndex:"state",sortable:true,renderer:this.renderStateCell.createDelegate(this)},{header:this.i18n.filename_col_title,width:this.i18n.filename_col_width,dataIndex:"filename",sortable:true,renderer:this.renderFilenameCell.createDelegate(this)},{header:this.i18n.note_col_title,width:this.i18n.note_col_width,dataIndex:"note",sortable:true,renderer:this.renderNoteCell.createDelegate(this)}]);this.grid_panel=new Ext.grid.GridPanel({ds:store,cm:cm,x:0,y:22,anchor:"0 -22",border:true,viewConfig:{autoFill:true,forceFit:true},bbar:new Ext.Toolbar()});this.grid_panel.on("render",this.onGridRender,this);this.add(this.grid_panel);this.grid_panel.getSelectionModel().on("selectionchange",this.onGridSelectionChange,this)},fillToolbar:function(){var tb=this.grid_panel.getBottomToolbar();tb.x_buttons={};tb.x_buttons.add=tb.addItem(new Ext.ux.UploadDialog.TBBrowseButton({input_name:this.post_var_name,text:this.i18n.add_btn_text,tooltip:this.i18n.add_btn_tip,iconCls:"ext-ux-uploaddialog-addbtn",handler:this.onAddButtonFileSelected,scope:this}));tb.x_buttons.remove=tb.addButton({text:this.i18n.remove_btn_text,tooltip:this.i18n.remove_btn_tip,iconCls:"ext-ux-uploaddialog-removebtn",handler:this.onRemoveButtonClick,scope:this});tb.x_buttons.reset=tb.addButton({text:this.i18n.reset_btn_text,tooltip:this.i18n.reset_btn_tip,iconCls:"ext-ux-uploaddialog-resetbtn",handler:this.onResetButtonClick,scope:this});tb.add("-");tb.x_buttons.upload=tb.addButton({text:this.i18n.upload_btn_start_text,tooltip:this.i18n.upload_btn_start_tip,iconCls:"ext-ux-uploaddialog-uploadstartbtn",handler:this.onUploadButtonClick,scope:this});tb.add("-");tb.x_buttons.indicator=tb.addItem(new Ext.Toolbar.Item(Ext.DomHelper.append(tb.getEl(),{tag:"div",cls:"ext-ux-uploaddialog-indicator-stoped",html:" "})));tb.add("->");tb.x_buttons.close=tb.addButton({text:this.i18n.close_btn_text,tooltip:this.i18n.close_btn_tip,handler:this.onCloseButtonClick,scope:this})},renderStateCell:function(data,cell,record,row_index,column_index,store){return this.state_tpl.apply({state:data})},renderFilenameCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();var f=function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}};f.defer(1000);return data},renderNoteCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();var f=function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}};f.defer(1000);return data},getFileExtension:function(filename){var result=null;var parts=filename.split(".");if(parts.length>1){result=parts.pop()}return result},isPermittedFileType:function(filename){var result=true;if(this.permitted_extensions.length>0){result=this.permitted_extensions.indexOf(this.getFileExtension(filename))!=-1}return result},isPermittedFile:function(browse_btn){var result=false;var filename=browse_btn.getInputFile().dom.value;if(this.isPermittedFileType(filename)){result=true}else{Ext.Msg.alert(this.i18n.error_msgbox_title,String.format(this.i18n.err_file_type_not_permitted,filename,this.permitted_extensions.join(this.i18n.permitted_extensions_join_str)));result=false}return result},fireFileTestEvent:function(browse_btn){return this.fireEvent("filetest",this,browse_btn.getInputFile().dom.value)!==false},addFileToUploadQueue:function(browse_btn){var input_file=browse_btn.detachInputFile();input_file.appendTo(this.form);input_file.setStyle("width","100px");input_file.dom.disabled=true;var store=this.grid_panel.getStore();store.add(new Ext.ux.UploadDialog.FileRecord({state:Ext.ux.UploadDialog.FileRecord.STATE_QUEUE,filename:input_file.dom.value,note:this.i18n.note_queued_to_upload,input_element:input_file}));this.fsa.postEvent("file-added",input_file.dom.value)},fireFileAddEvent:function(filename){this.fireEvent("fileadd",this,filename)},updateProgressBar:function(){if(this.is_uploading){var queued=this.getQueuedCount(true);var value=1-queued/this.initial_queued_count;this.progress_bar.updateProgress(value,String.format(this.i18n.progress_uploading_text,this.initial_queued_count-queued,this.initial_queued_count))}else{this.progress_bar.updateProgress(0,this.i18n.progress_waiting_text)}},updateToolbar:function(){var tb=this.grid_panel.getBottomToolbar();if(this.is_uploading){tb.x_buttons.remove.disable();tb.x_buttons.reset.disable();tb.x_buttons.upload.enable();if(!this.getAllowCloseOnUpload()){tb.x_buttons.close.disable()}Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass("ext-ux-uploaddialog-indicator-stoped","ext-ux-uploaddialog-indicator-processing");tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstopbtn");tb.x_buttons.upload.setText(this.i18n.upload_btn_stop_text);tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_stop_tip}else{tb.x_buttons.remove.enable();tb.x_buttons.reset.enable();tb.x_buttons.close.enable();Ext.fly(tb.x_buttons.indicator.getEl()).replaceClass("ext-ux-uploaddialog-indicator-processing","ext-ux-uploaddialog-indicator-stoped");tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstartbtn");tb.x_buttons.upload.setText(this.i18n.upload_btn_start_text);tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_start_tip;if(this.getQueuedCount()>0){tb.x_buttons.upload.enable()}else{tb.x_buttons.upload.disable()}if(this.grid_panel.getSelectionModel().hasSelection()){tb.x_buttons.remove.enable()}else{tb.x_buttons.remove.disable()}if(this.grid_panel.getStore().getCount()>0){tb.x_buttons.reset.enable()}else{tb.x_buttons.reset.disable()}}},saveInitialQueuedCount:function(){this.initial_queued_count=this.getQueuedCount()},incInitialQueuedCount:function(){this.initial_queued_count++},setUploadingFlag:function(){this.is_uploading=true},resetUploadingFlag:function(){this.is_uploading=false},prepareNextUploadTask:function(){var store=this.grid_panel.getStore();var record=null;store.each(function(r){if(!record&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE){record=r}else{r.get("input_element").dom.disabled=true}});record.get("input_element").dom.disabled=false;record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING);record.set("note",this.i18n.note_processing);record.commit();this.fsa.postEvent("file-upload-start",record)},fireUploadStartEvent:function(){this.fireEvent("uploadstart",this)},removeFiles:function(file_records){var store=this.grid_panel.getStore();for(var i=0,len=file_records.length;i<len;i++){var r=file_records[i];r.get("input_element").remove();store.remove(r)}},fireFileRemoveEvent:function(file_records){for(var i=0,len=file_records.length;i<len;i++){this.fireEvent("fileremove",this,file_records[i].get("filename"))}},resetQueue:function(){var store=this.grid_panel.getStore();store.each(function(r){r.get("input_element").remove()});store.removeAll()},fireResetQueueEvent:function(){this.fireEvent("resetqueue",this)},uploadFile:function(record){Ext.Ajax.request({url:this.url,params:this.base_params||this.baseParams||this.params,method:"POST",form:this.form,isUpload:true,success:this.onAjaxSuccess,failure:this.onAjaxFailure,scope:this,record:record})},fireFileUploadStartEvent:function(record){this.fireEvent("fileuploadstart",this,record.get("filename"))},updateRecordState:function(data){if("success" in data.response&&data.response.success){data.record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FINISHED);data.record.set("note",data.response.message||data.response.error||this.i18n.note_upload_success)}else{data.record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FAILED);data.record.set("note",data.response.message||data.response.error||this.i18n.note_upload_error)}data.record.commit()},fireUploadSuccessEvent:function(data){this.fireEvent("uploadsuccess",this,data.record.get("filename"),data.response)},fireUploadErrorEvent:function(data){this.fireEvent("uploaderror",this,data.record.get("filename"),data.response)},fireUploadFailedEvent:function(data){this.fireEvent("uploadfailed",this,data.record.get("filename"))},fireUploadCompleteEvent:function(){this.fireEvent("uploadcomplete",this)},findUploadFrame:function(){this.upload_frame=Ext.getBody().child("iframe.x-hidden:last")},resetUploadFrame:function(){this.upload_frame=null},removeUploadFrame:function(){if(this.upload_frame){this.upload_frame.removeAllListeners();this.upload_frame.dom.src="about:blank";this.upload_frame.remove()}this.upload_frame=null},abortUpload:function(){this.removeUploadFrame();var store=this.grid_panel.getStore();var record=null;store.each(function(r){if(r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING){record=r;return false}});record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_FAILED);record.set("note",this.i18n.note_aborted);record.commit()},fireUploadStopEvent:function(){this.fireEvent("uploadstop",this)},repostHide:function(){this.fsa.postEvent("hide")},flushEventQueue:function(){this.fsa.flushEventQueue()},onWindowRender:function(){this.fsa.postEvent("window-render")},onWindowBeforeHide:function(){return this.isUploading()?this.getAllowCloseOnUpload():true},onWindowHide:function(){this.fsa.postEvent("hide")},onWindowDestroy:function(){this.fsa.postEvent("destroy")},onGridRender:function(){this.fsa.postEvent("grid-render")},onGridSelectionChange:function(){this.fsa.postEvent("grid-selection-change")},onAddButtonFileSelected:function(btn){this.fsa.postEvent("file-selected",btn)},onUploadButtonClick:function(){if(this.is_uploading){this.fsa.postEvent("stop-upload")}else{this.fsa.postEvent("start-upload")}},onRemoveButtonClick:function(){var selections=this.grid_panel.getSelectionModel().getSelections();this.fsa.postEvent("remove-files",selections)},onResetButtonClick:function(){this.fsa.postEvent("reset-queue")},onCloseButtonClick:function(){this[this.closeAction].call(this)},onAjaxSuccess:function(response,options){var json_response={success:false,error:this.i18n.note_upload_error};try{var rt=response.responseText;var filter=rt.match(/^<[^>]+>((?:.|\n)*)<\/[^>]+>$/);if(filter){rt=filter[1]}json_response=Ext.util.JSON.decode(rt)}catch(e){}var data={record:options.record,response:json_response};if("success" in json_response&&json_response.success){this.fsa.postEvent("file-upload-success",data)}else{this.fsa.postEvent("file-upload-error",data)}},onAjaxFailure:function(response,options){var data={record:options.record,response:{success:false,error:this.i18n.note_upload_failed}};this.fsa.postEvent("file-upload-failed",data)},startUpload:function(){this.fsa.postEvent("start-upload")},stopUpload:function(){this.fsa.postEvent("stop-upload")},getUrl:function(){return this.url},setUrl:function(url){this.url=url},getBaseParams:function(){return this.base_params},setBaseParams:function(params){this.base_params=params},getUploadAutostart:function(){return this.upload_autostart},setUploadAutostart:function(value){this.upload_autostart=value},getAllowCloseOnUpload:function(){return this.allow_close_on_upload},setAllowCloseOnUpload:function(value){this.allow_close_on_upload},getResetOnHide:function(){return this.reset_on_hide},setResetOnHide:function(value){this.reset_on_hide=value},getPermittedExtensions:function(){return this.permitted_extensions},setPermittedExtensions:function(value){this.permitted_extensions=value},isUploading:function(){return this.is_uploading},isNotEmptyQueue:function(){return this.grid_panel.getStore().getCount()>0},getQueuedCount:function(count_processing){var count=0;var store=this.grid_panel.getStore();store.each(function(r){if(r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE){count++}if(count_processing&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING){count++}});return count},hasUnuploadedFiles:function(){return this.getQueuedCount()>0}});var p=Ext.ux.UploadDialog.Dialog.prototype;p.i18n={title:"File upload dialog",state_col_title:"State",state_col_width:70,filename_col_title:"Filename",filename_col_width:230,note_col_title:"Note",note_col_width:150,add_btn_text:"Add",add_btn_tip:"Add file into upload queue.",remove_btn_text:"Remove",remove_btn_tip:"Remove file from upload queue.",reset_btn_text:"Reset",reset_btn_tip:"Reset queue.",upload_btn_start_text:"Upload",upload_btn_stop_text:"Abort",upload_btn_start_tip:"Upload queued files to the server.",upload_btn_stop_tip:"Stop upload.",close_btn_text:"Close",close_btn_tip:"Close the dialog.",progress_waiting_text:"Waiting...",progress_uploading_text:"Uploading: {0} of {1} files complete.",error_msgbox_title:"Error",permitted_extensions_join_str:",",err_file_type_not_permitted:"Selected file extension isn't permitted.<br/>Please select files with following extensions: {1}",note_queued_to_upload:"Queued for upload.",note_processing:"Uploading...",note_upload_failed:"Server is unavailable or internal server error occured.",note_upload_success:"OK.",note_upload_error:"Upload error.",note_aborted:"Aborted by user."};
\ No newline at end of file
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientModule.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -30,6 +30,7 @@
import org.ourproject.kune.platf.client.state.Session;
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.ToolSelector;
+import org.ourproject.kune.platf.client.ui.dialogs.FileUploader;
import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
import org.ourproject.kune.workspace.client.editor.TextEditor;
@@ -58,7 +59,7 @@
public DocumentClientTool create() {
return new DocumentClientTool(i18n, $(ToolSelector.class), $(WsThemePresenter.class),
$(WorkspaceSkeleton.class), $$(DocumentContext.class), $(ContextNavigator.class),
- $(Session.class), $(StateManager.class), $$(ContentServiceAsync.class));
+ $(Session.class), $(StateManager.class), $$(ContentServiceAsync.class), $$(FileUploader.class));
}
});
Modified: trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/docs/client/DocumentClientTool.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -32,6 +32,7 @@
import org.ourproject.kune.platf.client.state.StateManager;
import org.ourproject.kune.platf.client.tool.AbstractClientTool;
import org.ourproject.kune.platf.client.tool.ToolSelector;
+import org.ourproject.kune.platf.client.ui.dialogs.FileUploader;
import org.ourproject.kune.workspace.client.ctxnav.ContextNavigator;
import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
import org.ourproject.kune.workspace.client.site.Site;
@@ -44,20 +45,28 @@
public class DocumentClientTool extends AbstractClientTool {
public static final String TYPE_ROOT = "docs.root";
public static final String TYPE_FOLDER = "docs.folder";
+ public static final String TYPE_GALLERY = "docs.gallery";
+ public static final String TYPE_BLOG = "docs.blog";
public static final String TYPE_DOCUMENT = "docs.doc";
+ public static final String TYPE_POST = "docs.post";
+ public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
+
public static final String NAME = "docs";
+
private final Provider<DocumentContext> documentContextProvider;
private final ContextNavigator contextNavigator;
private final StateManager stateManager;
private final I18nUITranslationService i18n;
private final Session session;
private final Provider<ContentServiceAsync> contentServiceProvider;
+ private final Provider<FileUploader> fileUploaderProvider;
public DocumentClientTool(final I18nUITranslationService i18n, final ToolSelector toolSelector,
final WsThemePresenter wsThemePresenter, final WorkspaceSkeleton ws,
final Provider<DocumentContext> documentContextProvider, final ContextNavigator contextNavigator,
final Session session, final StateManager stateManager,
- final Provider<ContentServiceAsync> contentServiceProvider) {
+ final Provider<ContentServiceAsync> contentServiceProvider,
+ final Provider<FileUploader> fileUploaderProvider) {
super(NAME, i18n.t("documents"), toolSelector, wsThemePresenter, ws);
this.i18n = i18n;
this.documentContextProvider = documentContextProvider;
@@ -65,8 +74,10 @@
this.session = session;
this.stateManager = stateManager;
this.contentServiceProvider = contentServiceProvider;
+ this.fileUploaderProvider = fileUploaderProvider;
createActions();
registerDragDropTypes();
+ registerImageTypes();
}
public String getName() {
@@ -142,8 +153,7 @@
session.getCurrentState().getGroup().getShortName(), token.getDocument(),
new AsyncCallbackSimple<String>() {
public void onSuccess(final String result) {
- final StateToken parent = token.clone();
- parent.setDocument(null);
+ final StateToken parent = token.clone().setDocument(null);
stateManager.gotoToken(parent);
}
});
@@ -182,16 +192,31 @@
refresh.setIconUrl("images/nav/refresh.png");
refresh.setToolTip(i18n.t("Refresh"));
+ final ActionDescriptor<StateToken> uploadFile = new ActionDescriptor<StateToken>(AccessRolDTO.Editor,
+ ActionPosition.bootombarAndItemMenu, new Slot<StateToken>() {
+ public void onEvent(final StateToken token) {
+ fileUploaderProvider.get().show();
+ }
+ });
+ uploadFile.setTextDescription(i18n.t("Upload file"));
+ uploadFile.setIconUrl("images/nav/upload.png");
+ uploadFile.setToolTip(i18n.t("Upload some files (images, PDFs, etc)"));
+
contextNavigator.addAction(TYPE_FOLDER, go);
contextNavigator.addAction(TYPE_FOLDER, addDoc);
contextNavigator.addAction(TYPE_FOLDER, addFolder);
contextNavigator.addAction(TYPE_FOLDER, delContainer);
contextNavigator.addAction(TYPE_FOLDER, rename);
contextNavigator.addAction(TYPE_FOLDER, refresh);
+ contextNavigator.addAction(TYPE_FOLDER, uploadFile);
+ contextNavigator.addAction(TYPE_BLOG, uploadFile);
+ contextNavigator.addAction(TYPE_GALLERY, uploadFile);
+
contextNavigator.addAction(TYPE_ROOT, addDoc);
contextNavigator.addAction(TYPE_ROOT, addFolder);
contextNavigator.addAction(TYPE_ROOT, refresh);
+ contextNavigator.addAction(TYPE_ROOT, uploadFile);
contextNavigator.addAction(TYPE_DOCUMENT, go);
contextNavigator.addAction(TYPE_DOCUMENT, delContent);
@@ -202,9 +227,18 @@
private void registerDragDropTypes() {
contextNavigator.registerDraggableType(TYPE_DOCUMENT);
contextNavigator.registerDraggableType(TYPE_FOLDER);
+ contextNavigator.registerDraggableType(TYPE_UPLOADEDFILE);
+
contextNavigator.registerDroppableType(TYPE_ROOT);
contextNavigator.registerDroppableType(TYPE_FOLDER);
- contextNavigator.registerDroppableType(TYPE_DOCUMENT);
+ contextNavigator.registerDroppableType(TYPE_GALLERY);
}
+ private void registerImageTypes() {
+ contextNavigator.registerContentTypeIcon(TYPE_BLOG, "images/nav/blog.png");
+ contextNavigator.registerContentTypeIcon(TYPE_GALLERY, "images/nav/gallery.png");
+ contextNavigator.registerContentTypeIcon(TYPE_DOCUMENT, "images/nav/page.png");
+ contextNavigator.registerContentTypeIcon(TYPE_POST, "images/nav/post.png");
+ }
+
}
Modified: trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/docs/server/DocumentServerTool.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -37,7 +37,12 @@
public class DocumentServerTool implements ServerTool {
public static final String TYPE_ROOT = "docs.root";
public static final String TYPE_FOLDER = "docs.folder";
+ public static final String TYPE_GALLERY = "docs.gallery";
+ public static final String TYPE_BLOG = "docs.blog";
public static final String TYPE_DOCUMENT = "docs.doc";
+ public static final String TYPE_POST = "docs.post";
+ public static final String TYPE_UPLOADEDFILE = "docs.uploaded";
+
public static final String NAME = "docs";
public static final String ROOT_NAME = "documents";
Modified: trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/services/KuneModule.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -26,6 +26,8 @@
import org.ourproject.kune.platf.client.tool.ToolSelector;
import org.ourproject.kune.platf.client.tool.ToolSelectorPresenter;
import org.ourproject.kune.platf.client.ui.QuickTipsHelper;
+import org.ourproject.kune.platf.client.ui.dialogs.FileUploader;
+import org.ourproject.kune.platf.client.ui.dialogs.FileUploaderDialog;
import org.ourproject.kune.platf.client.ui.rate.RateIt;
import org.ourproject.kune.platf.client.ui.rate.RateItPanel;
import org.ourproject.kune.platf.client.ui.rate.RateItPresenter;
@@ -593,6 +595,13 @@
}
});
+ register(SingletonScope.class, new Factory<FileUploader>(FileUploader.class) {
+ public FileUploader create() {
+ final FileUploaderDialog panel = new FileUploaderDialog(i18n, ws);
+ return panel;
+ }
+ });
+
install(ProviderRegisterStrategy.registerOnlyIfNotRegistered, new EmiteUIModule(), new DocumentClientModule(),
new ChatClientModule());
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploader.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,11 @@
+package org.ourproject.kune.platf.client.ui.dialogs;
+
+public interface FileUploader {
+
+ void hide();
+
+ void setPermittedExtensions(String[] extensions);
+
+ void show();
+
+}
Added: trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/platf/client/ui/dialogs/FileUploaderDialog.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -0,0 +1,71 @@
+package org.ourproject.kune.platf.client.ui.dialogs;
+
+import org.ourproject.kune.workspace.client.i18n.I18nUITranslationService;
+import org.ourproject.kune.workspace.client.site.Site;
+import org.ourproject.kune.workspace.client.skel.WorkspaceSkeleton;
+
+import com.gwtext.client.core.EventObject;
+import com.gwtext.client.widgets.Button;
+import com.gwtext.client.widgets.ToolbarButton;
+import com.gwtext.client.widgets.event.ButtonListenerAdapter;
+import com.gwtextux.client.widgets.upload.UploadDialog;
+import com.gwtextux.client.widgets.upload.UploadDialogListenerAdapter;
+
+public class FileUploaderDialog implements FileUploader {
+
+ private static final String URL = "/services/fileupload";
+
+ private final UploadDialog dialog;
+ private ToolbarButton traybarButton;
+ private final I18nUITranslationService i18n;
+ private final WorkspaceSkeleton ws;
+
+ public FileUploaderDialog(final I18nUITranslationService i18n, final WorkspaceSkeleton ws) {
+ this.i18n = i18n;
+ this.ws = ws;
+ dialog = new UploadDialog(i18n.t("File uploader"), false, true);
+ dialog.addListener(new UploadDialogListenerAdapter() {
+ @Override
+ public void onUploadComplete(final UploadDialog source) {
+ Site.info(i18n.t("Upload completed"));
+ // traybarButton.destroy();
+ // traybarButton = null;
+ }
+ });
+ dialog.setUrl(URL);
+
+ // final UrlParam param[] = new UrlParam[2];
+ // param[0] = new UrlParam("name1", "value1");
+ // param[1] = new UrlParam("name2", "value2");
+ // dialog.setBaseParams(param);
+ // dialog.setPostVarName("myvar");
+ }
+
+ public void hide() {
+ dialog.hide();
+ }
+
+ public void setPermittedExtensions(final String[] extensions) {
+ dialog.setPermittedExtensions(extensions);
+ }
+
+ public void show() {
+ if (traybarButton == null) {
+ traybarButton = new ToolbarButton();
+ traybarButton.setTooltip(i18n.t("Show/hide uploader window"));
+ traybarButton.setIcon("images/nav/upload.png");
+ traybarButton.addListener(new ButtonListenerAdapter() {
+ @Override
+ public void onClick(final Button button, final EventObject e) {
+ if (dialog.isVisible()) {
+ dialog.hide();
+ } else {
+ dialog.show();
+ }
+ }
+ });
+ ws.getSiteTraybar().addButton(traybarButton);
+ }
+ dialog.show();
+ }
+}
Modified: trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerDefault.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerDefault.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/platf/server/manager/impl/FileUploadManagerDefault.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -1,21 +1,41 @@
package org.ourproject.kune.platf.server.manager.impl;
+import java.io.File;
import java.util.HashMap;
+import java.util.Map;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.cafesip.gwtcomp.server.FileUploadAction;
import org.cafesip.gwtcomp.server.FormResponse;
public class FileUploadManagerDefault implements FileUploadAction {
+ public static final Log log = LogFactory.getLog(FileUploadManagerDefault.class);
+ private HashMap<String, File> files;
+
public FormResponse onSubmit(final HttpServlet servlet, final HttpServletRequest request) {
- return new FormResponse(200, "", false);
+ for (final Map.Entry<String, File> entry : files.entrySet()) {
+ log.info("file uploaded: " + entry.getKey());
+ }
+ /**
+ * Server side handler.
+ *
+ * The files in the queue are posted one at a time, the file field name
+ * is 'file'. The handler should return json encoded object with
+ * following properties: { success: true|false, // required error:
+ * 'Error or success message' // optional, also can be named 'message' }
+ */
+ return new FormResponse(HttpServletResponse.SC_OK, "{success: true, error: ''}", false);
}
- @SuppressWarnings("unchecked")
- public void setFileList(final HashMap files) {
+ public void setFileList(final HashMap<String, File> files) {
+ log.info("Setting files");
+ this.files = files;
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigator.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -33,6 +33,8 @@
View getView();
+ void registerContentTypeIcon(String contentTypeId, String iconUrl);
+
void registerDraggableType(String typeId);
void registerDroppableType(String typeId);
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/ctxnav/ContextNavigatorPresenter.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -56,6 +56,7 @@
private final HashMap<String, ActionCollection<StateToken>> actions;
private final ArrayList<String> draggables;
private final ArrayList<String> droppables;
+ private final HashMap<String, String> contentTypesIcons;
public ContextNavigatorPresenter(final StateManager stateManager, final Session session,
final Provider<ContentServiceAsync> contentServiceProvider, final I18nUITranslationService i18n) {
@@ -66,6 +67,7 @@
actions = new HashMap<String, ActionCollection<StateToken>>();
draggables = new ArrayList<String>();
droppables = new ArrayList<String>();
+ contentTypesIcons = new HashMap<String, String>();
}
public void addAction(final String contentTypeId, final ActionDescriptor<StateToken> action) {
@@ -125,6 +127,10 @@
});
}
+ public void registerContentTypeIcon(final String contentTypeId, final String iconUrl) {
+ contentTypesIcons.put(contentTypeId, iconUrl);
+ }
+
public void registerDraggableType(final String type) {
draggables.add(type);
}
@@ -172,7 +178,9 @@
final ActionCollection<StateToken> bottomActions = new ActionCollection<StateToken>();
boolean add = false;
- for (final ActionDescriptor<StateToken> action : actions.get(state.getTypeId())) {
+ final String contentId = state.getTypeId();
+
+ for (final ActionDescriptor<StateToken> action : actions.get(contentId)) {
switch (action.getAccessRol()) {
case Administrator:
add = rights.isAdministrable();
@@ -206,20 +214,21 @@
view.setTopActions(stateToken, topActions);
view.setBottomActions(stateToken, bottomActions);
- final ContextNavigatorItem item = new ContextNavigatorItem(treeId, containerTreeId, "images/nav/page.png",
- state.getTitle(), visible ? ContentStatusDTO.publicVisible : ContentStatusDTO.nonPublicVisible,
- stateToken, isDraggable(state.getTypeId(), rights.isAdministrable()), isDroppable(state.getTypeId(),
- rights.isAdministrable()), itemActions);
+ final ContextNavigatorItem item = new ContextNavigatorItem(treeId, containerTreeId,
+ getContentTypeIcon(contentId), state.getTitle(), visible ? ContentStatusDTO.publicVisible
+ : ContentStatusDTO.nonPublicVisible, stateToken, isDraggable(contentId, rights
+ .isAdministrable()), isDroppable(contentId, rights.isAdministrable()), itemActions);
view.addItem(item);
for (final ContentDTO content : container.getContents()) {
final StateToken siblingToken = stateToken.clone().setDocument(content.getId().toString());
final StateToken siblingParentToken = stateToken.clone().setDocument(null);
// TODO: rights not correct
+ final String contentTypeId = content.getTypeId();
final ContextNavigatorItem sibling = new ContextNavigatorItem(genId(siblingToken),
- genId(siblingParentToken), "images/nav/page.png", content.getTitle(),
- ContentStatusDTO.publicVisible, siblingToken, isDraggable(content.getTypeId(), rights
- .isAdministrable()), isDroppable(content.getTypeId(), rights.isAdministrable()), null);
+ genId(siblingParentToken), getContentTypeIcon(contentTypeId), content.getTitle(),
+ ContentStatusDTO.publicVisible, siblingToken, isDraggable(contentTypeId, rights.isAdministrable()),
+ isDroppable(contentTypeId, rights.isAdministrable()), null);
view.addItem(sibling);
}
@@ -230,15 +239,22 @@
final StateToken siblingParentToken = stateToken.clone().setDocument(null).setFolder(
siblingFolder.getParentFolderId().toString());
// TODO: rights not correct
+ final String containerTypeId = container.getTypeId();
final ContextNavigatorItem sibling = new ContextNavigatorItem(genId(siblingToken),
- genId(siblingParentToken), "", siblingFolder.getName(), ContentStatusDTO.publicVisible,
- siblingToken, isDraggable(container.getTypeId(), rights.isAdministrable()), isDroppable(container
- .getTypeId(), rights.isAdministrable()), null);
+ genId(siblingParentToken), getContentTypeIcon(containerTypeId), siblingFolder.getName(),
+ ContentStatusDTO.publicVisible, siblingToken,
+ isDraggable(containerTypeId, rights.isAdministrable()), isDroppable(containerTypeId, rights
+ .isAdministrable()), null);
view.addItem(sibling);
}
view.selectItem(treeId);
}
+ private void addItem(final String title, final String contentTypeId, final StateToken token,
+ final AccessRightsDTO rights) {
+
+ }
+
private void createTreePath(final StateToken state, final ContainerSimpleDTO[] absolutePath) {
for (int i = 0; i < absolutePath.length; i++) {
final ContainerSimpleDTO folder = absolutePath[i];
@@ -249,8 +265,8 @@
if (folder.getParentFolderId() != null) {
// Bad rights, draggable/droppable
final ContextNavigatorItem parent = new ContextNavigatorItem(genId(folderStateToken),
- genId(parentStateToken), "", folder.getName(), ContentStatusDTO.publicVisible,
- folderStateToken, false, true, null);
+ genId(parentStateToken), getContentTypeIcon(folder.getTypeId()), folder.getName(),
+ ContentStatusDTO.publicVisible, folderStateToken, false, true, null);
view.addItem(parent);
} else {
// create root folder
@@ -263,6 +279,12 @@
return "k-" + token.toString().replace(StateToken.SEPARATOR, "-");
}
+ private String getContentTypeIcon(final String typeId) {
+ final String icon = contentTypesIcons.get(typeId);
+ // TODO Auto-generated method stub
+ return icon == null ? "" : icon;
+ }
+
private boolean isDraggable(final String typeId, final boolean administrable) {
return administrable && draggables.contains(typeId);
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/signin/SignInPresenter.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -35,6 +35,7 @@
import org.ourproject.kune.workspace.client.site.Site;
import org.ourproject.kune.workspace.client.site.rpc.UserServiceAsync;
+import com.allen_sauer.gwt.log.client.Log;
import com.calclab.emite.client.im.roster.RosterManager.SubscriptionMode;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -171,8 +172,7 @@
view.setSignInMessage(i18n.t("Incorrect nickname/email or password"), SiteErrorType.error);
} catch (final Throwable e) {
view.setSignInMessage("Error in login", SiteErrorType.error);
- GWT.log("Other kind of exception in LoginFormPresenter/doLogin", null);
- throw new RuntimeException();
+ Log.error("Other kind of exception in LoginFormPresenter/doLogin");
}
}
Modified: trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java
===================================================================
--- trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-09-08 01:52:25 UTC (rev 864)
+++ trunk/src/main/java/org/ourproject/kune/workspace/client/socialnet/SocialNetworkPresenter.java 2008-09-09 18:00:21 UTC (rev 865)
@@ -126,7 +126,7 @@
});
unJoinButton = new GridButton("images/del.gif", i18n.t("Unjoin"), i18n
- .t("Don't participate more as a member in this group"), new Slot<String>() {
+ .t("Don't participate more in this group"), new Slot<String>() {
public void onEvent(final String parameter) {
removeMemberAction();
}
More information about the kune-commits
mailing list