diff --git a/JSD-8501-需求确认书V1.docx b/JSD-8501-需求确认书V1.docx new file mode 100644 index 0000000..36d47d2 Binary files /dev/null and b/JSD-8501-需求确认书V1.docx differ diff --git a/README.md b/README.md index ad94609..83ce427 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ # open-JSD-8501 -JSD-8501 文件控件功能加强 \ No newline at end of file +JSD-8501 文件控件功能加强\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系hugh处理。 \ No newline at end of file diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar new file mode 100644 index 0000000..546f2f5 Binary files /dev/null and b/lib/finekit-10.0.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..80c9a9e --- /dev/null +++ b/plugin.xml @@ -0,0 +1,22 @@ + + com.fr.plugin.third.party.jsdifab + + yes + 0.1 + 10.0 + 2019-01-01 + fr.open + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileCellWidgetOptionProvider.java b/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileCellWidgetOptionProvider.java new file mode 100644 index 0000000..fe11d86 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileCellWidgetOptionProvider.java @@ -0,0 +1,30 @@ +package com.fr.plugin.third.party.jsdifab.cell; + +import com.fanruan.api.design.DesignKit; +import com.fr.design.beans.BasicBeanPane; +import com.fr.design.fun.impl.AbstractCellWidgetOptionProvider; +import com.fr.form.ui.Widget; +import com.fr.plugin.third.party.jsdifab.parameter.CustomMultiFileEditor; + +public class CustomMultiFileCellWidgetOptionProvider extends AbstractCellWidgetOptionProvider { + @Override + public Class classForWidget() { + return CustomMultiFileEditor.class; + } + + @Override + public Class> appearanceForWidget() { + return CustomMultiFileEditorPane.class; + } + + @Override + public String iconPathForWidget() { + return "com/fr/plugin/third/party/jsdifab/images/files_up.png"; + } + + @Override + public String nameForWidget() { + return DesignKit.i18nText("Fine-Design_Basic_Widget_Type_File")+"++"; + } +} + diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileEditorPane.java b/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileEditorPane.java new file mode 100644 index 0000000..121dfdc --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/cell/CustomMultiFileEditorPane.java @@ -0,0 +1,124 @@ +package com.fr.plugin.third.party.jsdifab.cell; + +import com.fanruan.api.log.LogKit; +import com.fr.design.gui.icheckbox.UICheckBox; +import com.fr.design.gui.icombobox.DictionaryComboBox; +import com.fr.design.gui.icombobox.DictionaryConstants; +import com.fr.design.gui.ilable.UILabel; +import com.fr.design.gui.ispinner.UISpinner; +import com.fr.design.i18n.Toolkit; +import com.fr.design.layout.TableLayoutHelper; +import com.fr.design.utils.gui.UIComponentUtils; +import com.fr.design.widget.ui.FieldEditorDefinePane; +import com.fr.plugin.context.PluginContexts; +import com.fr.plugin.third.party.jsdifab.parameter.CustomMultiFileEditor; +import com.fr.stable.ArrayUtils; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; + +public class CustomMultiFileEditorPane extends FieldEditorDefinePane { + private DictionaryComboBox acceptType; + private UICheckBox singleFileCheckBox; + private UISpinner fileSizeField; + + public CustomMultiFileEditorPane() { + this.initComponents(); + } + + protected String title4PopupWindow() { + return "file"; + } + + protected JPanel setFirstContentPane() { + JPanel var1 = new JPanel(new BorderLayout()); + this.singleFileCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Report_Single_File_Upload")); + UIComponentUtils.setLineWrap(this.singleFileCheckBox); + this.singleFileCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); + //this.acceptType = new DictionaryComboBox(DictionaryConstants.acceptTypes, DictionaryConstants.fileTypeDisplays); + //this.acceptType.setEditable(true); + //jpg,jpeg,png + String[] tempAcceptTypes = ArrayUtils.addAll(DictionaryConstants.acceptTypes, new String[]{"jpg|jpeg|png"}); + String[] tempFileTypeDisplays = ArrayUtils.addAll(DictionaryConstants.fileTypeDisplays, new String[]{"jpg,jpeg,png"}); + + if (!PluginContexts.currentContext().isAvailable()) { + LogKit.error("文件控件加强版许可证过期"); + tempAcceptTypes = DictionaryConstants.acceptTypes; + tempFileTypeDisplays = DictionaryConstants.fileTypeDisplays; + } + this.acceptType = new DictionaryComboBox(tempAcceptTypes, tempFileTypeDisplays); + + this.acceptType.addKeyListener(new KeyListener() { + @Override + public void keyTyped(KeyEvent e) { + //必须加这个,否则自定义下拉框的值,会不保存 + doChangeOfAcceptType(); + } + + @Override + public void keyPressed(KeyEvent e) { + + } + + @Override + public void keyReleased(KeyEvent e) { + + } + }); + this.acceptType.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + //必须加这个,否则自定义下拉框的值,会不保存 + doChangeOfAcceptType(); + } + }); + + + this.fileSizeField = new UISpinner(0.0D, 2.147483647E9D, 1.0D, -1.0D); + this.fileSizeField.setPreferredSize(new Dimension(140, 20)); + JPanel var2 = new JPanel(new BorderLayout()); + UILabel var3 = new UILabel(Toolkit.i18nText("Fine-Design_Report_Utils_File_Type")); + UILabel var4 = new UILabel(Toolkit.i18nText("Fine-Design_Report_Size_Limit")); + var2.add(this.fileSizeField, "Center"); + var2.add(new UILabel(" KB"), "East"); + double var5 = -1.0D; + double var7 = -2.0D; + Component[][] var9 = new Component[][]{{this.singleFileCheckBox, null}, {var3, this.acceptType}, {var4, var2}}; + double[] var10 = new double[]{var7, var7, var7}; + double[] var11 = new double[]{var7, var5}; + int[][] var12 = new int[][]{{1, 1}, {1, 1}, {1, 1}}; + JPanel var13 = TableLayoutHelper.createGapTableLayoutPane(var9, var10, var11, var12, 25.0D, 10.0D); + var1.add(var13, "Center"); + return var1; + } + + private void doChangeOfAcceptType() { + //必须加这个,否则自定义下拉框的值,会不保存 + if (this.acceptType.getUiObserverListener() != null) { + this.acceptType.getUiObserverListener().doChange(); + } + } + + protected void populateSubFieldEditorBean(CustomMultiFileEditor var1) { + this.acceptType.setSelectedItem(var1.getAccept()); + this.singleFileCheckBox.setSelected(var1.isSingleFile()); + this.fileSizeField.setValue(var1.getMaxSize()); + } + + protected CustomMultiFileEditor updateSubFieldEditorBean() { + CustomMultiFileEditor var1 = new CustomMultiFileEditor(); + //this.acceptType.getSelectedItem() 只能获取到上一次的值 + String acceptTypeValue = this.acceptType.getEditor().getItem().toString(); + var1.setAccept(acceptTypeValue); + System.out.println("updateSubFieldEditorBean"); + System.out.println(var1.getAccept()); + var1.setSingleFile(this.singleFileCheckBox.isSelected()); + var1.setMaxSize(this.fileSizeField.getValue()); + return var1; + } +} + diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileEditor.java b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileEditor.java new file mode 100644 index 0000000..0940352 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileEditor.java @@ -0,0 +1,35 @@ +package com.fr.plugin.third.party.jsdifab.parameter; + +import com.fr.form.ui.MultiFileEditor; +import com.fr.general.ComparatorUtils; +import com.fr.stable.xml.XMLPrintWriter; +import com.fr.stable.xml.XMLableReader; + +public class CustomMultiFileEditor extends MultiFileEditor { + + @Override + public String getXType() { + //return "multifile_jsd5094" ; + return super.getXType(); + } + + public void readXML(XMLableReader var1) { + super.readXML(var1); + + + } + + public void writeXML(XMLPrintWriter var1) { + super.writeXML(var1); + + } + + public boolean equals(Object var1) { + if (!(var1 instanceof CustomMultiFileEditor)) { + return false; + } else { + return super.equals(var1) && ComparatorUtils.equals(((CustomMultiFileEditor)var1).getAccept(), this.getAccept()) && this.getMaxLength() == ((CustomMultiFileEditor)var1).getMaxLength(); + } + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileWidgetOptionProvider.java b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileWidgetOptionProvider.java new file mode 100644 index 0000000..205adf7 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/CustomMultiFileWidgetOptionProvider.java @@ -0,0 +1,27 @@ +package com.fr.plugin.third.party.jsdifab.parameter; + +import com.fanruan.api.design.DesignKit; +import com.fr.design.fun.impl.AbstractFormWidgetOptionProvider; + +public class CustomMultiFileWidgetOptionProvider extends AbstractFormWidgetOptionProvider { + @Override + public Class classForWidget() { + return CustomMultiFileEditor.class; + } + + @Override + public Class appearanceForWidget() { + return XCustomMultiFileUploader.class; + } + + @Override + public String iconPathForWidget() { + return "com/fr/plugin/third/party/jsdifab/images/files_up.png"; + } + + @Override + public String nameForWidget() { + return DesignKit.i18nText("Fine-Design_Basic_Widget_Type_File")+"++"; + } +} + diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/XCustomMultiFileUploader.java b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/XCustomMultiFileUploader.java new file mode 100644 index 0000000..2693998 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/parameter/XCustomMultiFileUploader.java @@ -0,0 +1,23 @@ +package com.fr.plugin.third.party.jsdifab.parameter; + +import com.fr.design.designer.creator.XMultiFileUploader; + +import java.awt.*; + +public class XCustomMultiFileUploader extends XMultiFileUploader { + + public XCustomMultiFileUploader(CustomMultiFileEditor editor, Dimension dimension) { + super(editor, dimension); + } + + @Override + public String getIconPath() { + return "/com/fr/plugin/third/party/jsdifab/images/files_up.png"; + } + + @Override + protected String getIconName() { + return "/com/fr/plugin/third/party/jsdifab/images/files_up.png"; + } +} + diff --git a/src/main/java/com/fr/plugin/third/party/jsdifab/web/ResourceJavaScriptFileHandler.java b/src/main/java/com/fr/plugin/third/party/jsdifab/web/ResourceJavaScriptFileHandler.java new file mode 100644 index 0000000..654faa2 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdifab/web/ResourceJavaScriptFileHandler.java @@ -0,0 +1,23 @@ +package com.fr.plugin.third.party.jsdifab.web; + +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.plugin.context.PluginContexts; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.stable.fun.Authorize; +import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler; + +@EnableMetrics +@Authorize(callSignKey = "com.fr.plugin.third.party.jsdifab") +public class ResourceJavaScriptFileHandler extends AbstractJavaScriptFileHandler { + @Override + @Focus(id = "com.fr.plugin.third.party.jsdifab", text = "plugin-jsd-ifab", source = Original.PLUGIN) + public String[] pathsForFiles() { + if (!PluginContexts.currentContext().isAvailable()) { + return new String[]{}; + } + return new String[]{ + "/com/fr/plugin/third/party/jsdifab/web/jsdifab.js" + }; + } +} \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/third/party/jsdifab/images/files_up.png b/src/main/resources/com/fr/plugin/third/party/jsdifab/images/files_up.png new file mode 100644 index 0000000..d52c19e Binary files /dev/null and b/src/main/resources/com/fr/plugin/third/party/jsdifab/images/files_up.png differ diff --git a/src/main/resources/com/fr/plugin/third/party/jsdifab/web/jsdifab.js b/src/main/resources/com/fr/plugin/third/party/jsdifab/web/jsdifab.js new file mode 100644 index 0000000..8a96b86 --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdifab/web/jsdifab.js @@ -0,0 +1,363 @@ +;(function (a) { + FR.CustomJsd5094MultiFileEditor = FR.extend(FR.BaseEditor, { + _defaultConfig: function () { + return a.extend(FR.CustomJsd5094MultiFileEditor.superclass._defaultConfig.apply(), { + width: 120, + height: 20, + render: true, + showViewImage: true + }) + }, _init: function () { + FR.$defaultImport("/com/fr/web/core/js/noswfupload.js", "js"); + FR.$defaultImport("/com/fr/web/core/css/widget/noswfupload-icons.css", "css"); + FR.CustomJsd5094MultiFileEditor.superclass._init.apply(this, arguments); + var h = this.options; + var d = this; + this.$uploadForm = a('
').css("position", "relative").appendTo(this.element); + this.divWrap = a("
").css({ + "width": this.options.width + "px", + "height": this.options.height + "px", + "position": "relative", + "overflow": "hidden" + }).appendTo(this.$uploadForm); + this.$fileupload = a('').addClass("fr-fileupload").appendTo(this.divWrap); + if (h.maxlength !== 1) { + this.$fileupload[0].setAttribute("multiple", "multiple") + } + if (h.disabled) { + this.$fileupload[0].setAttribute("disabled", "disabled") + } + if (h.render === true) { + var e = Math.min(this.options.height, this.options.width); + var c = e > 32 ? 32 : e - 2; + var b = e > 32 ? 20 : e * 0.7; + this.$previewImage = a("").attr("src", FR.servletURL + "?op=resource&resource=/com/fr/web/images/file/upload.png").appendTo(this.divWrap).addClass("fr-fileupload-image").css({ + left: this.options.width > 32 ? (this.options.width - 32) / 2 : 0, + top: this.options.height > 32 ? (this.options.height - 32) / 2 : 0, + width: c, + height: c + }); + if (h.tooltipText) { + var g = a("").addClass("fr-fileupload-tooltipspan"); + this.tooltipDiv = a("
").css({ + left: c + 7 + "px", + height: c + "px" + }).append(g.text(h.tooltipText)).addClass("fr-fileupload-tooltip").appendTo(this.$uploadForm) + } + this.$preview = this.$previewImage; + if (d.options.maxlength !== 1) { + this.$previewCount = a('
').text(0).appendTo(this.divWrap).css({ + left: this.options.width > 32 ? (this.options.width - 32) / 2 + 22 : this.$previewImage.width() - 10, + top: this.options.height > 32 ? (this.options.height - 32) / 2 + 8 : 0, + width: b, + height: b, + "border-radius": b, + "font-size": b * 0.6 + }) + } + } else { + this.$preview = this.element + } + if (this.options.write) { + a(".fr-fileupload", d.element).css({ + "right": 0, + "font-size": d.element.height() < 100 ? "100px" : d.element.height() + "px", + "width": this.options.width, + "height": this.options.height + }) + } + this.wrap = noswfupload.wrap((this.$fileupload)[0], h.maxSize, h.maxlength, this.options.width, this.options.height); + var f = this.wrap; + f.onerror = function () { + noswfupload.text(this.dom.info, "WARNING: Unable to upload " + this.file.fileName) + }; + f.onloadstart = function (i, j) { + this.show(0, 0); + noswfupload.text(this.dom.info, "Preparing for upload ... ") + }; + f.onprogress = function (i, j) { + this.show((this.sent + i.loaded) * 100 / this.total, i.loaded * 100 / i.total); + noswfupload.text(this.dom.info, FR.i18nText("Fine-Engine_Basic_File_Uping_File") + ": " + this.file.fileName); + if (this.file.fileSize !== -1) { + if (i.simulation) { + noswfupload.text(this.dom.info, FR.i18nText("Fine-Engine_Basic_File_Uping_File") + ": " + this.file.fileName, FR.i18nText("Fine-Engine_Basic_File_All_File_Uploaded") + noswfupload.size(this.sent + i.loaded)) + } else { + noswfupload.text(this.dom.info, FR.i18nText("Fine-Engine_Basic_File_Uping_File") + ": " + this.file.fileName, FR.i18nText("Fine-Engine_Basic_File_Uploaded_File") + ": " + noswfupload.size(i.loaded), FR.i18nText("Fine-Engine_Basic_File_All_File_Uploaded") + noswfupload.size(this.sent + i.loaded)) + } + } else { + noswfupload.text(this.dom.info, "Uploading: " + this.file.fileName, "Sent: " + (this.sent / 100) + " out of " + (this.total / 100)) + } + }; + f.onerror = function () { + noswfupload.text(this.dom.info, "WARNING: Unable to upload " + this.file.fileName) + }; + f.onload = function (k, m) { + var l = this; + noswfupload.text(this.dom.info, "Upload complete"); + setTimeout(function () { + l.clean(); + l.hide(); + noswfupload.text(l.dom.info, ""); + d.fireEvent(FR.Events.AFTEREDIT) + }, 1000); + var j = ""; + _.each(d.wrap.attach_array, function (n) { + if (n.errorCode === 21300002) { + j += n.filename + " : " + FR.i18nText("Fine-Engine_Report_File_File_Too_Big") + f.maxSize + "KB; " + } else { + if (n.errorCode === 21300003) { + var o = f.fileType ? (FR.i18nText("Fine-Dec_Invalid_File_Type_To_Upload") + f.fileType) : FR.i18nText("Fine-Engine_Generic_Invalid_File_Type_Security"); + j += n.filename + o + "; " + } + } + }); + if (j) { + FR.Msg.toast(j) + } + var i = _.filter(d.wrap.attach_array, function (n) { + return n.errorCode === undefined + }); + if (_.isEmpty(i)) { + d.wrap.attach_array = []; + return + } + d.showViewList(); + d.fireEvent(FR.Events.CALLBACK, d.wrap.attach_array[0]) + }; + f.url = this.options.url ? this.options.url : FR.servletURL + "?op=fr_attach&cmd=ah_upload"; + f.url += this.options.sessionID ? "&sessionID=" + this.options.sessionID : ""; + f.url += ((window.FS && window.FS.serverID) ? "&serverID=" + window.FS.serverID : ""); + f.fileType = h.accept; + f.attach_array = []; + f.attach_names = []; + f.attachNum = 0; + this._dealValueWithEvents(h.value) + }, _dealValueWithEvents: function (b) { + if (FR.equals(b, this.wrap.attach_array) || (this.wrap.attach_array.length === 1 && FR.equals(this.wrap.attach_array[0], b))) { + return + } + if ((a.isArray(b) && b.length > 0 && b[0].attach_id) || (b && b.attach_id)) { + var e = a.isArray(b) ? b : [b]; + this.wrap.attach_array = []; + for (var c = 0; c < e.length; c++) { + this.wrap.attach_array.push(e[c]); + var d = {}; + this.wrap.files.push(d) + } + this.showViewList(); + this.wrap.files.length = 0 + } + if (b == "") { + this.reset() + } + }, createListItem: function (d, e) { + if (d.errorCode) { + return null + } + var c = this; + var b = a("
  • "); + var f; + b.append(f = (a(" ")).click(function (g) { + c.removeAttach(d, b); + g.stopEvent() + }).hide()).append(a("" + c.wrap.attach_names[e] + " " + FR.__fileSizeFormat__(d.fileSize) + "").bind("click", function () { + var g = d.attach_id; + window.open(FR.servletURL + "?op=fr_attach&cmd=ah_download&id=" + g) + }).mouseover(function () { + a(this).css({color: "blue"}) + }).mouseout(function () { + a(this).css({color: ""}) + })).addClass("fr-fileupload-listitem").mouseover(function () { + f.show(); + a(this).css({"background-color": "#9FC5F8"}) + }).mouseout(function () { + f.hide(); + a(this).css({"background-color": ""}) + }); + c.wrap.attachNum++; + if (c.wrap.maxlength !== 1) { + c.$previewCount.text(c.wrap.attachNum) + } + return b + }, showViewList: function () { + var s = this; + var h; + var t; + if (!s.options.hideFileList) { + var r = a("ul", s.element); + if (r.length === 0) { + var l = a("
    ").appendTo(s.element).css({ + marginTop: 18 - s.options.height / 2, + marginLeft: s.options.width / 2 + 18 + }); + h = a("
    ").appendTo(l); + t = a("
      ").addClass("fr-fileupload-list").appendTo(h) + } else { + h = r.parent(); + t = r + } + } + var d = s.wrap; + this.imageURL = null; + if (s.options.maxlength === 1) { + var g = this.options; + var q = d.attach_array[0]; + this.removeBackground(); + if (q.attach_type == "image") { + s.$tempPreview = a("").appendTo(this.divWrap).css({ + left: s.element.outerWidth(true) - s.element.width(), + width: g.width, + height: g.height, + top: 0, + position: "absolute" + }); + FR.lastTarget = s.$tempPreview; + var f = a(s.$tempPreview); + f.css("background", ""); + var c = FR.servletURL + "?op=fr_attach&cmd=ah_image&id=" + q.attach_id; + f.css("background", "url(" + c + ") 0 0 no-repeat transparent"); + this.imageURL = c; + f.css("cursor", "default").unbind("click", b) + } + d.attach_names[0] = q.filename; + if (t) { + t.children().remove(); + t.append(this.createListItem(q, 0)) + } + } + if (s.options.maxlength !== 1) { + for (var p = d.attach_array.length - 1, k = 0; k < d.files.length; p--, k++) { + d.attach_names[p] = d.attach_array[p].filename; + var e = 0; + for (var n = 0; + n < d.attach_array.length - d.files.length; n++) { + if (d.attach_names[p] === d.attach_array[n].filename) { + e++ + } + } + if (e > 0) { + d.attach_names[p] = FR.lengthenFileName(d.attach_array[p].filename, "(" + e + ")") + } + t && t.append(this.createListItem(d.attach_array[p], p)) + } + } + s.wrap.attach_array = _.filter(s.wrap.attach_array, function (i) { + return i.errorCode === undefined + }); + if (FR.Browser.isIE() && h) { + if (h.height() > 160) { + h.height(160); + if (t.width() + 18 > h.width()) { + h.width(t.width() + 18) + } + } + } + + function b(i) { + window.open(FR.servletURL + "?op=fr_attach&cmd=ah_download&id=" + i.data); + i.stopPropagation() + } + }, removeAttach: function (e, c) { + var b = e.attach_id; + var d = this; + var f = this.wrap; + FR.ajax({ + url: FR.servletURL + "?op=fr_attach&cmd=ah_release", data: {id: b}, complete: function (h, g) { + if (g == "success") { + if (c) { + c.remove() + } + d.imageURL = null; + for (var i = 0; i < f.attach_array.length; i++) { + if (f.attach_array[i].attach_id == b) { + if (d.wrap.maxlength !== 1) { + f.attachNum--; + d.$previewCount.text(d.wrap.attachNum); + if (f.attachNum === 0) { + a(".fr-fileupload-popview", d.element).remove() + } + } + f.attach_array.removeWeakEqual(f.attach_array[i]); + break + } + } + if (d.wrap.maxlength === 1) { + a(".fr-fileupload-popview", d.element).remove(); + d.removeBackground() + } + d.fireEvent(FR.Events.CALLBACK) + } + } + }) + }, resetBackground: function (c) { + var b = c || this.imageURL; + this.removeBackground(); + if (this.options.tdCell) { + this.options.tdCell.css("background", "url(" + b + "&height=" + this.options.tdCell.height() + ") 0 0 no-repeat transparent") + } + }, removeBackground: function () { + if (this.options.tdCell) { + this.options.tdCell.css("background-image", "") + } + var b = this.divWrap.children().eq(2); + b.css("background-image", ""); + b.remove() + }, startEditing: function () { + if (this.options.tdCell) { + a(".attach-download-div,.fr-fileupload-download-all", a(this.options.tdCell)).hide() + } + this.$preview.show(); + if (this.options.disabled) { + this.$preview.unbind("click") + } + if (FR.Browser.isIE() && !a.support.boxModel && this.options.write) { + a(".x-editor").addClass("none-border") + } + FR.CustomJsd5094MultiFileEditor.superclass.startEditing.apply(this, arguments) + }, stopEditing: function () { + if (this.options.tdCell) { + var c = a(".attach-download-div,.fr-fileupload-download-all", a(this.options.tdCell)); + c.show() + } + if (FR.Browser.isIE() && !a.support.boxModel && this.options.write) { + a(".x-editor").removeClass("none-border") + } + if (this.imageURL != null) { + var b = this; + setTimeout(function () { + b.resetBackground() + }, 200) + } + }, getValue: function () { + if (!this.wrap.attach_array) { + return "" + } + if (this.options.maxlength === 1 && this.wrap.attach_array[0] && this.wrap.attach_array[0].attach_type == "image") { + return this.wrap.attach_array[0] + } + return this.wrap.attach_array.length === 0 ? "" : this.wrap.attach_array + }, setEnable: function (b) { + FR.CustomJsd5094MultiFileEditor.superclass.setEnable.apply(this, arguments); + if (this.$fileupload && this.$fileupload[0]) { + if (b) { + this.$fileupload[0].removeAttribute("disabled") + } else { + this.$fileupload[0].setAttribute("disabled", "disabled") + } + } + }, isShowViewImage: function () { + return this.options.showViewImage && this.options.maxlength === 1 + }, reset: function () { + this.wrap.attach_array = []; + this.wrap.attach_names = []; + this.wrap.attachNum = 0; + if (this.options.tdCell) { + a(".attach-download-div", a(this.options.tdCell)).remove() + } + a(".fr-fileupload-popview", this.element).remove(); + this.removeBackground() + } + }); + a.shortcut("multifile_jsd5094", FR.CustomJsd5094MultiFileEditor) + } +)(jQuery); \ No newline at end of file diff --git a/文件控件加强版插件使用手册.docx b/文件控件加强版插件使用手册.docx new file mode 100644 index 0000000..9cbfe38 Binary files /dev/null and b/文件控件加强版插件使用手册.docx differ