?? ext.ux.uploaddialog.packed.js
字號:
"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 json_response = Ext.util.JSON.decode(response.responseText)
} 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 : "上傳文件",
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 : "已經被用戶中斷"
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -