|
|
@@ -27,6 +27,9 @@ Ext.define('school.view.core.form.field.FileField', {
|
|
|
bodyStyle: 'padding:2px;background:#f7f7f7',
|
|
|
layout: 'hbox',
|
|
|
items: [{
|
|
|
+ xtype: 'hidden',
|
|
|
+ name: 'value'
|
|
|
+ }, {
|
|
|
xtype: 'filefield',
|
|
|
name: 'file',
|
|
|
cls:'x-form-filefield',
|
|
|
@@ -36,17 +39,6 @@ Ext.define('school.view.core.form.field.FileField', {
|
|
|
buttonConfig:{
|
|
|
cls:'x-filefield-button'
|
|
|
},
|
|
|
- createFileInput : function() {
|
|
|
- var me = this;
|
|
|
- me.fileInputEl = me.button.el.createChild({
|
|
|
- name: me.getName(),
|
|
|
- cls: Ext.baseCSSPrefix + 'form-file-input',
|
|
|
- tag: 'input',
|
|
|
- type: 'file',
|
|
|
- multiple:'multiple',
|
|
|
- size: 1
|
|
|
- }).on('change', me.onFileChange, me);
|
|
|
- },
|
|
|
listeners: {
|
|
|
change: function(field){
|
|
|
if(!!field.value){
|
|
|
@@ -58,12 +50,23 @@ Ext.define('school.view.core.form.field.FileField', {
|
|
|
}],
|
|
|
setValue: function(value){
|
|
|
this.value = value;
|
|
|
- this.dirty = true;
|
|
|
+ this.getValueField().setValue(value);
|
|
|
this.publishState('value', value);
|
|
|
},
|
|
|
- getValue: function (){
|
|
|
- return this.down('hidden').value;
|
|
|
- },
|
|
|
+ getValue: function() {
|
|
|
+ return this.getValueField().value;
|
|
|
+ },
|
|
|
+
|
|
|
+ getValueField: function () {
|
|
|
+ return this.items.items[0].items.items[0];
|
|
|
+ },
|
|
|
+
|
|
|
+ isValid: function () {
|
|
|
+ return this.getValueField().isValid();
|
|
|
+ },
|
|
|
+ isDirty: function () {
|
|
|
+ return this.getValueField().isDirty();
|
|
|
+ },
|
|
|
renderMF: function(f){
|
|
|
f.setHtml(null);
|
|
|
var form = f.ownerCt;
|
|
|
@@ -228,11 +231,5 @@ Ext.define('school.view.core.form.field.FileField', {
|
|
|
var arr=['php','php2','php3', 'php5', 'phtml', 'asp', 'aspx', 'ascx', 'jsp', 'cfm', 'cfc', 'pl','pl','bat', 'dll', 'reg', 'cgi','war'];
|
|
|
var suffix=fileName.substring(fileName.lastIndexOf(".")+1);
|
|
|
return Ext.Array.contains(arr,suffix);
|
|
|
- },
|
|
|
- isValid:function(){
|
|
|
- return true;
|
|
|
- },
|
|
|
- isDirty:function(){
|
|
|
- return this.dirty;
|
|
|
}
|
|
|
});
|