SNF Rapid Development Platform 3.0--File batch upload-Unified Attachment Manager-Online Preview file (with Internet and no two)

Source: Internet
Author: User

In fact, the use of attachment management in SNF is a very simple thing, a code can be done. But I also want to record here the requirements that the unified Attachment Manager can meet.

    1. Generic attachment management, do not repeat the development, call as concise as possible.
    2. Batch file upload, and limit for each file size, client no refresh
    3. You can change the name of the uploaded attachment to a more friendly name.
    4. Files that have already been uploaded can be deleted.
    5. and record the file size, the descendants, time and modify people and time and so on.
    6. You can download attachments to your local computer.
    7. Online preview of files, support for previewing without Office software (whether it's a picture or Office document that supports previews)

Although more than the professional graphics and document management system functions, but for most enterprises is enough, and easy to use.

Here's a look at the effect and how it's implemented:

The first step is to add a button to the page:

To configure a button event:

 //Attachment Manager     This. Attachmentsclick =function () {varrow = Self.grid.datagrid ('getselected'); if(!row)returnSnf.message ('Warning','Please select a character first! '); Snf. Attachments (row. Realname, row._id,"SYS","Sys-role"); }

Unified method for Button event invocation:

/** * Add Unified attachment Management * * @author Wang Jindou 2015-1-31 **/SNF. Attachments=function (title, Businessid, Businessmodule, Attachmenttype) {Snf.dialog ({title:"("+ title +"-Role) attachment management", Width: -, Height:550, Iconcls:'Icon-attach', maximizable:true, HTML:'<iframe id= "_view_attachmentsclick_" scrolling= "Auto" style= "width:100%;height:100%;" ></iframe>', Viewmodel:function (w) {W.find ("iframe"). attr ("src","/attachments/index/"+ Businessid +"/"+ Businessmodule +"/"+Attachmenttype); }    });};

The effect of running:

Attachments No Refresh bulk upload

Name modification and deletion of attachments

Download attachments

Accessories preview:

Integrated online and local generate files Two preview way, is to have the Internet users better experience and non-connected users can also view. And you do not need to install Office locally and on the server side.

    1. Use Microsoft's platform for Office documents to be viewed online, with good results but with the Internet.

2. View Office files after generating HTML files

Picture Preview Effect:

  

Excel Preview Effect:

Doc Preview Effect:

  

PPT Preview Effect:

  

PDF Preview Effect:

  

Background correspondence:

  

  

Modify or delete the main code for processing
 //Modify or delete a process                        Switch(Types[item. Name]) { CaseOptType.Mod:List<KeyValuePair<string,Object>> parameters =Newlist<keyvaluepair<string,Object>>(); Parameters. ADD (Newkeyvaluepair<string,Object>(Baseattachmentsentity.fieldoriginalname, entity.)                                Originalname)); Parameters. ADD (Newkeyvaluepair<string,Object> (Baseattachmentsentity.fieldmodifieduserid, userinfo.id));//last modified by primary keyParameters. ADD (Newkeyvaluepair<string,Object> (Baseattachmentsentity.fieldmodifiedby, Userinfo.realname));//last modified byParameters. ADD (Newkeyvaluepair<string,Object> (Baseattachmentsentity.fieldmodifiedon, DateTime.Now));//Last Modified Timeresult+ = SNFService.Instance.BaseAttachmentsService.SetAttachment ( This. UserInfo, entity.                                Id, parameters);  Break;  CaseOptType.Del:result+ = SNFService.Instance.BaseAttachmentsService.Delete ( This. UserInfo, entity.                                ID); //Deleting FilesFileutil.deletefile (Fileutil.getmappath ("/content/js/attachments/"+ entity. Serverpath +entity.                                ServerName));  Break;  CaseOpttype.none: Break; default:                                 Break; }

The list of articles in this series is as follows:

A series of articles based on the Mvc4.0+webapi+easyui+knockout Web development framework:

--spring.net.frameworkv3.0 General introduction of Web development framework based on Mvc4+easyui

SNF Rapid Development Platform 3.0 MVC Universal Control Library show-asp.net+mvc4.0+webapi+easyui+knockout

SNF Rapid Development Platform 3.0 of the BS page show and nine advantages-part of the page display effect-asp.net+mvc4.0+webapi+easyui +knockout

SNF Rapid Development Platform 3.0-interface Personalization + 10 skins + 7 Menu-asp.net+mvc4.0+webapi+easyui+knockout

SNF Rapid Development Platform 3.0-cs page-asp.net+spring.net.framework

SNF Rapid Development Platform 3.0-the role of broadcasting in the system-quickly and concisely send the message to the receiver

SNF Rapid Development Platform 3.0--asp.net MVC4 powerful export and bulk import without uploading files to excel

SNF Rapid Development Platform 3.0--File batch upload-Unified Attachment Manager-Online Preview file (with Internet and no two)

SNF Rapid Development Platform 3.0--File batch upload-Unified Attachment Manager-Online Preview file (with Internet and no two)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.