/**
* 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
);
this.input_file.setOpacity(0.0);
没有合适的资源?快使用搜索试试~ 我知道了~
批量上传图片EXT框架
共38个文件
jpg:11个
gif:11个
js:4个
4星 · 超过85%的资源 需积分: 50 80 下载量 32 浏览量
2008-12-31
11:10:43
上传
评论
收藏 408KB RAR 举报
温馨提示
批量上传图片EXT框架x来自17EXT.com
资源推荐
资源详情
资源评论
收起资源包目录
ExtUploadAndDeleteImages.rar (38个子文件)
ExtUploadAndDeleteImages
DataView.aspx.cs 457B
Upload
zack_hat.jpg 2KB
zack_sink6.jpg 2KB
zack_sink2.jpg 2KB
zack_Winter.jpg 103KB
zack_sink4.jpg 2KB
zack_dress.jpg 3KB
zack_sink.jpg 2KB
zack_sink1.jpg 2KB
zack_sink5.jpg 2KB
zack_sink3.jpg 2KB
Thumbs.db 62KB
zack_grill.jpg 3KB
DeleteImages.aspx 140B
UploadS.aspx.cs 2KB
DataView.aspx 11KB
Ext.ux.UploadDialog
Ext.ux.UploadDialog.packed.js 30KB
UploadDialog
css
Ext.ux.UploadDialog.css 2KB
Ext.ux.UploadDialog.js 42KB
Ext.ux.UploadDialog.packed.js 26KB
dox
automata-protocol.dia 4KB
automata-protocol.jpeg 318KB
images
done.gif 133B
file-add.gif 197B
file-uploading.gif 1KB
check.gif 581B
file-remove.gif 177B
loading.gif 771B
upload-start.gif 580B
upload-stop.gif 1KB
uncheck.gif 559B
reset.gif 545B
failed.gif 990B
locale
ru.utf-8.js 2KB
DataViewImages.aspx 119B
DataViewImages.aspx.cs 2KB
UploadS.aspx 111B
DeleteImages.aspx.cs 1KB
共 38 条
- 1
资源评论
- yxclub2011-10-20好像要net 3.5下才能运行..
- 李凯鹏2012-12-16好像不好用啊 怎么不写写使用方法啊 让我们新手情何以堪啊
hnzyhua
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功