提交 0f873b4c 编写于 作者: S st

[widget]附件上传增加accept属性

上级 92d46b93
o2.widget = o2.widget || {}; o2.widget = o2.widget || {};
o2.widget.Upload = new Class({ o2.widget.Upload = new Class({
Extends: o2.widget.Common, Extends: o2.widget.Common,
Implements: [Options, Events], Implements: [Options, Events],
options: { options: {
"data": null, "data": null,
"parameter": null, "parameter": null,
"action": null, "action": null,
"accept" : "*/*",
"method": "", "method": "",
"style": "default", "style": "default",
"multiple": true "multiple": true
}, },
initialize: function(container, options){ initialize: function(container, options){
this.setOptions(options); this.setOptions(options);
this.path = o2.session.path+"/widget/$Upload/"; this.path = o2.session.path+"/widget/$Upload/";
this.cssPath = o2.session.path+"/widget/$Upload/"+this.options.style+"/css.wcss"; this.cssPath = o2.session.path+"/widget/$Upload/"+this.options.style+"/css.wcss";
this._loadCss(); this._loadCss();
this.container = $(container); this.container = $(container);
this.action = (typeOf(this.options.action)=="string") ? o2.Actions.get(this.options.action).action : this.options.action; this.action = (typeOf(this.options.action)=="string") ? o2.Actions.get(this.options.action).action : this.options.action;
}, },
load: function(){ load: function(){
if (FormData.expiredIE){ if (FormData.expiredIE){
this.doUpload_InputFile(); this.doUpload_InputFile();
...@@ -42,7 +43,7 @@ o2.widget.Upload = new Class({ ...@@ -42,7 +43,7 @@ o2.widget.Upload = new Class({
formData_CreateUploadArea: function(){ formData_CreateUploadArea: function(){
if (!this.uploadFileAreaNode){ if (!this.uploadFileAreaNode){
this.uploadFileAreaNode = new Element("div"); this.uploadFileAreaNode = new Element("div");
var html = "<input name=\"file\" "+((this.options.multiple) ? "multiple": "")+" type=\"file\" accept=\"*/*\"/>"; var html = "<input name=\"file\" "+((this.options.multiple) ? "multiple": "")+" accept=\""+ this.options.accept +"\"/>";
this.uploadFileAreaNode.set("html", html); this.uploadFileAreaNode.set("html", html);
this.fileUploadNode = this.uploadFileAreaNode.getFirst(); this.fileUploadNode = this.uploadFileAreaNode.getFirst();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册