diff --git a/.classpath b/.classpath deleted file mode 100644 index 4f69b5689..000000000 --- a/.classpath +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.tomcatplugin b/.tomcatplugin deleted file mode 100644 index 546ecaf04..000000000 --- a/.tomcatplugin +++ /dev/null @@ -1,11 +0,0 @@ - - - /WebContent - false - true - false - true - - - /apzl - diff --git a/WebContent/.gitignore b/WebContent/.gitignore index 3385916da..09c3eec5c 100644 --- a/WebContent/.gitignore +++ b/WebContent/.gitignore @@ -1 +1,2 @@ -/META-INF/ +/META-INF/ + diff --git a/WebContent/404.html b/WebContent/404.html new file mode 100644 index 000000000..04f59e365 --- /dev/null +++ b/WebContent/404.html @@ -0,0 +1,35 @@ + + + + + + + + +App应用下载 + + + + + + +
+

404

+
+ 下载文件不存在! +
+ +
+
+

微信扫描打开APP下载链接提示代码优化 +

+ + \ No newline at end of file diff --git a/WebContent/406.html b/WebContent/406.html new file mode 100644 index 000000000..e8a5ec03e --- /dev/null +++ b/WebContent/406.html @@ -0,0 +1,35 @@ + + + + + + + + +南方租赁 + + + + + + +
+

406

+
+ 当前为APP服务,WEB无效访问权限! +
+ +
+
+

微信扫描打开APP下载链接提示代码优化 +

+ + \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/CashFlowQueryList.jsp b/WebContent/Accounting/LoanSimulation/CashFlowQueryList.jsp new file mode 100644 index 000000000..374b16ece --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/CashFlowQueryList.jsp @@ -0,0 +1,44 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-26 + Content: + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + String projectid=CurPage.getParameter("ProjectId"); + + String sql="SELECT o.contract_status FROM lb_contract_info o WHERE id='"+contractId+"'"; + String contract_status = Sqlca.getString(new SqlObject(sql)); + + String sTempletNo=""; + if("21".equals(contract_status)){ + sTempletNo="LCCashFlowQueryProj"; + }else{ + sTempletNo="LCCashFlowQuery"; + } + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + + if("21".equals(contract_status)){ + dwTemp.genHTMLObjectWindow(projectid); + }else{ + dwTemp.genHTMLObjectWindow(contractId); + } + + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/FundPlanList.jsp b/WebContent/Accounting/LoanSimulation/FundPlanList.jsp index a1b6e03ec..50c5be780 100644 --- a/WebContent/Accounting/LoanSimulation/FundPlanList.jsp +++ b/WebContent/Accounting/LoanSimulation/FundPlanList.jsp @@ -1,6 +1,10 @@ <%@ page contentType="text/html; charset=GBK"%> <%@page import="com.tenwa.reckon.util.TbBeanTools"%> <%@page import="com.tenwa.reckon.bean.TabCalBean"%> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.prd.BUSINESS_TYPE"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% String flowunid=CurPage.getParameter("flowunid");//流程编号 BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); @@ -19,6 +23,10 @@ String taskno=CurPage.getParameter("TaskNo"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + //判断是传统还是汽车业务 + BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID") + .setParameter("productID", productId).getSingleResult(false); + String productType = (bo==null)?"":bo.getAttribute("attribute2").getString(); ASObjectModel doTemp = new ASObjectModel("LCFundPlanTemp"); doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'"); if(null!=ishistory&&ishistory.equals("true")){ @@ -100,7 +108,13 @@ var param="FlowUnid=<%=flowunid%>&calType=<%=calType%>&plannumber=<%=plannumber%>&ProductId=<%=productId%>"; window.parent.parent.ischeck=false; ischeck=false; - window.parent.parent.AsControl.OpenView("/Accounting/LoanSimulation/LoanBasicInfo.jsp",param, "_self"); + var url=""; + if("<%=productType%>"=="car_product"){ + url="/Accounting/LoanSimulation/LoanBasicInfo.jsp"; + }else { + url="/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp"; + } + window.parent.parent.AsControl.OpenView(url,param, "_self"); } var ischeck=true; function checkModified(){ @@ -144,7 +158,7 @@ } } alert("复制成功"); - as_save(0,"reloadSelf()"); + as_save(0,"updateFlow()"); } function deleteAllRecords(){ RunJavaMethodTrans("com.tenwa.reckon.executor.CalcExecutor","deleteAllRecordsForFundPlanList","flowunid=<%=flowunid%>,planCName=<%=planCName%>,plannumber=<%=plannumber%>,calType=<%=calType%>"); diff --git a/WebContent/Accounting/LoanSimulation/FundPlanQueryList.jsp b/WebContent/Accounting/LoanSimulation/FundPlanQueryList.jsp new file mode 100644 index 000000000..8c4d46b54 --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/FundPlanQueryList.jsp @@ -0,0 +1,44 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-26 + Content: + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + String projectid=CurPage.getParameter("ProjectId"); + + String sql="SELECT o.contract_status FROM lb_contract_info o WHERE id='"+contractId+"'"; + String contract_status = Sqlca.getString(new SqlObject(sql)); + + String sTempletNo=""; + if("21".equals(contract_status)){ + sTempletNo="LCFundPlanQueryProj"; + }else{ + sTempletNo="LCFundPlanQuery"; + } + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + + if("21".equals(contract_status)){ + dwTemp.genHTMLObjectWindow(projectid); + }else{ + dwTemp.genHTMLObjectWindow(contractId); + } + + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp index de7d93275..452fe574d 100644 --- a/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation/LoanBasicInfo.jsp @@ -10,6 +10,10 @@ <%@ page import="java.util.Vector" %> <%@ page import="com.amarsoft.awe.dw.ui.validator.ValidateRule" %> <%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_EQUIPMENT_CAR_TEMP"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <% @@ -21,6 +25,8 @@ String nodeNo=CurPage.getParameter("NodeNo"); String RightType= CurPage.getParameter("RightType"); String calType = CurPage.getParameter("calType"); + String carAttributes = CurPage.getParameter("carAttributes"); + String projectId=CurPage.getParameter("ProjectId"); //判断是否为汽车业务 boolean isCarProduct = "004".equals(productId) ? false : true; /*获取参数*/ @@ -42,13 +48,14 @@ plannumber=condtion.getAttribute(planCName).getString(); } }else{ - String planType=ProductParamUtil.getProductParameterValue(productId, "PRD0314", "planinformation"); - if("SinglePlan".equals(planType)){ + //安鹏只有多方案,没有单方案。(产品配置中方案信息prd0314停用) + // String planType=ProductParamUtil.getProductParameterValue(productId, "PRD0314", "planinformation"); + // if("SinglePlan".equals(planType)){ BizObject condtion=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); if(condtion!=null){ plannumber=condtion.getAttribute(planCName).getString(); } - } + // } } } //新增数据 自动生成方案编号 @@ -57,10 +64,10 @@ JBOTransaction tx=JBOFactory.createJBOTransaction(); if("proj_process".equals(calType)){ BizObject proj=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); - sSerialType=proj.getAttribute("PROJECT_NO").getString(); + sSerialType=(proj==null)?"":proj.getAttribute("PROJECT_NO").getString(); }else{ BizObject contract=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); - sSerialType=contract.getAttribute("CONTRACT_NO").getString(); + sSerialType=(contract==null)?"":contract.getAttribute("CONTRACT_NO").getString(); } plannumber=SerialNumberUtil.getPlannumber(sSerialType,calType,tx); tx.commit(); @@ -84,11 +91,14 @@ doTemp.setHtmlEvent("BASE_RATE", "onchange", "changeBaseRate");//基准利率 doTemp.setHtmlEvent("RATE_FLOAT_AMT", "onchange", "changeRateFloatAmt");//利率调整值 doTemp.setHtmlEvent("CAUTION_MONEY", "onchange", "cautionMoney");//保证金 + doTemp.setHtmlEvent("CAUTION_MONEY_METHOD", "onchange", "cautionMoney");//保证金 doTemp.setHtmlEvent("CAUTION_DEDUCTION_MONEY", "onchange", "cautionDeductionMoney");//保证金抵扣金额 doTemp.setHtmlEvent("LEASE_AMT_DATE", "onchange", "changeLeaseAmtDate");//投放日 doTemp.setHtmlEvent("START_DATE", "onchange", "changeStartDate");//起租日 + doTemp.setHtmlEvent("DEFAULTDUEDAY", "onchange", "changeLeaseAmtDate"); doTemp.setHtmlEvent("FIRST_PLAN_DATE", "onchange", "changeFistPlanDate");//第一期计划日期 doTemp.setHtmlEvent("CORPUS_RATIO", "onchange", "changeCorpusRatio");//期限内本金比例 + doTemp.setHtmlEvent("EQUIP_AMT", "onchange", "changgeCompare");//车价 /*设置字段事件*/ /*设置模板属性*/ @@ -98,15 +108,20 @@ pc.getProductFundRules(doTemp, productId); String calcRules=pc.getProductRules(doTemp, productId,vali); + //获取产品名称 + BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID") + .setParameter("productID", productId).getSingleResult(false); + String productName = (bo==null)?"":bo.getAttribute("typename").getString(); + //非车辆产品,融资额可编辑 String productType = Sqlca.getString(new SqlObject("select attribute2 from business_type where typeno='"+productId+"'")); - if("1".equals(productType)){ - doTemp.setReadOnly("CLEAN_LEASE_MONEY", false); - }else{ - doTemp.setVisible("CORPUS_RATIO", true); - doTemp.setVisible("CORPUS", true); - doTemp.setRequired("CORPUS_RATIO", true); - } + if("car_product".equals(productType)){ + doTemp.setReadOnly("CLEAN_LEASE_MONEY", true); + }else if("business_product".equals(productType)){ + // doTemp.setVisible("CORPUS_RATIO", true); + // doTemp.setVisible("CORPUS", true); + // doTemp.setRequired("CORPUS_RATIO", true); + } if("quoted_price".equals(calType)){//客户报价 流程号存的是客户主键 doTemp.setDefaultValue("cust_id", flowunid); } @@ -114,10 +129,11 @@ doTemp.setJboClass(tcb.getCondition_tb()); doTemp.setDefaultValue(planCName, plannumber); doTemp.setDefaultValue("flowunid", flowunid); + doTemp.setDefaultValue("PRODUCT_NAME", productName); doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'"); - if(null!=ishistory&&ishistory.equals("true")){ +/* if(null!=ishistory&&ishistory.equals("true")){ --这个是插入到历史表中的每一步数据。 doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//如果是历史则新显示历史数据 - } + } */ /*设置模板属性*/ /*设置页面属性*/ @@ -125,15 +141,24 @@ Parameter p=new Parameter("plannumber",plannumber); Vector v=CurPage.parameterList; v.add(p); - /*设置页面属性*/ - + /*设置页面属性*/ + boolean flag=CurUser.hasRole("401"); + if(CurUser.hasRole("401")){ + doTemp.setVisible("CAUTION_MONEY_METHOD",false); + doTemp.setVisible("DISCOUNT", false); + // doTemp.setColumnAttribute("DISCOUNT","colvisible","0"); + } + if(CurUser.hasRole("800R00000013")||CurUser.hasRole("800R00000014")||CurUser.hasRole("800R00000015")){ + doTemp.setVisible("YEAR_RATE", true); + doTemp.setVisible("RENT_RATIO",true); + } ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); dwTemp.Style = "2";//freeform if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ - dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.ReadOnly = "1";//只读模式 isShowButton=false; }else{ isShowButton=true; @@ -147,51 +172,106 @@ String compClientID = request.getParameter("CompClientID"); dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput()); - dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput()); - dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput()); + //dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput()); + //dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput()); String businessDate = DateHelper.getBusinessDate(); + + //获取对应车辆指导价 + BizObject bo1 = JBOFactory.createBizObjectQuery(LB_EQUIPMENT_CAR_TEMP.CLASS_NAME,"PROJECT_ID=:projectId") + .setParameter("projectId",projectId).getSingleResult(false); + String nowTotal = (bo1==null)?"":bo1.getAttribute("NOW_TOTAL").getString(); String sButtons[][] = { //{"true","All","Button","重置","重置","reloadSelf()","","","",""}, - {"true","","Button","租金测算","租金测算","saveRecord()","","","","btn_icon_save"}, - {((isCarProduct) && ("proj_process".equals(calType)||"cont_process".equals(calType)))?"true":"false","","Button","引入客户报价","引入客户报价","importCustomerQuot()","","","","btn_icon_edit"} + {"true","All","Button","租金测算","租金测算","saveRecord()","","","","btn_icon_save"}, + // {((isCarProduct) && ("proj_process".equals(calType)||"cont_process".equals(calType)))?"true":"false","","Button","引入客户报价","引入客户报价","importCustomerQuot()","","","","btn_icon_edit"} }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Accounting/LoanSimulation/LoanSimulationBasicQueryInfo.jsp b/WebContent/Accounting/LoanSimulation/LoanSimulationBasicQueryInfo.jsp new file mode 100644 index 000000000..cc7c1d539 --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/LoanSimulationBasicQueryInfo.jsp @@ -0,0 +1,44 @@ +<%@page import="jbo.prd.BUSINESS_TYPE"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-10-25 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String contractId = CurPage.getParameter("ContractId"); + String productId=CurPage.getParameter("ProductId"); + String projectid=CurPage.getParameter("ProjectId"); + String compClientID = request.getParameter("CompClientID"); + if(sPrevUrl == null) sPrevUrl = ""; + + //获取产品名称 + BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID") + .setParameter("productID", productId).getSingleResult(false); + String productName = (bo==null)?"":bo.getAttribute("typename").getString(); + + String sTempletNo = "LoanSimulationBasicInfo_Query";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); +// ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "1";//只读模式 + dwTemp.genHTMLObjectWindow(contractId); + dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { + {"false","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/RentPlanList.jsp b/WebContent/Accounting/LoanSimulation/RentPlanList.jsp index 7f04440f5..a22b5a4f1 100644 --- a/WebContent/Accounting/LoanSimulation/RentPlanList.jsp +++ b/WebContent/Accounting/LoanSimulation/RentPlanList.jsp @@ -17,8 +17,16 @@ String nodeNo=CurPage.getParameter("NodeNo"); ASObjectModel doTemp = new ASObjectModel("LCRentPlanTemp"); doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'"); - if(null!=ishistory&&ishistory.equals("true")){ + /* if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcRentListArachiveShow"); + } */ + String Distributor=CurPage.getParameter("isDistributor"); + String orgid = CurUser.getOrgID(); + if(CurUser.hasRole("401")){ + doTemp.setVisible("CORPUS", false); + doTemp.setVisible("INTEREST", false); + doTemp.setVisible("CORPUS_BUSINESS", false); + doTemp.setVisible("INTEREST_BUSINESS", false); } CurPage.setAttribute("modelno","rent"); doTemp.setJboClass(tcb.getRentPlan_tb()); @@ -64,7 +72,7 @@ {width:"350px",height:"40px",title:"上传租金计划"},function(sreturn){ if(sreturn=="true"){ var param="FlowUnid=<%=flowunid%>&calType=<%=calType%>&plannumber=<%=plannumber%>"; - window.parent.parent.AsControl.OpenView("/Accounting/LoanSimulation/LoanBasicInfo.jsp",param, "_self"); + window.parent.parent.AsControl.OpenView("/Accounting/LoanSimulation/LoanBasicInfoBusiness.jsp",param, "_self"); } }); }else{ diff --git a/WebContent/Accounting/LoanSimulation/RentPlanQueryList.jsp b/WebContent/Accounting/LoanSimulation/RentPlanQueryList.jsp new file mode 100644 index 000000000..5695ac981 --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/RentPlanQueryList.jsp @@ -0,0 +1,54 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-26 + Content: + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + String projectid=CurPage.getParameter("ProjectId"); + + String sql="SELECT o.contract_status FROM lb_contract_info o WHERE id='"+contractId+"'"; + String contract_status = Sqlca.getString(new SqlObject(sql)); + + String sTempletNo=""; + if("21".equals(contract_status)){ + sTempletNo="LCRentPlanQueryPro"; + }else{ + sTempletNo="LCRentPlanQuery"; + } + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + String orgid = CurUser.getOrgID(); + if(CurUser.hasRole("401")){ + doTemp.setVisible("CORPUS", false); + doTemp.setVisible("INTEREST", false); + doTemp.setVisible("CORPUS_BUSINESS", false); + doTemp.setVisible("INTEREST_BUSINESS", false); + }else if(!"8009012002".equals(orgid)){ + doTemp.setVisible("CORPUS", false); + doTemp.setVisible("INTEREST", false); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; + dwTemp.setPageSize(10); + + if("21".equals(contract_status)){ + dwTemp.genHTMLObjectWindow(projectid); + }else{ + dwTemp.genHTMLObjectWindow(contractId); + } + + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/conditionQuery_plan.jsp b/WebContent/Accounting/LoanSimulation/conditionQuery_plan.jsp new file mode 100644 index 000000000..515a4946e --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/conditionQuery_plan.jsp @@ -0,0 +1,22 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%> +<% + String contractId = CurPage.getParameter("ContractId"); + String projectid=CurPage.getParameter("ProjectId"); + String sTempletNo=CurPage.getParameter("sTempletNo"); + + //参数:0.是否显示, 1.标题,2.URL,3,参数串, 4. Strip高度(默认600px),5. 是否有关闭按钮(默认无) 6. 是否缓存(默认是) +// String userid = CurUser.getUserID(); + String orgid = CurUser.getOrgID(); + String flag = "8009012002,8009001".indexOf(orgid)>-1?"true":"false"; + if("LoanSimulationBusiness_Query".equals(sTempletNo)){ + flag ="true"; + } + String sTabStrip[][] = { + {"true", "租金计划", "/Accounting/LoanSimulation/RentPlanQueryList.jsp","ContractId="+contractId+"&ProjectId="+projectid, "", "", "false"}, + {flag, "资金计划", "/Accounting/LoanSimulation/FundPlanQueryList.jsp","ContractId="+contractId+"&ProjectId="+projectid, "", "", "false"}, + {flag, "现金流", "/Accounting/LoanSimulation/CashFlowQueryList.jsp","ContractId="+contractId+"&ProjectId="+projectid, "", "", "false"}, + }; +%> +<%@ include file="/Resources/CodeParts/Tab01.jsp"%> +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/condition_plan.jsp b/WebContent/Accounting/LoanSimulation/condition_plan.jsp index 5fa5ecfa4..c5d19a5f6 100644 --- a/WebContent/Accounting/LoanSimulation/condition_plan.jsp +++ b/WebContent/Accounting/LoanSimulation/condition_plan.jsp @@ -8,13 +8,14 @@ String IsHistory=CurPage.getParameter("IsHistory"); String RightType=CurPage.getParameter("RightType"); String productId=CurPage.getParameter("ProductId"); - String params="flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&calType="+calType+"&IsHistory="+IsHistory+"&RightType="+RightType+"&ProductId="+productId; //参数:0.是否显示, 1.标题,2.URL,3,参数串, 4. Strip高度(默认600px),5. 是否有关闭按钮(默认无) 6. 是否缓存(默认是) +// String userid = CurUser.getUserID(); + String orgid = CurUser.getOrgID(); String sTabStrip[][] = { {"true", "租金计划", "/Accounting/LoanSimulation/RentPlanList.jsp",params, "", "", "false"}, - {"true", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"}, - {"true", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"}, + {"8009012002,8009001".indexOf(orgid)>-1?"true":"false", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"}, + {"8009012002,8009001".indexOf(orgid)>-1?"true":"false", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"}, }; %> <%@ include file="/Resources/CodeParts/Tab01.jsp"%> diff --git a/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp b/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp new file mode 100644 index 000000000..def048727 --- /dev/null +++ b/WebContent/Accounting/LoanSimulation/condition_plan_business.jsp @@ -0,0 +1,23 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%> +<% + String flowunid = CurPage.getParameter("flowunid"); + String plannumber=CurPage.getParameter("plannumber"); + String planCName=CurPage.getParameter("planCName"); + String calType=CurPage.getParameter("calType"); + String IsHistory=CurPage.getParameter("IsHistory"); + String RightType=CurPage.getParameter("RightType"); + String productId=CurPage.getParameter("ProductId"); + + String params="flowunid="+flowunid+"&plannumber="+plannumber+"&planCName="+planCName+"&calType="+calType+"&IsHistory="+IsHistory+"&RightType="+RightType+"&ProductId="+productId; + //参数:0.是否显示, 1.标题,2.URL,3,参数串, 4. Strip高度(默认600px),5. 是否有关闭按钮(默认无) 6. 是否缓存(默认是) +// String userid = CurUser.getUserID(); + String orgid = CurUser.getOrgID(); + String sTabStrip[][] = { + {"true", "租金计划", "/Accounting/LoanSimulation/RentPlanList.jsp",params, "", "", "false"}, + {"true", "资金计划", "/Accounting/LoanSimulation/FundPlanList.jsp",params, "", "", "false"}, + {"true", "现金流", "/Accounting/LoanSimulation/CashFlowList.jsp",params, "", "", "false"}, + }; +%> +<%@ include file="/Resources/CodeParts/Tab01.jsp"%> +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation/reriod/uploadReriodOperator.jsp b/WebContent/Accounting/LoanSimulation/reriod/uploadReriodOperator.jsp index ab8e498e7..71f5daf3c 100644 --- a/WebContent/Accounting/LoanSimulation/reriod/uploadReriodOperator.jsp +++ b/WebContent/Accounting/LoanSimulation/reriod/uploadReriodOperator.jsp @@ -19,7 +19,7 @@ String cmessage=""; if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){ try { - JBOTransaction tx=JBOFactory.getFactory().createTransaction(); + //JBOTransaction tx=JBOFactory.getFactory().createTransaction(); String importparam= CurPage.getParameter("importparam"); importparam=importparam.replaceAll("@", ","); JSONObject paramJson=JSONDecoder.decode(importparam); diff --git a/WebContent/Accounting/LoanSimulation/upload/uploadRentOperator.jsp b/WebContent/Accounting/LoanSimulation/upload/uploadRentOperator.jsp index 619b5d097..5d33acd8d 100644 --- a/WebContent/Accounting/LoanSimulation/upload/uploadRentOperator.jsp +++ b/WebContent/Accounting/LoanSimulation/upload/uploadRentOperator.jsp @@ -20,7 +20,7 @@ String cmessage=""; if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){ try { - JBOTransaction tx=JBOFactory.getFactory().createTransaction(); + //JBOTransaction tx=JBOFactory.getFactory().createTransaction(); String importparam= CurPage.getParameter("importparam"); importparam=importparam.replaceAll("@", ","); JSONObject paramJson=JSONDecoder.decode(importparam); diff --git a/WebContent/Accounting/LoanSimulationPlan/LCCalcPlanTempList.jsp b/WebContent/Accounting/LoanSimulationPlan/LCCalcPlanTempList.jsp index 6f08c6df3..41e630fdd 100644 --- a/WebContent/Accounting/LoanSimulationPlan/LCCalcPlanTempList.jsp +++ b/WebContent/Accounting/LoanSimulationPlan/LCCalcPlanTempList.jsp @@ -130,7 +130,6 @@ tempParam["CurUserId"]="<%=CurUser.getUserID()%>"; tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>"; tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>"; - debugger; param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据 for(var key in param){ if(sparam.length>0){sparam+=",";} diff --git a/WebContent/Accounting/LoanSimulation_change/LCRentChangeInfo.jsp b/WebContent/Accounting/LoanSimulation_change/LCRentChangeInfo.jsp index d4cfe4c05..e630b962f 100644 --- a/WebContent/Accounting/LoanSimulation_change/LCRentChangeInfo.jsp +++ b/WebContent/Accounting/LoanSimulation_change/LCRentChangeInfo.jsp @@ -15,15 +15,17 @@ String ProductId = CurPage.getParameter("ProductId"); String sRightType= CurPage.getParameter("RightType"); String taskno = CurPage.getParameter("TaskNo"); + String flowNo = CurPage.getParameter("FlowNo"); String settleMethod=""; String rentOrRate=""; + BizObject condition=null; if(plannumber==null){ - BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); plannumber=condition.getAttribute("payment_number").getString(); settleMethod=condition.getAttribute("SETTLE_METHOD").getString(); rentOrRate=condition.getAttribute("RENT_OR_RATE").getString(); }else{ - BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and payment_number=:plannumber").setParameter("flowunid", flowunid).setParameter("plannumber", plannumber).getSingleResult(false); + condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and payment_number=:plannumber").setParameter("flowunid", flowunid).setParameter("plannumber", plannumber).getSingleResult(false); settleMethod=condition.getAttribute("SETTLE_METHOD").getString(); rentOrRate=condition.getAttribute("RENT_OR_RATE").getString(); } @@ -75,8 +77,13 @@ dwTemp.setAttr("spanWidth","107"); dwTemp.genHTMLObjectWindow(flowunid); String compClientID = request.getParameter("CompClientID"); - - dwTemp.replaceColumn("pay_condition", "", CurPage.getObjectWindowOutput()); + String url=""; + if("ContractOnhireCarChangeFlow".equals(flowNo)){ + url="/Accounting/LoanSimulation_change/LoanBasicInfo.jsp"; + }else{ + url="/Accounting/LoanSimulation_change/LoanBasicInfoBusiness.jsp"; + } + dwTemp.replaceColumn("pay_condition", "", CurPage.getObjectWindowOutput()); String sButtons[][] = { {"true","","Button","租金变更","租金变更","saveRecord()","","","","btn_icon_rentchange"}, {"true","","Button","变更撤销","变更撤销","cancelChange()","","","","btn_icon_delete"} @@ -119,15 +126,31 @@ $(function(){ //保存数据 function saveRecord(sPostEvents) { + /* if(!cheackFinalPayment()){ + AsDebug.alert("提示","只有尾款的的项目并且大于还租次数才能展期变更!"); + return; + } */ //检查是否进行过变更 - var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=plannumber%>"); + as_save("myiframe0","run()"); + +<%-- var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=plannumber%>"); if(result == 'true'){ as_save("myiframe0","run()"); }else{ alert('请先撤销变更,再进行变更操作!!!'); + } --%> +} +function cheackFinalPayment(){ + var finalPayment=pay_condition.getItemValue(0,0,"FINAL_PAYMENT"); + var incomeNumber=pay_condition.getItemValue(0,0,"INCOME_NUMBER"); + var adjustList=getItemValue(0,0,"ADJUST_LIST"); + var startList=getItemValue(0,0,"START_LIST"); + if(parseFloat(finalPayment)>0&&parseFloat(adjustList)>parseFloat(incomeNumber)&&parseFloat(startList)==parseFloat(incomeNumber)){ + return true; + }else{ + return false; } } - function cancelChange(){ openDWDialog(); setTimeout(function(){ diff --git a/WebContent/Accounting/LoanSimulation_change/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation_change/LoanBasicInfo.jsp index f6aa04d43..d7f054256 100644 --- a/WebContent/Accounting/LoanSimulation_change/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation_change/LoanBasicInfo.jsp @@ -14,6 +14,7 @@ String plannumber=CurPage.getParameter("plannumber"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + String FlowNo=CurPage.getParameter("FlowNo");//流程名称 String taskno = CurPage.getParameter("TaskNo"); if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//如果是历史则新显示历史数据 @@ -63,21 +64,25 @@ dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput()); String sButtons[][] = { - {"true","","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"ContractOnhireCarChangeFlow".equals(FlowNo)?"false":"true","","Button","保存","保存所有修改","as_save(0)","","","",""}, }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp index c20f7cc63..51ff1bef0 100644 --- a/WebContent/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp @@ -6,7 +6,7 @@ <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <% - String sTempletNo = "LoanSimulationBasicInfo";//--模板号-- + String sTempletNo = "LoanSimulationBasicInfoBusiness";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); String ProjectId= CurPage.getParameter("ProjectId"); diff --git a/WebContent/Accounting/LoanSimulation_formal/RentPlanIncomeList.jsp b/WebContent/Accounting/LoanSimulation_formal/RentPlanIncomeList.jsp index 95dc975bf..2b539a48d 100644 --- a/WebContent/Accounting/LoanSimulation_formal/RentPlanIncomeList.jsp +++ b/WebContent/Accounting/LoanSimulation_formal/RentPlanIncomeList.jsp @@ -46,6 +46,7 @@ JBOTransaction tx=JBOFactory.createJBOTransaction(); Map params=new HashMap(); list=DataOperatorUtil.getDataBySql(tx, sql, params); + tx.commit(); String[][] displayData = new String[list.size()][headers.length]; for(int i=0;i +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-05-21 + Content: + History Log: + */ + String contract_id=CurPage.getParameter("id"); + String plannumber = CurPage.getParameter("plannumber"); + String sDONo = "VI_LC_RENT_INCOME"; + BizObject status=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_STATUS","contract_id=:contract_id").setParameter("contract_id", contract_id).getSingleResult(false); + if(status==null){ + sDONo="LC_PAY_RENT_PLAN"; + } + ASObjectModel doTemp = new ASObjectModel(sDONo); + if(plannumber!=null&&plannumber.length()>0&&!"null".equals(plannumber)){ + doTemp.appendJboWhere(" and payment_number='"+plannumber+"'"); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Accounting/LoanSimulation_formal/condition_plan.jsp b/WebContent/Accounting/LoanSimulation_formal/condition_plan.jsp index 5f9bf0c19..f6fedfeca 100644 --- a/WebContent/Accounting/LoanSimulation_formal/condition_plan.jsp +++ b/WebContent/Accounting/LoanSimulation_formal/condition_plan.jsp @@ -12,7 +12,7 @@ } //参数:0.是否显示, 1.标题,2.URL,3,参数串, 4. Strip高度(默认600px),5. 是否有关闭按钮(默认无) 6. 是否缓存(默认是) String sTabStrip[][] = { - {falg, "租金计划", "/Accounting/LoanSimulation_formal/RentPlanIncomeList.jsp",params, "", "", "false"}, + {falg, "租金计划(回笼)", "/Accounting/LoanSimulation_formal/RentPlanIncomeList_new.jsp",params, "", "", "false"}, {falg.equals("true")?"false":"true", "租金计划", "/Accounting/LoanSimulation_formal/RentPlanList.jsp",params, "", "", "false"}, {"true", "资金计划", "/Accounting/LoanSimulation_formal/FundPlanList.jsp",params, "", "", "false"}, {"true", "现金流", "/Accounting/LoanSimulation_formal/CashFlowList.jsp",params, "", "", "false"}, diff --git a/WebContent/Accounting/LoanSimulation_new/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation_new/LoanBasicInfo.jsp index 8d67b541f..930747909 100644 --- a/WebContent/Accounting/LoanSimulation_new/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation_new/LoanBasicInfo.jsp @@ -7,6 +7,10 @@ <%@ page import="java.util.Vector" %> <%@ page import="com.amarsoft.awe.dw.ui.validator.ValidateRule" %> <%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.prd.BUSINESS_TYPE"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <% @@ -33,8 +37,11 @@ //费用规则 ProductCondition pc=new ProductCondition(); String calcRules=pc.getProductRules(doTemp, productId,vali); - - + //获取产品名称 + BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID") + .setParameter("productID", productId).getSingleResult(false); + String productName = (bo==null)?"":bo.getAttribute("typename").getString(); + doTemp.setDefaultValue("PRODUCT_NAME", productName); CurPage.getCurComp().setAttribute("RightType", null); ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); Parameter p=new Parameter("plannumber",plannumber); @@ -42,9 +49,9 @@ v.add(p); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); - if(null!=ishistory&&ishistory.equals("true")){ + /* if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//如果是历史则新显示历史数据 - } + } */ dwTemp.Style = "2";//freeform dwTemp.ReadOnly = "1"; if((null!=RightType&&RightType.equals("ReadOnly"))){ @@ -72,11 +79,19 @@ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Accounting/LoanSimulation_old/LoanBasicInfo.jsp b/WebContent/Accounting/LoanSimulation_old/LoanBasicInfo.jsp index 3f7fa595c..a289e8fd8 100644 --- a/WebContent/Accounting/LoanSimulation_old/LoanBasicInfo.jsp +++ b/WebContent/Accounting/LoanSimulation_old/LoanBasicInfo.jsp @@ -3,11 +3,20 @@ <%@ page import="java.util.Vector" %> <%@ page import="com.amarsoft.awe.dw.ui.validator.ValidateRule" %> <%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.prd.BUSINESS_TYPE"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <% String sTempletNo = "LoanSimulationBasicInfo_old";//--模板号-- + String applytype=CurPage.getParameter("ApplyType"); + //如果是汽车的提请结清用汽车的模板 + if("ContractTerminateApply".equals(applytype)){ + sTempletNo = "LoanSimulationBasicInfo_old_Car";//--模板号-- + } ASObjectModel doTemp = new ASObjectModel(sTempletNo); String flowunid = CurPage.getParameter("FlowUnid"); String plannumber=CurPage.getParameter("plannumber"); @@ -28,8 +37,13 @@ //费用规则 ProductCondition pc=new ProductCondition(); String calcRules=pc.getProductRules(doTemp, productId,vali); + //获取产品名称 + BizObject bo = JBOFactory.createBizObjectQuery(BUSINESS_TYPE.CLASS_NAME,"typeno=:productID") + .setParameter("productID", productId).getSingleResult(false); + String productName = (bo==null)?"":bo.getAttribute("typename").getString(); CurPage.getCurComp().setAttribute("RightType", null); + doTemp.setDefaultValue("PRODUCT_NAME", productName); doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'"); ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); String ishistory=CurPage.getParameter("IsHistory"); @@ -39,7 +53,7 @@ } dwTemp.Style = "2";//freeform if((null!=RightType&&RightType.equals("ReadOnly"))){ - dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.ReadOnly = "1";//只读模式 }else{ } isShowButton=false; @@ -59,10 +73,18 @@ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Accounting/LoanSimulation_old/condition_plan.jsp b/WebContent/Accounting/LoanSimulation_old/condition_plan.jsp index 32bd5c4a8..e2e882de5 100644 --- a/WebContent/Accounting/LoanSimulation_old/condition_plan.jsp +++ b/WebContent/Accounting/LoanSimulation_old/condition_plan.jsp @@ -10,7 +10,7 @@ String sTabStrip[][] = { {"true", "租金计划", "/Accounting/LoanSimulation_old/RentPlanList.jsp",params, "", "", "false"}, {"true", "资金计划", "/Accounting/LoanSimulation_old/FundPlanList.jsp",params, "", "", "false"}, - {"true", "现金流", "/Accounting/LoanSimulation_old/RentPlanList.jsp",params, "", "", "false"}, + {"true", "现金流", "/Accounting/LoanSimulation_old/CashFlowList.jsp",params, "", "", "false"}, }; %> <%@ include file="/Resources/CodeParts/Tab01.jsp"%> diff --git a/WebContent/Accounting/LoanSimulation_onhire/LoanBasicInfoBusiness.jsp b/WebContent/Accounting/LoanSimulation_onhire/LoanBasicInfoBusiness.jsp new file mode 100644 index 000000000..bbd3cba0e --- /dev/null +++ b/WebContent/Accounting/LoanSimulation_onhire/LoanBasicInfoBusiness.jsp @@ -0,0 +1,1277 @@ +<%@page import="jbo.prd.BUSINESS_TYPE"%> +<%@page import="com.tenwa.reckon.util.TbBeanTools"%> +<%@page import="com.tenwa.reckon.bean.TabCalBean"%> +<%@page import="com.amarsoft.awe.control.model.Parameter"%> +<%@page import="com.amarsoft.app.base.util.DateHelper"%> +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@page import="com.tenwa.reckon.product.ProductCondition"%> +<%@page import="com.amarsoft.app.util.ProductParamUtil"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="java.util.Vector" %> +<%@ page import="com.amarsoft.awe.dw.ui.validator.ValidateRule" %> +<%@ page import="com.tenwa.reckon.product.ASObjectWindowCalc" %> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> +<% + /*获取参数*/ + String flowunid = CurPage.getParameter("FlowUnid"); + String plannumber=CurPage.getParameter("plannumber"); + String productId=CurPage.getParameter("ProductId"); + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType= CurPage.getParameter("RightType"); + String calType = CurPage.getParameter("calType"); + //判断是否为汽车业务 + boolean isCarProduct = "004".equals(productId) ? false : true; + /*获取参数*/ + /*根据参数判断 是否去数据库查询*/ + BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid); + if(productId==null){ + productId=flow.getAttribute("productId").getString(); + } + if(calType == null){ + calType = "proj_process"; + } + TabCalBean tcb=TbBeanTools.getTabInfo(calType); + String planCName=tcb.getPlanCName(); + //方案编号 + if(plannumber==null){ + if("pay_process".equals(calType)||"onHire_process".equals(calType)){ + BizObject condtion=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid and PAYMENT_NUMBER is not null and length(PAYMENT_NUMBER)>0 ").setParameter("flowunid", flowunid).getSingleResult(false); + if(condtion!=null){ + plannumber=condtion.getAttribute(planCName).getString(); + } + }else{ + String planType=ProductParamUtil.getProductParameterValue(productId, "PRD0314", "planinformation"); + if("SinglePlan".equals(planType)){ + BizObject condtion=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + if(condtion!=null){ + plannumber=condtion.getAttribute(planCName).getString(); + } + } + } + } + //新增数据 自动生成方案编号 + if(plannumber==null){ + String sSerialType=""; + JBOTransaction tx=JBOFactory.createJBOTransaction(); + if("proj_process".equals(calType)){ + BizObject proj=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_PROJECT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + sSerialType=proj.getAttribute("PROJECT_NO").getString(); + }else{ + BizObject contract=JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + sSerialType=contract.getAttribute("CONTRACT_NO").getString(); + } + plannumber=SerialNumberUtil.getPlannumber(sSerialType,calType,tx); + tx.commit(); + } + /*根据参数判断 是否去数据库查询*/ + + String sTempletNo = "TLoanSimulationBasicInfo_onhire";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + + + + /*设置字段事件*/ + doTemp.setHtmlEvent("SETTLE_METHOD", "onchange", "changeSettleMethod");//租金计算方式 + doTemp.setHtmlEvent("RENT_OR_RATE", "onchange", "rentOrRateChange");//租金推算方法 + doTemp.setHtmlEvent("INCOME_NUMBER_YEAR", "onchange", "changeIncomeNumber");//还款间隔 + doTemp.setHtmlEvent("INCOME_INTERVAL_MONTH", "onchange", "changeIntervalMonth");//还款间隔(月) + doTemp.setHtmlEvent("INCOME_NUMBER", "onchange", "changeNumber");//还款次数 + doTemp.setHtmlEvent("PERIOD_TYPE", "onchange", "changePeriod");//期初/期末 + doTemp.setHtmlEvent("GRACE", "onchange", "changeGrace");//宽限期RATTermID + doTemp.setHtmlEvent("RATE_FLOAT_TYPE", "onchange", "changeRateFloat");//利率计算方式 + doTemp.setHtmlEvent("BASE_RATE", "onchange", "changeBaseRate");//基准利率 + doTemp.setHtmlEvent("RATE_FLOAT_AMT", "onchange", "changeRateFloatAmt");//利率调整值 + doTemp.setHtmlEvent("CAUTION_MONEY", "onchange", "cautionMoney");//保证金 + doTemp.setHtmlEvent("CAUTION_DEDUCTION_MONEY", "onchange", "cautionDeductionMoney");//保证金抵扣金额 + doTemp.setHtmlEvent("LEASE_AMT_DATE", "onchange", "changeLeaseAmtDate");//投放日 + doTemp.setHtmlEvent("START_DATE", "onchange", "changeStartDate");//起租日 + doTemp.setHtmlEvent("FIRST_PLAN_DATE", "onchange", "changeFistPlanDate");//第一期计划日期 + doTemp.setHtmlEvent("CORPUS_RATIO", "onchange", "changeCorpusRatio");//期限内本金比例 + doTemp.setHtmlEvent("RATE_TYPE", "onchange", "changeRateTypeNew");//利率类型 + /*设置字段事件*/ + + /*设置模板属性*/ + Vector vali=new Vector(); + //费用规则 + ProductCondition pc=new ProductCondition(); + pc.getProductFundRules(doTemp, productId); + String calcRules=pc.getProductRulesBusiness(doTemp, productId,vali); + + if("quoted_price".equals(calType)){//客户报价 流程号存的是客户主键 + doTemp.setDefaultValue("cust_id", flowunid); + } + doTemp.setColumnAttribute(planCName,"isipdate","1"); + doTemp.setJboClass(tcb.getCondition_tb()); + doTemp.setDefaultValue(planCName, plannumber); + doTemp.setDefaultValue("flowunid", flowunid); + doTemp.appendJboWhere(" and "+planCName+"='"+plannumber+"'"); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.lease.flow.flowarchive.calcarchive.CalcCondtionInfoArachiveShow");//如果是历史则新显示历史数据 + } + /*设置模板属性*/ + + /*设置页面属性*/ + CurPage.getCurComp().setAttribute("RightType", null); + Parameter p=new Parameter("plannumber",plannumber); + Vector v=CurPage.parameterList; + v.add(p); + /*设置页面属性*/ + + + ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); + + + dwTemp.Style = "2";//freeform + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "-2";//只读模式 + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.setVali(vali); + dwTemp.setAttr("inputWidth","120"); + dwTemp.setAttr("spanWidth","107"); + dwTemp.setAttr("showRatio", true); + dwTemp.genHTMLObjectWindow(flowunid); + RightType="ReadOnly"; + CurPage.getCurComp().setAttribute("RightType", RightType); + + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("condition_plan", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("even_subsection", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("knowing_config", "", CurPage.getObjectWindowOutput()); + String businessDate = DateHelper.getBusinessDate(); + String sButtons[][] = { + //{"true","All","Button","重置","重置","reloadSelf()","","","",""}, + {"true","","Button","租金测算","租金测算","saveRecord()","","","","btn_icon_save"}, + // {((isCarProduct) && ("proj_process".equals(calType)||"cont_process".equals(calType)))?"true":"false","","Button","引入客户报价","引入客户报价","importCustomerQuot()","","","","btn_icon_edit"} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppConfig/AppFlowShow/AppFlowShowInfo.jsp b/WebContent/AppConfig/AppFlowShow/AppFlowShowInfo.jsp index ae2b531c2..d6f4bb030 100644 --- a/WebContent/AppConfig/AppFlowShow/AppFlowShowInfo.jsp +++ b/WebContent/AppConfig/AppFlowShow/AppFlowShowInfo.jsp @@ -50,7 +50,6 @@ }); function downImage() { - debugger; var uuid = getItemValue(0, getRow(), "ID"); var getParam = "id="+uuid; var requestUrl = '<%=sWebRootPath%>/webapi/resf/files/down/flow/image?' + getParam; diff --git a/WebContent/AppConfig/AppFlowShow/AppFlowShowList.jsp b/WebContent/AppConfig/AppFlowShow/AppFlowShowList.jsp index b4c27bab4..59aee15a8 100644 --- a/WebContent/AppConfig/AppFlowShow/AppFlowShowList.jsp +++ b/WebContent/AppConfig/AppFlowShow/AppFlowShowList.jsp @@ -61,7 +61,6 @@ } function deleteRecord() { - debugger; var uid = getItemValue(0, getRow(), "ID"); if(typeof(uid)=="undefined" || uid.length==0 ) { alert("请选择一条数据!"); diff --git a/WebContent/AppConfig/AutoRiskDetect/ScenarioAlarm.jsp b/WebContent/AppConfig/AutoRiskDetect/ScenarioAlarm.jsp index 9994b4251..b57e1b955 100644 --- a/WebContent/AppConfig/AutoRiskDetect/ScenarioAlarm.jsp +++ b/WebContent/AppConfig/AutoRiskDetect/ScenarioAlarm.jsp @@ -1,15 +1,29 @@ <%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/IncludeBegin.jsp"%> +<%@ include file="/IncludeBegin.jsp"%> <%@page import="com.amarsoft.app.alarm.*"%> <%@page import="com.tenwa.alarm.*"%> <%@page import="com.amarsoft.awe.util.ObjectConverts"%> <%@page import="java.util.List"%> <%@page import="java.util.ArrayList"%> - + <% //获得组件参数 String sScenarioNo = CurPage.getParameter("ScenarioNo"); String sBizArg = CurPage.getParameter("BizArg"); + String [] bizArr = sBizArg.split(","); + String ProjectNo=""; + String gpsVendor=""; + for(int i=0;i - -
- <% - List gList0 = context.getScenario().getGroupList(); - List gList = new ArrayList(); - - //根据运行条件进行预处理,分组下检查项检查条件均没通过,则不显示该分组 - for(int i=0;i ckList0 = group.getCheckItemList(); - List ckList1 = new ArrayList(); //存放检查通过的 - for(int j=0;j0){ - boolean bCondition = StringTool.runAmarScript(Sqlca, sCondition, context.getParameter()).booleanValue(); - if(!bCondition)continue; - else ckList1.add(ckItem); - }else{ - ckList1.add(ckItem); - } - } - if(ckList1.size()>0){ //重组分组 - group.getCheckItemList().clear(); - group.getCheckItemList().addAll(ckList1); - gList.add(group); - } - } - //生成界面 - for(int i=0;i ckList = group.getCheckItemList(); - %> -
-
-
<%=group.getGroupName()%>
-
-
-
-
- - - - - - - - - - - <%for(int j=0;j0){ - viewNode = "修改"; - } - %> - - <%if(ckItem.getItemID().equals("0027")||ckItem.getItemID().equals("0028")){ - autoCommit="fales"; - %> - - <%}else{ %> - - <%} %> - - - - - <%}%> - -
处理的任务处理结果提示信息
<%=ckItem.getItemName()%><%=ckItem.getItemName()%>
 
-
- -
- <%}%> -
- - + +
+ <% + List gList0 = context.getScenario().getGroupList(); + List gList = new ArrayList(); + + //根据运行条件进行预处理,分组下检查项检查条件均没通过,则不显示该分组 + for(int i=0;i ckList0 = group.getCheckItemList(); + List ckList1 = new ArrayList(); //存放检查通过的 + for(int j=0;j0){ + boolean bCondition = StringTool.runAmarScript(Sqlca, sCondition, context.getParameter()).booleanValue(); + if(!bCondition)continue; + else ckList1.add(ckItem); + }else{ + ckList1.add(ckItem); + } + } + if(ckList1.size()>0){ //重组分组 + group.getCheckItemList().clear(); + group.getCheckItemList().addAll(ckList1); + gList.add(group); + } + } + //生成界面 + for(int i=0;i ckList = group.getCheckItemList(); + %> +
+
+
<%=group.getGroupName()%>
+
+
+
+
+
+ + + + + + + + + + <% + for(int j=0;j0){ + viewNode = "修改"; + } + %> + + <% + if(ckItem.getItemID().equals("0027")||ckItem.getItemID().equals("0028")){ + autoCommit="fales"; + %> + + <% + }else{ + %> + + <% + } + %> + + + + + <% + } + %> + +
处理的任务处理结果提示信息
<%=ckItem.getItemName()%><%=ckItem.getItemName()%>
 
+
+ +
+ <% + } + %> +
+ + - + - + - +
- - - - - - -
<%=new Button("重新检查","重新检查","reRun()","","btn_icon_refresh").getHtmlText()%><%=new Button("确定","确定","alarm_ok()","","btn_icon_submit").getHtmlText()%><%=new Button("取消","取消","alarm_exit()","","btn_icon_close").getHtmlText()%>
-
+ + + + + + +
<%=new Button("重新检查","重新检查","reRun()","","btn_icon_refresh").getHtmlText()%><%=new Button("确定","确定","alarm_ok()","","btn_icon_submit").getHtmlText()%><%=new Button("取消","取消","alarm_exit()","","btn_icon_close").getHtmlText()%>
+
- + <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp b/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp index 0c9401cf1..9fa33235f 100644 --- a/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp +++ b/WebContent/AppConfig/FlowManage/FlowUserConfig/FlowUser.jsp @@ -67,8 +67,9 @@ {usertype:'流程中指定步骤的人员'}, {usertype:'提交人所在部门的角色'}, {usertype:'流程发起人所在部门的角色'}, + {usertype:'选择指定任务池角色'}, {usertype:'根据SQL语句'}, - {usertype:'根据java代码'} + {usertype:'根据java代码'}, ]; if("<%=selectbase%>"=="true"){ jsonData=[{usertype:'指定人员'}, diff --git a/WebContent/AppConfig/FlowManage/FlowUserConfig/flowUserSelect.jsp b/WebContent/AppConfig/FlowManage/FlowUserConfig/flowUserSelect.jsp index b6ddc99c2..dc942e991 100644 --- a/WebContent/AppConfig/FlowManage/FlowUserConfig/flowUserSelect.jsp +++ b/WebContent/AppConfig/FlowManage/FlowUserConfig/flowUserSelect.jsp @@ -6,7 +6,7 @@ <% String pid="8" ; String curOrgId=""; - + String userid= CurPage.getUserId(); //if(CurUser.hasRole("299")){ // curOrgId=session.getAttribute("managerPlatFormOrgId").toString(); //}else{ @@ -15,13 +15,19 @@ //if(curOrgId.length()>13){ // curOrgId=curOrgId.substring(0,13); //} - curOrgId=curOrgId.substring(0,curOrgId.length()-4); + if("admin".equals(userid)){ + curOrgId=curOrgId.substring(0,curOrgId.length()-6); + }else{ + curOrgId=curOrgId.substring(0,curOrgId.length()-3); + } pid=curOrgId; String selectType=CurPage.getParameter("selectType"); String flowno=CurPage.getParameter("flowno"); ObjectTree tree = new ObjectTree("多选参半案例"); SelectUser selectUser=new SelectUser(pid,Sqlca,"","",CurUser,selectType,flowno); selectUser.initTreeNode(tree); + /* SelectUser selectUser1=new SelectUser("8006",Sqlca,"","",CurUser,selectType,flowno); + selectUser1.initTreeNode(tree); */ String isSingle=CurPage.getParameter("IsSingle"); if(isSingle==null){isSingle="false";} %> diff --git a/WebContent/AppConfig/FormatDoc/FDConfig/ChangeHtmlData2DB.jsp b/WebContent/AppConfig/FormatDoc/FDConfig/ChangeHtmlData2DB.jsp index 1921e2d27..d137ff663 100644 --- a/WebContent/AppConfig/FormatDoc/FDConfig/ChangeHtmlData2DB.jsp +++ b/WebContent/AppConfig/FormatDoc/FDConfig/ChangeHtmlData2DB.jsp @@ -26,11 +26,13 @@ public static boolean changeHtmlData2DB(FormatDocConfig config, Transaction Sqlc changeHtmlData2xml(rs, config, conn); } conn.commit(); + conn.close(); return true; }catch(Exception e){ ARE.getLog().debug(e); if(conn != null) try{ conn.rollback(); + conn.close(); }catch(Exception e0){} return false; }finally{ diff --git a/WebContent/AppConfig/OrgUserManage/UserInfo.jsp b/WebContent/AppConfig/OrgUserManage/UserInfo.jsp index 914f1070d..4440fa05a 100644 --- a/WebContent/AppConfig/OrgUserManage/UserInfo.jsp +++ b/WebContent/AppConfig/OrgUserManage/UserInfo.jsp @@ -10,7 +10,7 @@ //获得页面参数 String sUserID = CurPage.getParameter("UserID"); if(sUserID==null) sUserID=""; - ASObjectModel doTemp = new ASObjectModel("UserInfo"); + ASObjectModel doTemp = new ASObjectModel("UserInfo_Type"); String orgId=CurPage.getParameter("OrgID"); if(orgId==null) orgId=""; String userNo=""; diff --git a/WebContent/AppConfig/OrgUserManage/UserList.jsp b/WebContent/AppConfig/OrgUserManage/UserList.jsp index 1986a765f..7e561a3ca 100644 --- a/WebContent/AppConfig/OrgUserManage/UserList.jsp +++ b/WebContent/AppConfig/OrgUserManage/UserList.jsp @@ -40,7 +40,7 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp b/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp index 5cce8af69..6a6f89f7a 100644 --- a/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp +++ b/WebContent/AppConfig/RoleManage/ViewAllUserList.jsp @@ -19,7 +19,8 @@ dwTemp.ReadOnly = "1"; //设置是否只读 1:只读 0:可写 dwTemp.genHTMLObjectWindow(sRoleID); String sButtons[][] = { - {"true","","Button","导出Excel","导出Excel","exportAll()","","","",""}, + {"true","","Button","导出Excel","导出Excel","exportAll()","","","","btn_icon_export"}, + {"true","","Button","配置任务权重","配置任务权重","configWeight()","","","","btn_icon_edit"} }; %> <%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppFlow/AppFlowCatalogList.jsp b/WebContent/AppFresh/AppFlow/AppFlowCatalogList.jsp new file mode 100644 index 000000000..7da5e2e79 --- /dev/null +++ b/WebContent/AppFresh/AppFlow/AppFlowCatalogList.jsp @@ -0,0 +1,56 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + ASObjectModel doTemp = new ASObjectModel("APP_FLOW_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(""); + + String sButtons[][] = { + {"true","","Button","导入新流程","导入新流程","importNewFlow()","","","","btn_icon_add"}, + {"true","","Button","取消流程","取消流程","delFlow()","","","","btn_icon_delete"}, + {"true","","Button","流程配置","流程配置","configureFlow()","","","","btn_icon_workflow"}, + }; +%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppFlow/CatalogInfo.jsp b/WebContent/AppFresh/AppFlow/CatalogInfo.jsp new file mode 100644 index 000000000..46759e044 --- /dev/null +++ b/WebContent/AppFresh/AppFlow/CatalogInfo.jsp @@ -0,0 +1,50 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%><% + //获得参数 + String flowNo = CurPage.getParameter("flowNo"); + String phaseNo = CurPage.getParameter("phaseNo"); + if (flowNo == null) flowNo = ""; + if (phaseNo == null) phaseNo = ""; + + String id = CurPage.getParameter("id"); + if (id == null) id = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) sUserID = ""; + + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + + ASObjectModel doTemp = new ASObjectModel("APP_PRD_CATALOG_INFO"); + + doTemp.setDefaultValue("FLOWNO", flowNo); + doTemp.setReadOnly("FLOWNO", true); + + if (!"".equals(phaseNo)) { + doTemp.setReadOnly("PHASENO", true); + } else { + doTemp.setReadOnly("PHASENO", false); + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"}, + {"true", "All", "Button", "关闭","关闭", "goBack()", "", "", "", "btn_icon_close"}, + }; + %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppFlow/CatalogList.jsp b/WebContent/AppFresh/AppFlow/CatalogList.jsp new file mode 100644 index 000000000..6e72a85a5 --- /dev/null +++ b/WebContent/AppFresh/AppFlow/CatalogList.jsp @@ -0,0 +1,63 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + String flowNo = CurPage.getParameter("flowNo"); + if (null == flowNo) flowNo = ""; + ASObjectModel doTemp = new ASObjectModel("APP_PRD_CATALOG_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(flowNo); + + String sButtons[][] = { + {"true","","Button","新增阶段","新增阶段","newRecord()","","","","btn_icon_add"}, + {"true","","Button","取消阶段","取消阶段", + "if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete"}, + {"true","","Button","编辑阶段","编辑阶段","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","页签配置","页签配置","middleConfig()","","","","btn_icon_workflow"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppFlow/MiddleInfo.jsp b/WebContent/AppFresh/AppFlow/MiddleInfo.jsp new file mode 100644 index 000000000..a73af8036 --- /dev/null +++ b/WebContent/AppFresh/AppFlow/MiddleInfo.jsp @@ -0,0 +1,39 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%><% + //获得参数 + String catalogId = CurPage.getParameter("catalogId"); + String libraryId = CurPage.getParameter("libraryId"); + if (catalogId == null) catalogId = ""; + if (libraryId == null) libraryId = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) sUserID = ""; + + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + + ASObjectModel doTemp = new ASObjectModel("APP_MIDDLE_INFO"); + if (!"".equals(catalogId)) doTemp.setDefaultValue("APP_NODE_CATALOG_ID", catalogId); + if (!"".equals(libraryId)) doTemp.setDefaultValue("APP_NODE_LIBRARY_ID", libraryId); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(catalogId+","+libraryId); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppFlow/MiddleList.jsp b/WebContent/AppFresh/AppFlow/MiddleList.jsp new file mode 100644 index 000000000..b9a1ac8d1 --- /dev/null +++ b/WebContent/AppFresh/AppFlow/MiddleList.jsp @@ -0,0 +1,68 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + String id = CurPage.getParameter("id"); + String flowNo = CurPage.getParameter("flowNo"); + String phaseNo = CurPage.getParameter("phaseNo"); + + if (id == null) id = ""; + if (null == flowNo) flowNo = ""; + if (phaseNo == null) phaseNo = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) sUserID = ""; + + ASObjectModel doTemp = new ASObjectModel("APP_MIDDLE_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = { + {"true","","Button","新增页签","新增页签","newRecord()","","","","btn_icon_add"}, + {"true","","Button","取消页签","取消页签", + "if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete"}, + {"true","","Button","编辑页签","编辑页签","viewAndEdit()","","","","btn_icon_edit"} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppPage/AppLibraryAdd.jsp b/WebContent/AppFresh/AppPage/AppLibraryAdd.jsp new file mode 100644 index 000000000..f39d1d3df --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppLibraryAdd.jsp @@ -0,0 +1,57 @@ +<%@page import="jbo.awe.AWE_DO_CATALOG"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //获得参数 + String GROUP_CODE = CurPage.getParameter("GROUP_CODE"); + if (GROUP_CODE == null) + GROUP_CODE = ""; + + ASObjectModel doTemp = new ASObjectModel( + "APP_BUSINESS_ADD"); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(GROUP_CODE); + + String sButtons[][] = { + {"true", "All", "Button", "添加","添加", "saveRecord()", "", "", "", "btn_icon_add"}, + {"true", "All", "Button", "关闭","关闭", "goBack()", "", "", "", "btn_icon_close"}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppPage/AppLibraryGroupInfo.jsp b/WebContent/AppFresh/AppPage/AppLibraryGroupInfo.jsp new file mode 100644 index 000000000..189c7ef06 --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppLibraryGroupInfo.jsp @@ -0,0 +1,44 @@ +<%@page import="jbo.awe.AWE_DO_CATALOG"%> + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%><% + //获得参数 + + String dono = CurPage.getParameter("dono"); + if (dono == null) dono = ""; + String doname = CurPage.getParameter("doname"); + if (doname == null) doname = ""; + + String GROUP_CODE = CurPage.getParameter("GROUP_CODE"); + if (GROUP_CODE == null) GROUP_CODE = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) sUserID = ""; + + ASObjectModel doTemp = new ASObjectModel("APP_BUSINESS_GROUP_INFO"); + + doTemp.setReadOnly("GROUP_CODE", true); + doTemp.setRequired("GROUP_CODE", true); + doTemp.setRequired("GROUP_NAME", true); + doTemp.setVisible("DONO", false); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(GROUP_CODE); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"}, + {"true", "All", "Button", "关闭","关闭", "goBack()", "", "", "", "btn_icon_close"}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppPage/AppLibraryGroupList.jsp b/WebContent/AppFresh/AppPage/AppLibraryGroupList.jsp new file mode 100644 index 000000000..f397044fa --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppLibraryGroupList.jsp @@ -0,0 +1,70 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + ASObjectModel doTemp = new ASObjectModel("APP_BUSINESS_GROUP_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(""); + + String sButtons[][] = { + {"true","","Button","新增新模板分组","新增新模板分组","newRecord()","","","","btn_icon_add"}, + {"true","","Button","取消模板分组","取消模板分组","if(confirm('确实要删除吗?'))del()","","","","btn_icon_delete"}, + {"true","","Button","编辑模板分组","编辑模板分组","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","模板分组配置","模板分组配置","templateConfig()","","","","btn_icon_workflow"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppPage/AppLibraryTemplateInfo.jsp b/WebContent/AppFresh/AppPage/AppLibraryTemplateInfo.jsp new file mode 100644 index 000000000..b6233f7a6 --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppLibraryTemplateInfo.jsp @@ -0,0 +1,43 @@ +<%@page import="jbo.awe.AWE_DO_CATALOG"%> + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%><% + //获得参数 + String GROUP_CODE = CurPage.getParameter("GROUP_CODE"); + if (GROUP_CODE == null) GROUP_CODE = ""; + String DATA_CODE = CurPage.getParameter("DATA_CODE"); + if (DATA_CODE == null) DATA_CODE = ""; + + ASObjectModel doTemp = new ASObjectModel("APP_BUSINESS_TEMPLATE_INFO"); + + if (!"".equals(DATA_CODE)) { + doTemp.setReadOnly("DONO", true); + doTemp.setReadOnly("COLINDEX", true); + doTemp.setReadOnly("SORTNO", true); + doTemp.setReadOnly("COLNAME", true); + + doTemp.setReadOnly("DATA_CODE", true); + } else { + doTemp.setDefaultValue("GROUP_CODE", GROUP_CODE); + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(GROUP_CODE+","+DATA_CODE); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"}, + {"true", "All", "Button", "关闭","关闭", "goBack()", "", "", "", "btn_icon_close"}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppPage/AppLibraryTemplateList.jsp b/WebContent/AppFresh/AppPage/AppLibraryTemplateList.jsp new file mode 100644 index 000000000..fd570ec0f --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppLibraryTemplateList.jsp @@ -0,0 +1,64 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + String GROUP_CODE = CurPage.getParameter("GROUP_CODE"); + if (GROUP_CODE == null) + GROUP_CODE = ""; + + ASObjectModel doTemp = new ASObjectModel("APP_BUSINESS_TEMPLATE_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(GROUP_CODE); + + String sButtons[][] = { + {"true","","Button","新增字段","新增字段","newRecord()","","","","btn_icon_add"}, + {"true","","Button","删除字段","删除字段","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete"}, + {"true","","Button","编辑字段","编辑字段","viewAndEdit()","","","","btn_icon_edit"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppPage/AppNodeInfo.jsp b/WebContent/AppFresh/AppPage/AppNodeInfo.jsp new file mode 100644 index 000000000..834a0bd8e --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppNodeInfo.jsp @@ -0,0 +1,40 @@ +<%@page import="jbo.awe.AWE_DO_CATALOG"%> + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%><% + //获得参数 + String GROUP_CODE = CurPage.getParameter("GROUP_CODE"); + + if (GROUP_CODE == null) GROUP_CODE = ""; + + String id = CurPage.getParameter("id"); + if (id == null) id = ""; + + ASObjectModel doTemp = new ASObjectModel("APP_NODEINFO_LIBRARY_APP_INFO"); + doTemp.setReadOnly("APP_BUSINESS_GROUP_CODE", true); + if ("".equals(id)) { + doTemp.setDefaultValue("APP_BUSINESS_GROUP_CODE", GROUP_CODE); + /* doTemp.setHtmlEvent("ENABLE_CONDITION", "onchange", "openConditionShow"); */ + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"}, + {"true", "All", "Button", "关闭","关闭", "goBack()", "", "", "", "btn_icon_close"}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppPage/AppNodeList.jsp b/WebContent/AppFresh/AppPage/AppNodeList.jsp new file mode 100644 index 000000000..30eb4bb1c --- /dev/null +++ b/WebContent/AppFresh/AppPage/AppNodeList.jsp @@ -0,0 +1,57 @@ + <%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_list.jspf"%><% + ASObjectModel doTemp = new ASObjectModel("APP_NODEINFO_LIBRARY_APP_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(""); + + String sButtons[][] = { + {"true","","Button","新增页面","新增页面","newRecord()","","","","btn_icon_add"}, + {"true","","Button","编辑页面","编辑页面","viewAndEdit()","","","","btn_icon_edit"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppVersion/AppVersionFile.jsp b/WebContent/AppFresh/AppVersion/AppVersionFile.jsp new file mode 100644 index 000000000..a604c87d3 --- /dev/null +++ b/WebContent/AppFresh/AppVersion/AppVersionFile.jsp @@ -0,0 +1,88 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //获得参数 + String id = CurPage.getParameter("id"); + if (id == null) + id = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) + sUserID = ""; + + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat( + "yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + + ASObjectModel doTemp = new ASObjectModel("APP_VERSION_FILE"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = {{"true", "All", "Button", "保存", + "开始上传", "uploadApp()", "", "", "", "btn_icon_up"},}; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppVersion/AppVersionInfo.jsp b/WebContent/AppFresh/AppVersion/AppVersionInfo.jsp new file mode 100644 index 000000000..833e7536e --- /dev/null +++ b/WebContent/AppFresh/AppVersion/AppVersionInfo.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //获得参数 + String id = CurPage.getParameter("id"); + if (id == null) + id = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) + sUserID = ""; + + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat( + "yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + + ASObjectModel doTemp = new ASObjectModel("APP_VERSION_INFO"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = {{"true", "All", "Button", "保存", + "保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"},}; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/AppFresh/AppVersion/AppVersionList.jsp b/WebContent/AppFresh/AppVersion/AppVersionList.jsp new file mode 100644 index 000000000..d47f3e815 --- /dev/null +++ b/WebContent/AppFresh/AppVersion/AppVersionList.jsp @@ -0,0 +1,91 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include + file="/Frame/resources/include/include_begin_list.jspf"%> +<% + ASObjectModel doTemp = new ASObjectModel("APP_VERSION_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(""); + + String sButtons[][] = { + {"true","","Button","新增APP应用","新增一个版本","newRecord()","","","","btn_icon_add"}, + {"true","","Button","APP应用信息","查看版本信息","viewAndEdit()","","","","btn_icon_detail"}, + {"true","","Button","上传APP应用","查看版本信息","uploadApp()","","","","btn_icon_up"}, + {"true","","Button","删除该应用","删除该版本","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete"}, + {"true","","Button","下载应用到本地","下载该版本","downloadFile()","","","","btn_icon_down"} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/AppFresh/AppVersion/AttachmentUpload.jsp b/WebContent/AppFresh/AppVersion/AttachmentUpload.jsp new file mode 100644 index 000000000..c69ee1639 --- /dev/null +++ b/WebContent/AppFresh/AppVersion/AttachmentUpload.jsp @@ -0,0 +1,81 @@ +<%@page import="jbo.app.APP_VERSION"%> +<%@page import="java.net.URLDecoder"%> +<%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%> +<%@page import="com.amarsoft.awe.util.DBKeyHelp"%> +<%@page import="com.amarsoft.awe.common.attachment.*"%> +<%@ page contentType="text/html; charset=UTF-8"%> +<%@ include file="/IncludeBegin.jsp"%> +<% + AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload(); + myAmarsoftUpload.initialize(pageContext); + myAmarsoftUpload.upload(); + + // 鐢ㄦ埛ID + String USER_ID = (String) myAmarsoftUpload.getRequest() + .getParameter("usreid"); + // 涓婁紶鏈湴鏂囦欢鍚嶇О + String sFileName = (String) myAmarsoftUpload.getRequest() + .getParameter("FILENAME"); + + String id = CurPage.getParameter("id"); + + BizObjectManager bom = JBOFactory + .getBizObjectManager(APP_VERSION.CLASS_NAME); + BizObjectQuery boq = bom.createQuery("id=:id").setParameter( + "id", id); + BizObject bo = boq.getSingleResult(true); + + if (null == bo) { +%> + +<% + return; + } + + // 褰撳墠鏃堕棿 + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat("yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + String date1 = date; + date1 = date1.replace("/", ""); + + String RandomName = date1 + "_" + sFileName; + String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + String sFileNameType = CurConfig.getConfigure("FileNameType"); + String sFullPath = ""; + if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()) { + try { + if (sFileSaveMode.equals("Disk")) { + // 鑾峰彇鍏ㄨ矾寰 + sFullPath = sFileSavePath + "/" + RandomName; + // 淇濆瓨鏈嶅姟鍣ㄦ枃浠 + myAmarsoftUpload.getFiles().getFile(0) + .saveAs(sFullPath); + bo.setAttributeValue("FILE_NAME", sFileName); + bo.setAttributeValue("IMAGE_PATH", sFullPath); + bo.setAttributeValue("MODIFICATOR", USER_ID); + bo.setAttributeValue("MODIFY_DATE", date); + bom.saveObject(bo); + } + } catch (Exception e) { + out.println("An error occurs : " + e.toString()); + myAmarsoftUpload = null; +%> + +<% + } + } +%> + +<%@ include file="/IncludeEnd.jsp"%> diff --git a/WebContent/AppMain/AppLogo/downLoad.png b/WebContent/AppMain/AppLogo/downLoad.png new file mode 100644 index 000000000..263a875ea Binary files /dev/null and b/WebContent/AppMain/AppLogo/downLoad.png differ diff --git a/WebContent/AppMain/Logon/logo_amarsoft.png b/WebContent/AppMain/Logon/logo_amarsoft.png index 9bf6fbb4b..b0942b175 100644 Binary files a/WebContent/AppMain/Logon/logo_amarsoft.png and b/WebContent/AppMain/Logon/logo_amarsoft.png differ diff --git a/WebContent/AppMain/Logon/logo_amarsoft11111.png b/WebContent/AppMain/Logon/logo_amarsoft11111.png new file mode 100644 index 000000000..65af1c2d9 Binary files /dev/null and b/WebContent/AppMain/Logon/logo_amarsoft11111.png differ diff --git a/WebContent/AppMain/Logon/logo_amarsoft2.png b/WebContent/AppMain/Logon/logo_amarsoft2.png new file mode 100644 index 000000000..9bf6fbb4b Binary files /dev/null and b/WebContent/AppMain/Logon/logo_amarsoft2.png differ diff --git a/WebContent/AppMain/Logon/logo_amarsoft3.png b/WebContent/AppMain/Logon/logo_amarsoft3.png new file mode 100644 index 000000000..85709ff78 Binary files /dev/null and b/WebContent/AppMain/Logon/logo_amarsoft3.png differ diff --git a/WebContent/AppMain/Logon/logon.css b/WebContent/AppMain/Logon/logon.css index b5aed6825..f10298eb8 100644 --- a/WebContent/AppMain/Logon/logon.css +++ b/WebContent/AppMain/Logon/logon.css @@ -11,23 +11,20 @@ body{ /*登录页面logo更换 高42px 宽213px 格式*/ .logo_pic{ float:left; - height:32px; - width:213px; + height:88px; + width:230px; background:url(logo_amarsoft.png); - margin-top:280px; + margin-top:270px; margin-left:90px; display: inline; } .logo_slogan{ - float:left; - width:213px; - text-align:center; - color:#333333; - font-family: 微软雅黑; - font-size: 12px; - margin-top:20px; - margin-left:90px; - display: inline; + float:right; + height:20px; + width:137px; + background-image:url(logon.png); +/* margin-top:5px; */ + margin-right:125px; } .logon_body{background:url(logon_bg2.gif) repeat-x top;} diff --git a/WebContent/AppMain/Logon/logon.png b/WebContent/AppMain/Logon/logon.png new file mode 100644 index 000000000..cc4e10874 Binary files /dev/null and b/WebContent/AppMain/Logon/logon.png differ diff --git a/WebContent/AppMain/ModifyPassword.jsp b/WebContent/AppMain/ModifyPassword.jsp index 336494df3..167599c86 100644 --- a/WebContent/AppMain/ModifyPassword.jsp +++ b/WebContent/AppMain/ModifyPassword.jsp @@ -44,10 +44,14 @@ window.open("<%=sWebRootPath%>/index.html","_top"); <%}else{%> showMessage("密码修改成功!"); + setTimeout(function(){ + parent.AsDialog.ClosePage(true);}, 1000); + <%}%> } } + function showMessage(src){ var o = document.getElementById("message"); if(o.flag) window.clearTimeout(o.flag); diff --git a/WebContent/AppMain/MyCalendar.jsp b/WebContent/AppMain/MyCalendar.jsp index a412994e3..f01eb4ef8 100644 --- a/WebContent/AppMain/MyCalendar.jsp +++ b/WebContent/AppMain/MyCalendar.jsp @@ -260,7 +260,7 @@ function fDrawCal(iYear, iMonth, iCellWidth, iCellHeight, sDateTextSize, sDateTe for (var w = 1; w < 7; w++) { sReturn += (""); for (var d = 0; d < 7; d++) { - tdClickEvent = " onClick=newTask("+myMonth[w][d][0]+","+myMonth[w][d][1]+","+myMonth[w][d][2]+") "; +// tdClickEvent = " onClick=newTask("+myMonth[w][d][0]+","+myMonth[w][d][1]+","+myMonth[w][d][2]+") "; if(myMonth[w][d][0] == iYear&&myMonth[w][d][1] == iMonth){ gstype = 'CURSOR:Hand;FONT-FAMILY:Arial;COLOR:#000000;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "'; }else{ diff --git a/WebContent/AppMain/Welcome/BankNotices.jsp b/WebContent/AppMain/Welcome/BankNotices.jsp index 78482a3c1..06b20e2b3 100644 --- a/WebContent/AppMain/Welcome/BankNotices.jsp +++ b/WebContent/AppMain/Welcome/BankNotices.jsp @@ -32,7 +32,7 @@ $(function(){
-
<% +
<% com.amarsoft.are.jbo.BizObjectManager boardM = com.amarsoft.are.jbo.JBOFactory.getBizObjectManager("jbo.sys.BOARD_LIST"); boardM.getQueryProperties().setProperty("largeResultWarn", "2000"); //String sql = "select O.BoardNo, O.BoardTitle, O.IsNew, O.IsEject, O.DocNo from O where O.IsPublish = 'Y' and (O.ShowToRoles is null or O.ShowToRoles in (select UR.RoleID from jbo.sys.USER_ROLE UR where UR.UserID=:UserID)) order by O.BoardNo desc"; @@ -52,6 +52,9 @@ if("Y".equals(boardBos.get(i).getAttribute("IsNew").getString())){%>
+
+ +
diff --git a/WebContent/AppMain/Welcome/WorkTips.jsp b/WebContent/AppMain/Welcome/WorkTips.jsp index 35deaedc6..7381529de 100644 --- a/WebContent/AppMain/Welcome/WorkTips.jsp +++ b/WebContent/AppMain/Welcome/WorkTips.jsp @@ -188,7 +188,7 @@ function openFLowReadPage(serialno,objecttype,objectno,readerid,flowNo,PhaseNo){ if(tabid.length>0||tabPid.length>0){ FlowFunction.viewHisTabRead(objecttype,objectno,flowNo,PhaseNo,serialno,readerid); }else{ - var param = "TaskNo="+sTaskNo+"&RightType=ReadOnly&PhaseNo="+PhaseNo+"&ViewID=001"+"&ObjectType="+objecttype+"&ObjectNo="+objectno+"&readerId="+readerid; + var param = "TaskNo="+sTaskNo+"&PhaseNo="+PhaseNo+"&ViewID=001"+"&ObjectType="+objecttype+"&ObjectNo="+objectno+"&ReaderId="+readerid; var objectinfo =$.parseJSON(RunJspAjax("/Tenwa/Core/FlowManager/GetObjectInfo.jsp?TaskNo="+sTaskNo)); var sUrl="/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp"; AsControl.OpenView("/AppMain/MenuTabContainer.jsp", "isAddMain=true&Title=传阅--"+objectinfo.title+"&ToDestroyAllComponent=N&Url="+sUrl+"&Paras="+param, "right"); diff --git a/WebContent/Common/FinanceReport/ReportData.jsp b/WebContent/Common/FinanceReport/ReportData.jsp index f80647393..3765bb6fa 100644 --- a/WebContent/Common/FinanceReport/ReportData.jsp +++ b/WebContent/Common/FinanceReport/ReportData.jsp @@ -152,7 +152,7 @@ <%=new Button("测 算","测算财务报表","calcReport()","","btn_icon_finish").getHtmlText()%>
<% }%> <%//=new Button("转出至电子表格","转出至电子表格","spreadsheetTransfer(formatContent());","","").getHtmlText()%> - <%=new Button("转出至电子表格","转出至电子表格","AsControl.ExportFinanceReport('"+rReport.ReportNo+"')","","btn_icon_export").getHtmlText()%> + <%//=new Button("转出至电子表格","转出至电子表格","AsControl.ExportFinanceReport('"+rReport.ReportNo+"')","","btn_icon_export").getHtmlText()%>   diff --git a/WebContent/Common/ToolsA/AreaVFrame.jsp b/WebContent/Common/ToolsA/AreaVFrame.jsp index 83762e0f0..0c3e6bac2 100644 --- a/WebContent/Common/ToolsA/AreaVFrame.jsp +++ b/WebContent/Common/ToolsA/AreaVFrame.jsp @@ -3,10 +3,16 @@ Content: 左右框架页面 ,行政区划 */ String sAreaCode = CurPage.getParameter("AreaCode"); + String usedCar = CurPage.getParameter("usedCar"); %><%@include file="/Resources/CodeParts/Frame03.jsp"%> <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Common/ToolsA/SuedCarAreaCodeSelect.jsp b/WebContent/Common/ToolsA/SuedCarAreaCodeSelect.jsp new file mode 100644 index 000000000..b2a331174 --- /dev/null +++ b/WebContent/Common/ToolsA/SuedCarAreaCodeSelect.jsp @@ -0,0 +1,119 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBeginMD.jsp"%><% + /* + 页面说明: 选择行政区划 + */ + String sAreaCodeValue = CurPage.getParameter("AreaCodeValue");//在该页面打开后打开二级分类时传值。 + String sAreaCode = CurPage.getParameter("AreaCode");//已有值时,做初始化传入。 + String sOpen = ""; + String sDefaultItem = ""; + String sDefaultItem2 = ""; + + if(sAreaCode.length()>3) sDefaultItem = sAreaCode.substring(0,4); + if(sAreaCode!=null&&sAreaCode.length()>4){ + sOpen = "YES";//暂不作控制。 + sDefaultItem2 =sAreaCode; + } +%> + + +请选择行政区划 + + + + +
+
+ + + + + + + <% + if(sAreaCodeValue == null){ + %> + +

行政区划大类

+ + + <%}%> + +
+ + + + + + +
<%=new Button("确定","确定","newBusiness()","","").getHtmlText()%><%=new Button("取消","取消","goBack()","","").getHtmlText()%><%=new Button("清空","清空","clearAll()","","").getHtmlText()%>
+
+
+
+ + + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp b/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp index 13a72021a..79a787ca5 100644 --- a/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp +++ b/WebContent/Common/WorkFlow/FlowBackSubmitDialog.jsp @@ -1,196 +1,205 @@ -<%@page import="com.amarsoft.are.jbo.ql.Parser"%> -<%@page import="com.amarsoft.biz.workflow.*"%> -<%@page import="com.amarsoft.app.flow.*"%> -<%@page import="com.tenwa.flow.task.*"%> -<%@page import="com.amarsoft.are.lang.StringX"%> -<%@include file="/Frame/resources/include/include_begin.jspf"%> -<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> -<%@page contentType="text/html; charset=GBK"%> -<% - String taskNo = CurPage.getParameter("TaskNo"); - String applyType = CurPage.getParameter("applyType"); - String phasename = CurPage.getParameter("phasename"); - if(StringX.isSpace(taskNo)) taskNo = ""; - if(StringX.isSpace(applyType)) applyType = ""; - if(StringX.isSpace(phasename)) phasename = ""; - String userID = CurUser.getUserID(); - JBOTransaction tx = JBOFactory.createJBOTransaction(); - TenwaFlowTask ft = new TenwaFlowTask(taskNo, tx);//使用jboTrans - String routeInfo=ft.getFlowRebackInfo(); - String flowNo = ft.FlowNo; - String phaseNo=ft.PhaseNo; - String objectNo=ft.ObjectNo; - String flowState = ft.FlowState; - //会签历史纪录阶段号问题 - tx.commit(); - -%> - -
- - - - - -
<%=new Button("提交","确认提交","javascript:backMethod();","","btn_icon_Submit","").getHtmlText()%><%=new Button("放弃","放弃提交","javascript:doCancel();","","btn_icon_delete","").getHtmlText()%>
-
- -
-
- 请选择退回后提交方式: -
-
- 直接提交退回步骤 - 逐级审批 - -
-
- 请选择退回路径: -
-
- -
-
-
- -
-
- -
-
-
- - - - -
-
- -<%@include file="/Frame/resources/include/include_end.jspf"%> +<%@page import="com.amarsoft.are.jbo.ql.Parser"%> +<%@page import="com.amarsoft.biz.workflow.*"%> +<%@page import="com.amarsoft.app.flow.*"%> +<%@page import="com.tenwa.flow.task.*"%> +<%@page import="com.amarsoft.are.lang.StringX"%> +<%@include file="/Frame/resources/include/include_begin.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<%@page contentType="text/html; charset=GBK"%> +<% + String taskNo = CurPage.getParameter("TaskNo"); + String applyType = CurPage.getParameter("applyType"); + String phasename = CurPage.getParameter("phasename"); + if(StringX.isSpace(taskNo)) taskNo = ""; + if(StringX.isSpace(applyType)) applyType = ""; + if(StringX.isSpace(phasename)) phasename = ""; + String userID = CurUser.getUserID(); + JBOTransaction tx = JBOFactory.createJBOTransaction(); + TenwaFlowTask ft = new TenwaFlowTask(taskNo, tx);//使用jboTrans + String routeInfo=ft.getFlowRebackInfo(); + String flowNo = ft.FlowNo; + String phaseNo=ft.PhaseNo; + String objectNo=ft.ObjectNo; + String flowState = ft.FlowState; + //会签历史纪录阶段号问题 + tx.commit(); + +%> + +
+ + + + + +
<%=new Button("提交","确认提交","javascript:backMethod();","","btn_icon_Submit","").getHtmlText()%><%=new Button("放弃","放弃提交","javascript:doCancel();","","btn_icon_delete","").getHtmlText()%>
+
+ +
+
+ 请选择退回后提交方式: +
+
+ 直接提交退回步骤 + 逐级审批 + +
+
+ 请选择退回路径: +
+
+ +
+
+
+ +
+
+ +
+
+
+ + + + +
+
+ +<%@include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp b/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp index 125d12dd3..26f243a18 100644 --- a/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp +++ b/WebContent/Common/WorkFlow/FlowSubmitDialog.jsp @@ -85,7 +85,10 @@ var applyType = "<%=applyType%>"; var phasename = "<%=phasename%>"; var userID = "<%=userID%>"; - $(function(){initRouteInfo();}); + $(function(){ + initRouteInfo(); + if($("input:radio[value='1000']"))$("input:radio[value='1000']").attr("checked",true); + }); function initRouteInfo(){ //一般路由和条件路由初始化 if(routeJson.routeType=="commroute"||routeJson.routeType=="conditionroute"){ @@ -112,6 +115,7 @@ actionSet.empty().show(); initFlowUserInfo(routeJson.route[0].phaseNo,0); } + initReaderList(routeJson.route[0].phaseNo); } //并行路由初始化 if(routeJson.routeType=="parallelroute"){ @@ -142,6 +146,8 @@ var i=cindex var phaseNo=routeJson.route[i].phaseNo; var noteType=routeJson.route[i].nodeType; + var flowNo="<%=flowNo%>"; + var phase="<%=phaseNo%>"; if(noteType!="END"){ if(noteType=="JOIN"){ if(routeJson.route[i].forkNumber>1){ @@ -156,6 +162,7 @@ actionSet.append("
请选择"+phaseName+"用户:
"); var phaseAction = $("#phaseaction"+cindex); var type = "radio"; + if(flowOperatorType!="01"){type="checkbox";} for(var i=0;i'){ var actionList=routeJson.readUser; + var phaseNo=routeJson.route[0].phaseNo; + if("BusinessApplyFlow"=='<%=flowNo%>'&&"1000"!=tempphaseno&&"8000"!=tempphaseno){ + actionList = ""; + $("#chuanyue").remove(); + $("#phaseactionReader").remove(); + return; + } if(actionList.length>0){ actionSet.empty().show(); - actionSet.append("
请选择传阅的用户:
"); + actionSet.append("
请选择传阅的用户:
"); var phaseAction = $("#phaseactionReader"); var type="checkbox"; for(var j=0;j=0){ //并行合并判断是否选人 diff --git a/WebContent/Common/WorkFlow/PassRound.jsp b/WebContent/Common/WorkFlow/PassRound.jsp index ad1ef1feb..f38381118 100644 --- a/WebContent/Common/WorkFlow/PassRound.jsp +++ b/WebContent/Common/WorkFlow/PassRound.jsp @@ -7,7 +7,7 @@ String taskNo = CurPage.getParameter("TaskNo"); if(StringX.isSpace(taskNo)) taskNo = ""; String userID = CurUser.getUserID(), attribute10 = null; /* 传阅角色 */ - JBOTransaction tx = JBOFactory.createJBOTransaction(); + //JBOTransaction tx = JBOFactory.createJBOTransaction(); FlowTask ft = new FlowTask(taskNo, Sqlca);//使用jboTrans BizObject fm = JBOFactory.getBizObjectManager("jbo.sys.FLOW_MODEL").createQuery("select attribute10 from O where flowNo=:flowNo and phaseNo=:phaseNo ") .setParameter("flowNo", ft.FlowNo ).setParameter("phaseNo", ft.PhaseNo).getSingleResult(false); diff --git a/WebContent/Common/WorkFlow/TaskAssign.jsp b/WebContent/Common/WorkFlow/TaskAssign.jsp index 2011e8d93..d846f433a 100644 --- a/WebContent/Common/WorkFlow/TaskAssign.jsp +++ b/WebContent/Common/WorkFlow/TaskAssign.jsp @@ -7,7 +7,7 @@ String taskNo = CurPage.getParameter("TaskNo"); if(StringX.isSpace(taskNo)) taskNo = ""; String userID = CurUser.getUserID(), attribute9 = null; /* 工作指派角色 */ - JBOTransaction tx = JBOFactory.createJBOTransaction(); + //JBOTransaction tx = JBOFactory.createJBOTransaction(); FlowTask ft = new FlowTask(taskNo, Sqlca);//使用jboTrans BizObject fm = JBOFactory.getBizObjectManager("jbo.sys.FLOW_MODEL").createQuery("select attribute9 from O where flowNo=:flowNo and phaseNo=:phaseNo ") .setParameter("flowNo", ft.FlowNo ).setParameter("phaseNo", ft.PhaseNo).getSingleResult(false); diff --git a/WebContent/Common/WorkFlow/ViewFlowOpinions.jsp b/WebContent/Common/WorkFlow/ViewFlowOpinions.jsp index 755b36a51..da5c25bb5 100644 --- a/WebContent/Common/WorkFlow/ViewFlowOpinions.jsp +++ b/WebContent/Common/WorkFlow/ViewFlowOpinions.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBeginMD.jsp"%><% /* @@ -23,6 +24,18 @@ if(sCurFlowNo==null)sCurFlowNo=""; if(sCurPhaseNo==null)sCurPhaseNo=""; + //control distributor(temporary) + boolean flag = false; + List sRoles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : sRoles) { + if(distributorRole.indexOf(role) != -1) { + flag = true; + break; + } + } + String sSql,sOpinionRightType="",sOpinionRightPhases="",sOpinionRightRoles="",sTempPrivilegePhases="",sPhaseAction=""; boolean bRolePrivilege = false; //哪些阶段能看 boolean bPhasePrivilege = false;// @@ -70,6 +83,21 @@ " ,v.getUserName(fo.inputuser) as v.optionUser,v.getOrgName(fo.inputorg) as v.optionOrg,fo.inputtime from O,jbo.sys.FLOW_OPINION FO,jbo.sys.FLOW_MODEL FM "+ " where O.Serialno=FO.SerialNo and O.FlowNo=FM.FlowNo and O.PhaseNo=FM.PhaseNo "+ " and (FO.PhaseOpinion is not null) and O.ObjectNo=:ObjectNo and O.ObjectType=:ObjectType "; + if(flag) { //经销商约束审批意见查看权限 + String sRole = ""; + for(String s : sRoles) { + if("800".equals(s)) { + continue; + } + if(sRole.length() != 0) { + sRole += ","; + } + sRole += "'" + s + "'"; + } + + sSql += " and (exists (select 1 from jbo.sys.USER_ROLE ur where O.userid = ur.userid and ur.roleid in (" + sRole + ")) or exists (select 1 from jbo.sys.FLOW_TASK FT left join jbo.sys.USER_ROLE U on FT.userid = U.userid where FT.relativeserialno = O.serialno and U.roleid in (" + sRole + ")))"; + } + if(sSelfOpinionPhase.equals("")){ sSql += " ORDER BY O.BeginTime desc, O.SerialNo "; }else{ @@ -144,8 +172,12 @@ 步骤名称:')"><%=DataConvert.toString(opinionBo.getAttribute("PhaseName").getString())%>   - 处理人:<%=DataConvert.toString(opinionBo.getAttribute("optionUser").getString())%>   - 处理人所属机构:<%=DataConvert.toString(opinionBo.getAttribute("optionOrg").getString())%>   + <% if(flag) {%> + 处理人所属机构:安鹏租赁   + <%} else {%> + 处理人:<%=DataConvert.toString(opinionBo.getAttribute("optionUser").getString())%>   + 处理人所属机构:<%=DataConvert.toString(opinionBo.getAttribute("optionOrg").getString())%>   + <%}%> 意见填写时间:<%=DataConvert.toString(opinionBo.getAttribute("inputtime").getString())%>   diff --git a/WebContent/DealerDeposit/DDepositReturn_HisList.jsp b/WebContent/DealerDeposit/DDepositReturn_HisList.jsp new file mode 100644 index 000000000..dd332590c --- /dev/null +++ b/WebContent/DealerDeposit/DDepositReturn_HisList.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-09 + Content: + History Log: + */ + String DistributorNo = CurPage.getParameter("DistributorNo"); + ASObjectModel doTemp = new ASObjectModel("DDepositReturn_HisList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(DistributorNo); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + /* {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, */ + /* {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, */ + /* {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, */ + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/DealerDeposit/DDepositReturn_TempInfo.jsp b/WebContent/DealerDeposit/DDepositReturn_TempInfo.jsp index ecd2accee..765d09d4b 100644 --- a/WebContent/DealerDeposit/DDepositReturn_TempInfo.jsp +++ b/WebContent/DealerDeposit/DDepositReturn_TempInfo.jsp @@ -7,31 +7,86 @@ */ String sFlowUnid = CurPage.getParameter("FlowUnid"); String sPrevUrl = CurPage.getParameter("ID"); - /* if(sPrevUrl == null) sPrevUrl = ""; */ + String ProjectName = CurPage.getParameter("ProjectName"); + String DistributorNo = CurPage.getParameter("DistributorNo"); + String RightType = CurPage.getParameter("RightType"); String sTempletNo = "DDepositReturn_TempInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); - doTemp.setColTips("", "测试"); + + doTemp.setDefaultValue("DISTRIBUTOR_ID", DistributorNo); + doTemp.setHtmlEvent("CAUTION_MONEY", "onchange", "selectBalance"); + if("ReadOnly".equals(RightType)){ + doTemp.setColInnerBtEvent("REFUND_NUMBER,LOCAL_ACCOUNT", ""); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "-2";//只读模式 - dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + dwTemp.genHTMLObjectWindow(sFlowUnid); + String acc_number = Sqlca.getString("select acc_number from OWN_ACCOUNT limit 0,1"); + String acc_bank = Sqlca.getString("select acc_bank from OWN_ACCOUNT limit 0,1"); + String acc = Sqlca.getString("select acc_number from DISTRIBUTOR_ACCOUNT where distributor_id='"+DistributorNo+"' limit 0,1"); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","save()","","","",""}, - {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + {"true","All","Button","保存","保存所有修改","save()","","","",""} }; - /* sButtonPosition = "south"; */ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/DealerDeposit/DDepositReturn_TempList.jsp b/WebContent/DealerDeposit/DDepositReturn_TempList.jsp index 8ff84c9ea..582f8100f 100644 --- a/WebContent/DealerDeposit/DDepositReturn_TempList.jsp +++ b/WebContent/DealerDeposit/DDepositReturn_TempList.jsp @@ -6,24 +6,36 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid"); + String DistributorNo = CurPage.getParameter("DistributorNo"); + String ProjectName = CurPage.getParameter("ProjectName"); + String type = CurPage.getParameter("PhaseNo"); ASObjectModel doTemp = new ASObjectModel("DDepositReturn_TempList"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(sFlowUnid); + + String falg = "true"; + if("0020".equals(type)){ + falg ="false"; + } //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { - {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, - {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {falg,"All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{falg,"","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {falg,"","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, +// {"","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, +// {"","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, +// {"","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/DealerDeposit/DMarginChargeInfo_Temp.jsp b/WebContent/DealerDeposit/DMarginChargeInfo_Temp.jsp index 88a2ebe31..9b3a63be9 100644 --- a/WebContent/DealerDeposit/DMarginChargeInfo_Temp.jsp +++ b/WebContent/DealerDeposit/DMarginChargeInfo_Temp.jsp @@ -1,37 +1,116 @@ -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% - /* - Author: undefined 2018-05-27 - Content: 示例详情页面 - History Log: - */ - String sFlowUnid = CurPage.getParameter("FlowUnid"); - String sPrevUrl = CurPage.getParameter("ID"); -/* if(sPrevUrl == null) sPrevUrl = "/DealerDeposit/DMarginChargeInfo_TempList.jsp"; */ - - String sTempletNo = "DMarginChargeInfo_Temp";//--模板号-- - ASObjectModel doTemp = new ASObjectModel(sTempletNo); - doTemp.setColTips("", "测试"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); - dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//只读模式 - dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); - - String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","save()","","","",""}, - {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} - }; -%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> - -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-27 + Content: 示例详情页面 + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid"); + String sPrevUrl = CurPage.getParameter("id"); + + String rightType = CurPage.getParameter("RightType"); + + String rightTypeS = CurPage.getParameter("distributor_id"); + String DistributorNo = CurPage.getParameter("DistributorNo"); + String sTempletNo = "DMarginChargeInfo_Temp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("DISTRIBUTOR_ID", DistributorNo); + doTemp.setDefaultValue("MONEY_TYPE", "bondCollect"); + String disno=""; + List nolist=JBOFactory.getBizObjectManager("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT").createQuery("select di.distributor_no from O ,jbo.app.tenwa.customer.DISTRIBUTOR_INFO di where di.id=O.flow_key and flow_unid=:flowunid") + .setParameter("flowunid",sFlowUnid).getResultList(false); + if(nolist.size()>0){ + disno=nolist.get(0).getAttribute("distributor_no").getString(); + } + + //ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + + if("ReadOnly".equals(rightType)){ + dwTemp.ReadOnly = "1";//只读模式 + doTemp.setColInnerBtEvent("LOCAL_ACCOUNT,ACCOUNT_INFO", ""); + } + String acc_number = Sqlca.getString("select acc_number from OWN_ACCOUNT limit 0,1"); + String acc_bank = Sqlca.getString("select acc_bank from OWN_ACCOUNT limit 0,1"); + + String acc = Sqlca.getString("select acc_number from DISTRIBUTOR_ACCOUNT where distributor_id="+"'"+DistributorNo+"'"+" limit 0,1"); + String acco = Sqlca.getString("select account from DISTRIBUTOR_ACCOUNT where distributor_id="+"'"+DistributorNo+"'"+" limit 0,1"); + dwTemp.genHTMLObjectWindow(sFlowUnid); + dwTemp.getDataObject().setVisible("CAUTION_MONEY", true); + String sButtons[][] = { + {"ReadOnly".equals(rightType)?"false":"true","","Button","保存","保存所有修改","save(0)","","","",""}, + //{"true","All","Button","返回","返回列表","returnList()","","","",""} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/DealerDeposit/DMarginChargeInfo_TempList.jsp b/WebContent/DealerDeposit/DMarginChargeInfo_TempList.jsp index 1caec11bf..48442ff7d 100644 --- a/WebContent/DealerDeposit/DMarginChargeInfo_TempList.jsp +++ b/WebContent/DealerDeposit/DMarginChargeInfo_TempList.jsp @@ -6,33 +6,66 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid"); + String ProjectName = CurPage.getParameter("ProjectName"); + String id = CurPage.getParameter("ProjectId"); + + String DistributorNo = CurPage.getParameter("DistributorNo"); + + String types = CurPage.getParameter("PhaseNo"); ASObjectModel doTemp = new ASObjectModel("DMarginChargeInfo_TempList"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(sFlowUnid); + + String flag ="true"; + if("0020".equals(types)){ + flag ="false"; + } + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { - {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, - {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""} + {flag,"All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {flag,"","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, + {flag,"","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {flag,"","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> diff --git a/WebContent/Flow/DealerDepositChargeApplyList.jsp b/WebContent/Flow/DealerDepositChargeApplyList.jsp index 6afed6e95..1d3b6add3 100644 --- a/WebContent/Flow/DealerDepositChargeApplyList.jsp +++ b/WebContent/Flow/DealerDepositChargeApplyList.jsp @@ -4,7 +4,7 @@ +%> + + + @@ -22,10 +35,15 @@ request.setAttribute("as_main", new com.amarsoft.awe.ui.layout.ASMain(CurPage).i
@@ -40,14 +58,20 @@ request.setAttribute("as_main", new com.amarsoft.awe.ui.layout.ASMain(CurPage).i
<%@ include file="/Frame/page/jspf/include/jsp_debug.jspf" %> - + \ No newline at end of file diff --git a/WebContent/Frame/page/jspf/include/jsp_sqlca_head.jspf b/WebContent/Frame/page/jspf/include/jsp_sqlca_head.jspf index 83c1f4000..312735bd4 100644 --- a/WebContent/Frame/page/jspf/include/jsp_sqlca_head.jspf +++ b/WebContent/Frame/page/jspf/include/jsp_sqlca_head.jspf @@ -1,4 +1,4 @@ -<% +<%@page import="com.amarsoft.awe.control.PageConstants"%><% Transaction Sqlca = null; Transaction SqlcaRepository = null; String sCurRunMode=CurConfig.getConfigure("RunMode"); @@ -7,6 +7,12 @@ try{ Sqlca = Transaction.createTransaction(sDataSource); SqlcaRepository = Sqlca; ComponentSession CurCompSession = CurARC.getCompSession(); + //checkSingleSignon + String sessionId = session.getId(); + String endtime = Sqlca.getString("select endtime from user_list where sessionid='"+sessionId+"'"); + if(null != endtime){ + response.sendRedirect(request.getContextPath() + PageConstants.SESSION_EXPIRE_PAGE); + } Component CurComp = CurCompSession.lookUp(sCompClientID); Page CurPage = new Page(CurComp); CurPage.setUser(CurUser); diff --git a/WebContent/Frame/page/jspf/ui/widget/tabstrip.jspf b/WebContent/Frame/page/jspf/ui/widget/tabstrip.jspf index ab834251d..801bee4e7 100644 --- a/WebContent/Frame/page/jspf/ui/widget/tabstrip.jspf +++ b/WebContent/Frame/page/jspf/ui/widget/tabstrip.jspf @@ -16,6 +16,7 @@ <%int _first = 0;try{_first = Integer.valueOf(CurPage.getAttribute("First"));}catch(Exception e){}%> var tabCompent = new TabStrip("T01", "单个TabStrip组", "<%="strip".equals(CurPage.getAttribute("TabStripType"))?"strip":"tab"%>", "#window1"); (function(datas, first){ + //debugger; if(datas){ var nums = new Array(); for(var i = 0; i < datas.length; i++){ @@ -23,7 +24,7 @@ var tabCompent = new TabStrip("T01", " if(datas[i][0] != "true") continue; nums.push(i); - tabCompent.addDataItem(self.name+i, datas[i][1], datas[i][2], datas[i][3]=="false"?false:true, datas[i][4]=="true"?true:false, datas[i][5]); + tabCompent.addDataItem(self.name+i,datas[i][1], datas[i][2], datas[i][3]=="false"?false:true, datas[i][4]=="true"?true:false, datas[i][5]); } if(nums.indexOf(first) < 0) first = nums[0]; tabCompent.setSelectedItem(self.name+first); @@ -34,6 +35,7 @@ var tabCompent = new TabStrip("T01", " $(window).resize(function(){ if(bts) $("#window1").height($("body").height() - $(bts).height()); if(tabCompent._view=="tab") $(".tabs_content").height($("#window1").height()-$(".tabs_button").height()-7); + //$(".handle").hide(); }).resize(); })(<%=CurPage.getAttribute("TabStrip")%>, <%=_first%>); diff --git a/WebContent/Frame/page/ow/RequiredRuleUpdator.jsp b/WebContent/Frame/page/ow/RequiredRuleUpdator.jsp index f6c65f00e..19f55619f 100644 --- a/WebContent/Frame/page/ow/RequiredRuleUpdator.jsp +++ b/WebContent/Frame/page/ow/RequiredRuleUpdator.jsp @@ -25,7 +25,8 @@ try{ ObjectConverts.saveObject(new java.io.File(Component.getDWTmpPath(asObj.getSerializableName())), asObj); out.print(sDataObject); }catch(Exception e){ - e.printStackTrace(); + //e.printStackTrace();2018/07/08 by zhulh 找不到校验文件没啥好大惊小怪的 + ARE.getLog().error(e.getMessage()); out.print("fail:"+ e.toString()); } %> \ No newline at end of file diff --git a/WebContent/Frame/page/resources/css/ow/info.css b/WebContent/Frame/page/resources/css/ow/info.css index 75d103b9c..a9ef816cd 100644 --- a/WebContent/Frame/page/resources/css/ow/info.css +++ b/WebContent/Frame/page/resources/css/ow/info.css @@ -143,7 +143,7 @@ label.error{ .info_td_left_even { margin:7px 5px auto auto; background:#fff; - width:150px; + width:200px; border-top:1px solid #D9D9D9; border-bottom:1px solid #d9d9d9; border-right:1px solid #d9d9d9; diff --git a/WebContent/Frame/page/resources/css/ow/list.css b/WebContent/Frame/page/resources/css/ow/list.css index a826f158e..ea3364a0b 100644 --- a/WebContent/Frame/page/resources/css/ow/list.css +++ b/WebContent/Frame/page/resources/css/ow/list.css @@ -1,6 +1,10 @@ @charset "gb2312"; @import url("common.css"); @import url("../filter.css"); + +input::-ms-clear{ + display: none; +} /*通用表格页面样式*/ .list_page{ background-color: transparent; diff --git a/WebContent/Frame/page/resources/css/widget/main.css b/WebContent/Frame/page/resources/css/widget/main.css index 5f9b29cc9..ab0a2cd41 100644 --- a/WebContent/Frame/page/resources/css/widget/main.css +++ b/WebContent/Frame/page/resources/css/widget/main.css @@ -20,7 +20,7 @@ body { float: right; } .main_logo { - width: 99px; + width: 120px; background: url(../../images/main/logo.png) no-repeat center; } #main_menu ul { diff --git a/WebContent/Frame/page/resources/images/main/logo.png b/WebContent/Frame/page/resources/images/main/logo.png index db736231a..662c2d7cd 100644 Binary files a/WebContent/Frame/page/resources/images/main/logo.png and b/WebContent/Frame/page/resources/images/main/logo.png differ diff --git a/WebContent/Frame/page/resources/images/main/logo1.png b/WebContent/Frame/page/resources/images/main/logo1.png new file mode 100644 index 000000000..db736231a Binary files /dev/null and b/WebContent/Frame/page/resources/images/main/logo1.png differ diff --git a/WebContent/Frame/page/resources/images/main/logo1111.png b/WebContent/Frame/page/resources/images/main/logo1111.png new file mode 100644 index 000000000..4a3837b3e Binary files /dev/null and b/WebContent/Frame/page/resources/images/main/logo1111.png differ diff --git a/WebContent/Frame/page/resources/images/main/logo3.png b/WebContent/Frame/page/resources/images/main/logo3.png new file mode 100644 index 000000000..dde4f54c8 Binary files /dev/null and b/WebContent/Frame/page/resources/images/main/logo3.png differ diff --git a/WebContent/Frame/page/tools/dialog/SelectCatalogGrid.jsp b/WebContent/Frame/page/tools/dialog/SelectCatalogGrid.jsp index 2c92a44bb..1156c307b 100644 --- a/WebContent/Frame/page/tools/dialog/SelectCatalogGrid.jsp +++ b/WebContent/Frame/page/tools/dialog/SelectCatalogGrid.jsp @@ -18,6 +18,7 @@ String PG_TITLE = "选择信息"; // 浏览器窗口标题 PG_TITLE //获取参数:查询名称和参数 + String pageSize = CurPage.getParameter("PageSize"); String sSelName = CurPage.getParameter("SelName"); String sParaString = CurPage.getParameter("ParaString"); String RightType=CurPage.getParameter("RightType"); @@ -112,11 +113,13 @@ //将Sql中的变量用相对应的值替换 StringTokenizer stArgs = new StringTokenizer(sParaString,","); + Map paramap = new HashMap(); while (stArgs.hasMoreTokens()) { try{ String sArgName = stArgs.nextToken().trim(); String sArgValue = stArgs.nextToken().trim(); - sSelCode = StringFunction.replace(sSelCode,"#"+sArgName,sArgValue ); + sSelCode = StringFunction.replace(sSelCode,"#"+sArgName,sArgValue ); + paramap.put(sArgName, sArgValue); }catch(NoSuchElementException ex){ throw new Exception("输入参数格式错误!"); } @@ -127,7 +130,12 @@ String[] params=param.split(","); if(params.length==2){ String sCondtion=DataRightManager.getRightConditionSelect(CurUser,params[0],params[1],"1"); - sSelCode = StringFunction.replace(sSelCode,"{"+param+"}",sCondtion ); + if("2".equals(paramap.get("businessType"))||"3".equals(paramap.get("businessType"))){ + sSelCode = StringFunction.replace(sSelCode,"{"+param+"}",sCondtion ); + }else{ + //汽车业务经销商发起没有跟单人员不需要加权限条件 + sSelCode = StringFunction.replace(sSelCode,"{"+param+"}"," and 1=1 " ); + } } } //实例化DataObject @@ -233,15 +241,16 @@ { doTemp.WhereClauseNoFilter+=" "+sAttribute4; } - + doTemp.WhereClauseNoFilter +=""; if(!sMutilOrSingle.equals("Single")) doTemp.multiSelectionEnabled=true; //实例化DataWindow ASDataWindow dwTemp = new ASDataWindow(CurPage,doTemp,Sqlca); dwTemp.Style="1"; //设置DW风格 1:Grid 2:Freeform dwTemp.ReadOnly = "1"; //设置是否只读 1:只读 0:可写 - dwTemp.setPageSize(10); //服务器分页 - +// dwTemp.setPageSize(10); //服务器分页 + + dwTemp.setPageSize((pageSize==null||"undefined".equals(pageSize))?20:Integer.parseInt(pageSize)); //生成HTMLDataWindow Vector vTemp = dwTemp.genHTMLDataWindow("%"); @@ -252,6 +261,7 @@ String sButtons[][] = {}; %><%@include file="/Resources/CodeParts/List05.jsp"%> <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/Uploader.swf b/WebContent/Frame/page/webuploader/Uploader.swf new file mode 100644 index 000000000..bd75d6082 Binary files /dev/null and b/WebContent/Frame/page/webuploader/Uploader.swf differ diff --git a/WebContent/Frame/page/webuploader/images/icons.png b/WebContent/Frame/page/webuploader/images/icons.png new file mode 100644 index 000000000..d5505c9d5 Binary files /dev/null and b/WebContent/Frame/page/webuploader/images/icons.png differ diff --git a/WebContent/Frame/page/webuploader/images/progress.png b/WebContent/Frame/page/webuploader/images/progress.png new file mode 100644 index 000000000..9dde38bbc Binary files /dev/null and b/WebContent/Frame/page/webuploader/images/progress.png differ diff --git a/WebContent/Frame/page/webuploader/noimage.jpg b/WebContent/Frame/page/webuploader/noimage.jpg new file mode 100644 index 000000000..4c58dd5e9 Binary files /dev/null and b/WebContent/Frame/page/webuploader/noimage.jpg differ diff --git a/WebContent/Frame/page/webuploader/upload.css b/WebContent/Frame/page/webuploader/upload.css new file mode 100644 index 000000000..3ee642a37 --- /dev/null +++ b/WebContent/Frame/page/webuploader/upload.css @@ -0,0 +1,564 @@ +body { + margin-top: 50px; + font-size: 16px; + font-family: "Myriad Pro", "Hiragino Sans GB","Microsoft YaHei","寰蒋闆呴粦", Calibri, Helvetica, tahoma,arial,simsun,"氓庐鈥姑ぢ斤拷?, sans-serif; + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +.jumbotron { + background: transparent url(../images/banner.jpg) repeat-x 50% 0%; + color: #fff; + text-shadow: 1px 1px 1px #3b3262; + margin-bottom: 0; +} + +#uploader .filelist div.file-panel { + position: absolute; + height: 0; + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#80000000', endColorstr='#80000000')\0; + background: rgba( 0, 0, 0, 0.5 ); + width: 100%; + top: 0; + left: 0; + overflow: hidden; + z-index: 300; +} + +#uploader .filelist div.file-panel { + position: absolute; + height: 0; + filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#80000000', endColorstr='#80000000')\0; + background: rgba( 0, 0, 0, 0.5 ); + width: 100%; + top: 0; + left: 0; + overflow: hidden; + z-index: 300; +} + +#uploader .filelist div.file-panel span { + width: 24px; + height: 24px; + display: inline; + float: right; + text-indent: -9999px; + overflow: hidden; + background: url(../webuploader/images/icons.png) no-repeat; + padding-right:30px; + margin: 5px 1px 1px; + cursor: pointer; +} + +#uploader .filelist div.file-panel span.rotateLeft { + background-position: -83px 0; +} +#uploader .filelist div.file-panel span.rotateLeft:hover { + background-position: -5px 0; +} + +#uploader .filelist div.file-panel span.rotateRight { + background-position: -108px 0; +} +#uploader .filelist div.file-panel span.rotateRight:hover { + background-position: -30px 0; +} + +#uploader .filelist div.file-panel span.cancel { + background-position: -134px 0; +} +#uploader .filelist div.file-panel span.cancel:hover { + background-position: -56px 0; +} + +.jumbotron .container { + position: relative; +} + +.jumbotron .github-btns { + position: absolute; + bottom: 0; + right: 0; +} + +.fetature { + margin-top: 30px; +} + +.page-body { + min-height: 450px; +} + +.page-container { + margin-top: 10px; +} + +.page-container h1, +.page-container h2, +.page-container h3 { + padding-top: 70px; + margin-top: -50px; +} + +.logo { + position: relative; + padding-left: 60px; +} +.logo span { + position: absolute; + left: 15px; + top: 8px; + font-size: 2em; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); +} +.logo.active { + color: #fff; +} +@media (min-width: 768px) { + .fetature .row .col-lg-4 { + min-height: 250px; + } +} +.footer { + width: 100%; + overflow: hidden; + color: #f2f2f2; + background: #212121; + margin-top: 50px; +} +.footer-fixed-bottom { + position: fixed; + bottom: 0; +} +.footer a { + color: #f2f2f2; +} +.footer .footer-inner { + margin: 15px; +} +.wu-example { + position: relative; + padding: 45px 15px 15px; + margin: 15px 0; + background-color: #fafafa; + box-shadow: inset 0 3px 6px rgba(0, 0, 0, .05); + border-color: #e5e5e5 #eee #eee; + border-style: solid; + border-width: 1px 0; +} +.memo { + content:"鏈夋嫨浠讳綍鏂囦欢"; + position: absolute; + top: 15px; + left: 15px; + font-size: 12px; + font-weight: bold; + color: #bbb; + text-transform: uppercase; + letter-spacing: 1px; +} +@media (min-width: 768px) { + .bs-example { + margin-left: 0; + margin-right: 0; + background-color: #fff; + border-width: 1px; + border-color: #ddd; + border-radius: 4px 4px 0 0; + box-shadow: none; + } +} +.post-toc { + margin-top: 30px; + margin-bottom: 30px; + padding-top: 10px; + padding-bottom: 10px; + text-shadow: 0 1px 0 #fff; + background-color: #f7f5fa; + border-radius: 5px; +} + +.post-toc .nav > li > a { + display: block; + color: #716b7a; + padding: 5px 20px; +} + +.post-toc .nav .nav > li > a { + padding-top: 3px; + padding-bottom: 3px; + padding-left: 30px; + font-size: 90%; +} + +.post-toc.affix { + position: static; +} + +.post-toc .nav .nav { + display: none; + margin-bottom: 8px; +} + + +@media (min-width: 992px) { + .post-toc.affix { + position: fixed; + width: 213px; + top: 50px; + } + + .post-toc .nav > .active > ul { + display: block; + } +} + +@media (min-width: 1200px) { + .post-toc.affix { + width: 263px; + } + + .post-toc .nav > .active > ul { + display: block; + } +} + +.post-toc .nav > .active > a, +.post-toc .nav > .active:hover > a, +.post-toc .nav > .active:focus > a { + font-weight: bold; + color: #563d7c; + background-color: transparent; + border-right: 1px solid #563d7c; +} + +.friends-links { + margin: 0; + padding: 0; + list-style: none; +} + +.weixin { + text-align: center; + display: inline-block; +} +.weixin img { + width: 80px; +} + + +/******************************** +* +* COMMENTS +* +********************************/ + + +.comment { + background-color: transparent; + border-color: #CACACA; + border-style: solid; + border-width: 1px; + color: black; + display: block; + margin-bottom: 10px; + margin-top: 10px; + padding: 0px; + width: 100%; + } + +.comment .commentheader { + border-bottom-color: #CACACA; + border-bottom-style: solid; + border-bottom-width: 1px; + color: black; + background-image: -webkit-linear-gradient(#F8F8F8,#E1E1E1); + background-image: -moz-linear-gradient(#F8F8F8,#E1E1E1); + color: black; + display: block; + float: left; + font-family: helvetica, arial, freesans, clean, sans-serif; + font-size: 12px; + font-style: normal; + font-variant: normal; + font-weight: normal; + height: 33px; + line-height: 33px; + margin: 0px; + overflow-x: hidden; + overflow-y: hidden; + padding: 0px; + text-overflow: ellipsis; + text-shadow: rgba(255, 255, 255, 0.699219) 1px 1px 0px; + white-space: nowrap; + width: 100%; +} + +.comment .commentheader .commentgravatar { + background-attachment: scroll; + background-clip: border-box; + background-color: white; + background-image: none; + background-origin: padding-box; + border-color: #C8C8C8; + border-style: solid; + border-width: 1px; + color: black; + display: inline-block; + float: none; + font-family: helvetica, arial, freesans, clean, sans-serif; + font-size: 1px; + font-style: normal; + font-variant: normal; + font-weight: normal; + height: 24px; + line-height: 1px; + margin-left: 5px; + margin-right: 3px; + margin-top: -2px; + overflow-x: visible; + overflow-y: visible; + padding: 1px; + text-overflow: clip; + text-shadow: rgba(255, 255, 255, 0.699219) 1px 1px 0px; + vertical-align: middle; + white-space: nowrap; + width: 24px; +} + +.comment .commentheader a:link { + text-decoration: none; +} + +.comment .commentheader a:hover { + border-bottom:1px solid; +} + + +.comment .commentheader .commentuser { + background-color: transparent; + color: black; + display: inline; + float: none; + font-family: helvetica, arial, freesans, clean, sans-serif; + font-size: 12px; + font-style: normal; + font-variant: normal; + font-weight: bold; + height: 0px; + line-height: 16px; + margin-left: 5px; + margin-right: 10px; + overflow-x: visible; + overflow-y: visible; + padding: 0px; + text-overflow: clip; + text-shadow: rgba(255, 255, 255, 0.699219) 1px 1px 0px; + white-space: nowrap; + width: 0px; +} + +.comment .commentheader .commentdate { + background-color: transparent; + color: #777; + display: inline; + float: none; + font-family: helvetica, arial, freesans, clean, sans-serif; + font-size: 11px; + font-style: normal; + font-variant: normal; + font-weight: normal; + height: 0px; + line-height: 33px; + margin: 0px; + overflow-x: visible; + overflow-y: visible; + padding: 0px; + text-overflow: clip; + text-shadow: rgba(255, 255, 255, 0.699219) 1px 1px 0px; + white-space: nowrap; + width: 20em; +} + +.comment .commentbody { + background-attachment: scroll; + background-clip: border-box; + background-color: transparent; + background-image: none; + background-origin: padding-box; + color: #333; + display: block; + margin-bottom: 1em; + margin-left: 1em; + margin-right: 1em; + margin-top: 40px; + overflow-x: visible; + overflow-y: visible; + padding: 0em; + position: static; + width: 96%; + word-wrap: break-word; +} + +.comment .commentbody p { + margin-bottom: 0.5em; + margin-top: 0.5em; + margin-left: 0em; + margin-right: 0em; +} + +.comment .commentbody pre { + border: 0px solid #ddd; + background-color: #eef; + padding: 0 .4em; +} + +.comment .commentbody pre code { + border: 0px solid #ddd; +} + +.comment .commentbody code { + border: 1px solid #ddd; + background-color: #eef; + font-size: 85%; + padding: 0 .2em; +} + + + + +/*demo忙聽路氓录聫*/ +#picker { + display: inline-block; + line-height: 1.428571429; + vertical-align: middle; + margin: 0 12px 0 0; +} +#picker .webuploader-pick { + padding: 6px 12px; + display: block; +} + + +#uploader-demo .thumbnail { + width: 110px; + height: 110px; +} +#uploader-demo .thumbnail img { + width: 100%; +} +.uploader-list { + width: 100%; + overflow: hidden; +} +.file-item { + float: left; + position: relative; + margin: 0 20px 20px 0; + padding: 4px; +} +.file-item .error { + position: absolute; + top: 4px; + left: 4px; + right: 4px; + background: red; + color: white; + text-align: center; + height: 20px; + font-size: 14px; + line-height: 23px; +} +.file-item .info { + position: absolute; + left: 4px; + bottom: 4px; + right: 4px; + height: 20px; + line-height: 20px; + text-indent: 5px; + background: rgba(0, 0, 0, 0.6); + color: white; + overflow: hidden; + white-space: nowrap; + text-overflow : ellipsis; + font-size: 12px; + z-index: 10; +} +.upload-state-done:after { + content:"\f00c"; + font-family: FontAwesome; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-size: 32px; + position: absolute; + bottom: 0; + right: 4px; + color: #4cae4c; + z-index: 99; +} +.file-item .progress { + position: absolute; + right: 4px; + bottom: 4px; + height: 3px; + left: 4px; + height: 4px; + overflow: hidden; + z-index: 15; + margin:0; + padding: 0; + border-radius: 0; + background: transparent; +} +.progress span { + display: block; + overflow: hidden; + width: 0; + height: 100%; + background: url(../webuploader/images/progress.png) repeat-x; + -webit-transition: width 200ms linear; + -moz-transition: width 200ms linear; + -o-transition: width 200ms linear; + -ms-transition: width 200ms linear; + transition: width 200ms linear; + -webkit-animation: progressmove 2s linear infinite; + -moz-animation: progressmove 2s linear infinite; + -o-animation: progressmove 2s linear infinite; + -ms-animation: progressmove 2s linear infinite; + animation: progressmove 2s linear infinite; + -webkit-transform: translateZ(0); +} +@-webkit-keyframes progressmove { + 0% { + background-position: 0 0; + } + 100% { + background-position: 17px 0; + } +} +@-moz-keyframes progressmove { + 0% { + background-position: 0 0; + } + 100% { + background-position: 17px 0; + } +} +@keyframes progressmove { + 0% { + background-position: 0 0; + } + 100% { + background-position: 17px 0; + } +} + +a.travis { + position: relative; + top: -4px; + right: 15px; +} \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.css b/WebContent/Frame/page/webuploader/webuploader.css new file mode 100644 index 000000000..12f451f80 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.css @@ -0,0 +1,28 @@ +.webuploader-container { + position: relative; +} +.webuploader-element-invisible { + position: absolute !important; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px,1px,1px,1px); +} +.webuploader-pick { + position: relative; + display: inline-block; + cursor: pointer; + background: #00b7ee; + padding: 10px 15px; + color: #fff; + text-align: center; + border-radius: 3px; + overflow: hidden; +} +.webuploader-pick-hover { + background: #00a2d4; +} + +.webuploader-pick-disable { + opacity: 0.6; + pointer-events:none; +} + diff --git a/WebContent/Frame/page/webuploader/webuploader.custom.js b/WebContent/Frame/page/webuploader/webuploader.custom.js new file mode 100644 index 000000000..f66a92c9c --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.custom.js @@ -0,0 +1,6502 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * 鐩存帴鏉ユ簮浜巎query鐨勪唬鐮併 + * @fileOverview Promise/A+ + * @beta + */ + define('promise-builtin',[ + 'dollar' + ], function( $ ) { + + var api; + + // 绠鍗曠増Callbacks, 榛樿memory锛屽彲閫塷nce. + function Callbacks( once ) { + var list = [], + stack = !once && [], + fire = function( data ) { + memory = data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ); + } + firing = false; + + if ( list ) { + if ( stack ) { + stack.length && fire( stack.shift() ); + } else { + list = []; + } + } + }, + self = { + add: function() { + if ( list ) { + var start = list.length; + (function add ( args ) { + $.each( args, function( _, arg ) { + var type = $.type( arg ); + if ( type === 'function' ) { + list.push( arg ); + } else if ( arg && arg.length && + type !== 'string' ) { + + add( arg ); + } + }); + })( arguments ); + + if ( firing ) { + firingLength = list.length; + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + + disable: function() { + list = stack = memory = undefined; + return this; + }, + + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + + fireWith: function( context, args ) { + if ( list && (!fired || stack) ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + + fire: function() { + self.fireWith( this, arguments ); + return this; + } + }, + + fired, firing, firingStart, firingLength, firingIndex, memory; + + return self; + } + + function Deferred( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ 'resolve', 'done', Callbacks( true ), 'resolved' ], + [ 'reject', 'fail', Callbacks( true ), 'rejected' ], + [ 'notify', 'progress', Callbacks() ] + ], + state = 'pending', + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return Deferred(function( newDefer ) { + $.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = $.isFunction( fns[ i ] ) && fns[ i ]; + + // deferred[ done | fail | progress ] for + // forwarding actions to newDefer + deferred[ tuple[ 1 ] ](function() { + var returned; + + returned = fn && fn.apply( this, arguments ); + + if ( returned && + $.isFunction( returned.promise ) ) { + + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + 'With' ]( + this === promise ? + newDefer.promise() : + this, + fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + + return obj != null ? $.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + $.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + 'With' ]( this === deferred ? promise : + this, arguments ); + return this; + }; + deferred[ tuple[ 0 ] + 'With' ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + } + + api = { + /** + * 鍒涘缓涓涓猍Deferred](http://api.jquery.com/category/deferred-object/)瀵硅薄銆 + * 璇︾粏鐨凞eferred鐢ㄦ硶璇存槑锛岃鍙傜収jQuery鐨凙PI鏂囨。銆 + * + * Deferred瀵硅薄鍦ㄩ挬瀛愬洖鎺夊嚱鏁颁腑缁忓父瑕佺敤鍒帮紝鐢ㄦ潵澶勭悊闇瑕佺瓑寰呯殑寮傛鎿嶄綔銆 + * + * @for Base + * @method Deferred + * @grammar Base.Deferred() => Deferred + * @example + * // 鍦ㄦ枃浠跺紑濮嬪彂閫佸墠鍋氫簺寮傛鎿嶄綔銆 + * // WebUploader浼氱瓑寰呮寮傛鎿嶄綔瀹屾垚鍚庯紝寮濮嬪彂閫佹枃浠躲 + * Uploader.register({ + * 'before-send-file': 'doSomthingAsync' + * }, { + * + * doSomthingAsync: function() { + * var deferred = Base.Deferred(); + * + * // 妯℃嫙涓娆″紓姝ユ搷浣溿 + * setTimeout(deferred.resolve, 2000); + * + * return deferred.promise(); + * } + * }); + */ + Deferred: Deferred, + + /** + * 鍒ゆ柇浼犲叆鐨勫弬鏁版槸鍚︿负涓涓猵romise瀵硅薄銆 + * @method isPromise + * @grammar Base.isPromise( anything ) => Boolean + * @param {*} anything 妫娴嬪璞° + * @return {Boolean} + * @for Base + * @example + * console.log( Base.isPromise() ); // => false + * console.log( Base.isPromise({ key: '123' }) ); // => false + * console.log( Base.isPromise( Base.Deferred().promise() ) ); // => true + * + * // Deferred涔熸槸涓涓狿romise + * console.log( Base.isPromise( Base.Deferred() ) ); // => true + */ + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + }, + + /** + * 杩斿洖涓涓猵romise锛屾promise鍦ㄦ墍鏈変紶鍏ョ殑promise閮藉畬鎴愪簡鍚庡畬鎴愩 + * 璇︾粏璇锋煡鐪媅杩欓噷](http://api.jquery.com/jQuery.when/)銆 + * + * @method when + * @for Base + * @grammar Base.when( promise1[, promise2[, promise3...]] ) => Promise + */ + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + slice = [].slice, + resolveValues = slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || (subordinate && + $.isFunction( subordinate.promise )) ? length : 0, + + // the master Deferred. If resolveValues consist of + // only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? + slice.call( arguments ) : value; + + if ( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !(--remaining) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && + $.isFunction( resolveValues[ i ].promise ) ) { + + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, + resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, + progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } + }; + + return api; + }); + define('promise',[ + 'promise-builtin' + ], function( $ ) { + return $; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鏃ュ織缁勪欢锛屼富瑕佺敤鏉ユ敹闆嗛敊璇俊鎭紝鍙互甯姪 webuploader 鏇村ソ鐨勫畾浣嶉棶棰樺拰鍙戝睍銆 + * + * 濡傛灉鎮ㄤ笉鎯宠鍚敤姝ゅ姛鑳斤紝璇峰湪鎵撳寘鐨勬椂鍊欏幓鎺 log 妯″潡銆 + * + * 鎴栬呭彲浠ュ湪鍒濆鍖栫殑鏃跺欓氳繃 options.disableWidgets 灞炴х鐢ㄣ + * + * 濡傦細 + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 鍙拡瀵 baidu 鍐呴儴浜у搧鐢ㄦ埛鍋氱粺璁″姛鑳姐 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 鏇村畨鍏ㄧ殑鏂瑰紡璋冪敤锛屾瘮濡俛ndroid閲岄潰灏辫兘鎶奵ontext鏀规垚鍏朵粬鐨勫璞° + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android涓嶆敮鎸佺洿鎺ew Blob, 鍙兘鍊熷姪blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 鎶藉嚭鏉ヤ富瑕佹槸涓轰簡瑙e喅android涓嬮潰canvas.toDataUrl涓嶆敮鎸乯peg. + // 浣犲緱鍒扮殑缁撴灉鏄痯ng. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 浠g爜鏉ヨ嚜浜庯細https://github.com/blueimp/JavaScript-Load-Image + * 鏆傛椂椤圭洰涓彧鐢ㄤ簡orientation. + * + * 鍘婚櫎浜 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF瑙f瀽 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 灏濊瘯璇诲彇缂╃暐鍥 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 鏍囪鏄惁琚慨鏀硅繃銆 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 璇诲彇meta淇℃伅銆 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 瑙e喅 orientation 鐨勯棶棰樸 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob闇瑕侀噸鏂扮敓鎴愩 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 閲婃斁鍐呭瓨銆傞潪甯搁噸瑕侊紝鍚﹀垯閲婃斁涓嶄簡image鐨勫唴瀛樸 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 浜ゆ崲width, height鐨勫笺 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 涓嶅厑璁告斁澶с + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 濡傛灉涓嶆槸ios, 涓嶉渶瑕佽繖涔堝鏉傦紒 + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * 杩欎釜鏂瑰紡鎬ц兘涓嶈锛屼絾鏄彲浠ヨВ鍐砤ndroid閲岄潰鐨則oDataUrl鐨刡ug + * android閲岄潰toDataUrl('image/jpege')寰楀埌鐨勭粨鏋滃嵈鏄痯ng. + * + * 鎵浠ヨ繖閲屾病杈欙紝鍙兘鍊熷姪杩欎釜宸ュ叿 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 闈瀉ndroid鎵嬫満鐩存帴璺宠繃銆 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 妫娴嬫槸鍚anvas鏀寔jpeg瀵煎嚭锛屾牴鎹暟鎹牸寮忔潵鍒ゆ柇銆 + // JPEG 鍓嶄袱浣嶅垎鍒槸锛255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 鍙湁鍦╝ndroid鐜涓嬫墠淇 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + define('webuploader',[ + 'base', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/log', + 'runtime/html5/blob', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/image', + 'runtime/html5/androidpatch', + 'runtime/html5/transport' + ], function( Base ) { + return Base; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.custom.min.js b/WebContent/Frame/page/webuploader/webuploader.custom.min.js new file mode 100644 index 000000000..097281056 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.custom.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-builtin",["dollar"],function(a){function b(b){var c,d,e,f,g,h,i=[],j=!b&&[],k=function(a){for(h=a,c=!0,g=e||0,e=0,f=i.length,d=!0;i&&f>g;g++)i[g].apply(a[0],a[1]);d=!1,i&&(j?j.length&&k(j.shift()):i=[])},l={add:function(){if(i){var b=i.length;!function c(b){a.each(b,function(b,d){var e=a.type(d);"function"===e?i.push(d):d&&d.length&&"string"!==e&&c(d)})}(arguments),d?f=i.length:h&&(e=b,k(h))}return this},disable:function(){return i=j=h=void 0,this},lock:function(){return j=void 0,h||l.disable(),this},fireWith:function(a,b){return!i||c&&!j||(b=b||[],b=[a,b.slice?b.slice():b],d?j.push(b):k(b)),this},fire:function(){return l.fireWith(this,arguments),this}};return l}function c(d){var e=[["resolve","done",b(!0),"resolved"],["reject","fail",b(!0),"rejected"],["notify","progress",b()]],f="pending",g={state:function(){return f},always:function(){return h.done(arguments).fail(arguments),this},then:function(){var b=arguments;return c(function(c){a.each(e,function(d,e){var f=e[0],i=a.isFunction(b[d])&&b[d];h[e[1]](function(){var b;b=i&&i.apply(this,arguments),b&&a.isFunction(b.promise)?b.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===g?c.promise():this,i?[b]:arguments)})}),b=null}).promise()},promise:function(b){return null!=b?a.extend(b,g):g}},h={};return g.pipe=g.then,a.each(e,function(a,b){var c=b[2],d=b[3];g[b[1]]=c.add,d&&c.add(function(){f=d},e[1^a][2].disable,e[2][2].lock),h[b[0]]=function(){return h[b[0]+"With"](this===h?g:this,arguments),this},h[b[0]+"With"]=c.fireWith}),g.promise(h),d&&d.call(h,h),h}var d;return d={Deferred:c,isPromise:function(a){return a&&"function"==typeof a.then},when:function(b){var d,e,f,g=0,h=[].slice,i=h.call(arguments),j=i.length,k=1!==j||b&&a.isFunction(b.promise)?j:0,l=1===k?b:c(),m=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?h.call(arguments):e,c===d?l.notifyWith(b,c):--k||l.resolveWith(b,c)}};if(j>1)for(d=new Array(j),e=new Array(j),f=new Array(j);j>g;g++)i[g]&&a.isFunction(i[g].promise)?i[g].promise().done(m(g,f,i)).fail(l.reject).progress(m(g,e,d)):--k;return k||l.resolveWith(f,i),l.promise()}}}),b("promise",["promise-builtin"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.sizeb;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c) +}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/log",["base","uploader","widgets/widget"],function(a,b){function c(a){var b=e.extend({},d,a),c=f.replace(/^(.*)\?/,"$1"+e.param(b)),g=new Image;g.src=c}var d,e=a.$,f=" http://static.tieba.baidu.com/tb/pms/img/st.gif??",g=(location.hostname||location.host||"protected").toLowerCase(),h=g&&/baidu/i.exec(g);if(h)return d={dv:3,master:"webuploader",online:/test/.exec(g)?0:1,module:"",product:g,type:0},b.register({name:"log",init:function(){var a=this.owner,b=0,d=0;a.on("error",function(a){c({type:2,c_error_code:a})}).on("uploadError",function(a,b){c({type:2,c_error_code:"UPLOAD_ERROR",c_reason:""+b})}).on("uploadComplete",function(a){b++,d+=a.size}).on("uploadFinished",function(){c({c_count:b,c_size:d}),b=d=0}),c({c_usage:1})}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;ei&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;lb.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("webuploader",["base","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/log","runtime/html5/blob","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/image","runtime/html5/androidpatch","runtime/html5/transport"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.fis.js b/WebContent/Frame/page/webuploader/webuploader.fis.js new file mode 100644 index 000000000..0099864b0 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.fis.js @@ -0,0 +1,8083 @@ +/*! WebUploader 0.1.5 */ + + +var jQuery = require('example:widget/ui/jquery/jquery.js') + +return (function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }; + + return makeExport( jQuery ); +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 璁 Md5 鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 璁$畻鏂囦欢 md5 鍊硷紝杩斿洖涓涓 promise 瀵硅薄锛屽彲浠ョ洃鍚 progress 杩涘害銆 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 鍙婃椂鏄剧ず杩涘害 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 瀹屾垚 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 鏇村畨鍏ㄧ殑鏂瑰紡璋冪敤锛屾瘮濡俛ndroid閲岄潰灏辫兘鎶奵ontext鏀规垚鍏朵粬鐨勫璞° + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android涓嶆敮鎸佺洿鎺ew Blob, 鍙兘鍊熷姪blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 鎶藉嚭鏉ヤ富瑕佹槸涓轰簡瑙e喅android涓嬮潰canvas.toDataUrl涓嶆敮鎸乯peg. + // 浣犲緱鍒扮殑缁撴灉鏄痯ng. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 浠g爜鏉ヨ嚜浜庯細https://github.com/blueimp/JavaScript-Load-Image + * 鏆傛椂椤圭洰涓彧鐢ㄤ簡orientation. + * + * 鍘婚櫎浜 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF瑙f瀽 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 灏濊瘯璇诲彇缂╃暐鍥 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 杩欎釜鏂瑰紡鎬ц兘涓嶈锛屼絾鏄彲浠ヨВ鍐砤ndroid閲岄潰鐨則oDataUrl鐨刡ug + * android閲岄潰toDataUrl('image/jpege')寰楀埌鐨勭粨鏋滃嵈鏄痯ng. + * + * 鎵浠ヨ繖閲屾病杈欙紝鍙兘鍊熷姪杩欎釜宸ュ叿 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 闈瀉ndroid鎵嬫満鐩存帴璺宠繃銆 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 妫娴嬫槸鍚anvas鏀寔jpeg瀵煎嚭锛屾牴鎹暟鎹牸寮忔潵鍒ゆ柇銆 + // JPEG 鍓嶄袱浣嶅垎鍒槸锛255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 鍙湁鍦╝ndroid鐜涓嬫墠淇 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 鏍囪鏄惁琚慨鏀硅繃銆 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 璇诲彇meta淇℃伅銆 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 瑙e喅 orientation 鐨勯棶棰樸 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob闇瑕侀噸鏂扮敓鎴愩 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 閲婃斁鍐呭瓨銆傞潪甯搁噸瑕侊紝鍚﹀垯閲婃斁涓嶄簡image鐨勫唴瀛樸 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 浜ゆ崲width, height鐨勫笺 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 涓嶅厑璁告斁澶с + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 濡傛灉涓嶆槸ios, 涓嶉渶瑕佽繖涔堝鏉傦紒 + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 鍥剧墖鍘嬬缉 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash瀹炵幇 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 瀹屽叏鐗堟湰銆 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + /** + * @fileOverview 鏃ュ織缁勪欢锛屼富瑕佺敤鏉ユ敹闆嗛敊璇俊鎭紝鍙互甯姪 webuploader 鏇村ソ鐨勫畾浣嶉棶棰樺拰鍙戝睍銆 + * + * 濡傛灉鎮ㄤ笉鎯宠鍚敤姝ゅ姛鑳斤紝璇峰湪鎵撳寘鐨勬椂鍊欏幓鎺 log 妯″潡銆 + * + * 鎴栬呭彲浠ュ湪鍒濆鍖栫殑鏃跺欓氳繃 options.disableWidgets 灞炴х鐢ㄣ + * + * 濡傦細 + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 鍙拡瀵 baidu 鍐呴儴浜у搧鐢ㄦ埛鍋氱粺璁″姛鑳姐 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('webuploader',[ + 'preset/all', + 'widgets/log' + ], function( preset ) { + return preset; + }); + + var _require = require; + return _require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.flashonly.js b/WebContent/Frame/page/webuploader/webuploader.flashonly.js new file mode 100644 index 000000000..956e256b8 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.flashonly.js @@ -0,0 +1,4622 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 鍥剧墖鍘嬬缉 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview 鍙湁flash瀹炵幇鐨勬枃浠剁増鏈 + */ + define('preset/flashonly',[ + 'base', + + // widgets + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/blob', + 'runtime/flash/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/flashonly' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.flashonly.min.js b/WebContent/Frame/page/webuploader/webuploader.flashonly.min.js new file mode 100644 index 000000000..7a2c8abbb --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.flashonly.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.sizeb;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate)); +return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("preset/flashonly",["base","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/flash/filepicker","runtime/flash/image","runtime/flash/blob","runtime/flash/transport"],function(a){return a}),b("webuploader",["preset/flashonly"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.html5only.js b/WebContent/Frame/page/webuploader/webuploader.html5only.js new file mode 100644 index 000000000..866967d96 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.html5only.js @@ -0,0 +1,6030 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 鏇村畨鍏ㄧ殑鏂瑰紡璋冪敤锛屾瘮濡俛ndroid閲岄潰灏辫兘鎶奵ontext鏀规垚鍏朵粬鐨勫璞° + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android涓嶆敮鎸佺洿鎺ew Blob, 鍙兘鍊熷姪blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 鎶藉嚭鏉ヤ富瑕佹槸涓轰簡瑙e喅android涓嬮潰canvas.toDataUrl涓嶆敮鎸乯peg. + // 浣犲緱鍒扮殑缁撴灉鏄痯ng. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 浠g爜鏉ヨ嚜浜庯細https://github.com/blueimp/JavaScript-Load-Image + * 鏆傛椂椤圭洰涓彧鐢ㄤ簡orientation. + * + * 鍘婚櫎浜 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF瑙f瀽 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 灏濊瘯璇诲彇缂╃暐鍥 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 鏍囪鏄惁琚慨鏀硅繃銆 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 璇诲彇meta淇℃伅銆 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 瑙e喅 orientation 鐨勯棶棰樸 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob闇瑕侀噸鏂扮敓鎴愩 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 閲婃斁鍐呭瓨銆傞潪甯搁噸瑕侊紝鍚﹀垯閲婃斁涓嶄簡image鐨勫唴瀛樸 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 浜ゆ崲width, height鐨勫笺 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 涓嶅厑璁告斁澶с + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 濡傛灉涓嶆槸ios, 涓嶉渶瑕佽繖涔堝鏉傦紒 + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview 鍙湁html5瀹炵幇鐨勬枃浠剁増鏈 + */ + define('preset/html5only',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/image', + 'runtime/html5/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/html5only' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.html5only.min.js b/WebContent/Frame/page/webuploader/webuploader.html5only.min.js new file mode 100644 index 000000000..8710e4ea6 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.html5only.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.sizeb;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;ei&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;lb.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/image",["base","runtime/html5/runtime","runtime/html5/util"],function(a,b,c){var d="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D";return b.register("Image",{modified:!1,init:function(){var a=this,b=new Image;b.onload=function(){a._info={type:a.type,width:this.width,height:this.height},a._metas||"image/jpeg"!==a.type?a.owner.trigger("load"):c.parseMeta(a._blob,function(b,c){a._metas=c,a.owner.trigger("load")})},b.onerror=function(){a.owner.trigger("error")},a._img=b},loadFromBlob:function(a){var b=this,d=b._img;b._blob=a,b.type=a.type,d.src=c.createObjectURL(a.getSource()),b.owner.once("load",function(){c.revokeObjectURL(d.src)})},resize:function(a,b){var c=this._canvas||(this._canvas=document.createElement("canvas"));this._resize(this._img,c,a,b),this._blob=null,this.modified=!0,this.owner.trigger("complete","resize")},crop:function(a,b,c,d,e){var f=this._canvas||(this._canvas=document.createElement("canvas")),g=this.options,h=this._img,i=h.naturalWidth,j=h.naturalHeight,k=this.getOrientation();e=e||1,f.width=c,f.height=d,g.preserveHeaders||this._rotate2Orientaion(f,k),this._renderImageToCanvas(f,h,-a,-b,i*e,j*e),this._blob=null,this.modified=!0,this.owner.trigger("complete","crop")},getAsBlob:function(a){var b,d=this._blob,e=this.options;if(a=a||this.type,this.modified||this.type!==a){if(b=this._canvas,"image/jpeg"===a){if(d=c.canvasToDataUrl(b,a,e.quality),e.preserveHeaders&&this._metas&&this._metas.imageHead)return d=c.dataURL2ArrayBuffer(d),d=c.updateImageHead(d,this._metas.imageHead),d=c.arrayBufferToBlob(d,a)}else d=c.canvasToDataUrl(b,a);d=c.dataURL2Blob(d)}return d},getAsDataUrl:function(a){var b=this.options;return a=a||this.type,"image/jpeg"===a?c.canvasToDataUrl(this._canvas,a,b.quality):this._canvas.toDataURL(a)},getOrientation:function(){return this._metas&&this._metas.exif&&this._metas.exif.get("Orientation")||1},info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},destroy:function(){var a=this._canvas;this._img.onload=null,a&&(a.getContext("2d").clearRect(0,0,a.width,a.height),a.width=a.height=0,this._canvas=null),this._img.src=d,this._img=this._blob=null},_resize:function(a,b,c,d){var e,f,g,h,i,j=this.options,k=a.width,l=a.height,m=this.getOrientation();~[5,6,7,8].indexOf(m)&&(c^=d,d^=c,c^=d),e=Math[j.crop?"max":"min"](c/k,d/l),j.allowMagnify||(e=Math.min(1,e)),f=k*e,g=l*e,j.crop?(b.width=c,b.height=d):(b.width=f,b.height=g),h=(b.width-f)/2,i=(b.height-g)/2,j.preserveHeaders||this._rotate2Orientaion(b,m),this._renderImageToCanvas(b,a,h,i,f,g)},_rotate2Orientaion:function(a,b){var c=a.width,d=a.height,e=a.getContext("2d");switch(b){case 5:case 6:case 7:case 8:a.width=d,a.height=c}switch(b){case 2:e.translate(c,0),e.scale(-1,1);break;case 3:e.translate(c,d),e.rotate(Math.PI);break;case 4:e.translate(0,d),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-d);break;case 7:e.rotate(.5*Math.PI),e.translate(c,-d),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-c,0)}},_renderImageToCanvas:function(){function b(a,b,c){var d,e,f,g=document.createElement("canvas"),h=g.getContext("2d"),i=0,j=c,k=c;for(g.width=1,g.height=c,h.drawImage(a,0,0),d=h.getImageData(0,0,1,c).data;k>i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("preset/html5only",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/image","runtime/html5/transport"],function(a){return a}),b("webuploader",["preset/html5only"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.js b/WebContent/Frame/page/webuploader/webuploader.js new file mode 100644 index 000000000..676e24be5 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.js @@ -0,0 +1,8105 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 璁 Md5 鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 璁$畻鏂囦欢 md5 鍊硷紝杩斿洖涓涓 promise 瀵硅薄锛屽彲浠ョ洃鍚 progress 杩涘害銆 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 鍙婃椂鏄剧ず杩涘害 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 瀹屾垚 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 鏇村畨鍏ㄧ殑鏂瑰紡璋冪敤锛屾瘮濡俛ndroid閲岄潰灏辫兘鎶奵ontext鏀规垚鍏朵粬鐨勫璞° + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android涓嶆敮鎸佺洿鎺ew Blob, 鍙兘鍊熷姪blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 鎶藉嚭鏉ヤ富瑕佹槸涓轰簡瑙e喅android涓嬮潰canvas.toDataUrl涓嶆敮鎸乯peg. + // 浣犲緱鍒扮殑缁撴灉鏄痯ng. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 浠g爜鏉ヨ嚜浜庯細https://github.com/blueimp/JavaScript-Load-Image + * 鏆傛椂椤圭洰涓彧鐢ㄤ簡orientation. + * + * 鍘婚櫎浜 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF瑙f瀽 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 灏濊瘯璇诲彇缂╃暐鍥 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 杩欎釜鏂瑰紡鎬ц兘涓嶈锛屼絾鏄彲浠ヨВ鍐砤ndroid閲岄潰鐨則oDataUrl鐨刡ug + * android閲岄潰toDataUrl('image/jpege')寰楀埌鐨勭粨鏋滃嵈鏄痯ng. + * + * 鎵浠ヨ繖閲屾病杈欙紝鍙兘鍊熷姪杩欎釜宸ュ叿 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 闈瀉ndroid鎵嬫満鐩存帴璺宠繃銆 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 妫娴嬫槸鍚anvas鏀寔jpeg瀵煎嚭锛屾牴鎹暟鎹牸寮忔潵鍒ゆ柇銆 + // JPEG 鍓嶄袱浣嶅垎鍒槸锛255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 鍙湁鍦╝ndroid鐜涓嬫墠淇 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 鏍囪鏄惁琚慨鏀硅繃銆 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 璇诲彇meta淇℃伅銆 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 瑙e喅 orientation 鐨勯棶棰樸 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob闇瑕侀噸鏂扮敓鎴愩 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 閲婃斁鍐呭瓨銆傞潪甯搁噸瑕侊紝鍚﹀垯閲婃斁涓嶄簡image鐨勫唴瀛樸 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 浜ゆ崲width, height鐨勫笺 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 涓嶅厑璁告斁澶с + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 濡傛灉涓嶆槸ios, 涓嶉渶瑕佽繖涔堝鏉傦紒 + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server, false); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 鍥剧墖鍘嬬缉 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash瀹炵幇 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 瀹屽叏鐗堟湰銆 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + /** + * @fileOverview 鏃ュ織缁勪欢锛屼富瑕佺敤鏉ユ敹闆嗛敊璇俊鎭紝鍙互甯姪 webuploader 鏇村ソ鐨勫畾浣嶉棶棰樺拰鍙戝睍銆 + * + * 濡傛灉鎮ㄤ笉鎯宠鍚敤姝ゅ姛鑳斤紝璇峰湪鎵撳寘鐨勬椂鍊欏幓鎺 log 妯″潡銆 + * + * 鎴栬呭彲浠ュ湪鍒濆鍖栫殑鏃跺欓氳繃 options.disableWidgets 灞炴х鐢ㄣ + * + * 濡傦細 + * WebUploader.create({ + * ... + * + * disableWidgets: 'log', + * + * ... + * }) + */ + define('widgets/log',[ + 'base', + 'uploader', + 'widgets/widget' + ], function( Base, Uploader ) { + var $ = Base.$, + logUrl = ' http://static.tieba.baidu.com/tb/pms/img/st.gif??', + product = (location.hostname || location.host || 'protected').toLowerCase(), + + // 鍙拡瀵 baidu 鍐呴儴浜у搧鐢ㄦ埛鍋氱粺璁″姛鑳姐 + enable = product && /baidu/i.exec(product), + base; + + if (!enable) { + return; + } + + base = { + dv: 3, + master: 'webuploader', + online: /test/.exec(product) ? 0 : 1, + module: '', + product: product, + type: 0 + }; + + function send(data) { + var obj = $.extend({}, base, data), + url = logUrl.replace(/^(.*)\?/, '$1' + $.param( obj )), + image = new Image(); + + image.src = url; + } + + return Uploader.register({ + name: 'log', + + init: function() { + var owner = this.owner, + count = 0, + size = 0; + + owner + .on('error', function(code) { + send({ + type: 2, + c_error_code: code + }); + }) + .on('uploadError', function(file, reason) { + send({ + type: 2, + c_error_code: 'UPLOAD_ERROR', + c_reason: '' + reason + }); + }) + .on('uploadComplete', function(file) { + count++; + size += file.size; + }). + on('uploadFinished', function() { + send({ + c_count: count, + c_size: size + }); + count = size = 0; + }); + + send({ + c_usage: 1 + }); + } + }); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('webuploader',[ + 'preset/all', + 'widgets/log' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.min.js b/WebContent/Frame/page/webuploader/webuploader.min.js new file mode 100644 index 000000000..b7476beaf --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.min.js @@ -0,0 +1,3 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.sizeb;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("lib/md5",["runtime/client","mediator"],function(a,b){function c(){a.call(this,"Md5")}return b.installTo(c.prototype),c.prototype.loadFromBlob=function(a){var b=this;b.getRuid()&&b.disconnectRuntime(),b.connectRuntime(a.ruid,function(){b.exec("init"),b.exec("loadFromBlob",a)})},c.prototype.getResult=function(){return this.exec("getResult")},c}),b("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(a,b,c,d){return b.register({name:"md5",md5File:function(b,e,f){var g=new c,h=a.Deferred(),i=b instanceof d?b:this.request("get-file",b).source;return g.on("progress load",function(a){a=a||{},h.notify(a.total?a.loaded/a.total:1)}),g.on("complete",function(){h.resolve(g.getResult())}),g.on("error",function(a){h.reject(a)}),arguments.length>1&&(e=e||0,f=f||0,0>e&&(e=i.size+e),0>f&&(f=i.size+f),f=Math.min(f,i.size),i=i.slice(e,f)),g.loadFromBlob(i),h.promise()}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;ei&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;lb.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/html5/md5",["runtime/html5/runtime"],function(a){var b=function(a,b){return a+b&4294967295},c=function(a,c,d,e,f,g){return c=b(b(c,a),b(e,g)),b(c<>>32-f,d)},d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)},e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)},f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)},g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)},h=function(a,c){var h=a[0],i=a[1],j=a[2],k=a[3];h=d(h,i,j,k,c[0],7,-680876936),k=d(k,h,i,j,c[1],12,-389564586),j=d(j,k,h,i,c[2],17,606105819),i=d(i,j,k,h,c[3],22,-1044525330),h=d(h,i,j,k,c[4],7,-176418897),k=d(k,h,i,j,c[5],12,1200080426),j=d(j,k,h,i,c[6],17,-1473231341),i=d(i,j,k,h,c[7],22,-45705983),h=d(h,i,j,k,c[8],7,1770035416),k=d(k,h,i,j,c[9],12,-1958414417),j=d(j,k,h,i,c[10],17,-42063),i=d(i,j,k,h,c[11],22,-1990404162),h=d(h,i,j,k,c[12],7,1804603682),k=d(k,h,i,j,c[13],12,-40341101),j=d(j,k,h,i,c[14],17,-1502002290),i=d(i,j,k,h,c[15],22,1236535329),h=e(h,i,j,k,c[1],5,-165796510),k=e(k,h,i,j,c[6],9,-1069501632),j=e(j,k,h,i,c[11],14,643717713),i=e(i,j,k,h,c[0],20,-373897302),h=e(h,i,j,k,c[5],5,-701558691),k=e(k,h,i,j,c[10],9,38016083),j=e(j,k,h,i,c[15],14,-660478335),i=e(i,j,k,h,c[4],20,-405537848),h=e(h,i,j,k,c[9],5,568446438),k=e(k,h,i,j,c[14],9,-1019803690),j=e(j,k,h,i,c[3],14,-187363961),i=e(i,j,k,h,c[8],20,1163531501),h=e(h,i,j,k,c[13],5,-1444681467),k=e(k,h,i,j,c[2],9,-51403784),j=e(j,k,h,i,c[7],14,1735328473),i=e(i,j,k,h,c[12],20,-1926607734),h=f(h,i,j,k,c[5],4,-378558),k=f(k,h,i,j,c[8],11,-2022574463),j=f(j,k,h,i,c[11],16,1839030562),i=f(i,j,k,h,c[14],23,-35309556),h=f(h,i,j,k,c[1],4,-1530992060),k=f(k,h,i,j,c[4],11,1272893353),j=f(j,k,h,i,c[7],16,-155497632),i=f(i,j,k,h,c[10],23,-1094730640),h=f(h,i,j,k,c[13],4,681279174),k=f(k,h,i,j,c[0],11,-358537222),j=f(j,k,h,i,c[3],16,-722521979),i=f(i,j,k,h,c[6],23,76029189),h=f(h,i,j,k,c[9],4,-640364487),k=f(k,h,i,j,c[12],11,-421815835),j=f(j,k,h,i,c[15],16,530742520),i=f(i,j,k,h,c[2],23,-995338651),h=g(h,i,j,k,c[0],6,-198630844),k=g(k,h,i,j,c[7],10,1126891415),j=g(j,k,h,i,c[14],15,-1416354905),i=g(i,j,k,h,c[5],21,-57434055),h=g(h,i,j,k,c[12],6,1700485571),k=g(k,h,i,j,c[3],10,-1894986606),j=g(j,k,h,i,c[10],15,-1051523),i=g(i,j,k,h,c[1],21,-2054922799),h=g(h,i,j,k,c[8],6,1873313359),k=g(k,h,i,j,c[15],10,-30611744),j=g(j,k,h,i,c[6],15,-1560198380),i=g(i,j,k,h,c[13],21,1309151649),h=g(h,i,j,k,c[4],6,-145523070),k=g(k,h,i,j,c[11],10,-1120210379),j=g(j,k,h,i,c[2],15,718787259),i=g(i,j,k,h,c[9],21,-343485551),a[0]=b(h,a[0]),a[1]=b(i,a[1]),a[2]=b(j,a[2]),a[3]=b(k,a[3])},i=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24);return c},j=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a[b]+(a[b+1]<<8)+(a[b+2]<<16)+(a[b+3]<<24);return c},k=function(a){var b,c,d,e,f,g,j=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;j>=b;b+=64)h(k,i(a.substring(b-64,b)));for(a=a.substring(b-64),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a.charCodeAt(b)<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*j,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},l=function(a){var b,c,d,e,f,g,i=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;i>=b;b+=64)h(k,j(a.subarray(b-64,b)));for(a=i>b-64?a.subarray(b-64):new Uint8Array(0),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a[b]<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*i,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},m=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n=function(a){var b,c="";for(b=0;4>b;b+=1)c+=m[a>>8*b+4&15]+m[a>>8*b&15];return c},o=function(a){var b;for(b=0;b>16)+(b>>16)+(c>>16);return d<<16|65535&c}),q.prototype.append=function(a){return/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a))),this.appendBinary(a),this},q.prototype.appendBinary=function(a){this._buff+=a,this._length+=a.length;var b,c=this._buff.length;for(b=64;c>=b;b+=64)h(this._state,i(this._buff.substring(b-64,b)));return this._buff=this._buff.substr(b-64),this},q.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;e>b;b+=1)f[b>>2]|=d.charCodeAt(b)<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.prototype._finish=function(a,b){var c,d,e,f=b;if(a[f>>2]|=128<<(f%4<<3),f>55)for(h(this._state,a),f=0;16>f;f+=1)a[f]=0;c=8*this._length,c=c.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(c[2],16),e=parseInt(c[1],16)||0,a[14]=d,a[15]=e,h(this._state,a)},q.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},q.hash=function(a,b){/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a)));var c=k(a);return b?c:o(c)},q.hashBinary=function(a,b){var c=k(a);return b?c:o(c)},q.ArrayBuffer=function(){this.reset()},q.ArrayBuffer.prototype.append=function(a){var b,c=this._concatArrayBuffer(this._buff,a),d=c.length;for(this._length+=a.byteLength,b=64;d>=b;b+=64)h(this._state,j(c.subarray(b-64,b)));return this._buff=d>b-64?c.subarray(b-64):new Uint8Array(0),this},q.ArrayBuffer.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +for(b=0;e>b;b+=1)f[b>>2]|=d[b]<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.ArrayBuffer.prototype._finish=q.prototype._finish,q.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.ArrayBuffer.prototype.destroy=q.prototype.destroy,q.ArrayBuffer.prototype._concatArrayBuffer=function(a,b){var c=a.length,d=new Uint8Array(c+b.byteLength);return d.set(a),d.set(new Uint8Array(b),c),d},q.ArrayBuffer.hash=function(a,b){var c=l(new Uint8Array(a));return b?c:o(c)},a.register("Md5",{init:function(){},loadFromBlob:function(a){var b,c,d=a.getSource(),e=2097152,f=Math.ceil(d.size/e),g=0,h=this.owner,i=new q.ArrayBuffer,j=this,k=d.mozSlice||d.webkitSlice||d.slice;c=new FileReader,(b=function(){var l,m;l=g*e,m=Math.min(l+e,d.size),c.onload=function(b){i.append(b.target.result),h.trigger("progress",{total:a.size,loaded:m})},c.onloadend=function(){c.onloadend=c.onload=null,++g',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/md5",["runtime/flash/runtime"],function(a){return a.register("Md5",{init:function(){},loadFromBlob:function(a){return this.flashExec("Md5","loadFromBlob",a.uid)}})}),b("preset/all",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","widgets/md5","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/androidpatch","runtime/html5/image","runtime/html5/transport","runtime/html5/md5","runtime/flash/filepicker","runtime/flash/image","runtime/flash/transport","runtime/flash/blob","runtime/flash/md5"],function(a){return a}),b("widgets/log",["base","uploader","widgets/widget"],function(a,b){function c(a){var b=e.extend({},d,a),c=f.replace(/^(.*)\?/,"$1"+e.param(b)),g=new Image;g.src=c}var d,e=a.$,f=" http://static.tieba.baidu.com/tb/pms/img/st.gif??",g=(location.hostname||location.host||"protected").toLowerCase(),h=g&&/baidu/i.exec(g);if(h)return d={dv:3,master:"webuploader",online:/test/.exec(g)?0:1,module:"",product:g,type:0},b.register({name:"log",init:function(){var a=this.owner,b=0,d=0;a.on("error",function(a){c({type:2,c_error_code:a})}).on("uploadError",function(a,b){c({type:2,c_error_code:"UPLOAD_ERROR",c_reason:""+b})}).on("uploadComplete",function(a){b++,d+=a.size}).on("uploadFinished",function(){c({c_count:b,c_size:d}),b=d=0}),c({c_usage:1})}})}),b("webuploader",["preset/all","widgets/log"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.noimage.js b/WebContent/Frame/page/webuploader/webuploader.noimage.js new file mode 100644 index 000000000..3a3083e41 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.noimage.js @@ -0,0 +1,5026 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview 娌℃湁鍥惧儚澶勭悊鐨勭増鏈 + */ + define('preset/withoutimage',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/transport', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/transport', + 'runtime/flash/blob' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/withoutimage' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.noimage.min.js b/WebContent/Frame/page/webuploader/webuploader.noimage.min.js new file mode 100644 index 000000000..1eaca4806 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.noimage.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice; +return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("preset/withoutimage",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/transport","runtime/flash/filepicker","runtime/flash/transport","runtime/flash/blob"],function(a){return a}),b("webuploader",["preset/withoutimage"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.nolog.js b/WebContent/Frame/page/webuploader/webuploader.nolog.js new file mode 100644 index 000000000..be882f58f --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.nolog.js @@ -0,0 +1,8012 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor|dom} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽**娉ㄦ剰** 杩欓噷铏界劧鍐欑殑鏄 id, 浣嗘槸涓嶆槸鍙敮鎸 id, 杩樻敮鎸 class, 鎴栬 dom 鑺傜偣銆 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview Image + */ + define('lib/image',[ + 'base', + 'runtime/client', + 'lib/blob' + ], function( Base, RuntimeClient, Blob ) { + var $ = Base.$; + + // 鏋勯犲櫒銆 + function Image( opts ) { + this.options = $.extend({}, Image.options, opts ); + RuntimeClient.call( this, 'Image' ); + + this.on( 'load', function() { + this._info = this.exec('info'); + this._meta = this.exec('meta'); + }); + } + + // 榛樿閫夐」銆 + Image.options = { + + // 榛樿鐨勫浘鐗囧鐞嗚川閲 + quality: 90, + + // 鏄惁瑁佸壀 + crop: false, + + // 鏄惁淇濈暀澶撮儴淇℃伅 + preserveHeaders: false, + + // 鏄惁鍏佽鏀惧ぇ銆 + allowMagnify: false + }; + + // 缁ф壙RuntimeClient. + Base.inherits( RuntimeClient, { + constructor: Image, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + loadFromBlob: function( blob ) { + var me = this, + ruid = blob.getRuid(); + + this.connectRuntime( ruid, function() { + me.exec( 'init', me.options ); + me.exec( 'loadFromBlob', blob ); + }); + }, + + resize: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'resize' ].concat( args ) ); + }, + + crop: function() { + var args = Base.slice( arguments ); + return this.exec.apply( this, [ 'crop' ].concat( args ) ); + }, + + getAsDataUrl: function( type ) { + return this.exec( 'getAsDataUrl', type ); + }, + + getAsBlob: function( type ) { + var blob = this.exec( 'getAsBlob', type ); + + return new Blob( this.getRuid(), blob ); + } + }); + + return Image; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/image',[ + 'base', + 'uploader', + 'lib/image', + 'widgets/widget' + ], function( Base, Uploader, Image ) { + + var $ = Base.$, + throttle; + + // 鏍规嵁瑕佸鐞嗙殑鏂囦欢澶у皬鏉ヨ妭娴侊紝涓娆′笉鑳藉鐞嗗お澶氾紝浼氬崱銆 + throttle = (function( max ) { + var occupied = 0, + waiting = [], + tick = function() { + var item; + + while ( waiting.length && occupied < max ) { + item = waiting.shift(); + occupied += item[ 0 ]; + item[ 1 ](); + } + }; + + return function( emiter, size, cb ) { + waiting.push([ size, cb ]); + emiter.once( 'destroy', function() { + occupied -= size; + setTimeout( tick, 1 ); + }); + setTimeout( tick, 1 ); + }; + })( 5 * 1024 * 1024 ); + + $.extend( Uploader.options, { + + /** + * @property {Object} [thumb] + * @namespace options + * @for Uploader + * @description 閰嶇疆鐢熸垚缂╃暐鍥剧殑閫夐」銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 110, + * height: 110, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 70, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: true, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: true, + * + * // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + * // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + * type: 'image/jpeg' + * } + * ``` + */ + thumb: { + width: 110, + height: 110, + quality: 70, + allowMagnify: true, + crop: true, + preserveHeaders: false, + + // 涓虹┖鐨勮瘽鍒欎繚鐣欏師鏈夊浘鐗囨牸寮忋 + // 鍚﹀垯寮哄埗杞崲鎴愭寚瀹氱殑绫诲瀷銆 + // IE 8涓嬮潰 base64 澶у皬涓嶈兘瓒呰繃 32K 鍚﹀垯棰勮澶辫触锛岃岄潪 jpeg 缂栫爜鐨勫浘鐗囧緢鍙 + // 鑳戒細瓒呰繃 32k, 鎵浠ヨ繖閲岃缃垚棰勮鐨勬椂鍊欓兘鏄 image/jpeg + type: 'image/jpeg' + }, + + /** + * @property {Object} [compress] + * @namespace options + * @for Uploader + * @description 閰嶇疆鍘嬬缉鐨勫浘鐗囩殑閫夐」銆傚鏋滄閫夐」涓篳false`, 鍒欏浘鐗囧湪涓婁紶鍓嶄笉杩涜鍘嬬缉銆 + * + * 榛樿涓猴細 + * + * ```javascript + * { + * width: 1600, + * height: 1600, + * + * // 鍥剧墖璐ㄩ噺锛屽彧鏈塼ype涓篳image/jpeg`鐨勬椂鍊欐墠鏈夋晥銆 + * quality: 90, + * + * // 鏄惁鍏佽鏀惧ぇ锛屽鏋滄兂瑕佺敓鎴愬皬鍥剧殑鏃跺欎笉澶辩湡锛屾閫夐」搴旇璁剧疆涓篺alse. + * allowMagnify: false, + * + * // 鏄惁鍏佽瑁佸壀銆 + * crop: false, + * + * // 鏄惁淇濈暀澶撮儴meta淇℃伅銆 + * preserveHeaders: true, + * + * // 濡傛灉鍙戠幇鍘嬬缉鍚庢枃浠跺ぇ灏忔瘮鍘熸潵杩樺ぇ锛屽垯浣跨敤鍘熸潵鍥剧墖 + * // 姝ゅ睘鎬у彲鑳戒細褰卞搷鍥剧墖鑷姩绾犳鍔熻兘 + * noCompressIfLarger: false, + * + * // 鍗曚綅瀛楄妭锛屽鏋滃浘鐗囧ぇ灏忓皬浜庢鍊硷紝涓嶄細閲囩敤鍘嬬缉銆 + * compressSize: 0 + * } + * ``` + */ + compress: { + width: 1600, + height: 1600, + quality: 90, + allowMagnify: false, + crop: false, + preserveHeaders: true + } + }); + + return Uploader.register({ + + name: 'image', + + + /** + * 鐢熸垚缂╃暐鍥撅紝姝よ繃绋嬩负寮傛锛屾墍浠ラ渶瑕佷紶鍏callback`銆 + * 閫氬父鎯呭喌鍦ㄥ浘鐗囧姞鍏ラ槦閲屽悗璋冪敤姝ゆ柟娉曟潵鐢熸垚棰勮鍥句互澧炲己浜や簰鏁堟灉銆 + * + * 褰 width 鎴栬 height 鐨勫间粙浜 0 - 1 鏃讹紝琚綋鎴愮櫨鍒嗘瘮浣跨敤銆 + * + * `callback`涓彲浠ユ帴鏀跺埌涓や釜鍙傛暟銆 + * * 绗竴涓负error锛屽鏋滅敓鎴愮缉鐣ュ浘鏈夐敊璇紝姝rror灏嗕负鐪熴 + * * 绗簩涓负ret, 缂╃暐鍥剧殑Data URL鍊笺 + * + * **娉ㄦ剰** + * Date URL鍦↖E6/7涓笉鏀寔锛屾墍浠ヤ笉鐢ㄨ皟鐢ㄦ鏂规硶浜嗭紝鐩存帴鏄剧ず涓寮犳殏涓嶆敮鎸侀瑙堝浘鐗囧ソ浜嗐 + * 涔熷彲浠ュ熷姪鏈嶅姟绔紝灏 base64 鏁版嵁浼犵粰鏈嶅姟绔紝鐢熸垚涓涓复鏃舵枃浠朵緵棰勮銆 + * + * @method makeThumb + * @grammar makeThumb( file, callback ) => undefined + * @grammar makeThumb( file, callback, width, height ) => undefined + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.makeThumb( file, function( error, ret ) { + * if ( error ) { + * $li.text('棰勮閿欒'); + * } else { + * $li.append(''); + * } + * }); + * + * }); + */ + makeThumb: function( file, cb, width, height ) { + var opts, image; + + file = this.request( 'get-file', file ); + + // 鍙瑙堝浘鐗囨牸寮忋 + if ( !file.type.match( /^image/ ) ) { + cb( true ); + return; + } + + opts = $.extend({}, this.options.thumb ); + + // 濡傛灉浼犲叆鐨勬槸object. + if ( $.isPlainObject( width ) ) { + opts = $.extend( opts, width ); + width = null; + } + + width = width || opts.width; + height = height || opts.height; + + image = new Image( opts ); + + image.once( 'load', function() { + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + // 褰 resize 瀹屽悗 + image.once( 'complete', function() { + cb( false, image.getAsDataUrl( opts.type ) ); + image.destroy(); + }); + + image.once( 'error', function( reason ) { + cb( reason || true ); + image.destroy(); + }); + + throttle( image, file.source.size, function() { + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + image.loadFromBlob( file.source ); + }); + }, + + beforeSendFile: function( file ) { + var opts = this.options.compress || this.options.resize, + compressSize = opts && opts.compressSize || 0, + noCompressIfLarger = opts && opts.noCompressIfLarger || false, + image, deferred; + + file = this.request( 'get-file', file ); + + // 鍙帇缂 jpeg 鍥剧墖鏍煎紡銆 + // gif 鍙兘浼氫涪澶遍拡 + // bmp png 鍩烘湰涓婂昂瀵搁兘涓嶅ぇ锛屼笖鍘嬬缉姣旀瘮杈冨皬銆 + if ( !opts || !~'image/jpeg,image/jpg'.indexOf( file.type ) || + file.size < compressSize || + file._compressed ) { + return; + } + + opts = $.extend({}, opts ); + deferred = Base.Deferred(); + + image = new Image( opts ); + + deferred.always(function() { + image.destroy(); + image = null; + }); + image.once( 'error', deferred.reject ); + image.once( 'load', function() { + var width = opts.width, + height = opts.height; + + file._info = file._info || image.info(); + file._meta = file._meta || image.meta(); + + // 濡傛灉 width 鐨勫间粙浜 0 - 1 + // 璇存槑璁剧疆鐨勬槸鐧惧垎姣斻 + if ( width <= 1 && width > 0 ) { + width = file._info.width * width; + } + + // 鍚屾牱鐨勮鍒欏簲鐢ㄤ簬 height + if ( height <= 1 && height > 0 ) { + height = file._info.height * height; + } + + image.resize( width, height ); + }); + + image.once( 'complete', function() { + var blob, size; + + // 绉诲姩绔 UC / qq 娴忚鍣ㄧ殑鏃犲浘妯″紡涓 + // ctx.getImageData 澶勭悊澶у浘鐨勬椂鍊欎細鎶 Exception + // INDEX_SIZE_ERR: DOM Exception 1 + try { + blob = image.getAsBlob( opts.type ); + + size = file.size; + + // 濡傛灉鍘嬬缉鍚庯紝姣斿師鏉ヨ繕澶у垯涓嶇敤鍘嬬缉鍚庣殑銆 + if ( !noCompressIfLarger || blob.size < size ) { + // file.source.destroy && file.source.destroy(); + file.source = blob; + file.size = blob.size; + + file.trigger( 'resize', blob.size, size ); + } + + // 鏍囪锛岄伩鍏嶉噸澶嶅帇缂┿ + file._compressed = true; + deferred.resolve(); + } catch ( e ) { + // 鍑洪敊浜嗙洿鎺ョ户缁紝璁╁叾涓婁紶鍘熷鍥剧墖 + deferred.resolve(); + } + }); + + file._info && image.info( file._info ); + file._meta && image.meta( file._meta ); + + image.loadFromBlob( file.source ); + return deferred.promise(); + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0 + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + /** + * @property {Object} [runtimeOrder=html5,flash] + * @namespace options + * @for Uploader + * @description 鎸囧畾杩愯鏃跺惎鍔ㄩ『搴忋傞粯璁や細鎯冲皾璇 html5 鏄惁鏀寔锛屽鏋滄敮鎸佸垯浣跨敤 html5, 鍚﹀垯鍒欎娇鐢 flash. + * + * 鍙互灏嗘鍊艰缃垚 `flash`锛屾潵寮哄埗浣跨敤 flash 杩愯鏃躲 + */ + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + var files = []; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + files.push(file); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + var file; + while ( (file = files.shift()) ) { + file.setStatus( Status.PROGRESS ); + } + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me.updateFileProgress( file ); + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + block.percentage = percentage; + me.updateFileProgress( file ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + }, + + updateFileProgress: function(file) { + var totalPercent = 0, + uploaded = 0; + + if (!file.blocks) { + return; + } + + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + this.owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Md5 + */ + define('lib/md5',[ + 'runtime/client', + 'mediator' + ], function( RuntimeClient, Mediator ) { + + function Md5() { + RuntimeClient.call( this, 'Md5' ); + } + + // 璁 Md5 鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Md5.prototype ); + + Md5.prototype.loadFromBlob = function( blob ) { + var me = this; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + me.exec( 'loadFromBlob', blob ); + }); + }; + + Md5.prototype.getResult = function() { + return this.exec('getResult'); + }; + + return Md5; + }); + /** + * @fileOverview 鍥剧墖鎿嶄綔, 璐熻矗棰勮鍥剧墖鍜屼笂浼犲墠鍘嬬缉鍥剧墖 + */ + define('widgets/md5',[ + 'base', + 'uploader', + 'lib/md5', + 'lib/blob', + 'widgets/widget' + ], function( Base, Uploader, Md5, Blob ) { + + return Uploader.register({ + name: 'md5', + + + /** + * 璁$畻鏂囦欢 md5 鍊硷紝杩斿洖涓涓 promise 瀵硅薄锛屽彲浠ョ洃鍚 progress 杩涘害銆 + * + * + * @method md5File + * @grammar md5File( file[, start[, end]] ) => promise + * @for Uploader + * @example + * + * uploader.on( 'fileQueued', function( file ) { + * var $li = ...; + * + * uploader.md5File( file ) + * + * // 鍙婃椂鏄剧ず杩涘害 + * .progress(function(percentage) { + * console.log('Percentage:', percentage); + * }) + * + * // 瀹屾垚 + * .then(function(val) { + * console.log('md5 result:', val); + * }); + * + * }); + */ + md5File: function( file, start, end ) { + var md5 = new Md5(), + deferred = Base.Deferred(), + blob = (file instanceof Blob) ? file : + this.request( 'get-file', file ).source; + + md5.on( 'progress load', function( e ) { + e = e || {}; + deferred.notify( e.total ? e.loaded / e.total : 1 ); + }); + + md5.on( 'complete', function() { + deferred.resolve( md5.getResult() ); + }); + + md5.on( 'error', function( reason ) { + deferred.reject( reason ); + }); + + if ( arguments.length > 1 ) { + start = start || 0; + end = end || 0; + start < 0 && (start = blob.size + start); + end < 0 && (end = blob.size + end); + end = Math.min( end, blob.size ); + blob = blob.slice( start, end ); + } + + md5.loadFromBlob( blob ); + + return deferred.promise(); + } + }); + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/util',[ + 'base' + ], function( Base ) { + + var urlAPI = window.createObjectURL && window || + window.URL && URL.revokeObjectURL && URL || + window.webkitURL, + createObjectURL = Base.noop, + revokeObjectURL = createObjectURL; + + if ( urlAPI ) { + + // 鏇村畨鍏ㄧ殑鏂瑰紡璋冪敤锛屾瘮濡俛ndroid閲岄潰灏辫兘鎶奵ontext鏀规垚鍏朵粬鐨勫璞° + createObjectURL = function() { + return urlAPI.createObjectURL.apply( urlAPI, arguments ); + }; + + revokeObjectURL = function() { + return urlAPI.revokeObjectURL.apply( urlAPI, arguments ); + }; + } + + return { + createObjectURL: createObjectURL, + revokeObjectURL: revokeObjectURL, + + dataURL2Blob: function( dataURI ) { + var byteStr, intArray, ab, i, mimetype, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + ab = new ArrayBuffer( byteStr.length ); + intArray = new Uint8Array( ab ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + mimetype = parts[ 0 ].split(':')[ 1 ].split(';')[ 0 ]; + + return this.arrayBufferToBlob( ab, mimetype ); + }, + + dataURL2ArrayBuffer: function( dataURI ) { + var byteStr, intArray, i, parts; + + parts = dataURI.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + byteStr = atob( parts[ 1 ] ); + } else { + byteStr = decodeURIComponent( parts[ 1 ] ); + } + + intArray = new Uint8Array( byteStr.length ); + + for ( i = 0; i < byteStr.length; i++ ) { + intArray[ i ] = byteStr.charCodeAt( i ); + } + + return intArray.buffer; + }, + + arrayBufferToBlob: function( buffer, type ) { + var builder = window.BlobBuilder || window.WebKitBlobBuilder, + bb; + + // android涓嶆敮鎸佺洿鎺ew Blob, 鍙兘鍊熷姪blobbuilder. + if ( builder ) { + bb = new builder(); + bb.append( buffer ); + return bb.getBlob( type ); + } + + return new Blob([ buffer ], type ? { type: type } : {} ); + }, + + // 鎶藉嚭鏉ヤ富瑕佹槸涓轰簡瑙e喅android涓嬮潰canvas.toDataUrl涓嶆敮鎸乯peg. + // 浣犲緱鍒扮殑缁撴灉鏄痯ng. + canvasToDataUrl: function( canvas, type, quality ) { + return canvas.toDataURL( type, quality / 100 ); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + parseMeta: function( blob, callback ) { + callback( false, {}); + }, + + // imagemeat浼氬鍐欒繖涓柟娉曪紝濡傛灉鐢ㄦ埛閫夋嫨鍔犺浇閭d釜鏂囦欢浜嗙殑璇濄 + updateImageHead: function( data ) { + return data; + } + }; + }); + /** + * Terms: + * + * Uint8Array, FileReader, BlobBuilder, atob, ArrayBuffer + * @fileOverview Image鎺т欢 + */ + define('runtime/html5/imagemeta',[ + 'runtime/html5/util' + ], function( Util ) { + + var api; + + api = { + parsers: { + 0xffe1: [] + }, + + maxMetaDataSize: 262144, + + parse: function( blob, cb ) { + var me = this, + fr = new FileReader(); + + fr.onload = function() { + cb( false, me._parse( this.result ) ); + fr = fr.onload = fr.onerror = null; + }; + + fr.onerror = function( e ) { + cb( e.message ); + fr = fr.onload = fr.onerror = null; + }; + + blob = blob.slice( 0, me.maxMetaDataSize ); + fr.readAsArrayBuffer( blob.getSource() ); + }, + + _parse: function( buffer, noParse ) { + if ( buffer.byteLength < 6 ) { + return; + } + + var dataview = new DataView( buffer ), + offset = 2, + maxOffset = dataview.byteLength - 4, + headLength = offset, + ret = {}, + markerBytes, markerLength, parsers, i; + + if ( dataview.getUint16( 0 ) === 0xffd8 ) { + + while ( offset < maxOffset ) { + markerBytes = dataview.getUint16( offset ); + + if ( markerBytes >= 0xffe0 && markerBytes <= 0xffef || + markerBytes === 0xfffe ) { + + markerLength = dataview.getUint16( offset + 2 ) + 2; + + if ( offset + markerLength > dataview.byteLength ) { + break; + } + + parsers = api.parsers[ markerBytes ]; + + if ( !noParse && parsers ) { + for ( i = 0; i < parsers.length; i += 1 ) { + parsers[ i ].call( api, dataview, offset, + markerLength, ret ); + } + } + + offset += markerLength; + headLength = offset; + } else { + break; + } + } + + if ( headLength > 6 ) { + if ( buffer.slice ) { + ret.imageHead = buffer.slice( 2, headLength ); + } else { + // Workaround for IE10, which does not yet + // support ArrayBuffer.slice: + ret.imageHead = new Uint8Array( buffer ) + .subarray( 2, headLength ); + } + } + } + + return ret; + }, + + updateImageHead: function( buffer, head ) { + var data = this._parse( buffer, true ), + buf1, buf2, bodyoffset; + + + bodyoffset = 2; + if ( data.imageHead ) { + bodyoffset = 2 + data.imageHead.byteLength; + } + + if ( buffer.slice ) { + buf2 = buffer.slice( bodyoffset ); + } else { + buf2 = new Uint8Array( buffer ).subarray( bodyoffset ); + } + + buf1 = new Uint8Array( head.byteLength + 2 + buf2.byteLength ); + + buf1[ 0 ] = 0xFF; + buf1[ 1 ] = 0xD8; + buf1.set( new Uint8Array( head ), 2 ); + buf1.set( new Uint8Array( buf2 ), head.byteLength + 2 ); + + return buf1.buffer; + } + }; + + Util.parseMeta = function() { + return api.parse.apply( api, arguments ); + }; + + Util.updateImageHead = function() { + return api.updateImageHead.apply( api, arguments ); + }; + + return api; + }); + /** + * 浠g爜鏉ヨ嚜浜庯細https://github.com/blueimp/JavaScript-Load-Image + * 鏆傛椂椤圭洰涓彧鐢ㄤ簡orientation. + * + * 鍘婚櫎浜 Exif Sub IFD Pointer, GPS Info IFD Pointer, Exif Thumbnail. + * @fileOverview EXIF瑙f瀽 + */ + + // Sample + // ==================================== + // Make : Apple + // Model : iPhone 4S + // Orientation : 1 + // XResolution : 72 [72/1] + // YResolution : 72 [72/1] + // ResolutionUnit : 2 + // Software : QuickTime 7.7.1 + // DateTime : 2013:09:01 22:53:55 + // ExifIFDPointer : 190 + // ExposureTime : 0.058823529411764705 [1/17] + // FNumber : 2.4 [12/5] + // ExposureProgram : Normal program + // ISOSpeedRatings : 800 + // ExifVersion : 0220 + // DateTimeOriginal : 2013:09:01 22:52:51 + // DateTimeDigitized : 2013:09:01 22:52:51 + // ComponentsConfiguration : YCbCr + // ShutterSpeedValue : 4.058893515764426 + // ApertureValue : 2.5260688216892597 [4845/1918] + // BrightnessValue : -0.3126686601998395 + // MeteringMode : Pattern + // Flash : Flash did not fire, compulsory flash mode + // FocalLength : 4.28 [107/25] + // SubjectArea : [4 values] + // FlashpixVersion : 0100 + // ColorSpace : 1 + // PixelXDimension : 2448 + // PixelYDimension : 3264 + // SensingMethod : One-chip color area sensor + // ExposureMode : 0 + // WhiteBalance : Auto white balance + // FocalLengthIn35mmFilm : 35 + // SceneCaptureType : Standard + define('runtime/html5/imagemeta/exif',[ + 'base', + 'runtime/html5/imagemeta' + ], function( Base, ImageMeta ) { + + var EXIF = {}; + + EXIF.ExifMap = function() { + return this; + }; + + EXIF.ExifMap.prototype.map = { + 'Orientation': 0x0112 + }; + + EXIF.ExifMap.prototype.get = function( id ) { + return this[ id ] || this[ this.map[ id ] ]; + }; + + EXIF.exifTagTypes = { + // byte, 8-bit unsigned int: + 1: { + getValue: function( dataView, dataOffset ) { + return dataView.getUint8( dataOffset ); + }, + size: 1 + }, + + // ascii, 8-bit byte: + 2: { + getValue: function( dataView, dataOffset ) { + return String.fromCharCode( dataView.getUint8( dataOffset ) ); + }, + size: 1, + ascii: true + }, + + // short, 16 bit int: + 3: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint16( dataOffset, littleEndian ); + }, + size: 2 + }, + + // long, 32 bit int: + 4: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // rational = two long values, + // first is numerator, second is denominator: + 5: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getUint32( dataOffset, littleEndian ) / + dataView.getUint32( dataOffset + 4, littleEndian ); + }, + size: 8 + }, + + // slong, 32 bit signed int: + 9: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ); + }, + size: 4 + }, + + // srational, two slongs, first is numerator, second is denominator: + 10: { + getValue: function( dataView, dataOffset, littleEndian ) { + return dataView.getInt32( dataOffset, littleEndian ) / + dataView.getInt32( dataOffset + 4, littleEndian ); + }, + size: 8 + } + }; + + // undefined, 8-bit byte, value depending on field: + EXIF.exifTagTypes[ 7 ] = EXIF.exifTagTypes[ 1 ]; + + EXIF.getExifValue = function( dataView, tiffOffset, offset, type, length, + littleEndian ) { + + var tagType = EXIF.exifTagTypes[ type ], + tagSize, dataOffset, values, i, str, c; + + if ( !tagType ) { + Base.log('Invalid Exif data: Invalid tag type.'); + return; + } + + tagSize = tagType.size * length; + + // Determine if the value is contained in the dataOffset bytes, + // or if the value at the dataOffset is a pointer to the actual data: + dataOffset = tagSize > 4 ? tiffOffset + dataView.getUint32( offset + 8, + littleEndian ) : (offset + 8); + + if ( dataOffset + tagSize > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid data offset.'); + return; + } + + if ( length === 1 ) { + return tagType.getValue( dataView, dataOffset, littleEndian ); + } + + values = []; + + for ( i = 0; i < length; i += 1 ) { + values[ i ] = tagType.getValue( dataView, + dataOffset + i * tagType.size, littleEndian ); + } + + if ( tagType.ascii ) { + str = ''; + + // Concatenate the chars: + for ( i = 0; i < values.length; i += 1 ) { + c = values[ i ]; + + // Ignore the terminating NULL byte(s): + if ( c === '\u0000' ) { + break; + } + str += c; + } + + return str; + } + return values; + }; + + EXIF.parseExifTag = function( dataView, tiffOffset, offset, littleEndian, + data ) { + + var tag = dataView.getUint16( offset, littleEndian ); + data.exif[ tag ] = EXIF.getExifValue( dataView, tiffOffset, offset, + dataView.getUint16( offset + 2, littleEndian ), // tag type + dataView.getUint32( offset + 4, littleEndian ), // tag length + littleEndian ); + }; + + EXIF.parseExifTags = function( dataView, tiffOffset, dirOffset, + littleEndian, data ) { + + var tagsNumber, dirEndOffset, i; + + if ( dirOffset + 6 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory offset.'); + return; + } + + tagsNumber = dataView.getUint16( dirOffset, littleEndian ); + dirEndOffset = dirOffset + 2 + 12 * tagsNumber; + + if ( dirEndOffset + 4 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid directory size.'); + return; + } + + for ( i = 0; i < tagsNumber; i += 1 ) { + this.parseExifTag( dataView, tiffOffset, + dirOffset + 2 + 12 * i, // tag offset + littleEndian, data ); + } + + // Return the offset to the next directory: + return dataView.getUint32( dirEndOffset, littleEndian ); + }; + + // EXIF.getExifThumbnail = function(dataView, offset, length) { + // var hexData, + // i, + // b; + // if (!length || offset + length > dataView.byteLength) { + // Base.log('Invalid Exif data: Invalid thumbnail data.'); + // return; + // } + // hexData = []; + // for (i = 0; i < length; i += 1) { + // b = dataView.getUint8(offset + i); + // hexData.push((b < 16 ? '0' : '') + b.toString(16)); + // } + // return 'data:image/jpeg,%' + hexData.join('%'); + // }; + + EXIF.parseExifData = function( dataView, offset, length, data ) { + + var tiffOffset = offset + 10, + littleEndian, dirOffset; + + // Check for the ASCII code for "Exif" (0x45786966): + if ( dataView.getUint32( offset + 4 ) !== 0x45786966 ) { + // No Exif data, might be XMP data instead + return; + } + if ( tiffOffset + 8 > dataView.byteLength ) { + Base.log('Invalid Exif data: Invalid segment size.'); + return; + } + + // Check for the two null bytes: + if ( dataView.getUint16( offset + 8 ) !== 0x0000 ) { + Base.log('Invalid Exif data: Missing byte alignment offset.'); + return; + } + + // Check the byte alignment: + switch ( dataView.getUint16( tiffOffset ) ) { + case 0x4949: + littleEndian = true; + break; + + case 0x4D4D: + littleEndian = false; + break; + + default: + Base.log('Invalid Exif data: Invalid byte alignment marker.'); + return; + } + + // Check for the TIFF tag marker (0x002A): + if ( dataView.getUint16( tiffOffset + 2, littleEndian ) !== 0x002A ) { + Base.log('Invalid Exif data: Missing TIFF marker.'); + return; + } + + // Retrieve the directory offset bytes, usually 0x00000008 or 8 decimal: + dirOffset = dataView.getUint32( tiffOffset + 4, littleEndian ); + // Create the exif object to store the tags: + data.exif = new EXIF.ExifMap(); + // Parse the tags of the main image directory and retrieve the + // offset to the next directory, usually the thumbnail directory: + dirOffset = EXIF.parseExifTags( dataView, tiffOffset, + tiffOffset + dirOffset, littleEndian, data ); + + // 灏濊瘯璇诲彇缂╃暐鍥 + // if ( dirOffset ) { + // thumbnailData = {exif: {}}; + // dirOffset = EXIF.parseExifTags( + // dataView, + // tiffOffset, + // tiffOffset + dirOffset, + // littleEndian, + // thumbnailData + // ); + + // // Check for JPEG Thumbnail offset: + // if (thumbnailData.exif[0x0201]) { + // data.exif.Thumbnail = EXIF.getExifThumbnail( + // dataView, + // tiffOffset + thumbnailData.exif[0x0201], + // thumbnailData.exif[0x0202] // Thumbnail data length + // ); + // } + // } + }; + + ImageMeta.parsers[ 0xffe1 ].push( EXIF.parseExifData ); + return EXIF; + }); + /** + * 杩欎釜鏂瑰紡鎬ц兘涓嶈锛屼絾鏄彲浠ヨВ鍐砤ndroid閲岄潰鐨則oDataUrl鐨刡ug + * android閲岄潰toDataUrl('image/jpege')寰楀埌鐨勭粨鏋滃嵈鏄痯ng. + * + * 鎵浠ヨ繖閲屾病杈欙紝鍙兘鍊熷姪杩欎釜宸ュ叿 + * @fileOverview jpeg encoder + */ + define('runtime/html5/jpegencoder',[], function( require, exports, module ) { + + /* + Copyright (c) 2008, Adobe Systems Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of Adobe Systems Incorporated nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + /* + JPEG encoder ported to JavaScript and optimized by Andreas Ritter, www.bytestrom.eu, 11/2009 + + Basic GUI blocking jpeg encoder + */ + + function JPEGEncoder(quality) { + var self = this; + var fround = Math.round; + var ffloor = Math.floor; + var YTable = new Array(64); + var UVTable = new Array(64); + var fdtbl_Y = new Array(64); + var fdtbl_UV = new Array(64); + var YDC_HT; + var UVDC_HT; + var YAC_HT; + var UVAC_HT; + + var bitcode = new Array(65535); + var category = new Array(65535); + var outputfDCTQuant = new Array(64); + var DU = new Array(64); + var byteout = []; + var bytenew = 0; + var bytepos = 7; + + var YDU = new Array(64); + var UDU = new Array(64); + var VDU = new Array(64); + var clt = new Array(256); + var RGB_YUV_TABLE = new Array(2048); + var currentQuality; + + var ZigZag = [ + 0, 1, 5, 6,14,15,27,28, + 2, 4, 7,13,16,26,29,42, + 3, 8,12,17,25,30,41,43, + 9,11,18,24,31,40,44,53, + 10,19,23,32,39,45,52,54, + 20,22,33,38,46,51,55,60, + 21,34,37,47,50,56,59,61, + 35,36,48,49,57,58,62,63 + ]; + + var std_dc_luminance_nrcodes = [0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0]; + var std_dc_luminance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_luminance_nrcodes = [0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d]; + var std_ac_luminance_values = [ + 0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12, + 0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07, + 0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08, + 0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0, + 0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16, + 0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28, + 0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39, + 0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49, + 0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59, + 0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69, + 0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79, + 0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89, + 0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98, + 0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7, + 0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6, + 0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5, + 0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4, + 0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2, + 0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea, + 0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + var std_dc_chrominance_nrcodes = [0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0]; + var std_dc_chrominance_values = [0,1,2,3,4,5,6,7,8,9,10,11]; + var std_ac_chrominance_nrcodes = [0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77]; + var std_ac_chrominance_values = [ + 0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21, + 0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71, + 0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91, + 0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0, + 0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34, + 0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26, + 0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38, + 0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48, + 0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58, + 0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68, + 0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78, + 0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87, + 0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96, + 0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5, + 0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4, + 0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3, + 0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2, + 0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda, + 0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9, + 0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8, + 0xf9,0xfa + ]; + + function initQuantTables(sf){ + var YQT = [ + 16, 11, 10, 16, 24, 40, 51, 61, + 12, 12, 14, 19, 26, 58, 60, 55, + 14, 13, 16, 24, 40, 57, 69, 56, + 14, 17, 22, 29, 51, 87, 80, 62, + 18, 22, 37, 56, 68,109,103, 77, + 24, 35, 55, 64, 81,104,113, 92, + 49, 64, 78, 87,103,121,120,101, + 72, 92, 95, 98,112,100,103, 99 + ]; + + for (var i = 0; i < 64; i++) { + var t = ffloor((YQT[i]*sf+50)/100); + if (t < 1) { + t = 1; + } else if (t > 255) { + t = 255; + } + YTable[ZigZag[i]] = t; + } + var UVQT = [ + 17, 18, 24, 47, 99, 99, 99, 99, + 18, 21, 26, 66, 99, 99, 99, 99, + 24, 26, 56, 99, 99, 99, 99, 99, + 47, 66, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99 + ]; + for (var j = 0; j < 64; j++) { + var u = ffloor((UVQT[j]*sf+50)/100); + if (u < 1) { + u = 1; + } else if (u > 255) { + u = 255; + } + UVTable[ZigZag[j]] = u; + } + var aasf = [ + 1.0, 1.387039845, 1.306562965, 1.175875602, + 1.0, 0.785694958, 0.541196100, 0.275899379 + ]; + var k = 0; + for (var row = 0; row < 8; row++) + { + for (var col = 0; col < 8; col++) + { + fdtbl_Y[k] = (1.0 / (YTable [ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + fdtbl_UV[k] = (1.0 / (UVTable[ZigZag[k]] * aasf[row] * aasf[col] * 8.0)); + k++; + } + } + } + + function computeHuffmanTbl(nrcodes, std_table){ + var codevalue = 0; + var pos_in_table = 0; + var HT = new Array(); + for (var k = 1; k <= 16; k++) { + for (var j = 1; j <= nrcodes[k]; j++) { + HT[std_table[pos_in_table]] = []; + HT[std_table[pos_in_table]][0] = codevalue; + HT[std_table[pos_in_table]][1] = k; + pos_in_table++; + codevalue++; + } + codevalue*=2; + } + return HT; + } + + function initHuffmanTbl() + { + YDC_HT = computeHuffmanTbl(std_dc_luminance_nrcodes,std_dc_luminance_values); + UVDC_HT = computeHuffmanTbl(std_dc_chrominance_nrcodes,std_dc_chrominance_values); + YAC_HT = computeHuffmanTbl(std_ac_luminance_nrcodes,std_ac_luminance_values); + UVAC_HT = computeHuffmanTbl(std_ac_chrominance_nrcodes,std_ac_chrominance_values); + } + + function initCategoryNumber() + { + var nrlower = 1; + var nrupper = 2; + for (var cat = 1; cat <= 15; cat++) { + //Positive numbers + for (var nr = nrlower; nr>0] = 38470 * i; + RGB_YUV_TABLE[(i+ 512)>>0] = 7471 * i + 0x8000; + RGB_YUV_TABLE[(i+ 768)>>0] = -11059 * i; + RGB_YUV_TABLE[(i+1024)>>0] = -21709 * i; + RGB_YUV_TABLE[(i+1280)>>0] = 32768 * i + 0x807FFF; + RGB_YUV_TABLE[(i+1536)>>0] = -27439 * i; + RGB_YUV_TABLE[(i+1792)>>0] = - 5329 * i; + } + } + + // IO functions + function writeBits(bs) + { + var value = bs[0]; + var posval = bs[1]-1; + while ( posval >= 0 ) { + if (value & (1 << posval) ) { + bytenew |= (1 << bytepos); + } + posval--; + bytepos--; + if (bytepos < 0) { + if (bytenew == 0xFF) { + writeByte(0xFF); + writeByte(0); + } + else { + writeByte(bytenew); + } + bytepos=7; + bytenew=0; + } + } + } + + function writeByte(value) + { + byteout.push(clt[value]); // write char directly instead of converting later + } + + function writeWord(value) + { + writeByte((value>>8)&0xFF); + writeByte((value )&0xFF); + } + + // DCT & quantization core + function fDCTQuant(data, fdtbl) + { + var d0, d1, d2, d3, d4, d5, d6, d7; + /* Pass 1: process rows. */ + var dataOff=0; + var i; + var I8 = 8; + var I64 = 64; + for (i=0; i 0.0) ? ((fDCTQuant + 0.5)|0) : ((fDCTQuant - 0.5)|0); + //outputfDCTQuant[i] = fround(fDCTQuant); + + } + return outputfDCTQuant; + } + + function writeAPP0() + { + writeWord(0xFFE0); // marker + writeWord(16); // length + writeByte(0x4A); // J + writeByte(0x46); // F + writeByte(0x49); // I + writeByte(0x46); // F + writeByte(0); // = "JFIF",'\0' + writeByte(1); // versionhi + writeByte(1); // versionlo + writeByte(0); // xyunits + writeWord(1); // xdensity + writeWord(1); // ydensity + writeByte(0); // thumbnwidth + writeByte(0); // thumbnheight + } + + function writeSOF0(width, height) + { + writeWord(0xFFC0); // marker + writeWord(17); // length, truecolor YUV JPG + writeByte(8); // precision + writeWord(height); + writeWord(width); + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0x11); // HVY + writeByte(0); // QTY + writeByte(2); // IdU + writeByte(0x11); // HVU + writeByte(1); // QTU + writeByte(3); // IdV + writeByte(0x11); // HVV + writeByte(1); // QTV + } + + function writeDQT() + { + writeWord(0xFFDB); // marker + writeWord(132); // length + writeByte(0); + for (var i=0; i<64; i++) { + writeByte(YTable[i]); + } + writeByte(1); + for (var j=0; j<64; j++) { + writeByte(UVTable[j]); + } + } + + function writeDHT() + { + writeWord(0xFFC4); // marker + writeWord(0x01A2); // length + + writeByte(0); // HTYDCinfo + for (var i=0; i<16; i++) { + writeByte(std_dc_luminance_nrcodes[i+1]); + } + for (var j=0; j<=11; j++) { + writeByte(std_dc_luminance_values[j]); + } + + writeByte(0x10); // HTYACinfo + for (var k=0; k<16; k++) { + writeByte(std_ac_luminance_nrcodes[k+1]); + } + for (var l=0; l<=161; l++) { + writeByte(std_ac_luminance_values[l]); + } + + writeByte(1); // HTUDCinfo + for (var m=0; m<16; m++) { + writeByte(std_dc_chrominance_nrcodes[m+1]); + } + for (var n=0; n<=11; n++) { + writeByte(std_dc_chrominance_values[n]); + } + + writeByte(0x11); // HTUACinfo + for (var o=0; o<16; o++) { + writeByte(std_ac_chrominance_nrcodes[o+1]); + } + for (var p=0; p<=161; p++) { + writeByte(std_ac_chrominance_values[p]); + } + } + + function writeSOS() + { + writeWord(0xFFDA); // marker + writeWord(12); // length + writeByte(3); // nrofcomponents + writeByte(1); // IdY + writeByte(0); // HTY + writeByte(2); // IdU + writeByte(0x11); // HTU + writeByte(3); // IdV + writeByte(0x11); // HTV + writeByte(0); // Ss + writeByte(0x3f); // Se + writeByte(0); // Bf + } + + function processDU(CDU, fdtbl, DC, HTDC, HTAC){ + var EOB = HTAC[0x00]; + var M16zeroes = HTAC[0xF0]; + var pos; + var I16 = 16; + var I63 = 63; + var I64 = 64; + var DU_DCT = fDCTQuant(CDU, fdtbl); + //ZigZag reorder + for (var j=0;j0)&&(DU[end0pos]==0); end0pos--) {}; + //end0pos = first element in reverse order !=0 + if ( end0pos == 0) { + writeBits(EOB); + return DC; + } + var i = 1; + var lng; + while ( i <= end0pos ) { + var startpos = i; + for (; (DU[i]==0) && (i<=end0pos); ++i) {} + var nrzeroes = i-startpos; + if ( nrzeroes >= I16 ) { + lng = nrzeroes>>4; + for (var nrmarker=1; nrmarker <= lng; ++nrmarker) + writeBits(M16zeroes); + nrzeroes = nrzeroes&0xF; + } + pos = 32767+DU[i]; + writeBits(HTAC[(nrzeroes<<4)+category[pos]]); + writeBits(bitcode[pos]); + i++; + } + if ( end0pos != I63 ) { + writeBits(EOB); + } + return DC; + } + + function initCharLookupTable(){ + var sfcc = String.fromCharCode; + for(var i=0; i < 256; i++){ ///// ACHTUNG // 255 + clt[i] = sfcc(i); + } + } + + this.encode = function(image,quality) // image data object + { + // var time_start = new Date().getTime(); + + if(quality) setQuality(quality); + + // Initialize bit writer + byteout = new Array(); + bytenew=0; + bytepos=7; + + // Add JPEG headers + writeWord(0xFFD8); // SOI + writeAPP0(); + writeDQT(); + writeSOF0(image.width,image.height); + writeDHT(); + writeSOS(); + + + // Encode 8x8 macroblocks + var DCY=0; + var DCU=0; + var DCV=0; + + bytenew=0; + bytepos=7; + + + this.encode.displayName = "_encode_"; + + var imageData = image.data; + var width = image.width; + var height = image.height; + + var quadWidth = width*4; + var tripleWidth = width*3; + + var x, y = 0; + var r, g, b; + var start,p, col,row,pos; + while(y < height){ + x = 0; + while(x < quadWidth){ + start = quadWidth * y + x; + p = start; + col = -1; + row = 0; + + for(pos=0; pos < 64; pos++){ + row = pos >> 3;// /8 + col = ( pos & 7 ) * 4; // %8 + p = start + ( row * quadWidth ) + col; + + if(y+row >= height){ // padding bottom + p-= (quadWidth*(y+1+row-height)); + } + + if(x+col >= quadWidth){ // padding right + p-= ((x+col) - quadWidth +4) + } + + r = imageData[ p++ ]; + g = imageData[ p++ ]; + b = imageData[ p++ ]; + + + /* // calculate YUV values dynamically + YDU[pos]=((( 0.29900)*r+( 0.58700)*g+( 0.11400)*b))-128; //-0x80 + UDU[pos]=(((-0.16874)*r+(-0.33126)*g+( 0.50000)*b)); + VDU[pos]=((( 0.50000)*r+(-0.41869)*g+(-0.08131)*b)); + */ + + // use lookup table (slightly faster) + YDU[pos] = ((RGB_YUV_TABLE[r] + RGB_YUV_TABLE[(g + 256)>>0] + RGB_YUV_TABLE[(b + 512)>>0]) >> 16)-128; + UDU[pos] = ((RGB_YUV_TABLE[(r + 768)>>0] + RGB_YUV_TABLE[(g + 1024)>>0] + RGB_YUV_TABLE[(b + 1280)>>0]) >> 16)-128; + VDU[pos] = ((RGB_YUV_TABLE[(r + 1280)>>0] + RGB_YUV_TABLE[(g + 1536)>>0] + RGB_YUV_TABLE[(b + 1792)>>0]) >> 16)-128; + + } + + DCY = processDU(YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT); + DCU = processDU(UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT); + DCV = processDU(VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT); + x+=32; + } + y+=8; + } + + + //////////////////////////////////////////////////////////////// + + // Do the bit alignment of the EOI marker + if ( bytepos >= 0 ) { + var fillbits = []; + fillbits[1] = bytepos+1; + fillbits[0] = (1<<(bytepos+1))-1; + writeBits(fillbits); + } + + writeWord(0xFFD9); //EOI + + var jpegDataUri = 'data:image/jpeg;base64,' + btoa(byteout.join('')); + + byteout = []; + + // benchmarking + // var duration = new Date().getTime() - time_start; + // console.log('Encoding time: '+ currentQuality + 'ms'); + // + + return jpegDataUri + } + + function setQuality(quality){ + if (quality <= 0) { + quality = 1; + } + if (quality > 100) { + quality = 100; + } + + if(currentQuality == quality) return // don't recalc if unchanged + + var sf = 0; + if (quality < 50) { + sf = Math.floor(5000 / quality); + } else { + sf = Math.floor(200 - quality*2); + } + + initQuantTables(sf); + currentQuality = quality; + // console.log('Quality set to: '+quality +'%'); + } + + function init(){ + // var time_start = new Date().getTime(); + if(!quality) quality = 50; + // Create tables + initCharLookupTable() + initHuffmanTbl(); + initCategoryNumber(); + initRGBYUVTable(); + + setQuality(quality); + // var duration = new Date().getTime() - time_start; + // console.log('Initialization '+ duration + 'ms'); + } + + init(); + + }; + + JPEGEncoder.encode = function( data, quality ) { + var encoder = new JPEGEncoder( quality ); + + return encoder.encode( data ); + } + + return JPEGEncoder; + }); + /** + * @fileOverview Fix android canvas.toDataUrl bug. + */ + define('runtime/html5/androidpatch',[ + 'runtime/html5/util', + 'runtime/html5/jpegencoder', + 'base' + ], function( Util, encoder, Base ) { + var origin = Util.canvasToDataUrl, + supportJpeg; + + Util.canvasToDataUrl = function( canvas, type, quality ) { + var ctx, w, h, fragement, parts; + + // 闈瀉ndroid鎵嬫満鐩存帴璺宠繃銆 + if ( !Base.os.android ) { + return origin.apply( null, arguments ); + } + + // 妫娴嬫槸鍚anvas鏀寔jpeg瀵煎嚭锛屾牴鎹暟鎹牸寮忔潵鍒ゆ柇銆 + // JPEG 鍓嶄袱浣嶅垎鍒槸锛255, 216 + if ( type === 'image/jpeg' && typeof supportJpeg === 'undefined' ) { + fragement = origin.apply( null, arguments ); + + parts = fragement.split(','); + + if ( ~parts[ 0 ].indexOf('base64') ) { + fragement = atob( parts[ 1 ] ); + } else { + fragement = decodeURIComponent( parts[ 1 ] ); + } + + fragement = fragement.substring( 0, 2 ); + + supportJpeg = fragement.charCodeAt( 0 ) === 255 && + fragement.charCodeAt( 1 ) === 216; + } + + // 鍙湁鍦╝ndroid鐜涓嬫墠淇 + if ( type === 'image/jpeg' && !supportJpeg ) { + w = canvas.width; + h = canvas.height; + ctx = canvas.getContext('2d'); + + return encoder.encode( ctx.getImageData( 0, 0, w, h ), quality ); + } + + return origin.apply( null, arguments ); + }; + }); + /** + * @fileOverview Image + */ + define('runtime/html5/image',[ + 'base', + 'runtime/html5/runtime', + 'runtime/html5/util' + ], function( Base, Html5Runtime, Util ) { + + var BLANK = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D'; + + return Html5Runtime.register( 'Image', { + + // flag: 鏍囪鏄惁琚慨鏀硅繃銆 + modified: false, + + init: function() { + var me = this, + img = new Image(); + + img.onload = function() { + + me._info = { + type: me.type, + width: this.width, + height: this.height + }; + + // 璇诲彇meta淇℃伅銆 + if ( !me._metas && 'image/jpeg' === me.type ) { + Util.parseMeta( me._blob, function( error, ret ) { + me._metas = ret; + me.owner.trigger('load'); + }); + } else { + me.owner.trigger('load'); + } + }; + + img.onerror = function() { + me.owner.trigger('error'); + }; + + me._img = img; + }, + + loadFromBlob: function( blob ) { + var me = this, + img = me._img; + + me._blob = blob; + me.type = blob.type; + img.src = Util.createObjectURL( blob.getSource() ); + me.owner.once( 'load', function() { + Util.revokeObjectURL( img.src ); + }); + }, + + resize: function( width, height ) { + var canvas = this._canvas || + (this._canvas = document.createElement('canvas')); + + this._resize( this._img, canvas, width, height ); + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'resize' ); + }, + + crop: function( x, y, w, h, s ) { + var cvs = this._canvas || + (this._canvas = document.createElement('canvas')), + opts = this.options, + img = this._img, + iw = img.naturalWidth, + ih = img.naturalHeight, + orientation = this.getOrientation(); + + s = s || 1; + + // todo 瑙e喅 orientation 鐨勯棶棰樸 + // values that require 90 degree rotation + // if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // switch ( orientation ) { + // case 6: + // tmp = x; + // x = y; + // y = iw * s - tmp - w; + // console.log(ih * s, tmp, w) + // break; + // } + + // (w ^= h, h ^= w, w ^= h); + // } + + cvs.width = w; + cvs.height = h; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + this._renderImageToCanvas( cvs, img, -x, -y, iw * s, ih * s ); + + this._blob = null; // 娌$敤浜嗭紝鍙互鍒犳帀浜嗐 + this.modified = true; + this.owner.trigger( 'complete', 'crop' ); + }, + + getAsBlob: function( type ) { + var blob = this._blob, + opts = this.options, + canvas; + + type = type || this.type; + + // blob闇瑕侀噸鏂扮敓鎴愩 + if ( this.modified || this.type !== type ) { + canvas = this._canvas; + + if ( type === 'image/jpeg' ) { + + blob = Util.canvasToDataUrl( canvas, type, opts.quality ); + + if ( opts.preserveHeaders && this._metas && + this._metas.imageHead ) { + + blob = Util.dataURL2ArrayBuffer( blob ); + blob = Util.updateImageHead( blob, + this._metas.imageHead ); + blob = Util.arrayBufferToBlob( blob, type ); + return blob; + } + } else { + blob = Util.canvasToDataUrl( canvas, type ); + } + + blob = Util.dataURL2Blob( blob ); + } + + return blob; + }, + + getAsDataUrl: function( type ) { + var opts = this.options; + + type = type || this.type; + + if ( type === 'image/jpeg' ) { + return Util.canvasToDataUrl( this._canvas, type, opts.quality ); + } else { + return this._canvas.toDataURL( type ); + } + }, + + getOrientation: function() { + return this._metas && this._metas.exif && + this._metas.exif.get('Orientation') || 1; + }, + + info: function( val ) { + + // setter + if ( val ) { + this._info = val; + return this; + } + + // getter + return this._info; + }, + + meta: function( val ) { + + // setter + if ( val ) { + this._meta = val; + return this; + } + + // getter + return this._meta; + }, + + destroy: function() { + var canvas = this._canvas; + this._img.onload = null; + + if ( canvas ) { + canvas.getContext('2d') + .clearRect( 0, 0, canvas.width, canvas.height ); + canvas.width = canvas.height = 0; + this._canvas = null; + } + + // 閲婃斁鍐呭瓨銆傞潪甯搁噸瑕侊紝鍚﹀垯閲婃斁涓嶄簡image鐨勫唴瀛樸 + this._img.src = BLANK; + this._img = this._blob = null; + }, + + _resize: function( img, cvs, width, height ) { + var opts = this.options, + naturalWidth = img.width, + naturalHeight = img.height, + orientation = this.getOrientation(), + scale, w, h, x, y; + + // values that require 90 degree rotation + if ( ~[ 5, 6, 7, 8 ].indexOf( orientation ) ) { + + // 浜ゆ崲width, height鐨勫笺 + width ^= height; + height ^= width; + width ^= height; + } + + scale = Math[ opts.crop ? 'max' : 'min' ]( width / naturalWidth, + height / naturalHeight ); + + // 涓嶅厑璁告斁澶с + opts.allowMagnify || (scale = Math.min( 1, scale )); + + w = naturalWidth * scale; + h = naturalHeight * scale; + + if ( opts.crop ) { + cvs.width = width; + cvs.height = height; + } else { + cvs.width = w; + cvs.height = h; + } + + x = (cvs.width - w) / 2; + y = (cvs.height - h) / 2; + + opts.preserveHeaders || this._rotate2Orientaion( cvs, orientation ); + + this._renderImageToCanvas( cvs, img, x, y, w, h ); + }, + + _rotate2Orientaion: function( canvas, orientation ) { + var width = canvas.width, + height = canvas.height, + ctx = canvas.getContext('2d'); + + switch ( orientation ) { + case 5: + case 6: + case 7: + case 8: + canvas.width = height; + canvas.height = width; + break; + } + + switch ( orientation ) { + case 2: // horizontal flip + ctx.translate( width, 0 ); + ctx.scale( -1, 1 ); + break; + + case 3: // 180 rotate left + ctx.translate( width, height ); + ctx.rotate( Math.PI ); + break; + + case 4: // vertical flip + ctx.translate( 0, height ); + ctx.scale( 1, -1 ); + break; + + case 5: // vertical flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.scale( 1, -1 ); + break; + + case 6: // 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( 0, -height ); + break; + + case 7: // horizontal flip + 90 rotate right + ctx.rotate( 0.5 * Math.PI ); + ctx.translate( width, -height ); + ctx.scale( -1, 1 ); + break; + + case 8: // 90 rotate left + ctx.rotate( -0.5 * Math.PI ); + ctx.translate( -width, 0 ); + break; + } + }, + + // https://github.com/stomita/ios-imagefile-megapixel/ + // blob/master/src/megapix-image.js + _renderImageToCanvas: (function() { + + // 濡傛灉涓嶆槸ios, 涓嶉渶瑕佽繖涔堝鏉傦紒 + if ( !Base.os.ios ) { + return function( canvas ) { + var args = Base.slice( arguments, 1 ), + ctx = canvas.getContext('2d'); + + ctx.drawImage.apply( ctx, args ); + }; + } + + /** + * Detecting vertical squash in loaded image. + * Fixes a bug which squash image vertically while drawing into + * canvas for some images. + */ + function detectVerticalSquash( img, iw, ih ) { + var canvas = document.createElement('canvas'), + ctx = canvas.getContext('2d'), + sy = 0, + ey = ih, + py = ih, + data, alpha, ratio; + + + canvas.width = 1; + canvas.height = ih; + ctx.drawImage( img, 0, 0 ); + data = ctx.getImageData( 0, 0, 1, ih ).data; + + // search image edge pixel position in case + // it is squashed vertically. + while ( py > sy ) { + alpha = data[ (py - 1) * 4 + 3 ]; + + if ( alpha === 0 ) { + ey = py; + } else { + sy = py; + } + + py = (ey + sy) >> 1; + } + + ratio = (py / ih); + return (ratio === 0) ? 1 : ratio; + } + + // fix ie7 bug + // http://stackoverflow.com/questions/11929099/ + // html5-canvas-drawimage-ratio-bug-ios + if ( Base.os.ios >= 7 ) { + return function( canvas, img, x, y, w, h ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + vertSquashRatio = detectVerticalSquash( img, iw, ih ); + + return canvas.getContext('2d').drawImage( img, 0, 0, + iw * vertSquashRatio, ih * vertSquashRatio, + x, y, w, h ); + }; + } + + /** + * Detect subsampling in loaded image. + * In iOS, larger images than 2M pixels may be + * subsampled in rendering. + */ + function detectSubsampling( img ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + canvas, ctx; + + // subsampling may happen overmegapixel image + if ( iw * ih > 1024 * 1024 ) { + canvas = document.createElement('canvas'); + canvas.width = canvas.height = 1; + ctx = canvas.getContext('2d'); + ctx.drawImage( img, -iw + 1, 0 ); + + // subsampled image becomes half smaller in rendering size. + // check alpha channel value to confirm image is covering + // edge pixel or not. if alpha value is 0 + // image is not covering, hence subsampled. + return ctx.getImageData( 0, 0, 1, 1 ).data[ 3 ] === 0; + } else { + return false; + } + } + + + return function( canvas, img, x, y, width, height ) { + var iw = img.naturalWidth, + ih = img.naturalHeight, + ctx = canvas.getContext('2d'), + subsampled = detectSubsampling( img ), + doSquash = this.type === 'image/jpeg', + d = 1024, + sy = 0, + dy = 0, + tmpCanvas, tmpCtx, vertSquashRatio, dw, dh, sx, dx; + + if ( subsampled ) { + iw /= 2; + ih /= 2; + } + + ctx.save(); + tmpCanvas = document.createElement('canvas'); + tmpCanvas.width = tmpCanvas.height = d; + + tmpCtx = tmpCanvas.getContext('2d'); + vertSquashRatio = doSquash ? + detectVerticalSquash( img, iw, ih ) : 1; + + dw = Math.ceil( d * width / iw ); + dh = Math.ceil( d * height / ih / vertSquashRatio ); + + while ( sy < ih ) { + sx = 0; + dx = 0; + while ( sx < iw ) { + tmpCtx.clearRect( 0, 0, d, d ); + tmpCtx.drawImage( img, -sx, -sy ); + ctx.drawImage( tmpCanvas, 0, 0, d, d, + x + dx, y + dy, dw, dh ); + sx += d; + dx += dw; + } + sy += d; + dy += dh; + } + ctx.restore(); + tmpCanvas = tmpCtx = null; + }; + })() + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/html5/md5',[ + 'runtime/html5/runtime' + ], function( FlashRuntime ) { + + /* + * Fastest md5 implementation around (JKM md5) + * Credits: Joseph Myers + * + * @see http://www.myersdaily.org/joseph/javascript/md5-text.html + * @see http://jsperf.com/md5-shootout/7 + */ + + /* this function is much faster, + so if possible we use it. Some IEs + are the only ones I know of that + need the idiotic second function, + generated by an if clause. */ + var add32 = function (a, b) { + return (a + b) & 0xFFFFFFFF; + }, + + cmn = function (q, a, b, x, s, t) { + a = add32(add32(a, q), add32(x, t)); + return add32((a << s) | (a >>> (32 - s)), b); + }, + + ff = function (a, b, c, d, x, s, t) { + return cmn((b & c) | ((~b) & d), a, b, x, s, t); + }, + + gg = function (a, b, c, d, x, s, t) { + return cmn((b & d) | (c & (~d)), a, b, x, s, t); + }, + + hh = function (a, b, c, d, x, s, t) { + return cmn(b ^ c ^ d, a, b, x, s, t); + }, + + ii = function (a, b, c, d, x, s, t) { + return cmn(c ^ (b | (~d)), a, b, x, s, t); + }, + + md5cycle = function (x, k) { + var a = x[0], + b = x[1], + c = x[2], + d = x[3]; + + a = ff(a, b, c, d, k[0], 7, -680876936); + d = ff(d, a, b, c, k[1], 12, -389564586); + c = ff(c, d, a, b, k[2], 17, 606105819); + b = ff(b, c, d, a, k[3], 22, -1044525330); + a = ff(a, b, c, d, k[4], 7, -176418897); + d = ff(d, a, b, c, k[5], 12, 1200080426); + c = ff(c, d, a, b, k[6], 17, -1473231341); + b = ff(b, c, d, a, k[7], 22, -45705983); + a = ff(a, b, c, d, k[8], 7, 1770035416); + d = ff(d, a, b, c, k[9], 12, -1958414417); + c = ff(c, d, a, b, k[10], 17, -42063); + b = ff(b, c, d, a, k[11], 22, -1990404162); + a = ff(a, b, c, d, k[12], 7, 1804603682); + d = ff(d, a, b, c, k[13], 12, -40341101); + c = ff(c, d, a, b, k[14], 17, -1502002290); + b = ff(b, c, d, a, k[15], 22, 1236535329); + + a = gg(a, b, c, d, k[1], 5, -165796510); + d = gg(d, a, b, c, k[6], 9, -1069501632); + c = gg(c, d, a, b, k[11], 14, 643717713); + b = gg(b, c, d, a, k[0], 20, -373897302); + a = gg(a, b, c, d, k[5], 5, -701558691); + d = gg(d, a, b, c, k[10], 9, 38016083); + c = gg(c, d, a, b, k[15], 14, -660478335); + b = gg(b, c, d, a, k[4], 20, -405537848); + a = gg(a, b, c, d, k[9], 5, 568446438); + d = gg(d, a, b, c, k[14], 9, -1019803690); + c = gg(c, d, a, b, k[3], 14, -187363961); + b = gg(b, c, d, a, k[8], 20, 1163531501); + a = gg(a, b, c, d, k[13], 5, -1444681467); + d = gg(d, a, b, c, k[2], 9, -51403784); + c = gg(c, d, a, b, k[7], 14, 1735328473); + b = gg(b, c, d, a, k[12], 20, -1926607734); + + a = hh(a, b, c, d, k[5], 4, -378558); + d = hh(d, a, b, c, k[8], 11, -2022574463); + c = hh(c, d, a, b, k[11], 16, 1839030562); + b = hh(b, c, d, a, k[14], 23, -35309556); + a = hh(a, b, c, d, k[1], 4, -1530992060); + d = hh(d, a, b, c, k[4], 11, 1272893353); + c = hh(c, d, a, b, k[7], 16, -155497632); + b = hh(b, c, d, a, k[10], 23, -1094730640); + a = hh(a, b, c, d, k[13], 4, 681279174); + d = hh(d, a, b, c, k[0], 11, -358537222); + c = hh(c, d, a, b, k[3], 16, -722521979); + b = hh(b, c, d, a, k[6], 23, 76029189); + a = hh(a, b, c, d, k[9], 4, -640364487); + d = hh(d, a, b, c, k[12], 11, -421815835); + c = hh(c, d, a, b, k[15], 16, 530742520); + b = hh(b, c, d, a, k[2], 23, -995338651); + + a = ii(a, b, c, d, k[0], 6, -198630844); + d = ii(d, a, b, c, k[7], 10, 1126891415); + c = ii(c, d, a, b, k[14], 15, -1416354905); + b = ii(b, c, d, a, k[5], 21, -57434055); + a = ii(a, b, c, d, k[12], 6, 1700485571); + d = ii(d, a, b, c, k[3], 10, -1894986606); + c = ii(c, d, a, b, k[10], 15, -1051523); + b = ii(b, c, d, a, k[1], 21, -2054922799); + a = ii(a, b, c, d, k[8], 6, 1873313359); + d = ii(d, a, b, c, k[15], 10, -30611744); + c = ii(c, d, a, b, k[6], 15, -1560198380); + b = ii(b, c, d, a, k[13], 21, 1309151649); + a = ii(a, b, c, d, k[4], 6, -145523070); + d = ii(d, a, b, c, k[11], 10, -1120210379); + c = ii(c, d, a, b, k[2], 15, 718787259); + b = ii(b, c, d, a, k[9], 21, -343485551); + + x[0] = add32(a, x[0]); + x[1] = add32(b, x[1]); + x[2] = add32(c, x[2]); + x[3] = add32(d, x[3]); + }, + + /* there needs to be support for Unicode here, + * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps + * by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise + * I suggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then + * how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something + * like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard + * itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 + * 8-bit unsigned value arrays. + */ + md5blk = function (s) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s.charCodeAt(i) + (s.charCodeAt(i + 1) << 8) + (s.charCodeAt(i + 2) << 16) + (s.charCodeAt(i + 3) << 24); + } + return md5blks; + }, + + md5blk_array = function (a) { + var md5blks = [], + i; /* Andy King said do it this way. */ + + for (i = 0; i < 64; i += 4) { + md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24); + } + return md5blks; + }, + + md51 = function (s) { + var n = s.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk(s.substring(i - 64, i))); + } + s = s.substring(i - 64); + length = s.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= s.charCodeAt(i) << ((i % 4) << 3); + } + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + return state; + }, + + md51_array = function (a) { + var n = a.length, + state = [1732584193, -271733879, -1732584194, 271733878], + i, + length, + tail, + tmp, + lo, + hi; + + for (i = 64; i <= n; i += 64) { + md5cycle(state, md5blk_array(a.subarray(i - 64, i))); + } + + // Not sure if it is a bug, however IE10 will always produce a sub array of length 1 + // containing the last element of the parent array if the sub array specified starts + // beyond the length of the parent array - weird. + // https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue + a = (i - 64) < n ? a.subarray(i - 64) : new Uint8Array(0); + + length = a.length; + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= a[i] << ((i % 4) << 3); + } + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Beware that the final length might not fit in 32 bits so we take care of that + tmp = n * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + + md5cycle(state, tail); + + return state; + }, + + hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'], + + rhex = function (n) { + var s = '', + j; + for (j = 0; j < 4; j += 1) { + s += hex_chr[(n >> (j * 8 + 4)) & 0x0F] + hex_chr[(n >> (j * 8)) & 0x0F]; + } + return s; + }, + + hex = function (x) { + var i; + for (i = 0; i < x.length; i += 1) { + x[i] = rhex(x[i]); + } + return x.join(''); + }, + + md5 = function (s) { + return hex(md51(s)); + }, + + + + //////////////////////////////////////////////////////////////////////////// + + /** + * SparkMD5 OOP implementation. + * + * Use this class to perform an incremental md5, otherwise use the + * static methods instead. + */ + SparkMD5 = function () { + // call reset to init the instance + this.reset(); + }; + + + // In some cases the fast add32 function cannot be used.. + if (md5('hello') !== '5d41402abc4b2a76b9719d911017c592') { + add32 = function (x, y) { + var lsw = (x & 0xFFFF) + (y & 0xFFFF), + msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); + }; + } + + + /** + * Appends a string. + * A conversion will be applied if an utf8 string is detected. + * + * @param {String} str The string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.append = function (str) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + // then append as binary + this.appendBinary(str); + + return this; + }; + + /** + * Appends a binary string. + * + * @param {String} contents The binary string to be appended + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.appendBinary = function (contents) { + this._buff += contents; + this._length += contents.length; + + var length = this._buff.length, + i; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk(this._buff.substring(i - 64, i))); + } + + this._buff = this._buff.substr(i - 64); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + i, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff.charCodeAt(i) << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + /** + * Finish the final calculation based on the tail. + * + * @param {Array} tail The tail (will be modified) + * @param {Number} length The length of the remaining buffer + */ + SparkMD5.prototype._finish = function (tail, length) { + var i = length, + tmp, + lo, + hi; + + tail[i >> 2] |= 0x80 << ((i % 4) << 3); + if (i > 55) { + md5cycle(this._state, tail); + for (i = 0; i < 16; i += 1) { + tail[i] = 0; + } + } + + // Do the final computation based on the tail and length + // Beware that the final length may not fit in 32 bits so we take care of that + tmp = this._length * 8; + tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/); + lo = parseInt(tmp[2], 16); + hi = parseInt(tmp[1], 16) || 0; + + tail[14] = lo; + tail[15] = hi; + md5cycle(this._state, tail); + }; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5} The instance itself + */ + SparkMD5.prototype.reset = function () { + this._buff = ""; + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.prototype.destroy = function () { + delete this._state; + delete this._buff; + delete this._length; + }; + + + /** + * Performs the md5 hash on a string. + * A conversion will be applied if utf8 string is detected. + * + * @param {String} str The string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hash = function (str, raw) { + // converts the string to utf8 bytes if necessary + if (/[\u0080-\uFFFF]/.test(str)) { + str = unescape(encodeURIComponent(str)); + } + + var hash = md51(str); + + return !!raw ? hash : hex(hash); + }; + + /** + * Performs the md5 hash on a binary string. + * + * @param {String} content The binary string + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.hashBinary = function (content, raw) { + var hash = md51(content); + + return !!raw ? hash : hex(hash); + }; + + /** + * SparkMD5 OOP implementation for array buffers. + * + * Use this class to perform an incremental md5 ONLY for array buffers. + */ + SparkMD5.ArrayBuffer = function () { + // call reset to init the instance + this.reset(); + }; + + //////////////////////////////////////////////////////////////////////////// + + /** + * Appends an array buffer. + * + * @param {ArrayBuffer} arr The array to be appended + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.append = function (arr) { + // TODO: we could avoid the concatenation here but the algorithm would be more complex + // if you find yourself needing extra performance, please make a PR. + var buff = this._concatArrayBuffer(this._buff, arr), + length = buff.length, + i; + + this._length += arr.byteLength; + + for (i = 64; i <= length; i += 64) { + md5cycle(this._state, md5blk_array(buff.subarray(i - 64, i))); + } + + // Avoids IE10 weirdness (documented above) + this._buff = (i - 64) < length ? buff.subarray(i - 64) : new Uint8Array(0); + + return this; + }; + + /** + * Finishes the incremental computation, reseting the internal state and + * returning the result. + * Use the raw parameter to obtain the raw result instead of the hex one. + * + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.prototype.end = function (raw) { + var buff = this._buff, + length = buff.length, + tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + i, + ret; + + for (i = 0; i < length; i += 1) { + tail[i >> 2] |= buff[i] << ((i % 4) << 3); + } + + this._finish(tail, length); + ret = !!raw ? this._state : hex(this._state); + + this.reset(); + + return ret; + }; + + SparkMD5.ArrayBuffer.prototype._finish = SparkMD5.prototype._finish; + + /** + * Resets the internal state of the computation. + * + * @return {SparkMD5.ArrayBuffer} The instance itself + */ + SparkMD5.ArrayBuffer.prototype.reset = function () { + this._buff = new Uint8Array(0); + this._length = 0; + this._state = [1732584193, -271733879, -1732584194, 271733878]; + + return this; + }; + + /** + * Releases memory used by the incremental buffer and other aditional + * resources. If you plan to use the instance again, use reset instead. + */ + SparkMD5.ArrayBuffer.prototype.destroy = SparkMD5.prototype.destroy; + + /** + * Concats two array buffers, returning a new one. + * + * @param {ArrayBuffer} first The first array buffer + * @param {ArrayBuffer} second The second array buffer + * + * @return {ArrayBuffer} The new array buffer + */ + SparkMD5.ArrayBuffer.prototype._concatArrayBuffer = function (first, second) { + var firstLength = first.length, + result = new Uint8Array(firstLength + second.byteLength); + + result.set(first); + result.set(new Uint8Array(second), firstLength); + + return result; + }; + + /** + * Performs the md5 hash on an array buffer. + * + * @param {ArrayBuffer} arr The array buffer + * @param {Boolean} raw True to get the raw result, false to get the hex result + * + * @return {String|Array} The result + */ + SparkMD5.ArrayBuffer.hash = function (arr, raw) { + var hash = md51_array(new Uint8Array(arr)); + + return !!raw ? hash : hex(hash); + }; + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( file ) { + var blob = file.getSource(), + chunkSize = 2 * 1024 * 1024, + chunks = Math.ceil( blob.size / chunkSize ), + chunk = 0, + owner = this.owner, + spark = new SparkMD5.ArrayBuffer(), + me = this, + blobSlice = blob.mozSlice || blob.webkitSlice || blob.slice, + loadNext, fr; + + fr = new FileReader(); + + loadNext = function() { + var start, end; + + start = chunk * chunkSize; + end = Math.min( start + chunkSize, blob.size ); + + fr.onload = function( e ) { + spark.append( e.target.result ); + owner.trigger( 'progress', { + total: file.size, + loaded: end + }); + }; + + fr.onloadend = function() { + fr.onloadend = fr.onload = null; + + if ( ++chunk < chunks ) { + setTimeout( loadNext, 1 ); + } else { + setTimeout(function(){ + owner.trigger('load'); + me.result = spark.end(); + loadNext = file = blob = spark = null; + owner.trigger('complete'); + }, 50 ); + } + }; + + fr.readAsArrayBuffer( blobSlice.call( blob, start, end ) ); + }; + + loadNext(); + }, + + getResult: function() { + return this.result; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview 鍥剧墖鍘嬬缉 + */ + define('runtime/flash/image',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Image', { + // init: function( options ) { + // var owner = this.owner; + + // this.flashExec( 'Image', 'init', options ); + // owner.on( 'load', function() { + // debugger; + // }); + // }, + + loadFromBlob: function( blob ) { + var owner = this.owner; + + owner.info() && this.flashExec( 'Image', 'info', owner.info() ); + owner.meta() && this.flashExec( 'Image', 'meta', owner.meta() ); + + this.flashExec( 'Image', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/flash/blob',[ + 'runtime/flash/runtime', + 'lib/blob' + ], function( FlashRuntime, Blob ) { + + return FlashRuntime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.flashExec( 'Blob', 'slice', start, end ); + + return new Blob( blob.uid, blob ); + } + }); + }); + /** + * @fileOverview Md5 flash瀹炵幇 + */ + define('runtime/flash/md5',[ + 'runtime/flash/runtime' + ], function( FlashRuntime ) { + + return FlashRuntime.register( 'Md5', { + init: function() { + // do nothing. + }, + + loadFromBlob: function( blob ) { + return this.flashExec( 'Md5', 'loadFromBlob', blob.uid ); + } + }); + }); + /** + * @fileOverview 瀹屽叏鐗堟湰銆 + */ + define('preset/all',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/image', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + 'widgets/md5', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/imagemeta/exif', + 'runtime/html5/androidpatch', + 'runtime/html5/image', + 'runtime/html5/transport', + 'runtime/html5/md5', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/image', + 'runtime/flash/transport', + 'runtime/flash/blob', + 'runtime/flash/md5' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/all' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.nolog.min.js b/WebContent/Frame/page/webuploader/webuploader.nolog.min.js new file mode 100644 index 000000000..a4ee44b36 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.nolog.min.js @@ -0,0 +1,3 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("lib/image",["base","runtime/client","lib/blob"],function(a,b,c){function d(a){this.options=e.extend({},d.options,a),b.call(this,"Image"),this.on("load",function(){this._info=this.exec("info"),this._meta=this.exec("meta")})}var e=a.$;return d.options={quality:90,crop:!1,preserveHeaders:!1,allowMagnify:!1},a.inherits(b,{constructor:d,info:function(a){return a?(this._info=a,this):this._info},meta:function(a){return a?(this._meta=a,this):this._meta},loadFromBlob:function(a){var b=this,c=a.getRuid();this.connectRuntime(c,function(){b.exec("init",b.options),b.exec("loadFromBlob",a)})},resize:function(){var b=a.slice(arguments);return this.exec.apply(this,["resize"].concat(b))},crop:function(){var b=a.slice(arguments);return this.exec.apply(this,["crop"].concat(b))},getAsDataUrl:function(a){return this.exec("getAsDataUrl",a)},getAsBlob:function(a){var b=this.exec("getAsBlob",a);return new c(this.getRuid(),b)}}),d}),b("widgets/image",["base","uploader","lib/image","widgets/widget"],function(a,b,c){var d,e=a.$;return d=function(a){var b=0,c=[],d=function(){for(var d;c.length&&a>b;)d=c.shift(),b+=d[0],d[1]()};return function(a,e,f){c.push([e,f]),a.once("destroy",function(){b-=e,setTimeout(d,1)}),setTimeout(d,1)}}(5242880),e.extend(b.options,{thumb:{width:110,height:110,quality:70,allowMagnify:!0,crop:!0,preserveHeaders:!1,type:"image/jpeg"},compress:{width:1600,height:1600,quality:90,allowMagnify:!1,crop:!1,preserveHeaders:!0}}),b.register({name:"image",makeThumb:function(a,b,f,g){var h,i;return a=this.request("get-file",a),a.type.match(/^image/)?(h=e.extend({},this.options.thumb),e.isPlainObject(f)&&(h=e.extend(h,f),f=null),f=f||h.width,g=g||h.height,i=new c(h),i.once("load",function(){a._info=a._info||i.info(),a._meta=a._meta||i.meta(),1>=f&&f>0&&(f=a._info.width*f),1>=g&&g>0&&(g=a._info.height*g),i.resize(f,g)}),i.once("complete",function(){b(!1,i.getAsDataUrl(h.type)),i.destroy()}),i.once("error",function(a){b(a||!0),i.destroy()}),void d(i,a.source.size,function(){a._info&&i.info(a._info),a._meta&&i.meta(a._meta),i.loadFromBlob(a.source)})):void b(!0)},beforeSendFile:function(b){var d,f,g=this.options.compress||this.options.resize,h=g&&g.compressSize||0,i=g&&g.noCompressIfLarger||!1;return b=this.request("get-file",b),!g||!~"image/jpeg,image/jpg".indexOf(b.type)||b.size=a&&a>0&&(a=b._info.width*a),1>=c&&c>0&&(c=b._info.height*c),d.resize(a,c)}),d.once("complete",function(){var a,c;try{a=d.getAsBlob(g.type),c=b.size,(!i||a.sizeb;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});if(!c.runing){c.runing=!0;var d=[];f.each(c.pool,function(a,b){var e=b.file;e.getStatus()===h.INTERRUPT&&(d.push(e),c._trigged=!1,b.transport&&b.transport.send())});for(var b;b=d.shift();)b.setStatus(h.PROGRESS);b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload")}},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b) +}).always(function(){d.trigger("uploadComplete",a)})},updateFileProgress:function(a){var b=0,c=0;a.blocks&&(f.each(a.blocks,function(a,b){c+=(b.percentage||0)*(b.end-b.start)}),b=c/a.size,this.owner.trigger("uploadProgress",a,b||0))}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("lib/md5",["runtime/client","mediator"],function(a,b){function c(){a.call(this,"Md5")}return b.installTo(c.prototype),c.prototype.loadFromBlob=function(a){var b=this;b.getRuid()&&b.disconnectRuntime(),b.connectRuntime(a.ruid,function(){b.exec("init"),b.exec("loadFromBlob",a)})},c.prototype.getResult=function(){return this.exec("getResult")},c}),b("widgets/md5",["base","uploader","lib/md5","lib/blob","widgets/widget"],function(a,b,c,d){return b.register({name:"md5",md5File:function(b,e,f){var g=new c,h=a.Deferred(),i=b instanceof d?b:this.request("get-file",b).source;return g.on("progress load",function(a){a=a||{},h.notify(a.total?a.loaded/a.total:1)}),g.on("complete",function(){h.resolve(g.getResult())}),g.on("error",function(a){h.reject(a)}),arguments.length>1&&(e=e||0,f=f||0,0>e&&(e=i.size+e),0>f&&(f=i.size+f),f=Math.min(f,i.size),i=i.slice(e,f)),g.loadFromBlob(i),h.promise()}})}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice;return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/util",["base"],function(b){var c=a.createObjectURL&&a||a.URL&&URL.revokeObjectURL&&URL||a.webkitURL,d=b.noop,e=d;return c&&(d=function(){return c.createObjectURL.apply(c,arguments)},e=function(){return c.revokeObjectURL.apply(c,arguments)}),{createObjectURL:d,revokeObjectURL:e,dataURL2Blob:function(a){var b,c,d,e,f,g;for(g=a.split(","),b=~g[0].indexOf("base64")?atob(g[1]):decodeURIComponent(g[1]),d=new ArrayBuffer(b.length),c=new Uint8Array(d),e=0;ei&&(d=h.getUint16(i),d>=65504&&65519>=d||65534===d)&&(e=h.getUint16(i+2)+2,!(i+e>h.byteLength));){if(f=b.parsers[d],!c&&f)for(g=0;g6&&(l.imageHead=a.slice?a.slice(2,k):new Uint8Array(a).subarray(2,k))}return l}},updateImageHead:function(a,b){var c,d,e,f=this._parse(a,!0);return e=2,f.imageHead&&(e=2+f.imageHead.byteLength),d=a.slice?a.slice(e):new Uint8Array(a).subarray(e),c=new Uint8Array(b.byteLength+2+d.byteLength),c[0]=255,c[1]=216,c.set(new Uint8Array(b),2),c.set(new Uint8Array(d),b.byteLength+2),c.buffer}},a.parseMeta=function(){return b.parse.apply(b,arguments)},a.updateImageHead=function(){return b.updateImageHead.apply(b,arguments)},b}),b("runtime/html5/imagemeta/exif",["base","runtime/html5/imagemeta"],function(a,b){var c={};return c.ExifMap=function(){return this},c.ExifMap.prototype.map={Orientation:274},c.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},c.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},c.exifTagTypes[7]=c.exifTagTypes[1],c.getExifValue=function(b,d,e,f,g,h){var i,j,k,l,m,n,o=c.exifTagTypes[f];if(!o)return void a.log("Invalid Exif data: Invalid tag type.");if(i=o.size*g,j=i>4?d+b.getUint32(e+8,h):e+8,j+i>b.byteLength)return void a.log("Invalid Exif data: Invalid data offset.");if(1===g)return o.getValue(b,j,h);for(k=[],l=0;g>l;l+=1)k[l]=o.getValue(b,j+l*o.size,h);if(o.ascii){for(m="",l=0;lb.byteLength)return void a.log("Invalid Exif data: Invalid directory offset.");if(g=b.getUint16(d,e),h=d+2+12*g,h+4>b.byteLength)return void a.log("Invalid Exif data: Invalid directory size.");for(i=0;g>i;i+=1)this.parseExifTag(b,c,d+2+12*i,e,f);return b.getUint32(h,e)},c.parseExifData=function(b,d,e,f){var g,h,i=d+10;if(1165519206===b.getUint32(d+4)){if(i+8>b.byteLength)return void a.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(d+8))return void a.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(i)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void a.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(i+2,g))return void a.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(i+4,g),f.exif=new c.ExifMap,h=c.parseExifTags(b,i,i+h,g,f)}},b.parsers[65505].push(c.parseExifData),c}),b("runtime/html5/jpegencoder",[],function(){function a(a){function b(a){for(var b=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],c=0;64>c;c++){var d=y((b[c]*a+50)/100);1>d?d=1:d>255&&(d=255),z[P[c]]=d}for(var e=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],f=0;64>f;f++){var g=y((e[f]*a+50)/100);1>g?g=1:g>255&&(g=255),A[P[f]]=g}for(var h=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],i=0,j=0;8>j;j++)for(var k=0;8>k;k++)B[i]=1/(z[P[i]]*h[j]*h[k]*8),C[i]=1/(A[P[i]]*h[j]*h[k]*8),i++}function c(a,b){for(var c=0,d=0,e=new Array,f=1;16>=f;f++){for(var g=1;g<=a[f];g++)e[b[d]]=[],e[b[d]][0]=c,e[b[d]][1]=f,d++,c++;c*=2}return e}function d(){t=c(Q,R),u=c(U,V),v=c(S,T),w=c(W,X)}function e(){for(var a=1,b=2,c=1;15>=c;c++){for(var d=a;b>d;d++)E[32767+d]=c,D[32767+d]=[],D[32767+d][1]=c,D[32767+d][0]=d;for(var e=-(b-1);-a>=e;e++)E[32767+e]=c,D[32767+e]=[],D[32767+e][1]=c,D[32767+e][0]=b-1+e;a<<=1,b<<=1}}function f(){for(var a=0;256>a;a++)O[a]=19595*a,O[a+256>>0]=38470*a,O[a+512>>0]=7471*a+32768,O[a+768>>0]=-11059*a,O[a+1024>>0]=-21709*a,O[a+1280>>0]=32768*a+8421375,O[a+1536>>0]=-27439*a,O[a+1792>>0]=-5329*a}function g(a){for(var b=a[0],c=a[1]-1;c>=0;)b&1<J&&(255==I?(h(255),h(0)):h(I),J=7,I=0)}function h(a){H.push(N[a])}function i(a){h(a>>8&255),h(255&a)}function j(a,b){var c,d,e,f,g,h,i,j,k,l=0,m=8,n=64;for(k=0;m>k;++k){c=a[l],d=a[l+1],e=a[l+2],f=a[l+3],g=a[l+4],h=a[l+5],i=a[l+6],j=a[l+7];var o=c+j,p=c-j,q=d+i,r=d-i,s=e+h,t=e-h,u=f+g,v=f-g,w=o+u,x=o-u,y=q+s,z=q-s;a[l]=w+y,a[l+4]=w-y;var A=.707106781*(z+x);a[l+2]=x+A,a[l+6]=x-A,w=v+t,y=t+r,z=r+p;var B=.382683433*(w-z),C=.5411961*w+B,D=1.306562965*z+B,E=.707106781*y,G=p+E,H=p-E;a[l+5]=H+C,a[l+3]=H-C,a[l+1]=G+D,a[l+7]=G-D,l+=8}for(l=0,k=0;m>k;++k){c=a[l],d=a[l+8],e=a[l+16],f=a[l+24],g=a[l+32],h=a[l+40],i=a[l+48],j=a[l+56];var I=c+j,J=c-j,K=d+i,L=d-i,M=e+h,N=e-h,O=f+g,P=f-g,Q=I+O,R=I-O,S=K+M,T=K-M;a[l]=Q+S,a[l+32]=Q-S;var U=.707106781*(T+R);a[l+16]=R+U,a[l+48]=R-U,Q=P+N,S=N+L,T=L+J;var V=.382683433*(Q-T),W=.5411961*Q+V,X=1.306562965*T+V,Y=.707106781*S,Z=J+Y,$=J-Y;a[l+40]=$+W,a[l+24]=$-W,a[l+8]=Z+X,a[l+56]=Z-X,l++}var _;for(k=0;n>k;++k)_=a[k]*b[k],F[k]=_>0?_+.5|0:_-.5|0;return F}function k(){i(65504),i(16),h(74),h(70),h(73),h(70),h(0),h(1),h(1),h(0),i(1),i(1),h(0),h(0)}function l(a,b){i(65472),i(17),h(8),i(b),i(a),h(3),h(1),h(17),h(0),h(2),h(17),h(1),h(3),h(17),h(1)}function m(){i(65499),i(132),h(0);for(var a=0;64>a;a++)h(z[a]);h(1);for(var b=0;64>b;b++)h(A[b])}function n(){i(65476),i(418),h(0);for(var a=0;16>a;a++)h(Q[a+1]);for(var b=0;11>=b;b++)h(R[b]);h(16);for(var c=0;16>c;c++)h(S[c+1]);for(var d=0;161>=d;d++)h(T[d]);h(1);for(var e=0;16>e;e++)h(U[e+1]);for(var f=0;11>=f;f++)h(V[f]);h(17);for(var g=0;16>g;g++)h(W[g+1]);for(var j=0;161>=j;j++)h(X[j])}function o(){i(65498),i(12),h(3),h(1),h(0),h(2),h(17),h(3),h(17),h(0),h(63),h(0)}function p(a,b,c,d,e){for(var f,h=e[0],i=e[240],k=16,l=63,m=64,n=j(a,b),o=0;m>o;++o)G[P[o]]=n[o];var p=G[0]-c;c=G[0],0==p?g(d[0]):(f=32767+p,g(d[E[f]]),g(D[f]));for(var q=63;q>0&&0==G[q];q--);if(0==q)return g(h),c;for(var r,s=1;q>=s;){for(var t=s;0==G[s]&&q>=s;++s);var u=s-t;if(u>=k){r=u>>4;for(var v=1;r>=v;++v)g(i);u=15&u}f=32767+G[s],g(e[(u<<4)+E[f]]),g(D[f]),s++}return q!=l&&g(h),c}function q(){for(var a=String.fromCharCode,b=0;256>b;b++)N[b]=a(b)}function r(a){if(0>=a&&(a=1),a>100&&(a=100),x!=a){var c=0;c=Math.floor(50>a?5e3/a:200-2*a),b(c),x=a}}function s(){a||(a=50),q(),d(),e(),f(),r(a)}var t,u,v,w,x,y=(Math.round,Math.floor),z=new Array(64),A=new Array(64),B=new Array(64),C=new Array(64),D=new Array(65535),E=new Array(65535),F=new Array(64),G=new Array(64),H=[],I=0,J=7,K=new Array(64),L=new Array(64),M=new Array(64),N=new Array(256),O=new Array(2048),P=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],Q=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],R=[0,1,2,3,4,5,6,7,8,9,10,11],S=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],T=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],U=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],V=[0,1,2,3,4,5,6,7,8,9,10,11],W=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],X=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(a,b){b&&r(b),H=new Array,I=0,J=7,i(65496),k(),m(),l(a.width,a.height),n(),o();var c=0,d=0,e=0;I=0,J=7,this.encode.displayName="_encode_";for(var f,h,j,q,s,x,y,z,A,D=a.data,E=a.width,F=a.height,G=4*E,N=0;F>N;){for(f=0;G>f;){for(s=G*N+f,x=s,y=-1,z=0,A=0;64>A;A++)z=A>>3,y=4*(7&A),x=s+z*G+y,N+z>=F&&(x-=G*(N+1+z-F)),f+y>=G&&(x-=f+y-G+4),h=D[x++],j=D[x++],q=D[x++],K[A]=(O[h]+O[j+256>>0]+O[q+512>>0]>>16)-128,L[A]=(O[h+768>>0]+O[j+1024>>0]+O[q+1280>>0]>>16)-128,M[A]=(O[h+1280>>0]+O[j+1536>>0]+O[q+1792>>0]>>16)-128;c=p(K,B,c,t,v),d=p(L,C,d,u,w),e=p(M,C,e,u,w),f+=32}N+=8}if(J>=0){var P=[];P[1]=J+1,P[0]=(1<i;)e=d[4*(k-1)+3],0===e?j=k:i=k,k=j+i>>1;return f=k/c,0===f?1:f}function c(a){var b,c,d=a.naturalWidth,e=a.naturalHeight;return d*e>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-d+1,0),0===c.getImageData(0,0,1,1).data[3]):!1}return a.os.ios?a.os.ios>=7?function(a,c,d,e,f,g){var h=c.naturalWidth,i=c.naturalHeight,j=b(c,h,i);return a.getContext("2d").drawImage(c,0,0,h*j,i*j,d,e,f,g)}:function(a,d,e,f,g,h){var i,j,k,l,m,n,o,p=d.naturalWidth,q=d.naturalHeight,r=a.getContext("2d"),s=c(d),t="image/jpeg"===this.type,u=1024,v=0,w=0;for(s&&(p/=2,q/=2),r.save(),i=document.createElement("canvas"),i.width=i.height=u,j=i.getContext("2d"),k=t?b(d,p,q):1,l=Math.ceil(u*g/p),m=Math.ceil(u*h/q/k);q>v;){for(n=0,o=0;p>n;)j.clearRect(0,0,u,u),j.drawImage(d,-n,-v),r.drawImage(i,0,0,u,u,e+o,f+w,l,m),n+=u,o+=l;v+=u,w+=m}r.restore(),i=j=null}:function(b){var c=a.slice(arguments,1),d=b.getContext("2d");d.drawImage.apply(d,c)}}()})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/html5/md5",["runtime/html5/runtime"],function(a){var b=function(a,b){return a+b&4294967295},c=function(a,c,d,e,f,g){return c=b(b(c,a),b(e,g)),b(c<>>32-f,d)},d=function(a,b,d,e,f,g,h){return c(b&d|~b&e,a,b,f,g,h)},e=function(a,b,d,e,f,g,h){return c(b&e|d&~e,a,b,f,g,h)},f=function(a,b,d,e,f,g,h){return c(b^d^e,a,b,f,g,h)},g=function(a,b,d,e,f,g,h){return c(d^(b|~e),a,b,f,g,h)},h=function(a,c){var h=a[0],i=a[1],j=a[2],k=a[3];h=d(h,i,j,k,c[0],7,-680876936),k=d(k,h,i,j,c[1],12,-389564586),j=d(j,k,h,i,c[2],17,606105819),i=d(i,j,k,h,c[3],22,-1044525330),h=d(h,i,j,k,c[4],7,-176418897),k=d(k,h,i,j,c[5],12,1200080426),j=d(j,k,h,i,c[6],17,-1473231341),i=d(i,j,k,h,c[7],22,-45705983),h=d(h,i,j,k,c[8],7,1770035416),k=d(k,h,i,j,c[9],12,-1958414417),j=d(j,k,h,i,c[10],17,-42063),i=d(i,j,k,h,c[11],22,-1990404162),h=d(h,i,j,k,c[12],7,1804603682),k=d(k,h,i,j,c[13],12,-40341101),j=d(j,k,h,i,c[14],17,-1502002290),i=d(i,j,k,h,c[15],22,1236535329),h=e(h,i,j,k,c[1],5,-165796510),k=e(k,h,i,j,c[6],9,-1069501632),j=e(j,k,h,i,c[11],14,643717713),i=e(i,j,k,h,c[0],20,-373897302),h=e(h,i,j,k,c[5],5,-701558691),k=e(k,h,i,j,c[10],9,38016083),j=e(j,k,h,i,c[15],14,-660478335),i=e(i,j,k,h,c[4],20,-405537848),h=e(h,i,j,k,c[9],5,568446438),k=e(k,h,i,j,c[14],9,-1019803690),j=e(j,k,h,i,c[3],14,-187363961),i=e(i,j,k,h,c[8],20,1163531501),h=e(h,i,j,k,c[13],5,-1444681467),k=e(k,h,i,j,c[2],9,-51403784),j=e(j,k,h,i,c[7],14,1735328473),i=e(i,j,k,h,c[12],20,-1926607734),h=f(h,i,j,k,c[5],4,-378558),k=f(k,h,i,j,c[8],11,-2022574463),j=f(j,k,h,i,c[11],16,1839030562),i=f(i,j,k,h,c[14],23,-35309556),h=f(h,i,j,k,c[1],4,-1530992060),k=f(k,h,i,j,c[4],11,1272893353),j=f(j,k,h,i,c[7],16,-155497632),i=f(i,j,k,h,c[10],23,-1094730640),h=f(h,i,j,k,c[13],4,681279174),k=f(k,h,i,j,c[0],11,-358537222),j=f(j,k,h,i,c[3],16,-722521979),i=f(i,j,k,h,c[6],23,76029189),h=f(h,i,j,k,c[9],4,-640364487),k=f(k,h,i,j,c[12],11,-421815835),j=f(j,k,h,i,c[15],16,530742520),i=f(i,j,k,h,c[2],23,-995338651),h=g(h,i,j,k,c[0],6,-198630844),k=g(k,h,i,j,c[7],10,1126891415),j=g(j,k,h,i,c[14],15,-1416354905),i=g(i,j,k,h,c[5],21,-57434055),h=g(h,i,j,k,c[12],6,1700485571),k=g(k,h,i,j,c[3],10,-1894986606),j=g(j,k,h,i,c[10],15,-1051523),i=g(i,j,k,h,c[1],21,-2054922799),h=g(h,i,j,k,c[8],6,1873313359),k=g(k,h,i,j,c[15],10,-30611744),j=g(j,k,h,i,c[6],15,-1560198380),i=g(i,j,k,h,c[13],21,1309151649),h=g(h,i,j,k,c[4],6,-145523070),k=g(k,h,i,j,c[11],10,-1120210379),j=g(j,k,h,i,c[2],15,718787259),i=g(i,j,k,h,c[9],21,-343485551),a[0]=b(h,a[0]),a[1]=b(i,a[1]),a[2]=b(j,a[2]),a[3]=b(k,a[3])},i=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a.charCodeAt(b)+(a.charCodeAt(b+1)<<8)+(a.charCodeAt(b+2)<<16)+(a.charCodeAt(b+3)<<24);return c},j=function(a){var b,c=[];for(b=0;64>b;b+=4)c[b>>2]=a[b]+(a[b+1]<<8)+(a[b+2]<<16)+(a[b+3]<<24);return c},k=function(a){var b,c,d,e,f,g,j=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;j>=b;b+=64)h(k,i(a.substring(b-64,b)));for(a=a.substring(b-64),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a.charCodeAt(b)<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*j,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},l=function(a){var b,c,d,e,f,g,i=a.length,k=[1732584193,-271733879,-1732584194,271733878];for(b=64;i>=b;b+=64)h(k,j(a.subarray(b-64,b)));for(a=i>b-64?a.subarray(b-64):new Uint8Array(0),c=a.length,d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b=0;c>b;b+=1)d[b>>2]|=a[b]<<(b%4<<3);if(d[b>>2]|=128<<(b%4<<3),b>55)for(h(k,d),b=0;16>b;b+=1)d[b]=0;return e=8*i,e=e.toString(16).match(/(.*?)(.{0,8})$/),f=parseInt(e[2],16),g=parseInt(e[1],16)||0,d[14]=f,d[15]=g,h(k,d),k},m=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n=function(a){var b,c="";for(b=0;4>b;b+=1)c+=m[a>>8*b+4&15]+m[a>>8*b&15];return c},o=function(a){var b;for(b=0;b>16)+(b>>16)+(c>>16);return d<<16|65535&c}),q.prototype.append=function(a){return/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a))),this.appendBinary(a),this},q.prototype.appendBinary=function(a){this._buff+=a,this._length+=a.length;var b,c=this._buff.length;for(b=64;c>=b;b+=64)h(this._state,i(this._buff.substring(b-64,b)));return this._buff=this._buff.substr(b-64),this},q.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(b=0;e>b;b+=1)f[b>>2]|=d.charCodeAt(b)<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.prototype._finish=function(a,b){var c,d,e,f=b;if(a[f>>2]|=128<<(f%4<<3),f>55)for(h(this._state,a),f=0;16>f;f+=1)a[f]=0;c=8*this._length,c=c.toString(16).match(/(.*?)(.{0,8})$/),d=parseInt(c[2],16),e=parseInt(c[1],16)||0,a[14]=d,a[15]=e,h(this._state,a)},q.prototype.reset=function(){return this._buff="",this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.prototype.destroy=function(){delete this._state,delete this._buff,delete this._length},q.hash=function(a,b){/[\u0080-\uFFFF]/.test(a)&&(a=unescape(encodeURIComponent(a)));var c=k(a);return b?c:o(c)},q.hashBinary=function(a,b){var c=k(a);return b?c:o(c)},q.ArrayBuffer=function(){this.reset()},q.ArrayBuffer.prototype.append=function(a){var b,c=this._concatArrayBuffer(this._buff,a),d=c.length;for(this._length+=a.byteLength,b=64;d>=b;b+=64)h(this._state,j(c.subarray(b-64,b)));return this._buff=d>b-64?c.subarray(b-64):new Uint8Array(0),this},q.ArrayBuffer.prototype.end=function(a){var b,c,d=this._buff,e=d.length,f=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; +for(b=0;e>b;b+=1)f[b>>2]|=d[b]<<(b%4<<3);return this._finish(f,e),c=a?this._state:o(this._state),this.reset(),c},q.ArrayBuffer.prototype._finish=q.prototype._finish,q.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._state=[1732584193,-271733879,-1732584194,271733878],this},q.ArrayBuffer.prototype.destroy=q.prototype.destroy,q.ArrayBuffer.prototype._concatArrayBuffer=function(a,b){var c=a.length,d=new Uint8Array(c+b.byteLength);return d.set(a),d.set(new Uint8Array(b),c),d},q.ArrayBuffer.hash=function(a,b){var c=l(new Uint8Array(a));return b?c:o(c)},a.register("Md5",{init:function(){},loadFromBlob:function(a){var b,c,d=a.getSource(),e=2097152,f=Math.ceil(d.size/e),g=0,h=this.owner,i=new q.ArrayBuffer,j=this,k=d.mozSlice||d.webkitSlice||d.slice;c=new FileReader,(b=function(){var l,m;l=g*e,m=Math.min(l+e,d.size),c.onload=function(b){i.append(b.target.result),h.trigger("progress",{total:a.size,loaded:m})},c.onloadend=function(){c.onloadend=c.onload=null,++g',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/image",["runtime/flash/runtime"],function(a){return a.register("Image",{loadFromBlob:function(a){var b=this.owner;b.info()&&this.flashExec("Image","info",b.info()),b.meta()&&this.flashExec("Image","meta",b.meta()),this.flashExec("Image","loadFromBlob",a.uid)}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("runtime/flash/blob",["runtime/flash/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.flashExec("Blob","slice",a,c);return new b(d.uid,d)}})}),b("runtime/flash/md5",["runtime/flash/runtime"],function(a){return a.register("Md5",{init:function(){},loadFromBlob:function(a){return this.flashExec("Md5","loadFromBlob",a.uid)}})}),b("preset/all",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/image","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","widgets/md5","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/imagemeta/exif","runtime/html5/androidpatch","runtime/html5/image","runtime/html5/transport","runtime/html5/md5","runtime/flash/filepicker","runtime/flash/image","runtime/flash/transport","runtime/flash/blob","runtime/flash/md5"],function(a){return a}),b("webuploader",["preset/all"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/page/webuploader/webuploader.withoutimage.js b/WebContent/Frame/page/webuploader/webuploader.withoutimage.js new file mode 100644 index 000000000..881c05dee --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.withoutimage.js @@ -0,0 +1,4993 @@ +/*! WebUploader 0.1.5 */ + + +/** + * @fileOverview 璁╁唴閮ㄥ悇涓儴浠剁殑浠g爜鍙互鐢╗amd](https://github.com/amdjs/amdjs-api/wiki/AMD)妯″潡瀹氫箟鏂瑰紡缁勭粐璧锋潵銆 + * + * AMD API 鍐呴儴鐨勭畝鍗曚笉瀹屽叏瀹炵幇锛岃蹇界暐銆傚彧鏈夊綋WebUploader琚悎骞舵垚涓涓枃浠剁殑鏃跺欐墠浼氬紩鍏ャ + */ +(function( root, factory ) { + var modules = {}, + + // 鍐呴儴require, 绠鍗曚笉瀹屽叏瀹炵幇銆 + // https://github.com/amdjs/amdjs-api/wiki/require + _require = function( deps, callback ) { + var args, len, i; + + // 濡傛灉deps涓嶆槸鏁扮粍锛屽垯鐩存帴杩斿洖鎸囧畾module + if ( typeof deps === 'string' ) { + return getModule( deps ); + } else { + args = []; + for( len = deps.length, i = 0; i < len; i++ ) { + args.push( getModule( deps[ i ] ) ); + } + + return callback.apply( null, args ); + } + }, + + // 鍐呴儴define锛屾殏鏃朵笉鏀寔涓嶆寚瀹歩d. + _define = function( id, deps, factory ) { + if ( arguments.length === 2 ) { + factory = deps; + deps = null; + } + + _require( deps || [], function() { + setModule( id, factory, arguments ); + }); + }, + + // 璁剧疆module, 鍏煎CommonJs鍐欐硶銆 + setModule = function( id, factory, args ) { + var module = { + exports: factory + }, + returned; + + if ( typeof factory === 'function' ) { + args.length || (args = [ _require, module.exports, module ]); + returned = factory.apply( null, args ); + returned !== undefined && (module.exports = returned); + } + + modules[ id ] = module.exports; + }, + + // 鏍规嵁id鑾峰彇module + getModule = function( id ) { + var module = modules[ id ] || root[ id ]; + + if ( !module ) { + throw new Error( '`' + id + '` is undefined' ); + } + + return module; + }, + + // 灏嗘墍鏈塵odules锛屽皢璺緞ids瑁呮崲鎴愬璞° + exportsTo = function( obj ) { + var key, host, parts, part, last, ucFirst; + + // make the first character upper case. + ucFirst = function( str ) { + return str && (str.charAt( 0 ).toUpperCase() + str.substr( 1 )); + }; + + for ( key in modules ) { + host = obj; + + if ( !modules.hasOwnProperty( key ) ) { + continue; + } + + parts = key.split('/'); + last = ucFirst( parts.pop() ); + + while( (part = ucFirst( parts.shift() )) ) { + host[ part ] = host[ part ] || {}; + host = host[ part ]; + } + + host[ last ] = modules[ key ]; + } + + return obj; + }, + + makeExport = function( dollar ) { + root.__dollar = dollar; + + // exports every module. + return exportsTo( factory( root, _define, _require ) ); + }, + + origin; + + if ( typeof module === 'object' && typeof module.exports === 'object' ) { + + // For CommonJS and CommonJS-like environments where a proper window is present, + module.exports = makeExport(); + } else if ( typeof define === 'function' && define.amd ) { + + // Allow using this built library as an AMD module + // in another project. That other project will only + // see this AMD call, not the internal modules in + // the closure below. + define([ 'jquery' ], makeExport ); + } else { + + // Browser globals case. Just assign the + // result to a property on the global. + origin = root.WebUploader; + root.WebUploader = makeExport(); + root.WebUploader.noConflict = function() { + root.WebUploader = origin; + }; + } +})( window, function( window, define, require ) { + + + /** + * @fileOverview jQuery or Zepto + */ + define('dollar-third',[],function() { + var $ = window.__dollar || window.jQuery || window.Zepto; + + if ( !$ ) { + throw new Error('jQuery or Zepto not found!'); + } + + return $; + }); + /** + * @fileOverview Dom 鎿嶄綔鐩稿叧 + */ + define('dollar',[ + 'dollar-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 浣跨敤jQuery鐨凱romise + */ + define('promise-third',[ + 'dollar' + ], function( $ ) { + return { + Deferred: $.Deferred, + when: $.when, + + isPromise: function( anything ) { + return anything && typeof anything.then === 'function'; + } + }; + }); + /** + * @fileOverview Promise/A+ + */ + define('promise',[ + 'promise-third' + ], function( _ ) { + return _; + }); + /** + * @fileOverview 鍩虹绫绘柟娉曘 + */ + + /** + * Web Uploader鍐呴儴绫荤殑璇︾粏璇存槑锛屼互涓嬫彁鍙婄殑鍔熻兘绫伙紝閮藉彲浠ュ湪`WebUploader`杩欎釜鍙橀噺涓闂埌銆 + * + * As you know, Web Uploader鐨勬瘡涓枃浠堕兘鏄敤杩嘯AMD](https://github.com/amdjs/amdjs-api/wiki/AMD)瑙勮寖涓殑`define`缁勭粐璧锋潵鐨, 姣忎釜Module閮戒細鏈変釜module id. + * 榛樿module id涓鸿鏂囦欢鐨勮矾寰勶紝鑰屾璺緞灏嗕細杞寲鎴愬悕瀛楃┖闂村瓨鏀惧湪WebUploader涓傚锛 + * + * * module `base`锛歐ebUploader.Base + * * module `file`: WebUploader.File + * * module `lib/dnd`: WebUploader.Lib.Dnd + * * module `runtime/html5/dnd`: WebUploader.Runtime.Html5.Dnd + * + * + * 浠ヤ笅鏂囨。涓绫荤殑浣跨敤鍙兘鐪佺暐鎺変簡`WebUploader`鍓嶇紑銆 + * @module WebUploader + * @title WebUploader API鏂囨。 + */ + define('base',[ + 'dollar', + 'promise' + ], function( $, promise ) { + + var noop = function() {}, + call = Function.call; + + // http://jsperf.com/uncurrythis + // 鍙嶇閲屽寲 + function uncurryThis( fn ) { + return function() { + return call.apply( fn, arguments ); + }; + } + + function bindFn( fn, context ) { + return function() { + return fn.apply( context, arguments ); + }; + } + + function createObject( proto ) { + var f; + + if ( Object.create ) { + return Object.create( proto ); + } else { + f = function() {}; + f.prototype = proto; + return new f(); + } + } + + + /** + * 鍩虹绫伙紝鎻愪緵涓浜涚畝鍗曞父鐢ㄧ殑鏂规硶銆 + * @class Base + */ + return { + + /** + * @property {String} version 褰撳墠鐗堟湰鍙枫 + */ + version: '0.1.5', + + /** + * @property {jQuery|Zepto} $ 寮曠敤渚濊禆鐨刯Query鎴栬匷epto瀵硅薄銆 + */ + $: $, + + Deferred: promise.Deferred, + + isPromise: promise.isPromise, + + when: promise.when, + + /** + * @description 绠鍗曠殑娴忚鍣ㄦ鏌ョ粨鏋溿 + * + * * `webkit` webkit鐗堟湰鍙凤紝濡傛灉娴忚鍣ㄤ负闈瀢ebkit鍐呮牳锛屾灞炴т负`undefined`銆 + * * `chrome` chrome娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓篶hrome锛屾灞炴т负`undefined`銆 + * * `ie` ie娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪ie锛屾灞炴т负`undefined`銆**鏆備笉鏀寔ie10+** + * * `firefox` firefox娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪firefox锛屾灞炴т负`undefined`銆 + * * `safari` safari娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪safari锛屾灞炴т负`undefined`銆 + * * `opera` opera娴忚鍣ㄧ増鏈彿锛屽鏋滄祻瑙堝櫒涓洪潪opera锛屾灞炴т负`undefined`銆 + * + * @property {Object} [browser] + */ + browser: (function( ua ) { + var ret = {}, + webkit = ua.match( /WebKit\/([\d.]+)/ ), + chrome = ua.match( /Chrome\/([\d.]+)/ ) || + ua.match( /CriOS\/([\d.]+)/ ), + + ie = ua.match( /MSIE\s([\d\.]+)/ ) || + ua.match( /(?:trident)(?:.*rv:([\w.]+))?/i ), + firefox = ua.match( /Firefox\/([\d.]+)/ ), + safari = ua.match( /Safari\/([\d.]+)/ ), + opera = ua.match( /OPR\/([\d.]+)/ ); + + webkit && (ret.webkit = parseFloat( webkit[ 1 ] )); + chrome && (ret.chrome = parseFloat( chrome[ 1 ] )); + ie && (ret.ie = parseFloat( ie[ 1 ] )); + firefox && (ret.firefox = parseFloat( firefox[ 1 ] )); + safari && (ret.safari = parseFloat( safari[ 1 ] )); + opera && (ret.opera = parseFloat( opera[ 1 ] )); + + return ret; + })( navigator.userAgent ), + + /** + * @description 鎿嶄綔绯荤粺妫鏌ョ粨鏋溿 + * + * * `android` 濡傛灉鍦╝ndroid娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刟ndroid鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * * `ios` 濡傛灉鍦╥os娴忚鍣ㄧ幆澧冧笅锛屾鍊间负瀵瑰簲鐨刬os鐗堟湰鍙凤紝鍚﹀垯涓篳undefined`銆 + * @property {Object} [os] + */ + os: (function( ua ) { + var ret = {}, + + // osx = !!ua.match( /\(Macintosh\; Intel / ), + android = ua.match( /(?:Android);?[\s\/]+([\d.]+)?/ ), + ios = ua.match( /(?:iPad|iPod|iPhone).*OS\s([\d_]+)/ ); + + // osx && (ret.osx = true); + android && (ret.android = parseFloat( android[ 1 ] )); + ios && (ret.ios = parseFloat( ios[ 1 ].replace( /_/g, '.' ) )); + + return ret; + })( navigator.userAgent ), + + /** + * 瀹炵幇绫讳笌绫讳箣闂寸殑缁ф壙銆 + * @method inherits + * @grammar Base.inherits( super ) => child + * @grammar Base.inherits( super, protos ) => child + * @grammar Base.inherits( super, protos, statics ) => child + * @param {Class} super 鐖剁被 + * @param {Object | Function} [protos] 瀛愮被鎴栬呭璞°傚鏋滃璞′腑鍖呭惈constructor锛屽瓙绫诲皢鏄敤姝ゅ睘鎬у笺 + * @param {Function} [protos.constructor] 瀛愮被鏋勯犲櫒锛屼笉鎸囧畾鐨勮瘽灏嗗垱寤轰釜涓存椂鐨勭洿鎺ユ墽琛岀埗绫绘瀯閫犲櫒鐨勬柟娉曘 + * @param {Object} [statics] 闈欐佸睘鎬ф垨鏂规硶銆 + * @return {Class} 杩斿洖瀛愮被銆 + * @example + * function Person() { + * console.log( 'Super' ); + * } + * Person.prototype.hello = function() { + * console.log( 'hello' ); + * }; + * + * var Manager = Base.inherits( Person, { + * world: function() { + * console.log( 'World' ); + * } + * }); + * + * // 鍥犱负娌℃湁鎸囧畾鏋勯犲櫒锛岀埗绫荤殑鏋勯犲櫒灏嗕細鎵ц銆 + * var instance = new Manager(); // => Super + * + * // 缁ф壙瀛愮埗绫荤殑鏂规硶 + * instance.hello(); // => hello + * instance.world(); // => World + * + * // 瀛愮被鐨刜_super__灞炴ф寚鍚戠埗绫 + * console.log( Manager.__super__ === Person ); // => true + */ + inherits: function( Super, protos, staticProtos ) { + var child; + + if ( typeof protos === 'function' ) { + child = protos; + protos = null; + } else if ( protos && protos.hasOwnProperty('constructor') ) { + child = protos.constructor; + } else { + child = function() { + return Super.apply( this, arguments ); + }; + } + + // 澶嶅埗闈欐佹柟娉 + $.extend( true, child, Super, staticProtos || {} ); + + /* jshint camelcase: false */ + + // 璁╁瓙绫荤殑__super__灞炴ф寚鍚戠埗绫汇 + child.__super__ = Super.prototype; + + // 鏋勫缓鍘熷瀷锛屾坊鍔犲師鍨嬫柟娉曟垨灞炴с + // 鏆傛椂鐢∣bject.create瀹炵幇銆 + child.prototype = createObject( Super.prototype ); + protos && $.extend( true, child.prototype, protos ); + + return child; + }, + + /** + * 涓涓笉鍋氫换浣曚簨鎯呯殑鏂规硶銆傚彲浠ョ敤鏉ヨ祴鍊肩粰榛樿鐨刢allback. + * @method noop + */ + noop: noop, + + /** + * 杩斿洖涓涓柊鐨勬柟娉曪紝姝ゆ柟娉曞皢宸叉寚瀹氱殑`context`鏉ユ墽琛屻 + * @grammar Base.bindFn( fn, context ) => Function + * @method bindFn + * @example + * var doSomething = function() { + * console.log( this.name ); + * }, + * obj = { + * name: 'Object Name' + * }, + * aliasFn = Base.bind( doSomething, obj ); + * + * aliasFn(); // => Object Name + * + */ + bindFn: bindFn, + + /** + * 寮曠敤Console.log濡傛灉瀛樺湪鐨勮瘽锛屽惁鍒欏紩鐢ㄤ竴涓猍绌哄嚱鏁皀oop](#WebUploader:Base.noop)銆 + * @grammar Base.log( args... ) => undefined + * @method log + */ + log: (function() { + if ( window.console ) { + return bindFn( console.log, console ); + } + return noop; + })(), + + nextTick: (function() { + + return function( cb ) { + setTimeout( cb, 1 ); + }; + + // @bug 褰撴祻瑙堝櫒涓嶅湪褰撳墠绐楀彛鏃跺氨鍋滀簡銆 + // var next = window.requestAnimationFrame || + // window.webkitRequestAnimationFrame || + // window.mozRequestAnimationFrame || + // function( cb ) { + // window.setTimeout( cb, 1000 / 60 ); + // }; + + // // fix: Uncaught TypeError: Illegal invocation + // return bindFn( next, window ); + })(), + + /** + * 琚玔uncurrythis](http://www.2ality.com/2011/11/uncurrying-this.html)鐨勬暟缁剆lice鏂规硶銆 + * 灏嗙敤鏉ュ皢闈炴暟缁勫璞¤浆鍖栨垚鏁扮粍瀵硅薄銆 + * @grammar Base.slice( target, start[, end] ) => Array + * @method slice + * @example + * function doSomthing() { + * var args = Base.slice( arguments, 1 ); + * console.log( args ); + * } + * + * doSomthing( 'ignored', 'arg2', 'arg3' ); // => Array ["arg2", "arg3"] + */ + slice: uncurryThis( [].slice ), + + /** + * 鐢熸垚鍞竴鐨処D + * @method guid + * @grammar Base.guid() => String + * @grammar Base.guid( prefx ) => String + */ + guid: (function() { + var counter = 0; + + return function( prefix ) { + var guid = (+new Date()).toString( 32 ), + i = 0; + + for ( ; i < 5; i++ ) { + guid += Math.floor( Math.random() * 65535 ).toString( 32 ); + } + + return (prefix || 'wu_') + guid + (counter++).toString( 32 ); + }; + })(), + + /** + * 鏍煎紡鍖栨枃浠跺ぇ灏, 杈撳嚭鎴愬甫鍗曚綅鐨勫瓧绗︿覆 + * @method formatSize + * @grammar Base.formatSize( size ) => String + * @grammar Base.formatSize( size, pointLength ) => String + * @grammar Base.formatSize( size, pointLength, units ) => String + * @param {Number} size 鏂囦欢澶у皬 + * @param {Number} [pointLength=2] 绮剧‘鍒扮殑灏忔暟鐐规暟銆 + * @param {Array} [units=[ 'B', 'K', 'M', 'G', 'TB' ]] 鍗曚綅鏁扮粍銆備粠瀛楄妭锛屽埌鍗冨瓧鑺傦紝涓鐩村線涓婃寚瀹氥傚鏋滃崟浣嶆暟缁勯噷闈㈠彧鎸囧畾浜嗗埌浜咾(鍗冨瓧鑺)锛屽悓鏃舵枃浠跺ぇ灏忓ぇ浜嶮, 姝ゆ柟娉曠殑杈撳嚭灏嗚繕鏄樉绀烘垚澶氬皯K. + * @example + * console.log( Base.formatSize( 100 ) ); // => 100B + * console.log( Base.formatSize( 1024 ) ); // => 1.00K + * console.log( Base.formatSize( 1024, 0 ) ); // => 1K + * console.log( Base.formatSize( 1024 * 1024 ) ); // => 1.00M + * console.log( Base.formatSize( 1024 * 1024 * 1024 ) ); // => 1.00G + * console.log( Base.formatSize( 1024 * 1024 * 1024, 0, ['B', 'KB', 'MB'] ) ); // => 1024MB + */ + formatSize: function( size, pointLength, units ) { + var unit; + + units = units || [ 'B', 'K', 'M', 'G', 'TB' ]; + + while ( (unit = units.shift()) && size > 1024 ) { + size = size / 1024; + } + + return (unit === 'B' ? size : size.toFixed( pointLength || 2 )) + + unit; + } + }; + }); + /** + * 浜嬩欢澶勭悊绫伙紝鍙互鐙珛浣跨敤锛屼篃鍙互鎵╁睍缁欏璞′娇鐢ㄣ + * @fileOverview Mediator + */ + define('mediator',[ + 'base' + ], function( Base ) { + var $ = Base.$, + slice = [].slice, + separator = /\s+/, + protos; + + // 鏍规嵁鏉′欢杩囨护鍑轰簨浠秇andlers. + function findHandlers( arr, name, callback, context ) { + return $.grep( arr, function( handler ) { + return handler && + (!name || handler.e === name) && + (!callback || handler.cb === callback || + handler.cb._cb === callback) && + (!context || handler.ctx === context); + }); + } + + function eachEvent( events, callback, iterator ) { + // 涓嶆敮鎸佸璞★紝鍙敮鎸佸涓猠vent鐢ㄧ┖鏍奸殧寮 + $.each( (events || '').split( separator ), function( _, key ) { + iterator( key, callback ); + }); + } + + function triggerHanders( events, args ) { + var stoped = false, + i = -1, + len = events.length, + handler; + + while ( ++i < len ) { + handler = events[ i ]; + + if ( handler.cb.apply( handler.ctx2, args ) === false ) { + stoped = true; + break; + } + } + + return !stoped; + } + + protos = { + + /** + * 缁戝畾浜嬩欢銆 + * + * `callback`鏂规硶鍦ㄦ墽琛屾椂锛宎rguments灏嗕細鏉ユ簮浜巘rigger鐨勬椂鍊欐惡甯︾殑鍙傛暟銆傚 + * ```javascript + * var obj = {}; + * + * // 浣垮緱obj鏈変簨浠惰涓 + * Mediator.installTo( obj ); + * + * obj.on( 'testa', function( arg1, arg2 ) { + * console.log( arg1, arg2 ); // => 'arg1', 'arg2' + * }); + * + * obj.trigger( 'testa', 'arg1', 'arg2' ); + * ``` + * + * 濡傛灉`callback`涓紝鏌愪竴涓柟娉昤return false`浜嗭紝鍒欏悗缁殑鍏朵粬`callback`閮戒笉浼氳鎵ц鍒般 + * 鍒囦細褰卞搷鍒癭trigger`鏂规硶鐨勮繑鍥炲硷紝涓篳false`銆 + * + * `on`杩樺彲浠ョ敤鏉ユ坊鍔犱竴涓壒娈婁簨浠禶all`, 杩欐牱鎵鏈夌殑浜嬩欢瑙﹀彂閮戒細鍝嶅簲鍒般傚悓鏃舵绫籤callback`涓殑arguments鏈変竴涓笉鍚屽锛 + * 灏辨槸绗竴涓弬鏁颁负`type`锛岃褰曞綋鍓嶆槸浠涔堜簨浠跺湪瑙﹀彂銆傛绫籤callback`鐨勪紭鍏堢骇姣旇剼浣庯紝浼氬啀姝e父`callback`鎵ц瀹屽悗瑙﹀彂銆 + * ```javascript + * obj.on( 'all', function( type, arg1, arg2 ) { + * console.log( type, arg1, arg2 ); // => 'testa', 'arg1', 'arg2' + * }); + * ``` + * + * @method on + * @grammar on( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚嶏紝鏀寔澶氫釜浜嬩欢鐢ㄧ┖鏍奸殧寮 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + * @class Mediator + */ + on: function( name, callback, context ) { + var me = this, + set; + + if ( !callback ) { + return this; + } + + set = this._events || (this._events = []); + + eachEvent( name, callback, function( name, callback ) { + var handler = { e: name }; + + handler.cb = callback; + handler.ctx = context; + handler.ctx2 = context || me; + handler.id = set.length; + + set.push( handler ); + }); + + return this; + }, + + /** + * 缁戝畾浜嬩欢锛屼笖褰揾andler鎵ц瀹屽悗锛岃嚜鍔ㄨВ闄ょ粦瀹氥 + * @method once + * @grammar once( name, callback[, context] ) => self + * @param {String} name 浜嬩欢鍚 + * @param {Function} callback 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + once: function( name, callback, context ) { + var me = this; + + if ( !callback ) { + return me; + } + + eachEvent( name, callback, function( name, callback ) { + var once = function() { + me.off( name, once ); + return callback.apply( context || me, arguments ); + }; + + once._cb = callback; + me.on( name, once, context ); + }); + + return me; + }, + + /** + * 瑙i櫎浜嬩欢缁戝畾 + * @method off + * @grammar off( [name[, callback[, context] ] ] ) => self + * @param {String} [name] 浜嬩欢鍚 + * @param {Function} [callback] 浜嬩欢澶勭悊鍣 + * @param {Object} [context] 浜嬩欢澶勭悊鍣ㄧ殑涓婁笅鏂囥 + * @return {self} 杩斿洖鑷韩锛屾柟渚块摼寮 + * @chainable + */ + off: function( name, cb, ctx ) { + var events = this._events; + + if ( !events ) { + return this; + } + + if ( !name && !cb && !ctx ) { + this._events = []; + return this; + } + + eachEvent( name, cb, function( name, cb ) { + $.each( findHandlers( events, name, cb, ctx ), function() { + delete events[ this.id ]; + }); + }); + + return this; + }, + + /** + * 瑙﹀彂浜嬩欢 + * @method trigger + * @grammar trigger( name[, args...] ) => self + * @param {String} type 浜嬩欢鍚 + * @param {*} [...] 浠绘剰鍙傛暟 + * @return {Boolean} 濡傛灉handler涓璻eturn false浜嗭紝鍒欒繑鍥瀎alse, 鍚﹀垯杩斿洖true + */ + trigger: function( type ) { + var args, events, allEvents; + + if ( !this._events || !type ) { + return this; + } + + args = slice.call( arguments, 1 ); + events = findHandlers( this._events, type ); + allEvents = findHandlers( this._events, 'all' ); + + return triggerHanders( events, args ) && + triggerHanders( allEvents, arguments ); + } + }; + + /** + * 涓粙鑰咃紝瀹冩湰韬槸涓崟渚嬶紝浣嗗彲浠ラ氳繃[installTo](#WebUploader:Mediator:installTo)鏂规硶锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢琛屼负銆 + * 涓昏鐩殑鏄礋璐fā鍧椾笌妯″潡涔嬮棿鐨勫悎浣滐紝闄嶄綆鑰﹀悎搴︺ + * + * @class Mediator + */ + return $.extend({ + + /** + * 鍙互閫氳繃杩欎釜鎺ュ彛锛屼娇浠讳綍瀵硅薄鍏峰浜嬩欢鍔熻兘銆 + * @method installTo + * @param {Object} obj 闇瑕佸叿澶囦簨浠惰涓虹殑瀵硅薄銆 + * @return {Object} 杩斿洖obj. + */ + installTo: function( obj ) { + return $.extend( obj, protos ); + } + + }, protos ); + }); + /** + * @fileOverview Uploader涓婁紶绫 + */ + define('uploader',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$; + + /** + * 涓婁紶鍏ュ彛绫汇 + * @class Uploader + * @constructor + * @grammar new Uploader( opts ) => Uploader + * @example + * var uploader = WebUploader.Uploader({ + * swf: 'path_of_swf/Uploader.swf', + * + * // 寮璧峰垎鐗囦笂浼犮 + * chunked: true + * }); + */ + function Uploader( opts ) { + this.options = $.extend( true, {}, Uploader.options, opts ); + this._init( this.options ); + } + + // default Options + // widgets涓湁鐩稿簲鎵╁睍 + Uploader.options = {}; + Mediator.installTo( Uploader.prototype ); + + // 鎵归噺娣诲姞绾懡浠ゅ紡鏂规硶銆 + $.each({ + upload: 'start-upload', + stop: 'stop-upload', + getFile: 'get-file', + getFiles: 'get-files', + addFile: 'add-file', + addFiles: 'add-file', + sort: 'sort-files', + removeFile: 'remove-file', + cancelFile: 'cancel-file', + skipFile: 'skip-file', + retry: 'retry', + isInProgress: 'is-in-progress', + makeThumb: 'make-thumb', + md5File: 'md5-file', + getDimension: 'get-dimension', + addButton: 'add-btn', + predictRuntimeType: 'predict-runtime-type', + refresh: 'refresh', + disable: 'disable', + enable: 'enable', + reset: 'reset' + }, function( fn, command ) { + Uploader.prototype[ fn ] = function() { + return this.request( command, arguments ); + }; + }); + + $.extend( Uploader.prototype, { + state: 'pending', + + _init: function( opts ) { + var me = this; + + me.request( 'init', opts, function() { + me.state = 'ready'; + me.trigger('ready'); + }); + }, + + /** + * 鑾峰彇鎴栬呰缃甎ploader閰嶇疆椤广 + * @method option + * @grammar option( key ) => * + * @grammar option( key, val ) => self + * @example + * + * // 鍒濆鐘舵佸浘鐗囦笂浼犲墠涓嶄細鍘嬬缉 + * var uploader = new WebUploader.Uploader({ + * compress: null; + * }); + * + * // 淇敼鍚庡浘鐗囦笂浼犲墠锛屽皾璇曞皢鍥剧墖鍘嬬缉鍒1600 * 1600 + * uploader.option( 'compress', { + * width: 1600, + * height: 1600 + * }); + */ + option: function( key, val ) { + var opts = this.options; + + // setter + if ( arguments.length > 1 ) { + + if ( $.isPlainObject( val ) && + $.isPlainObject( opts[ key ] ) ) { + $.extend( opts[ key ], val ); + } else { + opts[ key ] = val; + } + + } else { // getter + return key ? opts[ key ] : opts; + } + }, + + /** + * 鑾峰彇鏂囦欢缁熻淇℃伅銆傝繑鍥炰竴涓寘鍚竴涓嬩俊鎭殑瀵硅薄銆 + * * `successNum` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `progressNum` 涓婁紶涓殑鏂囦欢鏁 + * * `cancelNum` 琚垹闄ょ殑鏂囦欢鏁 + * * `invalidNum` 鏃犳晥鐨勬枃浠舵暟 + * * `uploadFailNum` 涓婁紶澶辫触鐨勬枃浠舵暟 + * * `queueNum` 杩樺湪闃熷垪涓殑鏂囦欢鏁 + * * `interruptNum` 琚殏鍋滅殑鏂囦欢鏁 + * @method getStats + * @grammar getStats() => Object + */ + getStats: function() { + // return this._mgr.getStats.apply( this._mgr, arguments ); + var stats = this.request('get-stats'); + + return stats ? { + successNum: stats.numOfSuccess, + progressNum: stats.numOfProgress, + + // who care? + // queueFailNum: 0, + cancelNum: stats.numOfCancel, + invalidNum: stats.numOfInvalid, + uploadFailNum: stats.numOfUploadFailed, + queueNum: stats.numOfQueue, + interruptNum: stats.numofInterrupt + } : {}; + }, + + // 闇瑕侀噸鍐欐鏂规硶鏉ユ潵鏀寔opts.onEvent鍜宨nstance.onEvent鐨勫鐞嗗櫒 + trigger: function( type/*, args...*/ ) { + var args = [].slice.call( arguments, 1 ), + opts = this.options, + name = 'on' + type.substring( 0, 1 ).toUpperCase() + + type.substring( 1 ); + + if ( + // 璋冪敤閫氳繃on鏂规硶娉ㄥ唽鐨刪andler. + Mediator.trigger.apply( this, arguments ) === false || + + // 璋冪敤opts.onEvent + $.isFunction( opts[ name ] ) && + opts[ name ].apply( this, args ) === false || + + // 璋冪敤this.onEvent + $.isFunction( this[ name ] ) && + this[ name ].apply( this, args ) === false || + + // 骞挎挱鎵鏈塽ploader鐨勪簨浠躲 + Mediator.trigger.apply( Mediator, + [ this, type ].concat( args ) ) === false ) { + + return false; + } + + return true; + }, + + /** + * 閿姣 webuploader 瀹炰緥 + * @method destroy + * @grammar destroy() => undefined + */ + destroy: function() { + this.request( 'destroy', arguments ); + this.off(); + }, + + // widgets/widget.js灏嗚ˉ鍏呮鏂规硶鐨勮缁嗘枃妗c + request: Base.noop + }); + + /** + * 鍒涘缓Uploader瀹炰緥锛岀瓑鍚屼簬new Uploader( opts ); + * @method create + * @class Base + * @static + * @grammar Base.create( opts ) => Uploader + */ + Base.create = Uploader.create = function( opts ) { + return new Uploader( opts ); + }; + + // 鏆撮湶Uploader锛屽彲浠ラ氳繃瀹冩潵鎵╁睍涓氬姟閫昏緫銆 + Base.Uploader = Uploader; + + return Uploader; + }); + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/runtime',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + factories = {}, + + // 鑾峰彇瀵硅薄鐨勭涓涓猭ey + getFirstKey = function( obj ) { + for ( var key in obj ) { + if ( obj.hasOwnProperty( key ) ) { + return key; + } + } + return null; + }; + + // 鎺ュ彛绫汇 + function Runtime( options ) { + this.options = $.extend({ + container: document.body + }, options ); + this.uid = Base.guid('rt_'); + } + + $.extend( Runtime.prototype, { + + getContainer: function() { + var opts = this.options, + parent, container; + + if ( this._container ) { + return this._container; + } + + parent = $( opts.container || document.body ); + container = $( document.createElement('div') ); + + container.attr( 'id', 'rt_' + this.uid ); + container.css({ + position: 'absolute', + top: '0px', + left: '0px', + width: '1px', + height: '1px', + overflow: 'hidden' + }); + + parent.append( container ); + parent.addClass('webuploader-container'); + this._container = container; + this._parent = parent; + return container; + }, + + init: Base.noop, + exec: Base.noop, + + destroy: function() { + this._container && this._container.remove(); + this._parent && this._parent.removeClass('webuploader-container'); + this.off(); + } + }); + + Runtime.orders = 'html5,flash'; + + + /** + * 娣诲姞Runtime瀹炵幇銆 + * @param {String} type 绫诲瀷 + * @param {Runtime} factory 鍏蜂綋Runtime瀹炵幇銆 + */ + Runtime.addRuntime = function( type, factory ) { + factories[ type ] = factory; + }; + + Runtime.hasRuntime = function( type ) { + return !!(type ? factories[ type ] : getFirstKey( factories )); + }; + + Runtime.create = function( opts, orders ) { + var type, runtime; + + orders = orders || Runtime.orders; + $.each( orders.split( /\s*,\s*/g ), function() { + if ( factories[ this ] ) { + type = this; + return false; + } + }); + + type = type || getFirstKey( factories ); + + if ( !type ) { + throw new Error('Runtime Error'); + } + + runtime = new factories[ type ]( opts ); + return runtime; + }; + + Mediator.installTo( Runtime.prototype ); + return Runtime; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/client',[ + 'base', + 'mediator', + 'runtime/runtime' + ], function( Base, Mediator, Runtime ) { + + var cache; + + cache = (function() { + var obj = {}; + + return { + add: function( runtime ) { + obj[ runtime.uid ] = runtime; + }, + + get: function( ruid, standalone ) { + var i; + + if ( ruid ) { + return obj[ ruid ]; + } + + for ( i in obj ) { + // 鏈変簺绫诲瀷涓嶈兘閲嶇敤锛屾瘮濡俧ilepicker. + if ( standalone && obj[ i ].__standalone ) { + continue; + } + + return obj[ i ]; + } + + return null; + }, + + remove: function( runtime ) { + delete obj[ runtime.uid ]; + } + }; + })(); + + function RuntimeClient( component, standalone ) { + var deferred = Base.Deferred(), + runtime; + + this.uid = Base.guid('client_'); + + // 鍏佽runtime娌℃湁鍒濆鍖栦箣鍓嶏紝娉ㄥ唽涓浜涙柟娉曞湪鍒濆鍖栧悗鎵ц銆 + this.runtimeReady = function( cb ) { + return deferred.done( cb ); + }; + + this.connectRuntime = function( opts, cb ) { + + // already connected. + if ( runtime ) { + throw new Error('already connected!'); + } + + deferred.done( cb ); + + if ( typeof opts === 'string' && cache.get( opts ) ) { + runtime = cache.get( opts ); + } + + // 鍍廸ilePicker鍙兘鐙珛瀛樺湪锛屼笉鑳藉叕鐢ㄣ + runtime = runtime || cache.get( null, standalone ); + + // 闇瑕佸垱寤 + if ( !runtime ) { + runtime = Runtime.create( opts, opts.runtimeOrder ); + runtime.__promise = deferred.promise(); + runtime.once( 'ready', deferred.resolve ); + runtime.init(); + cache.add( runtime ); + runtime.__client = 1; + } else { + // 鏉ヨ嚜cache + Base.$.extend( runtime.options, opts ); + runtime.__promise.then( deferred.resolve ); + runtime.__client++; + } + + standalone && (runtime.__standalone = standalone); + return runtime; + }; + + this.getRuntime = function() { + return runtime; + }; + + this.disconnectRuntime = function() { + if ( !runtime ) { + return; + } + + runtime.__client--; + + if ( runtime.__client <= 0 ) { + cache.remove( runtime ); + delete runtime.__promise; + runtime.destroy(); + } + + runtime = null; + }; + + this.exec = function() { + if ( !runtime ) { + return; + } + + var args = Base.slice( arguments ); + component && args.unshift( component ); + + return runtime.exec.apply( this, args ); + }; + + this.getRuid = function() { + return runtime && runtime.uid; + }; + + this.destroy = (function( destroy ) { + return function() { + destroy && destroy.apply( this, arguments ); + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }; + })( this.destroy ); + } + + Mediator.installTo( RuntimeClient.prototype ); + return RuntimeClient; + }); + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/dnd',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function DragAndDrop( opts ) { + opts = this.options = $.extend({}, DragAndDrop.options, opts ); + + opts.container = $( opts.container ); + + if ( !opts.container.length ) { + return; + } + + RuntimeClent.call( this, 'DragAndDrop' ); + } + + DragAndDrop.options = { + accept: null, + disableGlobalDnd: false + }; + + Base.inherits( RuntimeClent, { + constructor: DragAndDrop, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( DragAndDrop.prototype ); + + return DragAndDrop; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/widget',[ + 'base', + 'uploader' + ], function( Base, Uploader ) { + + var $ = Base.$, + _init = Uploader.prototype._init, + _destroy = Uploader.prototype.destroy, + IGNORE = {}, + widgetClass = []; + + function isArrayLike( obj ) { + if ( !obj ) { + return false; + } + + var length = obj.length, + type = $.type( obj ); + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === 'array' || type !== 'function' && type !== 'string' && + (length === 0 || typeof length === 'number' && length > 0 && + (length - 1) in obj); + } + + function Widget( uploader ) { + this.owner = uploader; + this.options = uploader.options; + } + + $.extend( Widget.prototype, { + + init: Base.noop, + + // 绫籅ackbone鐨勪簨浠剁洃鍚0鏄庯紝鐩戝惉uploader瀹炰緥涓婄殑浜嬩欢 + // widget鐩存帴鏃犳硶鐩戝惉浜嬩欢锛屼簨浠跺彧鑳介氳繃uploader鏉ヤ紶閫 + invoke: function( apiName, args ) { + + /* + { + 'make-thumb': 'makeThumb' + } + */ + var map = this.responseMap; + + // 濡傛灉鏃燗PI鍝嶅簲澹版槑鍒欏拷鐣 + if ( !map || !(apiName in map) || !(map[ apiName ] in this) || + !$.isFunction( this[ map[ apiName ] ] ) ) { + + return IGNORE; + } + + return this[ map[ apiName ] ].apply( this, args ); + + }, + + /** + * 鍙戦佸懡浠ゃ傚綋浼犲叆`callback`鎴栬卄handler`涓繑鍥瀈promise`鏃躲傝繑鍥炰竴涓綋鎵鏈塦handler`涓殑promise閮藉畬鎴愬悗瀹屾垚鐨勬柊`promise`銆 + * @method request + * @grammar request( command, args ) => * | Promise + * @grammar request( command, args, callback ) => Promise + * @for Uploader + */ + request: function() { + return this.owner.request.apply( this.owner, arguments ); + } + }); + + // 鎵╁睍Uploader. + $.extend( Uploader.prototype, { + + /** + * @property {String | Array} [disableWidgets=undefined] + * @namespace options + * @for Uploader + * @description 榛樿鎵鏈 Uploader.register 浜嗙殑 widget 閮戒細琚姞杞斤紝濡傛灉绂佺敤鏌愪竴閮ㄥ垎锛岃閫氳繃姝 option 鎸囧畾榛戝悕鍗曘 + */ + + // 瑕嗗啓_init鐢ㄦ潵鍒濆鍖杦idgets + _init: function() { + var me = this, + widgets = me._widgets = [], + deactives = me.options.disableWidgets || ''; + + $.each( widgetClass, function( _, klass ) { + (!deactives || !~deactives.indexOf( klass._name )) && + widgets.push( new klass( me ) ); + }); + + return _init.apply( me, arguments ); + }, + + request: function( apiName, args, callback ) { + var i = 0, + widgets = this._widgets, + len = widgets && widgets.length, + rlts = [], + dfds = [], + widget, rlt, promise, key; + + args = isArrayLike( args ) ? args : [ args ]; + + for ( ; i < len; i++ ) { + widget = widgets[ i ]; + rlt = widget.invoke( apiName, args ); + + if ( rlt !== IGNORE ) { + + // Deferred瀵硅薄 + if ( Base.isPromise( rlt ) ) { + dfds.push( rlt ); + } else { + rlts.push( rlt ); + } + } + } + + // 濡傛灉鏈塩allback锛屽垯鐢ㄥ紓姝ユ柟寮忋 + if ( callback || dfds.length ) { + promise = Base.when.apply( Base, dfds ); + key = promise.pipe ? 'pipe' : 'then'; + + // 寰堥噸瑕佷笉鑳藉垹闄ゃ傚垹闄や簡浼氭寰幆銆 + // 淇濊瘉鎵ц椤哄簭銆傝callback鎬绘槸鍦ㄤ笅涓涓 tick 涓墽琛屻 + return promise[ key ](function() { + var deferred = Base.Deferred(), + args = arguments; + + if ( args.length === 1 ) { + args = args[ 0 ]; + } + + setTimeout(function() { + deferred.resolve( args ); + }, 1 ); + + return deferred.promise(); + })[ callback ? key : 'done' ]( callback || Base.noop ); + } else { + return rlts[ 0 ]; + } + }, + + destroy: function() { + _destroy.apply( this, arguments ); + this._widgets = null; + } + }); + + /** + * 娣诲姞缁勪欢 + * @grammar Uploader.register(proto); + * @grammar Uploader.register(map, proto); + * @param {object} responseMap API 鍚嶇О涓庡嚱鏁板疄鐜扮殑鏄犲皠 + * @param {object} proto 缁勪欢鍘熷瀷锛屾瀯閫犲嚱鏁伴氳繃 constructor 灞炴у畾涔 + * @method Uploader.register + * @for Uploader + * @example + * Uploader.register({ + * 'make-thumb': 'makeThumb' + * }, { + * init: function( options ) {}, + * makeThumb: function() {} + * }); + * + * Uploader.register({ + * 'make-thumb': function() { + * + * } + * }); + */ + Uploader.register = Widget.register = function( responseMap, widgetProto ) { + var map = { init: 'init', destroy: 'destroy', name: 'anonymous' }, + klass; + + if ( arguments.length === 1 ) { + widgetProto = responseMap; + + // 鑷姩鐢熸垚 map 琛ㄣ + $.each(widgetProto, function(key) { + if ( key[0] === '_' || key === 'name' ) { + key === 'name' && (map.name = widgetProto.name); + return; + } + + map[key.replace(/[A-Z]/g, '-$&').toLowerCase()] = key; + }); + + } else { + map = $.extend( map, responseMap ); + } + + widgetProto.responseMap = map; + klass = Base.inherits( Widget, widgetProto ); + klass._name = map.name; + widgetClass.push( klass ); + + return klass; + }; + + /** + * 鍒犻櫎鎻掍欢锛屽彧鏈夊湪娉ㄥ唽鏃舵寚瀹氫簡鍚嶅瓧鐨勬墠鑳借鍒犻櫎銆 + * @grammar Uploader.unRegister(name); + * @param {string} name 缁勪欢鍚嶅瓧 + * @method Uploader.unRegister + * @for Uploader + * @example + * + * Uploader.register({ + * name: 'custom', + * + * 'make-thumb': function() { + * + * } + * }); + * + * Uploader.unRegister('custom'); + */ + Uploader.unRegister = Widget.unRegister = function( name ) { + if ( !name || name === 'anonymous' ) { + return; + } + + // 鍒犻櫎鎸囧畾鐨勬彃浠躲 + for ( var i = widgetClass.length; i--; ) { + if ( widgetClass[i]._name === name ) { + widgetClass.splice(i, 1) + } + } + }; + + return Widget; + }); + /** + * @fileOverview DragAndDrop Widget銆 + */ + define('widgets/filednd',[ + 'base', + 'uploader', + 'lib/dnd', + 'widgets/widget' + ], function( Base, Uploader, Dnd ) { + var $ = Base.$; + + Uploader.options.dnd = ''; + + /** + * @property {Selector} [dnd=undefined] 鎸囧畾Drag And Drop鎷栨嫿鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝鍒欎笉鍚姩銆 + * @namespace options + * @for Uploader + */ + + /** + * @property {Selector} [disableGlobalDnd=false] 鏄惁绂佹帀鏁翠釜椤甸潰鐨勬嫋鎷藉姛鑳斤紝濡傛灉涓嶇鐢紝鍥剧墖鎷栬繘鏉ョ殑鏃跺欎細榛樿琚祻瑙堝櫒鎵撳紑銆 + * @namespace options + * @for Uploader + */ + + /** + * @event dndAccept + * @param {DataTransferItemList} items DataTransferItem + * @description 闃绘姝や簨浠跺彲浠ユ嫆缁濇煇浜涚被鍨嬬殑鏂囦欢鎷栧叆杩涙潵銆傜洰鍓嶅彧鏈 chrome 鎻愪緵杩欐牱鐨 API锛屼笖鍙兘閫氳繃 mime-type 楠岃瘉銆 + * @for Uploader + */ + return Uploader.register({ + name: 'dnd', + + init: function( opts ) { + + if ( !opts.dnd || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + disableGlobalDnd: opts.disableGlobalDnd, + container: opts.dnd, + accept: opts.accept + }), + dnd; + + this.dnd = dnd = new Dnd( options ); + + dnd.once( 'ready', deferred.resolve ); + dnd.on( 'drop', function( files ) { + me.request( 'add-file', [ files ]); + }); + + // 妫娴嬫枃浠舵槸鍚﹀叏閮ㄥ厑璁告坊鍔犮 + dnd.on( 'accept', function( items ) { + return me.owner.trigger( 'dndAccept', items ); + }); + + dnd.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.dnd && this.dnd.destroy(); + } + }); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepaste',[ + 'base', + 'mediator', + 'runtime/client' + ], function( Base, Mediator, RuntimeClent ) { + + var $ = Base.$; + + function FilePaste( opts ) { + opts = this.options = $.extend({}, opts ); + opts.container = $( opts.container || document.body ); + RuntimeClent.call( this, 'FilePaste' ); + } + + Base.inherits( RuntimeClent, { + constructor: FilePaste, + + init: function() { + var me = this; + + me.connectRuntime( me.options, function() { + me.exec('init'); + me.trigger('ready'); + }); + } + }); + + Mediator.installTo( FilePaste.prototype ); + + return FilePaste; + }); + /** + * @fileOverview 缁勪欢鍩虹被銆 + */ + define('widgets/filepaste',[ + 'base', + 'uploader', + 'lib/filepaste', + 'widgets/widget' + ], function( Base, Uploader, FilePaste ) { + var $ = Base.$; + + /** + * @property {Selector} [paste=undefined] 鎸囧畾鐩戝惉paste浜嬩欢鐨勫鍣紝濡傛灉涓嶆寚瀹氾紝涓嶅惎鐢ㄦ鍔熻兘銆傛鍔熻兘涓洪氳繃绮樿创鏉ユ坊鍔犳埅灞忕殑鍥剧墖銆傚缓璁缃负`document.body`. + * @namespace options + * @for Uploader + */ + return Uploader.register({ + name: 'paste', + + init: function( opts ) { + + if ( !opts.paste || + this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + var me = this, + deferred = Base.Deferred(), + options = $.extend({}, { + container: opts.paste, + accept: opts.accept + }), + paste; + + this.paste = paste = new FilePaste( options ); + + paste.once( 'ready', deferred.resolve ); + paste.on( 'paste', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + paste.init(); + + return deferred.promise(); + }, + + destroy: function() { + this.paste && this.paste.destroy(); + } + }); + }); + /** + * @fileOverview Blob + */ + define('lib/blob',[ + 'base', + 'runtime/client' + ], function( Base, RuntimeClient ) { + + function Blob( ruid, source ) { + var me = this; + + me.source = source; + me.ruid = ruid; + this.size = source.size || 0; + + // 濡傛灉娌℃湁鎸囧畾 mimetype, 浣嗘槸鐭ラ亾鏂囦欢鍚庣紑銆 + if ( !source.type && this.ext && + ~'jpg,jpeg,png,gif,bmp'.indexOf( this.ext ) ) { + this.type = 'image/' + (this.ext === 'jpg' ? 'jpeg' : this.ext); + } else { + this.type = source.type || 'application/octet-stream'; + } + + RuntimeClient.call( me, 'Blob' ); + this.uid = source.uid || this.uid; + + if ( ruid ) { + me.connectRuntime( ruid ); + } + } + + Base.inherits( RuntimeClient, { + constructor: Blob, + + slice: function( start, end ) { + return this.exec( 'slice', start, end ); + }, + + getSource: function() { + return this.source; + } + }); + + return Blob; + }); + /** + * 涓轰簡缁熶竴鍖朏lash鐨凢ile鍜孒TML5鐨凢ile鑰屽瓨鍦ㄣ + * 浠ヨ嚦浜庤璋冪敤Flash閲岄潰鐨凢ile锛屼篃鍙互鍍忚皟鐢℉TML5鐗堟湰鐨凢ile涓涓嬨 + * @fileOverview File + */ + define('lib/file',[ + 'base', + 'lib/blob' + ], function( Base, Blob ) { + + var uid = 1, + rExt = /\.([^.]+)$/; + + function File( ruid, file ) { + var ext; + + this.name = file.name || ('untitled' + uid++); + ext = rExt.exec( file.name ) ? RegExp.$1.toLowerCase() : ''; + + // todo 鏀寔鍏朵粬绫诲瀷鏂囦欢鐨勮浆鎹€ + // 濡傛灉鏈 mimetype, 浣嗘槸鏂囦欢鍚嶉噷闈㈡病鏈夋壘鍑哄悗缂瑙勫緥 + if ( !ext && file.type ) { + ext = /\/(jpg|jpeg|png|gif|bmp)$/i.exec( file.type ) ? + RegExp.$1.toLowerCase() : ''; + this.name += '.' + ext; + } + + this.ext = ext; + this.lastModifiedDate = file.lastModifiedDate || + (new Date()).toLocaleString(); + + Blob.apply( this, arguments ); + } + + return Base.inherits( Blob, File ); + }); + + /** + * @fileOverview 閿欒淇℃伅 + */ + define('lib/filepicker',[ + 'base', + 'runtime/client', + 'lib/file' + ], function( Base, RuntimeClent, File ) { + + var $ = Base.$; + + function FilePicker( opts ) { + opts = this.options = $.extend({}, FilePicker.options, opts ); + + opts.container = $( opts.id ); + + if ( !opts.container.length ) { + throw new Error('鎸夐挳鎸囧畾閿欒'); + } + + opts.innerHTML = opts.innerHTML || opts.label || + opts.container.html() || ''; + + opts.button = $( opts.button || document.createElement('div') ); + opts.button.html( opts.innerHTML ); + opts.container.html( opts.button ); + + RuntimeClent.call( this, 'FilePicker', true ); + } + + FilePicker.options = { + button: null, + container: null, + label: null, + innerHTML: null, + multiple: true, + accept: null, + name: 'file' + }; + + Base.inherits( RuntimeClent, { + constructor: FilePicker, + + init: function() { + var me = this, + opts = me.options, + button = opts.button; + + button.addClass('webuploader-pick'); + + me.on( 'all', function( type ) { + var files; + + switch ( type ) { + case 'mouseenter': + button.addClass('webuploader-pick-hover'); + break; + + case 'mouseleave': + button.removeClass('webuploader-pick-hover'); + break; + + case 'change': + files = me.exec('getFiles'); + me.trigger( 'select', $.map( files, function( file ) { + file = new File( me.getRuid(), file ); + + // 璁板綍鏉ユ簮銆 + file._refer = opts.container; + return file; + }), opts.container ); + break; + } + }); + + me.connectRuntime( opts, function() { + me.refresh(); + me.exec( 'init', opts ); + me.trigger('ready'); + }); + + this._resizeHandler = Base.bindFn( this.refresh, this ); + $( window ).on( 'resize', this._resizeHandler ); + }, + + refresh: function() { + var shimContainer = this.getRuntime().getContainer(), + button = this.options.button, + width = button.outerWidth ? + button.outerWidth() : button.width(), + + height = button.outerHeight ? + button.outerHeight() : button.height(), + + pos = button.offset(); + + width && height && shimContainer.css({ + bottom: 'auto', + right: 'auto', + width: width + 'px', + height: height + 'px' + }).offset( pos ); + }, + + enable: function() { + var btn = this.options.button; + + btn.removeClass('webuploader-pick-disable'); + this.refresh(); + }, + + disable: function() { + var btn = this.options.button; + + this.getRuntime().getContainer().css({ + top: '-99999px' + }); + + btn.addClass('webuploader-pick-disable'); + }, + + destroy: function() { + var btn = this.options.button; + $( window ).off( 'resize', this._resizeHandler ); + btn.removeClass('webuploader-pick-disable webuploader-pick-hover ' + + 'webuploader-pick'); + } + }); + + return FilePicker; + }); + + /** + * @fileOverview 鏂囦欢閫夋嫨鐩稿叧 + */ + define('widgets/filepicker',[ + 'base', + 'uploader', + 'lib/filepicker', + 'widgets/widget' + ], function( Base, Uploader, FilePicker ) { + var $ = Base.$; + + $.extend( Uploader.options, { + + /** + * @property {Selector | Object} [pick=undefined] + * @namespace options + * @for Uploader + * @description 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * + * * `id` {Seletor} 鎸囧畾閫夋嫨鏂囦欢鐨勬寜閽鍣紝涓嶆寚瀹氬垯涓嶅垱寤烘寜閽 + * * `label` {String} 璇烽噰鐢 `innerHTML` 浠f浛 + * * `innerHTML` {String} 鎸囧畾鎸夐挳鏂囧瓧銆備笉鎸囧畾鏃朵紭鍏堜粠鎸囧畾鐨勫鍣ㄤ腑鐪嬫槸鍚﹁嚜甯︽枃瀛椼 + * * `multiple` {Boolean} 鏄惁寮璧峰悓鏃堕夋嫨澶氫釜鏂囦欢鑳藉姏銆 + */ + pick: null, + + /** + * @property {Arroy} [accept=null] + * @namespace options + * @for Uploader + * @description 鎸囧畾鎺ュ彈鍝簺绫诲瀷鐨勬枃浠躲 鐢变簬鐩墠杩樻湁ext杞琺imeType琛紝鎵浠ヨ繖閲岄渶瑕佸垎寮鎸囧畾銆 + * + * * `title` {String} 鏂囧瓧鎻忚堪 + * * `extensions` {String} 鍏佽鐨勬枃浠跺悗缂锛屼笉甯︾偣锛屽涓敤閫楀彿鍒嗗壊銆 + * * `mimeTypes` {String} 澶氫釜鐢ㄩ楀彿鍒嗗壊銆 + * + * 濡傦細 + * + * ``` + * { + * title: 'Images', + * extensions: 'gif,jpg,jpeg,bmp,png', + * mimeTypes: 'image/*' + * } + * ``` + */ + accept: null/*{ + title: 'Images', + extensions: 'gif,jpg,jpeg,bmp,png', + mimeTypes: 'image/*' + }*/ + }); + + return Uploader.register({ + name: 'picker', + + init: function( opts ) { + this.pickers = []; + return opts.pick && this.addBtn( opts.pick ); + }, + + refresh: function() { + $.each( this.pickers, function() { + this.refresh(); + }); + }, + + /** + * @method addButton + * @for Uploader + * @grammar addButton( pick ) => Promise + * @description + * 娣诲姞鏂囦欢閫夋嫨鎸夐挳锛屽鏋滀竴涓寜閽笉澶燂紝闇瑕佽皟鐢ㄦ鏂规硶鏉ユ坊鍔犮傚弬鏁拌窡[options.pick](#WebUploader:Uploader:options)涓鑷淬 + * @example + * uploader.addButton({ + * id: '#btnContainer', + * innerHTML: '閫夋嫨鏂囦欢' + * }); + */ + addBtn: function( pick ) { + var me = this, + opts = me.options, + accept = opts.accept, + promises = []; + + if ( !pick ) { + return; + } + + $.isPlainObject( pick ) || (pick = { + id: pick + }); + + $( pick.id ).each(function() { + var options, picker, deferred; + + deferred = Base.Deferred(); + + options = $.extend({}, pick, { + accept: $.isPlainObject( accept ) ? [ accept ] : accept, + swf: opts.swf, + runtimeOrder: opts.runtimeOrder, + id: this + }); + + picker = new FilePicker( options ); + + picker.once( 'ready', deferred.resolve ); + picker.on( 'select', function( files ) { + me.owner.request( 'add-file', [ files ]); + }); + picker.init(); + + me.pickers.push( picker ); + + promises.push( deferred.promise() ); + }); + + return Base.when.apply( Base, promises ); + }, + + disable: function() { + $.each( this.pickers, function() { + this.disable(); + }); + }, + + enable: function() { + $.each( this.pickers, function() { + this.enable(); + }); + }, + + destroy: function() { + $.each( this.pickers, function() { + this.destroy(); + }); + this.pickers = null; + } + }); + }); + /** + * @fileOverview 鏂囦欢灞炴у皝瑁 + */ + define('file',[ + 'base', + 'mediator' + ], function( Base, Mediator ) { + + var $ = Base.$, + idPrefix = 'WU_FILE_', + idSuffix = 0, + rExt = /\.([^.]+)$/, + statusMap = {}; + + function gid() { + return idPrefix + idSuffix++; + } + + /** + * 鏂囦欢绫 + * @class File + * @constructor 鏋勯犲嚱鏁 + * @grammar new File( source ) => File + * @param {Lib.File} source [lib.File](#Lib.File)瀹炰緥, 姝ource瀵硅薄鏄甫鏈塕untime淇℃伅鐨勩 + */ + function WUFile( source ) { + + /** + * 鏂囦欢鍚嶏紝鍖呮嫭鎵╁睍鍚嶏紙鍚庣紑锛 + * @property name + * @type {string} + */ + this.name = source.name || 'Untitled'; + + /** + * 鏂囦欢浣撶Н锛堝瓧鑺傦級 + * @property size + * @type {uint} + * @default 0 + */ + this.size = source.size || 0; + + /** + * 鏂囦欢MIMETYPE绫诲瀷锛屼笌鏂囦欢绫诲瀷鐨勫搴斿叧绯昏鍙傝僛http://t.cn/z8ZnFny](http://t.cn/z8ZnFny) + * @property type + * @type {string} + * @default 'application/octet-stream' + */ + this.type = source.type || 'application/octet-stream'; + + /** + * 鏂囦欢鏈鍚庝慨鏀规棩鏈 + * @property lastModifiedDate + * @type {int} + * @default 褰撳墠鏃堕棿鎴 + */ + this.lastModifiedDate = source.lastModifiedDate || (new Date() * 1); + + /** + * 鏂囦欢ID锛屾瘡涓璞″叿鏈夊敮涓ID锛屼笌鏂囦欢鍚嶆棤鍏 + * @property id + * @type {string} + */ + this.id = gid(); + + /** + * 鏂囦欢鎵╁睍鍚嶏紝閫氳繃鏂囦欢鍚嶈幏鍙栵紝渚嬪test.png鐨勬墿灞曞悕涓簆ng + * @property ext + * @type {string} + */ + this.ext = rExt.exec( this.name ) ? RegExp.$1 : ''; + + + /** + * 鐘舵佹枃瀛楄鏄庛傚湪涓嶅悓鐨剆tatus璇涓嬫湁涓嶅悓鐨勭敤閫斻 + * @property statusText + * @type {string} + */ + this.statusText = ''; + + // 瀛樺偍鏂囦欢鐘舵侊紝闃叉閫氳繃灞炴х洿鎺ヤ慨鏀 + statusMap[ this.id ] = WUFile.Status.INITED; + + this.source = source; + this.loaded = 0; + + this.on( 'error', function( msg ) { + this.setStatus( WUFile.Status.ERROR, msg ); + }); + } + + $.extend( WUFile.prototype, { + + /** + * 璁剧疆鐘舵侊紝鐘舵佸彉鍖栨椂浼氳Е鍙慲change`浜嬩欢銆 + * @method setStatus + * @grammar setStatus( status[, statusText] ); + * @param {File.Status|String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @param {String} [statusText=''] 鐘舵佽鏄庯紝甯稿湪error鏃朵娇鐢紝鐢╤ttp, abort,server绛夋潵鏍囪鏄敱浜庝粈涔堝師鍥犲鑷存枃浠堕敊璇 + */ + setStatus: function( status, text ) { + + var prevStatus = statusMap[ this.id ]; + + typeof text !== 'undefined' && (this.statusText = text); + + if ( status !== prevStatus ) { + statusMap[ this.id ] = status; + /** + * 鏂囦欢鐘舵佸彉鍖 + * @event statuschange + */ + this.trigger( 'statuschange', status, prevStatus ); + } + + }, + + /** + * 鑾峰彇鏂囦欢鐘舵 + * @return {File.Status} + * @example + 鏂囦欢鐘舵佸叿浣撳寘鎷互涓嬪嚑绉嶇被鍨嬶細 + { + // 鍒濆鍖 + INITED: 0, + // 宸插叆闃熷垪 + QUEUED: 1, + // 姝e湪涓婁紶 + PROGRESS: 2, + // 涓婁紶鍑洪敊 + ERROR: 3, + // 涓婁紶鎴愬姛 + COMPLETE: 4, + // 涓婁紶鍙栨秷 + CANCELLED: 5 + } + */ + getStatus: function() { + return statusMap[ this.id ]; + }, + + /** + * 鑾峰彇鏂囦欢鍘熷淇℃伅銆 + * @return {*} + */ + getSource: function() { + return this.source; + }, + + destroy: function() { + this.off(); + delete statusMap[ this.id ]; + } + }); + + Mediator.installTo( WUFile.prototype ); + + /** + * 鏂囦欢鐘舵佸硷紝鍏蜂綋鍖呮嫭浠ヤ笅鍑犵绫诲瀷锛 + * * `inited` 鍒濆鐘舵 + * * `queued` 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + * * `progress` 涓婁紶涓 + * * `complete` 涓婁紶瀹屾垚銆 + * * `error` 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + * * `interrupt` 涓婁紶涓柇锛屽彲缁紶銆 + * * `invalid` 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆備細鑷姩浠庨槦鍒椾腑绉婚櫎銆 + * * `cancelled` 鏂囦欢琚Щ闄ゃ + * @property {Object} Status + * @namespace File + * @class File + * @static + */ + WUFile.Status = { + INITED: 'inited', // 鍒濆鐘舵 + QUEUED: 'queued', // 宸茬粡杩涘叆闃熷垪, 绛夊緟涓婁紶 + PROGRESS: 'progress', // 涓婁紶涓 + ERROR: 'error', // 涓婁紶鍑洪敊锛屽彲閲嶈瘯 + COMPLETE: 'complete', // 涓婁紶瀹屾垚銆 + CANCELLED: 'cancelled', // 涓婁紶鍙栨秷銆 + INTERRUPT: 'interrupt', // 涓婁紶涓柇锛屽彲缁紶銆 + INVALID: 'invalid' // 鏂囦欢涓嶅悎鏍硷紝涓嶈兘閲嶈瘯涓婁紶銆 + }; + + return WUFile; + }); + + /** + * @fileOverview 鏂囦欢闃熷垪 + */ + define('queue',[ + 'base', + 'mediator', + 'file' + ], function( Base, Mediator, WUFile ) { + + var $ = Base.$, + STATUS = WUFile.Status; + + /** + * 鏂囦欢闃熷垪, 鐢ㄦ潵瀛樺偍鍚勪釜鐘舵佷腑鐨勬枃浠躲 + * @class Queue + * @extends Mediator + */ + function Queue() { + + /** + * 缁熻鏂囦欢鏁般 + * * `numOfQueue` 闃熷垪涓殑鏂囦欢鏁般 + * * `numOfSuccess` 涓婁紶鎴愬姛鐨勬枃浠舵暟 + * * `numOfCancel` 琚彇娑堢殑鏂囦欢鏁 + * * `numOfProgress` 姝e湪涓婁紶涓殑鏂囦欢鏁 + * * `numOfUploadFailed` 涓婁紶閿欒鐨勬枃浠舵暟銆 + * * `numOfInvalid` 鏃犳晥鐨勬枃浠舵暟銆 + * * `numofDeleted` 琚Щ闄ょ殑鏂囦欢鏁般 + * @property {Object} stats + */ + this.stats = { + numOfQueue: 0, + numOfSuccess: 0, + numOfCancel: 0, + numOfProgress: 0, + numOfUploadFailed: 0, + numOfInvalid: 0, + numofDeleted: 0, + numofInterrupt: 0, + }; + + // 涓婁紶闃熷垪锛屼粎鍖呮嫭绛夊緟涓婁紶鐨勬枃浠 + this._queue = []; + + // 瀛樺偍鎵鏈夋枃浠 + this._map = {}; + } + + $.extend( Queue.prototype, { + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀熬閮 + * + * @method append + * @param {File} file 鏂囦欢瀵硅薄 + */ + append: function( file ) { + this._queue.push( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 灏嗘柊鏂囦欢鍔犲叆瀵归槦鍒楀ご閮 + * + * @method prepend + * @param {File} file 鏂囦欢瀵硅薄 + */ + prepend: function( file ) { + this._queue.unshift( file ); + this._fileAdded( file ); + return this; + }, + + /** + * 鑾峰彇鏂囦欢瀵硅薄 + * + * @method getFile + * @param {String} fileId 鏂囦欢ID + * @return {File} + */ + getFile: function( fileId ) { + if ( typeof fileId !== 'string' ) { + return fileId; + } + return this._map[ fileId ]; + }, + + /** + * 浠庨槦鍒椾腑鍙栧嚭涓涓寚瀹氱姸鎬佺殑鏂囦欢銆 + * @grammar fetch( status ) => File + * @method fetch + * @param {String} status [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + * @return {File} [File](#WebUploader:File) + */ + fetch: function( status ) { + var len = this._queue.length, + i, file; + + status = status || STATUS.QUEUED; + + for ( i = 0; i < len; i++ ) { + file = this._queue[ i ]; + + if ( status === file.getStatus() ) { + return file; + } + } + + return null; + }, + + /** + * 瀵归槦鍒楄繘琛屾帓搴忥紝鑳藉鎺у埗鏂囦欢涓婁紶椤哄簭銆 + * @grammar sort( fn ) => undefined + * @method sort + * @param {Function} fn 鎺掑簭鏂规硶 + */ + sort: function( fn ) { + if ( typeof fn === 'function' ) { + this._queue.sort( fn ); + } + }, + + /** + * 鑾峰彇鎸囧畾绫诲瀷鐨勬枃浠跺垪琛, 鍒楄〃涓瘡涓涓垚鍛樹负[File](#WebUploader:File)瀵硅薄銆 + * @grammar getFiles( [status1[, status2 ...]] ) => Array + * @method getFiles + * @param {String} [status] [鏂囦欢鐘舵佸糫(#WebUploader:File:File.Status) + */ + getFiles: function() { + var sts = [].slice.call( arguments, 0 ), + ret = [], + i = 0, + len = this._queue.length, + file; + + for ( ; i < len; i++ ) { + file = this._queue[ i ]; + + if ( sts.length && !~$.inArray( file.getStatus(), sts ) ) { + continue; + } + + ret.push( file ); + } + + return ret; + }, + + /** + * 鍦ㄩ槦鍒椾腑鍒犻櫎鏂囦欢銆 + * @grammar removeFile( file ) => Array + * @method removeFile + * @param {File} 鏂囦欢瀵硅薄銆 + */ + removeFile: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( existing ) { + delete this._map[ file.id ]; + file.destroy(); + this.stats.numofDeleted++; + } + }, + + _fileAdded: function( file ) { + var me = this, + existing = this._map[ file.id ]; + + if ( !existing ) { + this._map[ file.id ] = file; + + file.on( 'statuschange', function( cur, pre ) { + me._onFileStatusChange( cur, pre ); + }); + } + }, + + _onFileStatusChange: function( curStatus, preStatus ) { + var stats = this.stats; + + switch ( preStatus ) { + case STATUS.PROGRESS: + stats.numOfProgress--; + break; + + case STATUS.QUEUED: + stats.numOfQueue --; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed--; + break; + + case STATUS.INVALID: + stats.numOfInvalid--; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt--; + break; + } + + switch ( curStatus ) { + case STATUS.QUEUED: + stats.numOfQueue++; + break; + + case STATUS.PROGRESS: + stats.numOfProgress++; + break; + + case STATUS.ERROR: + stats.numOfUploadFailed++; + break; + + case STATUS.COMPLETE: + stats.numOfSuccess++; + break; + + case STATUS.CANCELLED: + stats.numOfCancel++; + break; + + + case STATUS.INVALID: + stats.numOfInvalid++; + break; + + case STATUS.INTERRUPT: + stats.numofInterrupt++; + break; + } + } + + }); + + Mediator.installTo( Queue.prototype ); + + return Queue; + }); + /** + * @fileOverview 闃熷垪 + */ + define('widgets/queue',[ + 'base', + 'uploader', + 'queue', + 'file', + 'lib/file', + 'runtime/client', + 'widgets/widget' + ], function( Base, Uploader, Queue, WUFile, File, RuntimeClient ) { + + var $ = Base.$, + rExt = /\.\w+$/, + Status = WUFile.Status; + + return Uploader.register({ + name: 'queue', + + init: function( opts ) { + var me = this, + deferred, len, i, item, arr, accept, runtime; + + if ( $.isPlainObject( opts.accept ) ) { + opts.accept = [ opts.accept ]; + } + + // accept涓殑涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].extensions; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = '\\.' + arr.join(',') + .replace( /,/g, '$|\\.' ) + .replace( /\*/g, '.*' ) + '$'; + } + + me.accept = new RegExp( accept, 'i' ); + } + + me.queue = new Queue(); + me.stats = me.queue.stats; + + // 濡傛灉褰撳墠涓嶆槸html5杩愯鏃讹紝閭e氨绠椾簡銆 + // 涓嶆墽琛屽悗缁搷浣 + if ( this.request('predict-runtime-type') !== 'html5' ) { + return; + } + + // 鍒涘缓涓涓 html5 杩愯鏃剁殑 placeholder + // 浠ヨ嚦浜庡閮ㄦ坊鍔犲師鐢 File 瀵硅薄鐨勬椂鍊欒兘姝g‘鍖呰9涓涓嬩緵 webuploader 浣跨敤銆 + deferred = Base.Deferred(); + this.placeholder = runtime = new RuntimeClient('Placeholder'); + runtime.connectRuntime({ + runtimeOrder: 'html5' + }, function() { + me._ruid = runtime.getRuid(); + deferred.resolve(); + }); + return deferred.promise(); + }, + + + // 涓轰簡鏀寔澶栭儴鐩存帴娣诲姞涓涓師鐢烣ile瀵硅薄銆 + _wrapFile: function( file ) { + if ( !(file instanceof WUFile) ) { + + if ( !(file instanceof File) ) { + if ( !this._ruid ) { + throw new Error('Can\'t add external files.'); + } + file = new File( this._ruid, file ); + } + + file = new WUFile( file ); + } + + return file; + }, + + // 鍒ゆ柇鏂囦欢鏄惁鍙互琚姞鍏ラ槦鍒 + acceptFile: function( file ) { + var invalid = !file || !file.size || this.accept && + + // 濡傛灉鍚嶅瓧涓湁鍚庣紑锛屾墠鍋氬悗缂鐧藉悕鍗曞鐞嗐 + rExt.exec( file.name ) && !this.accept.test( file.name ); + + return !invalid; + }, + + + /** + * @event beforeFileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪涔嬪墠瑙﹀彂锛屾浜嬩欢鐨刪andler杩斿洖鍊间负`false`锛屽垯姝ゆ枃浠朵笉浼氳娣诲姞杩涘叆闃熷垪銆 + * @for Uploader + */ + + /** + * @event fileQueued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰鍔犲叆闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + _addFile: function( file ) { + var me = this; + + file = me._wrapFile( file ); + + // 涓嶈繃绫诲瀷鍒ゆ柇鍏佽涓嶅厑璁革紝鍏堟淳閫 `beforeFileQueued` + if ( !me.owner.trigger( 'beforeFileQueued', file ) ) { + return; + } + + // 绫诲瀷涓嶅尮閰嶏紝鍒欐淳閫侀敊璇簨浠讹紝骞惰繑鍥炪 + if ( !me.acceptFile( file ) ) { + me.owner.trigger( 'error', 'Q_TYPE_DENIED', file ); + return; + } + + me.queue.append( file ); + me.owner.trigger( 'fileQueued', file ); + return file; + }, + + getFile: function( fileId ) { + return this.queue.getFile( fileId ); + }, + + /** + * @event filesQueued + * @param {File} files 鏁扮粍锛屽唴瀹逛负鍘熷File(lib/File锛夊璞° + * @description 褰撲竴鎵规枃浠舵坊鍔犺繘闃熷垪浠ュ悗瑙﹀彂銆 + * @for Uploader + */ + + /** + * @property {Boolean} [auto=false] + * @namespace options + * @for Uploader + * @description 璁剧疆涓 true 鍚庯紝涓嶉渶瑕佹墜鍔ㄨ皟鐢ㄤ笂浼狅紝鏈夋枃浠堕夋嫨鍗冲紑濮嬩笂浼犮 + * + */ + + /** + * @method addFiles + * @grammar addFiles( file ) => undefined + * @grammar addFiles( [file1, file2 ...] ) => undefined + * @param {Array of File or File} [files] Files 瀵硅薄 鏁扮粍 + * @description 娣诲姞鏂囦欢鍒伴槦鍒 + * @for Uploader + */ + addFile: function( files ) { + var me = this; + + if ( !files.length ) { + files = [ files ]; + } + + files = $.map( files, function( file ) { + return me._addFile( file ); + }); + + me.owner.trigger( 'filesQueued', files ); + + if ( me.options.auto ) { + setTimeout(function() { + me.request('start-upload'); + }, 20 ); + } + }, + + getStats: function() { + return this.stats; + }, + + /** + * @event fileDequeued + * @param {File} file File瀵硅薄 + * @description 褰撴枃浠惰绉婚櫎闃熷垪鍚庤Е鍙戙 + * @for Uploader + */ + + /** + * @method removeFile + * @grammar removeFile( file ) => undefined + * @grammar removeFile( id ) => undefined + * @grammar removeFile( file, true ) => undefined + * @grammar removeFile( id, true ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 绉婚櫎鏌愪竴鏂囦欢, 榛樿鍙細鏍囪鏂囦欢鐘舵佷负宸插彇娑堬紝濡傛灉绗簩涓弬鏁颁负 `true` 鍒欎細浠 queue 涓Щ闄ゃ + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.removeFile( file ); + * }) + */ + removeFile: function( file, remove ) { + var me = this; + + file = file.id ? file : me.queue.getFile( file ); + + this.request( 'cancel-file', file ); + + if ( remove ) { + this.queue.removeFile( file ); + } + }, + + /** + * @method getFiles + * @grammar getFiles() => Array + * @grammar getFiles( status1, status2, status... ) => Array + * @description 杩斿洖鎸囧畾鐘舵佺殑鏂囦欢闆嗗悎锛屼笉浼犲弬鏁板皢杩斿洖鎵鏈夌姸鎬佺殑鏂囦欢銆 + * @for Uploader + * @example + * console.log( uploader.getFiles() ); // => all files + * console.log( uploader.getFiles('error') ) // => all error files. + */ + getFiles: function() { + return this.queue.getFiles.apply( this.queue, arguments ); + }, + + fetchFile: function() { + return this.queue.fetch.apply( this.queue, arguments ); + }, + + /** + * @method retry + * @grammar retry() => undefined + * @grammar retry( file ) => undefined + * @description 閲嶈瘯涓婁紶锛岄噸璇曟寚瀹氭枃浠讹紝鎴栬呬粠鍑洪敊鐨勬枃浠跺紑濮嬮噸鏂颁笂浼犮 + * @for Uploader + * @example + * function retry() { + * uploader.retry(); + * } + */ + retry: function( file, noForceStart ) { + var me = this, + files, i, len; + + if ( file ) { + file = file.id ? file : me.queue.getFile( file ); + file.setStatus( Status.QUEUED ); + noForceStart || me.request('start-upload'); + return; + } + + files = me.queue.getFiles( Status.ERROR ); + i = 0; + len = files.length; + + for ( ; i < len; i++ ) { + file = files[ i ]; + file.setStatus( Status.QUEUED ); + } + + me.request('start-upload'); + }, + + /** + * @method sort + * @grammar sort( fn ) => undefined + * @description 鎺掑簭闃熷垪涓殑鏂囦欢锛屽湪涓婁紶涔嬪墠璋冩暣鍙互鎺у埗涓婁紶椤哄簭銆 + * @for Uploader + */ + sortFiles: function() { + return this.queue.sort.apply( this.queue, arguments ); + }, + + /** + * @event reset + * @description 褰 uploader 琚噸缃殑鏃跺欒Е鍙戙 + * @for Uploader + */ + + /** + * @method reset + * @grammar reset() => undefined + * @description 閲嶇疆uploader銆傜洰鍓嶅彧閲嶇疆浜嗛槦鍒椼 + * @for Uploader + * @example + * uploader.reset(); + */ + reset: function() { + this.owner.trigger('reset'); + this.queue = new Queue(); + this.stats = this.queue.stats; + }, + + destroy: function() { + this.reset(); + this.placeholder && this.placeholder.destroy(); + } + }); + + }); + /** + * @fileOverview 娣诲姞鑾峰彇Runtime鐩稿叧淇℃伅鐨勬柟娉曘 + */ + define('widgets/runtime',[ + 'uploader', + 'runtime/runtime', + 'widgets/widget' + ], function( Uploader, Runtime ) { + + Uploader.support = function() { + return Runtime.hasRuntime.apply( Runtime, arguments ); + }; + + return Uploader.register({ + name: 'runtime', + + init: function() { + if ( !this.predictRuntimeType() ) { + throw Error('Runtime Error'); + } + }, + + /** + * 棰勬祴Uploader灏嗛噰鐢ㄥ摢涓猔Runtime` + * @grammar predictRuntimeType() => String + * @method predictRuntimeType + * @for Uploader + */ + predictRuntimeType: function() { + var orders = this.options.runtimeOrder || Runtime.orders, + type = this.type, + i, len; + + if ( !type ) { + orders = orders.split( /\s*,\s*/g ); + + for ( i = 0, len = orders.length; i < len; i++ ) { + if ( Runtime.hasRuntime( orders[ i ] ) ) { + this.type = type = orders[ i ]; + break; + } + } + } + + return type; + } + }); + }); + /** + * @fileOverview Transport + */ + define('lib/transport',[ + 'base', + 'runtime/client', + 'mediator' + ], function( Base, RuntimeClient, Mediator ) { + + var $ = Base.$; + + function Transport( opts ) { + var me = this; + + opts = me.options = $.extend( true, {}, Transport.options, opts || {} ); + RuntimeClient.call( this, 'Transport' ); + + this._blob = null; + this._formData = opts.formData || {}; + this._headers = opts.headers || {}; + + this.on( 'progress', this._timeout ); + this.on( 'load error', function() { + me.trigger( 'progress', 1 ); + clearTimeout( me._timer ); + }); + } + + Transport.options = { + server: '', + method: 'POST', + + // 璺ㄥ煙鏃讹紝鏄惁鍏佽鎼哄甫cookie, 鍙湁html5 runtime鎵嶆湁鏁 + withCredentials: false, + fileVal: 'file', + timeout: 2 * 60 * 1000, // 2鍒嗛挓 + formData: {}, + headers: {}, + sendAsBinary: false + }; + + $.extend( Transport.prototype, { + + // 娣诲姞Blob, 鍙兘娣诲姞涓娆★紝鏈鍚庝竴娆℃湁鏁堛 + appendBlob: function( key, blob, filename ) { + var me = this, + opts = me.options; + + if ( me.getRuid() ) { + me.disconnectRuntime(); + } + + // 杩炴帴鍒癰lob褰掑睘鐨勫悓涓涓猺untime. + me.connectRuntime( blob.ruid, function() { + me.exec('init'); + }); + + me._blob = blob; + opts.fileVal = key || opts.fileVal; + opts.filename = filename || opts.filename; + }, + + // 娣诲姞鍏朵粬瀛楁 + append: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._formData, key ); + } else { + this._formData[ key ] = value; + } + }, + + setRequestHeader: function( key, value ) { + if ( typeof key === 'object' ) { + $.extend( this._headers, key ); + } else { + this._headers[ key ] = value; + } + }, + + send: function( method ) { + this.exec( 'send', method ); + this._timeout(); + }, + + abort: function() { + clearTimeout( this._timer ); + return this.exec('abort'); + }, + + destroy: function() { + this.trigger('destroy'); + this.off(); + this.exec('destroy'); + this.disconnectRuntime(); + }, + + getResponse: function() { + return this.exec('getResponse'); + }, + + getResponseAsJson: function() { + return this.exec('getResponseAsJson'); + }, + + getStatus: function() { + return this.exec('getStatus'); + }, + + _timeout: function() { + var me = this, + duration = me.options.timeout; + + if ( !duration ) { + return; + } + + clearTimeout( me._timer ); + me._timer = setTimeout(function() { + me.abort(); + me.trigger( 'error', 'timeout' ); + }, duration ); + } + + }); + + // 璁㏕ransport鍏峰浜嬩欢鍔熻兘銆 + Mediator.installTo( Transport.prototype ); + + return Transport; + }); + /** + * @fileOverview 璐熻矗鏂囦欢涓婁紶鐩稿叧銆 + */ + define('widgets/upload',[ + 'base', + 'uploader', + 'file', + 'lib/transport', + 'widgets/widget' + ], function( Base, Uploader, WUFile, Transport ) { + + var $ = Base.$, + isPromise = Base.isPromise, + Status = WUFile.Status; + + // 娣诲姞榛樿閰嶇疆椤 + $.extend( Uploader.options, { + + + /** + * @property {Boolean} [prepareNextFile=false] + * @namespace options + * @for Uploader + * @description 鏄惁鍏佽鍦ㄦ枃浠朵紶杈撴椂鎻愬墠鎶婁笅涓涓枃浠跺噯澶囧ソ銆 + * 瀵逛簬涓涓枃浠剁殑鍑嗗宸ヤ綔姣旇緝鑰楁椂锛屾瘮濡傚浘鐗囧帇缂╋紝md5搴忓垪鍖栥 + * 濡傛灉鑳芥彁鍓嶅湪褰撳墠鏂囦欢浼犺緭鏈熷鐞嗭紝鍙互鑺傜渷鎬讳綋鑰楁椂銆 + */ + prepareNextFile: false, + + /** + * @property {Boolean} [chunked=false] + * @namespace options + * @for Uploader + * @description 鏄惁瑕佸垎鐗囧鐞嗗ぇ鏂囦欢涓婁紶銆 + */ + chunked: false, + + /** + * @property {Boolean} [chunkSize=5242880] + * @namespace options + * @for Uploader + * @description 濡傛灉瑕佸垎鐗囷紝鍒嗗澶т竴鐗囷紵 榛樿澶у皬涓5M. + */ + chunkSize: 5 * 1024 * 1024, + + /** + * @property {Boolean} [chunkRetry=2] + * @namespace options + * @for Uploader + * @description 濡傛灉鏌愪釜鍒嗙墖鐢变簬缃戠粶闂鍑洪敊锛屽厑璁歌嚜鍔ㄩ噸浼犲灏戞锛 + */ + chunkRetry: 2, + + /** + * @property {Boolean} [threads=3] + * @namespace options + * @for Uploader + * @description 涓婁紶骞跺彂鏁般傚厑璁稿悓鏃舵渶澶т笂浼犺繘绋嬫暟銆 + */ + threads: 3, + + + /** + * @property {Object} [formData={}] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶璇锋眰鐨勫弬鏁拌〃锛屾瘡娆″彂閫侀兘浼氬彂閫佹瀵硅薄涓殑鍙傛暟銆 + */ + formData: {} + + /** + * @property {Object} [fileVal='file'] + * @namespace options + * @for Uploader + * @description 璁剧疆鏂囦欢涓婁紶鍩熺殑name銆 + */ + + /** + * @property {Object} [method='POST'] + * @namespace options + * @for Uploader + * @description 鏂囦欢涓婁紶鏂瑰紡锛宍POST`鎴栬卄GET`銆 + */ + + /** + * @property {Object} [sendAsBinary=false] + * @namespace options + * @for Uploader + * @description 鏄惁宸蹭簩杩涘埗鐨勬祦鐨勬柟寮忓彂閫佹枃浠讹紝杩欐牱鏁翠釜涓婁紶鍐呭`php://input`閮戒负鏂囦欢鍐呭锛 + * 鍏朵粬鍙傛暟鍦$_GET鏁扮粍涓 + */ + }); + + // 璐熻矗灏嗘枃浠跺垏鐗囥 + function CuteFile( file, chunkSize ) { + var pending = [], + blob = file.source, + total = blob.size, + chunks = chunkSize ? Math.ceil( total / chunkSize ) : 1, + start = 0, + index = 0, + len, api; + + api = { + file: file, + + has: function() { + return !!pending.length; + }, + + shift: function() { + return pending.shift(); + }, + + unshift: function( block ) { + pending.unshift( block ); + } + }; + + while ( index < chunks ) { + len = Math.min( chunkSize, total - start ); + + pending.push({ + file: file, + start: start, + end: chunkSize ? (start + len) : total, + total: total, + chunks: chunks, + chunk: index++, + cuted: api + }); + start += len; + } + + file.blocks = pending.concat(); + file.remaning = pending.length; + + return api; + } + + Uploader.register({ + name: 'upload', + + init: function() { + var owner = this.owner, + me = this; + + this.runing = false; + this.progress = false; + + owner + .on( 'startUpload', function() { + me.progress = true; + }) + .on( 'uploadFinished', function() { + me.progress = false; + }); + + // 璁板綍褰撳墠姝e湪浼犵殑鏁版嵁锛岃窡threads鐩稿叧 + this.pool = []; + + // 缂撳瓨鍒嗗ソ鐗囩殑鏂囦欢銆 + this.stack = []; + + // 缂撳瓨鍗冲皢涓婁紶鐨勬枃浠躲 + this.pending = []; + + // 璺熻釜杩樻湁澶氬皯鍒嗙墖鍦ㄤ笂浼犱腑浣嗘槸娌℃湁瀹屾垚涓婁紶銆 + this.remaning = 0; + this.__tick = Base.bindFn( this._tick, this ); + + owner.on( 'uploadComplete', function( file ) { + + // 鎶婂叾浠栧潡鍙栨秷浜嗐 + file.blocks && $.each( file.blocks, function( _, v ) { + v.transport && (v.transport.abort(), v.transport.destroy()); + delete v.transport; + }); + + delete file.blocks; + delete file.remaning; + }); + }, + + reset: function() { + this.request( 'stop-upload', true ); + this.runing = false; + this.pool = []; + this.stack = []; + this.pending = []; + this.remaning = 0; + this._trigged = false; + this._promise = null; + }, + + /** + * @event startUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 寮濮嬩笂浼犮傛鏂规硶鍙互浠庡垵濮嬬姸鎬佽皟鐢ㄥ紑濮嬩笂浼犳祦绋嬶紝涔熷彲浠ヤ粠鏆傚仠鐘舵佽皟鐢紝缁х画涓婁紶娴佺▼銆 + * + * 鍙互鎸囧畾寮濮嬫煇涓涓枃浠躲 + * @grammar upload() => undefined + * @grammar upload( file | fileId) => undefined + * @method upload + * @for Uploader + */ + startUpload: function(file) { + var me = this; + + // 绉诲嚭invalid鐨勬枃浠 + $.each( me.request( 'get-files', Status.INVALID ), function() { + me.request( 'remove-file', this ); + }); + + // 濡傛灉鎸囧畾浜嗗紑濮嬫煇涓枃浠讹紝鍒欏彧寮濮嬫寚瀹氭枃浠躲 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if (file.getStatus() === Status.INTERRUPT) { + $.each( me.pool, function( _, v ) { + + // 涔嬪墠鏆傚仠杩囥 + if (v.file !== file) { + return; + } + + v.transport && v.transport.send(); + }); + + file.setStatus( Status.QUEUED ); + } else if (file.getStatus() === Status.PROGRESS) { + return; + } else { + file.setStatus( Status.QUEUED ); + } + } else { + $.each( me.request( 'get-files', [ Status.INITED ] ), function() { + this.setStatus( Status.QUEUED ); + }); + } + + if ( me.runing ) { + return; + } + + me.runing = true; + + // 濡傛灉鏈夋殏鍋滅殑锛屽垯缁紶 + $.each( me.pool, function( _, v ) { + var file = v.file; + + if ( file.getStatus() === Status.INTERRUPT ) { + file.setStatus( Status.PROGRESS ); + me._trigged = false; + v.transport && v.transport.send(); + } + }); + + file || $.each( me.request( 'get-files', + Status.INTERRUPT ), function() { + this.setStatus( Status.PROGRESS ); + }); + + me._trigged = false; + Base.nextTick( me.__tick ); + me.owner.trigger('startUpload'); + }, + + /** + * @event stopUpload + * @description 褰撳紑濮嬩笂浼犳祦绋嬫殏鍋滄椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * 鏆傚仠涓婁紶銆傜涓涓弬鏁颁负鏄惁涓柇涓婁紶褰撳墠姝e湪涓婁紶鐨勬枃浠躲 + * + * 濡傛灉绗竴涓弬鏁版槸鏂囦欢锛屽垯鍙殏鍋滄寚瀹氭枃浠躲 + * @grammar stop() => undefined + * @grammar stop( true ) => undefined + * @grammar stop( file ) => undefined + * @method stop + * @for Uploader + */ + stopUpload: function( file, interrupt ) { + var me = this; + + if (file === true) { + interrupt = file; + file = null; + } + + if ( me.runing === false ) { + return; + } + + // 濡傛灉鍙槸鏆傚仠鏌愪釜鏂囦欢銆 + if ( file ) { + file = file.id ? file : me.request( 'get-file', file ); + + if ( file.getStatus() !== Status.PROGRESS && + file.getStatus() !== Status.QUEUED ) { + return; + } + + file.setStatus( Status.INTERRUPT ); + $.each( me.pool, function( _, v ) { + + // 鍙 abort 鎸囧畾鐨勬枃浠躲 + if (v.file !== file) { + return; + } + + v.transport && v.transport.abort(); + me._putback(v); + me._popBlock(v); + }); + + return Base.nextTick( me.__tick ); + } + + me.runing = false; + + if (this._promise && this._promise.file) { + this._promise.file.setStatus( Status.INTERRUPT ); + } + + interrupt && $.each( me.pool, function( _, v ) { + v.transport && v.transport.abort(); + v.file.setStatus( Status.INTERRUPT ); + }); + + me.owner.trigger('stopUpload'); + }, + + /** + * @method cancelFile + * @grammar cancelFile( file ) => undefined + * @grammar cancelFile( id ) => undefined + * @param {File|id} file File瀵硅薄鎴栬繖File瀵硅薄鐨刬d + * @description 鏍囪鏂囦欢鐘舵佷负宸插彇娑, 鍚屾椂灏嗕腑鏂枃浠朵紶杈撱 + * @for Uploader + * @example + * + * $li.on('click', '.remove-this', function() { + * uploader.cancelFile( file ); + * }) + */ + cancelFile: function( file ) { + file = file.id ? file : this.request( 'get-file', file ); + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + file.setStatus( Status.CANCELLED ); + this.owner.trigger( 'fileDequeued', file ); + }, + + /** + * 鍒ゆ柇`Uplaode`r鏄惁姝e湪涓婁紶涓 + * @grammar isInProgress() => Boolean + * @method isInProgress + * @for Uploader + */ + isInProgress: function() { + return !!this.progress; + }, + + _getStats: function() { + return this.request('get-stats'); + }, + + /** + * 鎺夎繃涓涓枃浠朵笂浼狅紝鐩存帴鏍囪鎸囧畾鏂囦欢涓哄凡涓婁紶鐘舵併 + * @grammar skipFile( file ) => undefined + * @method skipFile + * @for Uploader + */ + skipFile: function( file, status ) { + file = file.id ? file : this.request( 'get-file', file ); + + file.setStatus( status || Status.COMPLETE ); + file.skipped = true; + + // 濡傛灉姝e湪涓婁紶銆 + file.blocks && $.each( file.blocks, function( _, v ) { + var _tr = v.transport; + + if ( _tr ) { + _tr.abort(); + _tr.destroy(); + delete v.transport; + } + }); + + this.owner.trigger( 'uploadSkip', file ); + }, + + /** + * @event uploadFinished + * @description 褰撴墍鏈夋枃浠朵笂浼犵粨鏉熸椂瑙﹀彂銆 + * @for Uploader + */ + _tick: function() { + var me = this, + opts = me.options, + fn, val; + + // 涓婁竴涓猵romise杩樻病鏈夌粨鏉燂紝鍒欑瓑寰呭畬鎴愬悗鍐嶆墽琛屻 + if ( me._promise ) { + return me._promise.always( me.__tick ); + } + + // 杩樻湁浣嶇疆锛屼笖杩樻湁鏂囦欢瑕佸鐞嗙殑璇濄 + if ( me.pool.length < opts.threads && (val = me._nextBlock()) ) { + me._trigged = false; + + fn = function( val ) { + me._promise = null; + + // 鏈夊彲鑳芥槸reject杩囨潵鐨勶紝鎵浠ヨ妫娴媣al鐨勭被鍨嬨 + val && val.file && me._startSend( val ); + Base.nextTick( me.__tick ); + }; + + me._promise = isPromise( val ) ? val.always( fn ) : fn( val ); + + // 娌℃湁瑕佷笂浼犵殑浜嗭紝涓旀病鏈夋鍦ㄤ紶杈撶殑浜嗐 + } else if ( !me.remaning && !me._getStats().numOfQueue && + !me._getStats().numofInterrupt ) { + me.runing = false; + + me._trigged || Base.nextTick(function() { + me.owner.trigger('uploadFinished'); + }); + me._trigged = true; + } + }, + + _putback: function(block) { + var idx; + + block.cuted.unshift(block); + idx = this.stack.indexOf(block.cuted); + + if (!~idx) { + this.stack.unshift(block.cuted); + } + }, + + _getStack: function() { + var i = 0, + act; + + while ( (act = this.stack[ i++ ]) ) { + if ( act.has() && act.file.getStatus() === Status.PROGRESS ) { + return act; + } else if (!act.has() || + act.file.getStatus() !== Status.PROGRESS && + act.file.getStatus() !== Status.INTERRUPT ) { + + // 鎶婂凡缁忓鐞嗗畬浜嗙殑锛屾垨鑰咃紝鐘舵佷负闈 progress锛堜笂浼犱腑锛夈 + // interupt锛堟殏鍋滀腑锛 鐨勭Щ闄ゃ + this.stack.splice( --i, 1 ); + } + } + + return null; + }, + + _nextBlock: function() { + var me = this, + opts = me.options, + act, next, done, preparing; + + // 濡傛灉褰撳墠鏂囦欢杩樻湁娌℃湁闇瑕佷紶杈撶殑锛屽垯鐩存帴杩斿洖鍓╀笅鐨勩 + if ( (act = this._getStack()) ) { + + // 鏄惁鎻愬墠鍑嗗涓嬩竴涓枃浠 + if ( opts.prepareNextFile && !me.pending.length ) { + me._prepareNextFile(); + } + + return act.shift(); + + // 鍚﹀垯锛屽鏋滄鍦ㄨ繍琛岋紝鍒欏噯澶囦笅涓涓枃浠讹紝骞剁瓑寰呭畬鎴愬悗杩斿洖涓嬩釜鍒嗙墖銆 + } else if ( me.runing ) { + + // 濡傛灉缂撳瓨涓湁锛屽垯鐩存帴鍦ㄧ紦瀛樹腑鍙栵紝娌℃湁鍒欏幓queue涓彇銆 + if ( !me.pending.length && me._getStats().numOfQueue ) { + me._prepareNextFile(); + } + + next = me.pending.shift(); + done = function( file ) { + if ( !file ) { + return null; + } + + act = CuteFile( file, opts.chunked ? opts.chunkSize : 0 ); + me.stack.push(act); + return act.shift(); + }; + + // 鏂囦欢鍙兘杩樺湪prepare涓紝涔熸湁鍙兘宸茬粡瀹屽叏鍑嗗濂戒簡銆 + if ( isPromise( next) ) { + preparing = next.file; + next = next[ next.pipe ? 'pipe' : 'then' ]( done ); + next.file = preparing; + return next; + } + + return done( next ); + } + }, + + + /** + * @event uploadStart + * @param {File} file File瀵硅薄 + * @description 鏌愪釜鏂囦欢寮濮嬩笂浼犲墠瑙﹀彂锛屼竴涓枃浠跺彧浼氳Е鍙戜竴娆° + * @for Uploader + */ + _prepareNextFile: function() { + var me = this, + file = me.request('fetch-file'), + pending = me.pending, + promise; + + if ( file ) { + promise = me.request( 'before-send-file', file, function() { + + // 鏈夊彲鑳芥枃浠惰skip鎺変簡銆傛枃浠惰skip鎺夊悗锛岀姸鎬佸潙瀹氫笉鏄疩ueued. + if ( file.getStatus() === Status.PROGRESS || + file.getStatus() === Status.INTERRUPT ) { + return file; + } + + return me._finishFile( file ); + }); + + me.owner.trigger( 'uploadStart', file ); + file.setStatus( Status.PROGRESS ); + + promise.file = file; + + // 濡傛灉杩樺湪pending涓紝鍒欐浛鎹㈡垚鏂囦欢鏈韩銆 + promise.done(function() { + var idx = $.inArray( promise, pending ); + + ~idx && pending.splice( idx, 1, file ); + }); + + // befeore-send-file鐨勯挬瀛愬氨鏈夐敊璇彂鐢熴 + promise.fail(function( reason ) { + file.setStatus( Status.ERROR, reason ); + me.owner.trigger( 'uploadError', file, reason ); + me.owner.trigger( 'uploadComplete', file ); + }); + + pending.push( promise ); + } + }, + + // 璁╁嚭浣嶇疆浜嗭紝鍙互璁╁叾浠栧垎鐗囧紑濮嬩笂浼 + _popBlock: function( block ) { + var idx = $.inArray( block, this.pool ); + + this.pool.splice( idx, 1 ); + block.file.remaning--; + this.remaning--; + }, + + // 寮濮嬩笂浼狅紝鍙互琚帀杩囥傚鏋減romise琚玶eject浜嗭紝鍒欒〃绀鸿烦杩囨鍒嗙墖銆 + _startSend: function( block ) { + var me = this, + file = block.file, + promise; + + // 鏈夊彲鑳藉湪 before-send-file 鐨 promise 鏈熼棿鏀瑰彉浜嗘枃浠剁姸鎬併 + // 濡傦細鏆傚仠锛屽彇娑 + // 鎴戜滑涓嶈兘涓柇 promise, 浣嗘槸鍙互鍦 promise 瀹屽悗锛屼笉鍋氫笂浼犳搷浣溿 + if ( file.getStatus() !== Status.PROGRESS ) { + + // 濡傛灉鏄腑鏂紝鍒欒繕闇瑕佹斁鍥炲幓銆 + if (file.getStatus() === Status.INTERRUPT) { + me._putback(block); + } + + return; + } + + me.pool.push( block ); + me.remaning++; + + // 濡傛灉娌℃湁鍒嗙墖锛屽垯鐩存帴浣跨敤鍘熷鐨勩 + // 涓嶄細涓㈠けcontent-type淇℃伅銆 + block.blob = block.chunks === 1 ? file.source : + file.source.slice( block.start, block.end ); + + // hook, 姣忎釜鍒嗙墖鍙戦佷箣鍓嶅彲鑳借鍋氫簺寮傛鐨勪簨鎯呫 + promise = me.request( 'before-send', block, function() { + + // 鏈夊彲鑳芥枃浠跺凡缁忎笂浼犲嚭閿欎簡锛屾墍浠ヤ笉闇瑕佸啀浼犺緭浜嗐 + if ( file.getStatus() === Status.PROGRESS ) { + me._doSend( block ); + } else { + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + + // 濡傛灉涓篺ail浜嗭紝鍒欒烦杩囨鍒嗙墖銆 + promise.fail(function() { + if ( file.remaning === 1 ) { + me._finishFile( file ).always(function() { + block.percentage = 1; + me._popBlock( block ); + me.owner.trigger( 'uploadComplete', file ); + Base.nextTick( me.__tick ); + }); + } else { + block.percentage = 1; + me._popBlock( block ); + Base.nextTick( me.__tick ); + } + }); + }, + + + /** + * @event uploadBeforeSend + * @param {Object} object + * @param {Object} data 榛樿鐨勪笂浼犲弬鏁帮紝鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶鍙傛暟銆 + * @param {Object} headers 鍙互鎵╁睍姝ゅ璞℃潵鎺у埗涓婁紶澶撮儴銆 + * @description 褰撴煇涓枃浠剁殑鍒嗗潡鍦ㄥ彂閫佸墠瑙﹀彂锛屼富瑕佺敤鏉ヨ闂槸鍚﹁娣诲姞闄勫甫鍙傛暟锛屽ぇ鏂囦欢鍦ㄥ紑璧峰垎鐗囦笂浼犵殑鍓嶆彁涓嬫浜嬩欢鍙兘浼氳Е鍙戝娆° + * @for Uploader + */ + + /** + * @event uploadAccept + * @param {Object} object + * @param {Object} ret 鏈嶅姟绔殑杩斿洖鏁版嵁锛宩son鏍煎紡锛屽鏋滄湇鍔$涓嶆槸json鏍煎紡锛屼粠ret._raw涓彇鏁版嵁锛岃嚜琛岃В鏋愩 + * @description 褰撴煇涓枃浠朵笂浼犲埌鏈嶅姟绔搷搴斿悗锛屼細娲鹃佹浜嬩欢鏉ヨ闂湇鍔$鍝嶅簲鏄惁鏈夋晥銆傚鏋滄浜嬩欢handler杩斿洖鍊间负`false`, 鍒欐鏂囦欢灏嗘淳閫乣server`绫诲瀷鐨刞uploadError`浜嬩欢銆 + * @for Uploader + */ + + /** + * @event uploadProgress + * @param {File} file File瀵硅薄 + * @param {Number} percentage 涓婁紶杩涘害 + * @description 涓婁紶杩囩▼涓Е鍙戯紝鎼哄甫涓婁紶杩涘害銆 + * @for Uploader + */ + + + /** + * @event uploadError + * @param {File} file File瀵硅薄 + * @param {String} reason 鍑洪敊鐨刢ode + * @description 褰撴枃浠朵笂浼犲嚭閿欐椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadSuccess + * @param {File} file File瀵硅薄 + * @param {Object} response 鏈嶅姟绔繑鍥炵殑鏁版嵁 + * @description 褰撴枃浠朵笂浼犳垚鍔熸椂瑙﹀彂銆 + * @for Uploader + */ + + /** + * @event uploadComplete + * @param {File} [file] File瀵硅薄 + * @description 涓嶇鎴愬姛鎴栬呭け璐ワ紝鏂囦欢涓婁紶瀹屾垚鏃惰Е鍙戙 + * @for Uploader + */ + + // 鍋氫笂浼犳搷浣溿 + _doSend: function( block ) { + var me = this, + owner = me.owner, + opts = me.options, + file = block.file, + tr = new Transport( opts ), + data = $.extend({}, opts.formData ), + headers = $.extend({}, opts.headers ), + requestAccept, ret; + + block.transport = tr; + + tr.on( 'destroy', function() { + delete block.transport; + me._popBlock( block ); + Base.nextTick( me.__tick ); + }); + + // 骞挎挱涓婁紶杩涘害銆備互鏂囦欢涓哄崟浣嶃 + tr.on( 'progress', function( percentage ) { + var totalPercent = 0, + uploaded = 0; + + // 鍙兘娌℃湁abort鎺夛紝progress杩樻槸鎵ц杩涙潵浜嗐 + // if ( !file.blocks ) { + // return; + // } + + totalPercent = block.percentage = percentage; + + if ( block.chunks > 1 ) { // 璁$畻鏂囦欢鐨勬暣浣撻熷害銆 + $.each( file.blocks, function( _, v ) { + uploaded += (v.percentage || 0) * (v.end - v.start); + }); + + totalPercent = uploaded / file.size; + } + + owner.trigger( 'uploadProgress', file, totalPercent || 0 ); + }); + + // 鐢ㄦ潵璇㈤棶锛屾槸鍚﹁繑鍥炵殑缁撴灉鏄湁閿欒鐨勩 + requestAccept = function( reject ) { + var fn; + + ret = tr.getResponseAsJson() || {}; + ret._raw = tr.getResponse(); + fn = function( value ) { + reject = value; + }; + + // 鏈嶅姟绔搷搴斾簡锛屼笉浠h〃鎴愬姛浜嗭紝璇㈤棶鏄惁鍝嶅簲姝g‘銆 + if ( !owner.trigger( 'uploadAccept', block, ret, fn ) ) { + reject = reject || 'server'; + } + + return reject; + }; + + // 灏濊瘯閲嶈瘯锛岀劧鍚庡箍鎾枃浠朵笂浼犲嚭閿欍 + tr.on( 'error', function( type, flag ) { + block.retried = block.retried || 0; + + // 鑷姩閲嶈瘯 + if ( block.chunks > 1 && ~'http,abort'.indexOf( type ) && + block.retried < opts.chunkRetry ) { + + block.retried++; + tr.send(); + + } else { + + // http status 500 ~ 600 + if ( !flag && type === 'server' ) { + type = requestAccept( type ); + } + + file.setStatus( Status.ERROR, type ); + owner.trigger( 'uploadError', file, type ); + owner.trigger( 'uploadComplete', file ); + } + }); + + // 涓婁紶鎴愬姛 + tr.on( 'load', function() { + var reason; + + // 濡傛灉闈為鏈燂紝杞悜涓婁紶鍑洪敊銆 + if ( (reason = requestAccept()) ) { + tr.trigger( 'error', reason, true ); + return; + } + + // 鍏ㄩ儴涓婁紶瀹屾垚銆 + if ( file.remaning === 1 ) { + me._finishFile( file, ret ); + } else { + tr.destroy(); + } + }); + + // 閰嶇疆榛樿鐨勪笂浼犲瓧娈点 + data = $.extend( data, { + id: file.id, + name: file.name, + type: file.type, + lastModifiedDate: file.lastModifiedDate, + size: file.size + }); + + block.chunks > 1 && $.extend( data, { + chunks: block.chunks, + chunk: block.chunk + }); + + // 鍦ㄥ彂閫佷箣闂村彲浠ユ坊鍔犲瓧娈典粈涔堢殑銆傘傘 + // 濡傛灉榛樿鐨勫瓧娈典笉澶熶娇鐢紝鍙互閫氳繃鐩戝惉姝や簨浠舵潵鎵╁睍 + owner.trigger( 'uploadBeforeSend', block, data, headers ); + + // 寮濮嬪彂閫併 + tr.appendBlob( opts.fileVal, block.blob, file.name ); + tr.append( data ); + tr.setRequestHeader( headers ); + tr.send(); + }, + + // 瀹屾垚涓婁紶銆 + _finishFile: function( file, ret, hds ) { + var owner = this.owner; + + return owner + .request( 'after-send-file', arguments, function() { + file.setStatus( Status.COMPLETE ); + owner.trigger( 'uploadSuccess', file, ret, hds ); + }) + .fail(function( reason ) { + + // 濡傛灉澶栭儴宸茬粡鏍囪涓篿nvalid浠涔堢殑锛屼笉鍐嶆敼鐘舵併 + if ( file.getStatus() === Status.PROGRESS ) { + file.setStatus( Status.ERROR, reason ); + } + + owner.trigger( 'uploadError', file, reason ); + }) + .always(function() { + owner.trigger( 'uploadComplete', file ); + }); + } + + }); + }); + /** + * @fileOverview 鍚勭楠岃瘉锛屽寘鎷枃浠舵诲ぇ灏忔槸鍚﹁秴鍑恒佸崟鏂囦欢鏄惁瓒呭嚭鍜屾枃浠舵槸鍚﹂噸澶嶃 + */ + + define('widgets/validator',[ + 'base', + 'uploader', + 'file', + 'widgets/widget' + ], function( Base, Uploader, WUFile ) { + + var $ = Base.$, + validators = {}, + api; + + /** + * @event error + * @param {String} type 閿欒绫诲瀷銆 + * @description 褰搗alidate涓嶉氳繃鏃讹紝浼氫互娲鹃侀敊璇簨浠剁殑褰㈠紡閫氱煡璋冪敤鑰呫傞氳繃`upload.on('error', handler)`鍙互鎹曡幏鍒版绫婚敊璇紝鐩墠鏈変互涓嬮敊璇細鍦ㄧ壒瀹氱殑鎯呭喌涓嬫淳閫侀敊鏉ャ + * + * * `Q_EXCEED_NUM_LIMIT` 鍦ㄨ缃簡`fileNumLimit`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵暟閲忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_EXCEED_SIZE_LIMIT` 鍦ㄨ缃簡`Q_EXCEED_SIZE_LIMIT`涓斿皾璇曠粰`uploader`娣诲姞鐨勬枃浠舵诲ぇ灏忚秴鍑鸿繖涓兼椂娲鹃併 + * * `Q_TYPE_DENIED` 褰撴枃浠剁被鍨嬩笉婊¤冻鏃惰Е鍙戙傘 + * @for Uploader + */ + + // 鏆撮湶缁欏闈㈢殑api + api = { + + // 娣诲姞楠岃瘉鍣 + addValidator: function( type, cb ) { + validators[ type ] = cb; + }, + + // 绉婚櫎楠岃瘉鍣 + removeValidator: function( type ) { + delete validators[ type ]; + } + }; + + // 鍦║ploader鍒濆鍖栫殑鏃跺欏惎鍔╒alidators鐨勫垵濮嬪寲 + Uploader.register({ + name: 'validator', + + init: function() { + var me = this; + Base.nextTick(function() { + $.each( validators, function() { + this.call( me.owner ); + }); + }); + } + }); + + /** + * @property {int} [fileNumLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬绘暟閲, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileNumLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileNumLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( count >= max && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_NUM_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return count >= max ? false : true; + }); + + uploader.on( 'fileQueued', function() { + count++; + }); + + uploader.on( 'fileDequeued', function() { + count--; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + + /** + * @property {int} [fileSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鏂囦欢鎬诲ぇ灏忔槸鍚﹁秴鍑洪檺鍒, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSizeLimit', function() { + var uploader = this, + opts = uploader.options, + count = 0, + max = parseInt( opts.fileSizeLimit, 10 ), + flag = true; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var invalid = count + file.size > max; + + if ( invalid && flag ) { + flag = false; + this.trigger( 'error', 'Q_EXCEED_SIZE_LIMIT', max, file ); + setTimeout(function() { + flag = true; + }, 1 ); + } + + return invalid ? false : true; + }); + + uploader.on( 'fileQueued', function( file ) { + count += file.size; + }); + + uploader.on( 'fileDequeued', function( file ) { + count -= file.size; + }); + + uploader.on( 'reset', function() { + count = 0; + }); + }); + + /** + * @property {int} [fileSingleSizeLimit=undefined] + * @namespace options + * @for Uploader + * @description 楠岃瘉鍗曚釜鏂囦欢澶у皬鏄惁瓒呭嚭闄愬埗, 瓒呭嚭鍒欎笉鍏佽鍔犲叆闃熷垪銆 + */ + api.addValidator( 'fileSingleSizeLimit', function() { + var uploader = this, + opts = uploader.options, + max = opts.fileSingleSizeLimit; + + if ( !max ) { + return; + } + + uploader.on( 'beforeFileQueued', function( file ) { + + if ( file.size > max ) { + file.setStatus( WUFile.Status.INVALID, 'exceed_size' ); + this.trigger( 'error', 'F_EXCEED_SIZE', max, file ); + return false; + } + + }); + + }); + + /** + * @property {Boolean} [duplicate=undefined] + * @namespace options + * @for Uploader + * @description 鍘婚噸锛 鏍规嵁鏂囦欢鍚嶅瓧銆佹枃浠跺ぇ灏忓拰鏈鍚庝慨鏀规椂闂存潵鐢熸垚hash Key. + */ + api.addValidator( 'duplicate', function() { + var uploader = this, + opts = uploader.options, + mapping = {}; + + if ( opts.duplicate ) { + return; + } + + function hashString( str ) { + var hash = 0, + i = 0, + len = str.length, + _char; + + for ( ; i < len; i++ ) { + _char = str.charCodeAt( i ); + hash = _char + (hash << 6) + (hash << 16) - hash; + } + + return hash; + } + + uploader.on( 'beforeFileQueued', function( file ) { + var hash = file.__hash || (file.__hash = hashString( file.name + + file.size + file.lastModifiedDate )); + + // 宸茬粡閲嶅浜 + if ( mapping[ hash ] ) { + this.trigger( 'error', 'F_DUPLICATE', file ); + return false; + } + }); + + uploader.on( 'fileQueued', function( file ) { + var hash = file.__hash; + + hash && (mapping[ hash ] = true); + }); + + uploader.on( 'fileDequeued', function( file ) { + var hash = file.__hash; + + hash && (delete mapping[ hash ]); + }); + + uploader.on( 'reset', function() { + mapping = {}; + }); + }); + + return api; + }); + + /** + * @fileOverview Runtime绠$悊鍣紝璐熻矗Runtime鐨勯夋嫨, 杩炴帴 + */ + define('runtime/compbase',[],function() { + + function CompBase( owner, runtime ) { + + this.owner = owner; + this.options = owner.options; + + this.getRuntime = function() { + return runtime; + }; + + this.getRuid = function() { + return runtime.uid; + }; + + this.trigger = function() { + return owner.trigger.apply( owner, arguments ); + }; + } + + return CompBase; + }); + /** + * @fileOverview Html5Runtime + */ + define('runtime/html5/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var type = 'html5', + components = {}; + + function Html5Runtime() { + var pool = {}, + me = this, + destroy = this.destroy; + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + if ( components[ comp ] ) { + instance = pool[ uid ] = pool[ uid ] || + new components[ comp ]( client, me ); + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + }; + + me.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + } + + Base.inherits( Runtime, { + constructor: Html5Runtime, + + // 涓嶉渶瑕佽繛鎺ュ叾浠栫▼搴忥紝鐩存帴鎵цcallback + init: function() { + var me = this; + setTimeout(function() { + me.trigger('ready'); + }, 1 ); + } + + }); + + // 娉ㄥ唽Components + Html5Runtime.register = function( name, component ) { + var klass = components[ name ] = Base.inherits( CompBase, component ); + return klass; + }; + + // 娉ㄥ唽html5杩愯鏃躲 + // 鍙湁鍦ㄦ敮鎸佺殑鍓嶆彁涓嬫敞鍐屻 + if ( window.Blob && window.FileReader && window.DataView ) { + Runtime.addRuntime( type, Html5Runtime ); + } + + return Html5Runtime; + }); + /** + * @fileOverview Blob Html瀹炵幇 + */ + define('runtime/html5/blob',[ + 'runtime/html5/runtime', + 'lib/blob' + ], function( Html5Runtime, Blob ) { + + return Html5Runtime.register( 'Blob', { + slice: function( start, end ) { + var blob = this.owner.source, + slice = blob.slice || blob.webkitSlice || blob.mozSlice; + + blob = slice.call( blob, start, end ); + + return new Blob( this.getRuid(), blob ); + } + }); + }); + /** + * @fileOverview FilePaste + */ + define('runtime/html5/dnd',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + var $ = Base.$, + prefix = 'webuploader-dnd-'; + + return Html5Runtime.register( 'DragAndDrop', { + init: function() { + var elem = this.elem = this.options.container; + + this.dragEnterHandler = Base.bindFn( this._dragEnterHandler, this ); + this.dragOverHandler = Base.bindFn( this._dragOverHandler, this ); + this.dragLeaveHandler = Base.bindFn( this._dragLeaveHandler, this ); + this.dropHandler = Base.bindFn( this._dropHandler, this ); + this.dndOver = false; + + elem.on( 'dragenter', this.dragEnterHandler ); + elem.on( 'dragover', this.dragOverHandler ); + elem.on( 'dragleave', this.dragLeaveHandler ); + elem.on( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).on( 'dragover', this.dragOverHandler ); + $( document ).on( 'drop', this.dropHandler ); + } + }, + + _dragEnterHandler: function( e ) { + var me = this, + denied = me._denied || false, + items; + + e = e.originalEvent || e; + + if ( !me.dndOver ) { + me.dndOver = true; + + // 娉ㄦ剰鍙湁 chrome 鏀寔銆 + items = e.dataTransfer.items; + + if ( items && items.length ) { + me._denied = denied = !me.trigger( 'accept', items ); + } + + me.elem.addClass( prefix + 'over' ); + me.elem[ denied ? 'addClass' : + 'removeClass' ]( prefix + 'denied' ); + } + + e.dataTransfer.dropEffect = denied ? 'none' : 'copy'; + + return false; + }, + + _dragOverHandler: function( e ) { + // 鍙鐞嗘鍐呯殑銆 + var parentElem = this.elem.parent().get( 0 ); + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + clearTimeout( this._leaveTimer ); + this._dragEnterHandler.call( this, e ); + + return false; + }, + + _dragLeaveHandler: function() { + var me = this, + handler; + + handler = function() { + me.dndOver = false; + me.elem.removeClass( prefix + 'over ' + prefix + 'denied' ); + }; + + clearTimeout( me._leaveTimer ); + me._leaveTimer = setTimeout( handler, 100 ); + return false; + }, + + _dropHandler: function( e ) { + var me = this, + ruid = me.getRuid(), + parentElem = me.elem.parent().get( 0 ), + dataTransfer, data; + + // 鍙鐞嗘鍐呯殑銆 + if ( parentElem && !$.contains( parentElem, e.currentTarget ) ) { + return false; + } + + e = e.originalEvent || e; + dataTransfer = e.dataTransfer; + + // 濡傛灉鏄〉闈㈠唴鎷栨嫿锛岃繕涓嶈兘澶勭悊锛屼笉闃绘浜嬩欢銆 + // 姝ゅ ie11 涓嬩細鎶ュ弬鏁伴敊璇紝 + try { + data = dataTransfer.getData('text/html'); + } catch( err ) { + } + + if ( data ) { + return; + } + + me._getTansferFiles( dataTransfer, function( results ) { + me.trigger( 'drop', $.map( results, function( file ) { + return new File( ruid, file ); + }) ); + }); + + me.dndOver = false; + me.elem.removeClass( prefix + 'over' ); + return false; + }, + + // 濡傛灉浼犲叆 callback 鍒欏幓鏌ョ湅鏂囦欢澶癸紝鍚﹀垯鍙褰撳墠鏂囦欢澶广 + _getTansferFiles: function( dataTransfer, callback ) { + var results = [], + promises = [], + items, files, file, item, i, len, canAccessFolder; + + items = dataTransfer.items; + files = dataTransfer.files; + + canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry); + + for ( i = 0, len = files.length; i < len; i++ ) { + file = files[ i ]; + item = items && items[ i ]; + + if ( canAccessFolder && item.webkitGetAsEntry().isDirectory ) { + + promises.push( this._traverseDirectoryTree( + item.webkitGetAsEntry(), results ) ); + } else { + results.push( file ); + } + } + + Base.when.apply( Base, promises ).done(function() { + + if ( !results.length ) { + return; + } + + callback( results ); + }); + }, + + _traverseDirectoryTree: function( entry, results ) { + var deferred = Base.Deferred(), + me = this; + + if ( entry.isFile ) { + entry.file(function( file ) { + results.push( file ); + deferred.resolve(); + }); + } else if ( entry.isDirectory ) { + entry.createReader().readEntries(function( entries ) { + var len = entries.length, + promises = [], + arr = [], // 涓轰簡淇濊瘉椤哄簭銆 + i; + + for ( i = 0; i < len; i++ ) { + promises.push( me._traverseDirectoryTree( + entries[ i ], arr ) ); + } + + Base.when.apply( Base, promises ).then(function() { + results.push.apply( results, arr ); + deferred.resolve(); + }, deferred.reject ); + }); + } + + return deferred.promise(); + }, + + destroy: function() { + var elem = this.elem; + + // 杩樻病 init 灏辫皟鐢 destroy + if (!elem) { + return; + } + + elem.off( 'dragenter', this.dragEnterHandler ); + elem.off( 'dragover', this.dragOverHandler ); + elem.off( 'dragleave', this.dragLeaveHandler ); + elem.off( 'drop', this.dropHandler ); + + if ( this.options.disableGlobalDnd ) { + $( document ).off( 'dragover', this.dragOverHandler ); + $( document ).off( 'drop', this.dropHandler ); + } + } + }); + }); + + /** + * @fileOverview FilePaste + */ + define('runtime/html5/filepaste',[ + 'base', + 'runtime/html5/runtime', + 'lib/file' + ], function( Base, Html5Runtime, File ) { + + return Html5Runtime.register( 'FilePaste', { + init: function() { + var opts = this.options, + elem = this.elem = opts.container, + accept = '.*', + arr, i, len, item; + + // accetp鐨刴imeTypes涓敓鎴愬尮閰嶆鍒欍 + if ( opts.accept ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + item = opts.accept[ i ].mimeTypes; + item && arr.push( item ); + } + + if ( arr.length ) { + accept = arr.join(','); + accept = accept.replace( /,/g, '|' ).replace( /\*/g, '.*' ); + } + } + this.accept = accept = new RegExp( accept, 'i' ); + this.hander = Base.bindFn( this._pasteHander, this ); + elem.on( 'paste', this.hander ); + }, + + _pasteHander: function( e ) { + var allowed = [], + ruid = this.getRuid(), + items, item, blob, i, len; + + e = e.originalEvent || e; + items = e.clipboardData.items; + + for ( i = 0, len = items.length; i < len; i++ ) { + item = items[ i ]; + + if ( item.kind !== 'file' || !(blob = item.getAsFile()) ) { + continue; + } + + allowed.push( new File( ruid, blob ) ); + } + + if ( allowed.length ) { + // 涓嶉樆姝㈤潪鏂囦欢绮樿创锛堟枃瀛楃矘璐达級鐨勪簨浠跺啋娉 + e.preventDefault(); + e.stopPropagation(); + this.trigger( 'paste', allowed ); + } + }, + + destroy: function() { + this.elem.off( 'paste', this.hander ); + } + }); + }); + + /** + * @fileOverview FilePicker + */ + define('runtime/html5/filepicker',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var $ = Base.$; + + return Html5Runtime.register( 'FilePicker', { + init: function() { + var container = this.getRuntime().getContainer(), + me = this, + owner = me.owner, + opts = me.options, + label = this.label = $( document.createElement('label') ), + input = this.input = $( document.createElement('input') ), + arr, i, len, mouseHandler; + + input.attr( 'type', 'file' ); + input.attr( 'name', opts.name ); + input.addClass('webuploader-element-invisible'); + + label.on( 'click', function() { + input.trigger('click'); + }); + + label.css({ + opacity: 0, + width: '100%', + height: '100%', + display: 'block', + cursor: 'pointer', + background: '#ffffff' + }); + + if ( opts.multiple ) { + input.attr( 'multiple', 'multiple' ); + } + + // @todo Firefox涓嶆敮鎸佸崟鐙寚瀹氬悗缂 + if ( opts.accept && opts.accept.length > 0 ) { + arr = []; + + for ( i = 0, len = opts.accept.length; i < len; i++ ) { + arr.push( opts.accept[ i ].mimeTypes ); + } + + input.attr( 'accept', arr.join(',') ); + } + + container.append( input ); + container.append( label ); + + mouseHandler = function( e ) { + owner.trigger( e.type ); + }; + + input.on( 'change', function( e ) { + var fn = arguments.callee, + clone; + + me.files = e.target.files; + + // reset input + clone = this.cloneNode( true ); + clone.value = null; + this.parentNode.replaceChild( clone, this ); + + input.off(); + input = $( clone ).on( 'change', fn ) + .on( 'mouseenter mouseleave', mouseHandler ); + + owner.trigger('change'); + }); + + label.on( 'mouseenter mouseleave', mouseHandler ); + + }, + + + getFiles: function() { + return this.files; + }, + + destroy: function() { + this.input.off(); + this.label.off(); + } + }); + }); + /** + * @fileOverview Transport + * @todo 鏀寔chunked浼犺緭锛屼紭鍔匡細 + * 鍙互灏嗗ぇ鏂囦欢鍒嗘垚灏忓潡锛屾尐涓紶杈擄紝鍙互鎻愰珮澶ф枃浠舵垚鍔熺巼锛屽綋澶辫触鐨勬椂鍊欙紝涔熷彧闇瑕侀噸浼犻偅灏忛儴鍒嗭紝 + * 鑰屼笉闇瑕侀噸澶村啀浼犱竴娆°傚彟澶栨柇鐐圭画浼犱篃闇瑕佺敤chunked鏂瑰紡銆 + */ + define('runtime/html5/transport',[ + 'base', + 'runtime/html5/runtime' + ], function( Base, Html5Runtime ) { + + var noop = Base.noop, + $ = Base.$; + + return Html5Runtime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + formData, binary, fr; + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.getSource(); + } else { + formData = new FormData(); + $.each( owner._formData, function( k, v ) { + formData.append( k, v ); + }); + + formData.append( opts.fileVal, blob.getSource(), + opts.filename || owner._formData.name || '' ); + } + + if ( opts.withCredentials && 'withCredentials' in xhr ) { + xhr.open( opts.method, server, true ); + xhr.withCredentials = true; + } else { + xhr.open( opts.method, server ); + } + + this._setRequestHeader( xhr, opts.headers ); + + if ( binary ) { + // 寮哄埗璁剧疆鎴 content-type 涓烘枃浠舵祦銆 + xhr.overrideMimeType && + xhr.overrideMimeType('application/octet-stream'); + + // android鐩存帴鍙戦乥lob浼氬鑷存湇鍔$鎺ユ敹鍒扮殑鏄┖鏂囦欢銆 + // bug璇︽儏銆 + // https://code.google.com/p/android/issues/detail?id=39882 + // 鎵浠ュ厛鐢╢ileReader璇诲彇鍑烘潵鍐嶉氳繃arraybuffer鐨勬柟寮忓彂閫併 + if ( Base.os.android ) { + fr = new FileReader(); + + fr.onload = function() { + xhr.send( this.result ); + fr = fr.onload = null; + }; + + fr.readAsArrayBuffer( binary ); + } else { + xhr.send( binary ); + } + } else { + xhr.send( formData ); + } + }, + + getResponse: function() { + return this._response; + }, + + getResponseAsJson: function() { + return this._parseJson( this._response ); + }, + + getStatus: function() { + return this._status; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + xhr.abort(); + + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new XMLHttpRequest(), + opts = this.options; + + if ( opts.withCredentials && !('withCredentials' in xhr) && + typeof XDomainRequest !== 'undefined' ) { + xhr = new XDomainRequest(); + } + + xhr.upload.onprogress = function( e ) { + var percentage = 0; + + if ( e.lengthComputable ) { + percentage = e.loaded / e.total; + } + + return me.trigger( 'progress', percentage ); + }; + + xhr.onreadystatechange = function() { + + if ( xhr.readyState !== 4 ) { + return; + } + + xhr.upload.onprogress = noop; + xhr.onreadystatechange = noop; + me._xhr = null; + me._status = xhr.status; + + if ( xhr.status >= 200 && xhr.status < 300 ) { + me._response = xhr.responseText; + return me.trigger('load'); + } else if ( xhr.status >= 500 && xhr.status < 600 ) { + me._response = xhr.responseText; + return me.trigger( 'error', 'server' ); + } + + + return me.trigger( 'error', me._status ? 'http' : 'abort' ); + }; + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.setRequestHeader( key, val ); + }); + }, + + _parseJson: function( str ) { + var json; + + try { + json = JSON.parse( str ); + } catch ( ex ) { + json = {}; + } + + return json; + } + }); + }); + /** + * @fileOverview FlashRuntime + */ + define('runtime/flash/runtime',[ + 'base', + 'runtime/runtime', + 'runtime/compbase' + ], function( Base, Runtime, CompBase ) { + + var $ = Base.$, + type = 'flash', + components = {}; + + + function getFlashVersion() { + var version; + + try { + version = navigator.plugins[ 'Shockwave Flash' ]; + version = version.description; + } catch ( ex ) { + try { + version = new ActiveXObject('ShockwaveFlash.ShockwaveFlash') + .GetVariable('$version'); + } catch ( ex2 ) { + version = '0.0'; + } + } + version = version.match( /\d+/g ); + return parseFloat( version[ 0 ] + '.' + version[ 1 ], 10 ); + } + + function FlashRuntime() { + var pool = {}, + clients = {}, + destroy = this.destroy, + me = this, + jsreciver = Base.guid('webuploader_'); + + Runtime.apply( me, arguments ); + me.type = type; + + + // 杩欎釜鏂规硶鐨勮皟鐢ㄨ咃紝瀹為檯涓婃槸RuntimeClient + me.exec = function( comp, fn/*, args...*/ ) { + var client = this, + uid = client.uid, + args = Base.slice( arguments, 2 ), + instance; + + clients[ uid ] = client; + + if ( components[ comp ] ) { + if ( !pool[ uid ] ) { + pool[ uid ] = new components[ comp ]( client, me ); + } + + instance = pool[ uid ]; + + if ( instance[ fn ] ) { + return instance[ fn ].apply( instance, args ); + } + } + + return me.flashExec.apply( client, arguments ); + }; + + function handler( evt, obj ) { + var type = evt.type || evt, + parts, uid; + + parts = type.split('::'); + uid = parts[ 0 ]; + type = parts[ 1 ]; + + // console.log.apply( console, arguments ); + + if ( type === 'Ready' && uid === me.uid ) { + me.trigger('ready'); + } else if ( clients[ uid ] ) { + clients[ uid ].trigger( type.toLowerCase(), evt, obj ); + } + + // Base.log( evt, obj ); + } + + // flash鐨勬帴鍙楀櫒銆 + window[ jsreciver ] = function() { + var args = arguments; + + // 涓轰簡鑳芥崟鑾峰緱鍒般 + setTimeout(function() { + handler.apply( null, args ); + }, 1 ); + }; + + this.jsreciver = jsreciver; + + this.destroy = function() { + // @todo 鍒犻櫎姹犲瓙涓殑鎵鏈夊疄渚 + return destroy && destroy.apply( this, arguments ); + }; + + this.flashExec = function( comp, fn ) { + var flash = me.getFlash(), + args = Base.slice( arguments, 2 ); + + return flash.exec( this.uid, comp, fn, args ); + }; + + // @todo + } + + Base.inherits( Runtime, { + constructor: FlashRuntime, + + init: function() { + var container = this.getContainer(), + opts = this.options, + html; + + // if not the minimal height, shims are not initialized + // in older browsers (e.g FF3.6, IE6,7,8, Safari 4.0,5.0, etc) + container.css({ + position: 'absolute', + top: '-8px', + left: '-8px', + width: '9px', + height: '9px', + overflow: 'hidden' + }); + + // insert flash object + html = '' + + '' + + '' + + '' + + ''; + + container.html( html ); + }, + + getFlash: function() { + if ( this._flash ) { + return this._flash; + } + + this._flash = $( '#' + this.uid ).get( 0 ); + return this._flash; + } + + }); + + FlashRuntime.register = function( name, component ) { + component = components[ name ] = Base.inherits( CompBase, $.extend({ + + // @todo fix this later + flashExec: function() { + var owner = this.owner, + runtime = this.getRuntime(); + + return runtime.flashExec.apply( owner, arguments ); + } + }, component ) ); + + return component; + }; + + if ( getFlashVersion() >= 11.4 ) { + Runtime.addRuntime( type, FlashRuntime ); + } + + return FlashRuntime; + }); + /** + * @fileOverview FilePicker + */ + define('runtime/flash/filepicker',[ + 'base', + 'runtime/flash/runtime' + ], function( Base, FlashRuntime ) { + var $ = Base.$; + + return FlashRuntime.register( 'FilePicker', { + init: function( opts ) { + var copy = $.extend({}, opts ), + len, i; + + // 淇Flash鍐嶆病鏈夎缃畉itle鐨勬儏鍐典笅鏃犳硶寮瑰嚭flash鏂囦欢閫夋嫨妗嗙殑bug. + len = copy.accept && copy.accept.length; + for ( i = 0; i < len; i++ ) { + if ( !copy.accept[ i ].title ) { + copy.accept[ i ].title = 'Files'; + } + } + + delete copy.button; + delete copy.id; + delete copy.container; + + this.flashExec( 'FilePicker', 'init', copy ); + }, + + destroy: function() { + this.flashExec( 'FilePicker', 'destroy' ); + } + }); + }); + /** + * @fileOverview Transport flash瀹炵幇 + */ + define('runtime/flash/transport',[ + 'base', + 'runtime/flash/runtime', + 'runtime/client' + ], function( Base, FlashRuntime, RuntimeClient ) { + var $ = Base.$; + + return FlashRuntime.register( 'Transport', { + init: function() { + this._status = 0; + this._response = null; + this._responseJson = null; + }, + + send: function() { + var owner = this.owner, + opts = this.options, + xhr = this._initAjax(), + blob = owner._blob, + server = opts.server, + binary; + + xhr.connectRuntime( blob.ruid ); + + if ( opts.sendAsBinary ) { + server += (/\?/.test( server ) ? '&' : '?') + + $.param( owner._formData ); + + binary = blob.uid; + } else { + $.each( owner._formData, function( k, v ) { + xhr.exec( 'append', k, v ); + }); + + xhr.exec( 'appendBlob', opts.fileVal, blob.uid, + opts.filename || owner._formData.name || '' ); + } + + this._setRequestHeader( xhr, opts.headers ); + xhr.exec( 'send', { + method: opts.method, + url: server, + forceURLStream: opts.forceURLStream, + mimeType: 'application/octet-stream' + }, binary ); + }, + + getStatus: function() { + return this._status; + }, + + getResponse: function() { + return this._response || ''; + }, + + getResponseAsJson: function() { + return this._responseJson; + }, + + abort: function() { + var xhr = this._xhr; + + if ( xhr ) { + xhr.exec('abort'); + xhr.destroy(); + this._xhr = xhr = null; + } + }, + + destroy: function() { + this.abort(); + }, + + _initAjax: function() { + var me = this, + xhr = new RuntimeClient('XMLHttpRequest'); + + xhr.on( 'uploadprogress progress', function( e ) { + var percent = e.loaded / e.total; + percent = Math.min( 1, Math.max( 0, percent ) ); + return me.trigger( 'progress', percent ); + }); + + xhr.on( 'load', function() { + var status = xhr.exec('getStatus'), + readBody = false, + err = '', + p; + + xhr.off(); + me._xhr = null; + + if ( status >= 200 && status < 300 ) { + readBody = true; + } else if ( status >= 500 && status < 600 ) { + readBody = true; + err = 'server'; + } else { + err = 'http'; + } + + if ( readBody ) { + me._response = xhr.exec('getResponse'); + me._response = decodeURIComponent( me._response ); + + // flash 澶勭悊鍙兘瀛樺湪 bug, 娌¤緳鍙兘闈 js 浜 + // try { + // me._responseJson = xhr.exec('getResponseAsJson'); + // } catch ( error ) { + + p = window.JSON && window.JSON.parse || function( s ) { + try { + return new Function('return ' + s).call(); + } catch ( err ) { + return {}; + } + }; + me._responseJson = me._response ? p(me._response) : {}; + + // } + } + + xhr.destroy(); + xhr = null; + + return err ? me.trigger( 'error', err ) : me.trigger('load'); + }); + + xhr.on( 'error', function() { + xhr.off(); + me._xhr = null; + me.trigger( 'error', 'http' ); + }); + + me._xhr = xhr; + return xhr; + }, + + _setRequestHeader: function( xhr, headers ) { + $.each( headers, function( key, val ) { + xhr.exec( 'setRequestHeader', key, val ); + }); + } + }); + }); + /** + * @fileOverview 娌℃湁鍥惧儚澶勭悊鐨勭増鏈 + */ + define('preset/withoutimage',[ + 'base', + + // widgets + 'widgets/filednd', + 'widgets/filepaste', + 'widgets/filepicker', + 'widgets/queue', + 'widgets/runtime', + 'widgets/upload', + 'widgets/validator', + + // runtimes + // html5 + 'runtime/html5/blob', + 'runtime/html5/dnd', + 'runtime/html5/filepaste', + 'runtime/html5/filepicker', + 'runtime/html5/transport', + + // flash + 'runtime/flash/filepicker', + 'runtime/flash/transport' + ], function( Base ) { + return Base; + }); + define('webuploader',[ + 'preset/withoutimage' + ], function( preset ) { + return preset; + }); + return require('webuploader'); +}); diff --git a/WebContent/Frame/page/webuploader/webuploader.withoutimage.min.js b/WebContent/Frame/page/webuploader/webuploader.withoutimage.min.js new file mode 100644 index 000000000..84ba19870 --- /dev/null +++ b/WebContent/Frame/page/webuploader/webuploader.withoutimage.min.js @@ -0,0 +1,2 @@ +/* WebUploader 0.1.5 */!function(a,b){var c,d={},e=function(a,b){var c,d,e;if("string"==typeof a)return h(a);for(c=[],d=a.length,e=0;d>e;e++)c.push(h(a[e]));return b.apply(null,c)},f=function(a,b,c){2===arguments.length&&(c=b,b=null),e(b||[],function(){g(a,c,arguments)})},g=function(a,b,c){var f,g={exports:b};"function"==typeof b&&(c.length||(c=[e,g.exports,g]),f=b.apply(null,c),void 0!==f&&(g.exports=f)),d[a]=g.exports},h=function(b){var c=d[b]||a[b];if(!c)throw new Error("`"+b+"` is undefined");return c},i=function(a){var b,c,e,f,g,h;h=function(a){return a&&a.charAt(0).toUpperCase()+a.substr(1)};for(b in d)if(c=a,d.hasOwnProperty(b)){for(e=b.split("/"),g=h(e.pop());f=h(e.shift());)c[f]=c[f]||{},c=c[f];c[g]=d[b]}return a},j=function(c){return a.__dollar=c,i(b(a,f,e))};"object"==typeof module&&"object"==typeof module.exports?module.exports=j():"function"==typeof define&&define.amd?define(["jquery"],j):(c=a.WebUploader,a.WebUploader=j(),a.WebUploader.noConflict=function(){a.WebUploader=c})}(window,function(a,b,c){return b("dollar-third",[],function(){var b=a.__dollar||a.jQuery||a.Zepto;if(!b)throw new Error("jQuery or Zepto not found!");return b}),b("dollar",["dollar-third"],function(a){return a}),b("promise-third",["dollar"],function(a){return{Deferred:a.Deferred,when:a.when,isPromise:function(a){return a&&"function"==typeof a.then}}}),b("promise",["promise-third"],function(a){return a}),b("base",["dollar","promise"],function(b,c){function d(a){return function(){return h.apply(a,arguments)}}function e(a,b){return function(){return a.apply(b,arguments)}}function f(a){var b;return Object.create?Object.create(a):(b=function(){},b.prototype=a,new b)}var g=function(){},h=Function.call;return{version:"0.1.5",$:b,Deferred:c.Deferred,isPromise:c.isPromise,when:c.when,browser:function(a){var b={},c=a.match(/WebKit\/([\d.]+)/),d=a.match(/Chrome\/([\d.]+)/)||a.match(/CriOS\/([\d.]+)/),e=a.match(/MSIE\s([\d\.]+)/)||a.match(/(?:trident)(?:.*rv:([\w.]+))?/i),f=a.match(/Firefox\/([\d.]+)/),g=a.match(/Safari\/([\d.]+)/),h=a.match(/OPR\/([\d.]+)/);return c&&(b.webkit=parseFloat(c[1])),d&&(b.chrome=parseFloat(d[1])),e&&(b.ie=parseFloat(e[1])),f&&(b.firefox=parseFloat(f[1])),g&&(b.safari=parseFloat(g[1])),h&&(b.opera=parseFloat(h[1])),b}(navigator.userAgent),os:function(a){var b={},c=a.match(/(?:Android);?[\s\/]+([\d.]+)?/),d=a.match(/(?:iPad|iPod|iPhone).*OS\s([\d_]+)/);return c&&(b.android=parseFloat(c[1])),d&&(b.ios=parseFloat(d[1].replace(/_/g,"."))),b}(navigator.userAgent),inherits:function(a,c,d){var e;return"function"==typeof c?(e=c,c=null):e=c&&c.hasOwnProperty("constructor")?c.constructor:function(){return a.apply(this,arguments)},b.extend(!0,e,a,d||{}),e.__super__=a.prototype,e.prototype=f(a.prototype),c&&b.extend(!0,e.prototype,c),e},noop:g,bindFn:e,log:function(){return a.console?e(console.log,console):g}(),nextTick:function(){return function(a){setTimeout(a,1)}}(),slice:d([].slice),guid:function(){var a=0;return function(b){for(var c=(+new Date).toString(32),d=0;5>d;d++)c+=Math.floor(65535*Math.random()).toString(32);return(b||"wu_")+c+(a++).toString(32)}}(),formatSize:function(a,b,c){var d;for(c=c||["B","K","M","G","TB"];(d=c.shift())&&a>1024;)a/=1024;return("B"===d?a:a.toFixed(b||2))+d}}}),b("mediator",["base"],function(a){function b(a,b,c,d){return f.grep(a,function(a){return!(!a||b&&a.e!==b||c&&a.cb!==c&&a.cb._cb!==c||d&&a.ctx!==d)})}function c(a,b,c){f.each((a||"").split(h),function(a,d){c(d,b)})}function d(a,b){for(var c,d=!1,e=-1,f=a.length;++e1?void(d.isPlainObject(b)&&d.isPlainObject(c[a])?d.extend(c[a],b):c[a]=b):a?c[a]:c},getStats:function(){var a=this.request("get-stats");return a?{successNum:a.numOfSuccess,progressNum:a.numOfProgress,cancelNum:a.numOfCancel,invalidNum:a.numOfInvalid,uploadFailNum:a.numOfUploadFailed,queueNum:a.numOfQueue,interruptNum:a.numofInterrupt}:{}},trigger:function(a){var c=[].slice.call(arguments,1),e=this.options,f="on"+a.substring(0,1).toUpperCase()+a.substring(1);return b.trigger.apply(this,arguments)===!1||d.isFunction(e[f])&&e[f].apply(this,c)===!1||d.isFunction(this[f])&&this[f].apply(this,c)===!1||b.trigger.apply(b,[this,a].concat(c))===!1?!1:!0},destroy:function(){this.request("destroy",arguments),this.off()},request:a.noop}),a.create=c.create=function(a){return new c(a)},a.Uploader=c,c}),b("runtime/runtime",["base","mediator"],function(a,b){function c(b){this.options=d.extend({container:document.body},b),this.uid=a.guid("rt_")}var d=a.$,e={},f=function(a){for(var b in a)if(a.hasOwnProperty(b))return b;return null};return d.extend(c.prototype,{getContainer:function(){var a,b,c=this.options;return this._container?this._container:(a=d(c.container||document.body),b=d(document.createElement("div")),b.attr("id","rt_"+this.uid),b.css({position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.append(b),a.addClass("webuploader-container"),this._container=b,this._parent=a,b)},init:a.noop,exec:a.noop,destroy:function(){this._container&&this._container.remove(),this._parent&&this._parent.removeClass("webuploader-container"),this.off()}}),c.orders="html5,flash",c.addRuntime=function(a,b){e[a]=b},c.hasRuntime=function(a){return!!(a?e[a]:f(e))},c.create=function(a,b){var g,h;if(b=b||c.orders,d.each(b.split(/\s*,\s*/g),function(){return e[this]?(g=this,!1):void 0}),g=g||f(e),!g)throw new Error("Runtime Error");return h=new e[g](a)},b.installTo(c.prototype),c}),b("runtime/client",["base","mediator","runtime/runtime"],function(a,b,c){function d(b,d){var f,g=a.Deferred();this.uid=a.guid("client_"),this.runtimeReady=function(a){return g.done(a)},this.connectRuntime=function(b,h){if(f)throw new Error("already connected!");return g.done(h),"string"==typeof b&&e.get(b)&&(f=e.get(b)),f=f||e.get(null,d),f?(a.$.extend(f.options,b),f.__promise.then(g.resolve),f.__client++):(f=c.create(b,b.runtimeOrder),f.__promise=g.promise(),f.once("ready",g.resolve),f.init(),e.add(f),f.__client=1),d&&(f.__standalone=d),f},this.getRuntime=function(){return f},this.disconnectRuntime=function(){f&&(f.__client--,f.__client<=0&&(e.remove(f),delete f.__promise,f.destroy()),f=null)},this.exec=function(){if(f){var c=a.slice(arguments);return b&&c.unshift(b),f.exec.apply(this,c)}},this.getRuid=function(){return f&&f.uid},this.destroy=function(a){return function(){a&&a.apply(this,arguments),this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()}}(this.destroy)}var e;return e=function(){var a={};return{add:function(b){a[b.uid]=b},get:function(b,c){var d;if(b)return a[b];for(d in a)if(!c||!a[d].__standalone)return a[d];return null},remove:function(b){delete a[b.uid]}}}(),b.installTo(d.prototype),d}),b("lib/dnd",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},d.options,a),a.container=e(a.container),a.container.length&&c.call(this,"DragAndDrop")}var e=a.$;return d.options={accept:null,disableGlobalDnd:!1},a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/widget",["base","uploader"],function(a,b){function c(a){if(!a)return!1;var b=a.length,c=e.type(a);return 1===a.nodeType&&b?!0:"array"===c||"function"!==c&&"string"!==c&&(0===b||"number"==typeof b&&b>0&&b-1 in a)}function d(a){this.owner=a,this.options=a.options}var e=a.$,f=b.prototype._init,g=b.prototype.destroy,h={},i=[];return e.extend(d.prototype,{init:a.noop,invoke:function(a,b){var c=this.responseMap;return c&&a in c&&c[a]in this&&e.isFunction(this[c[a]])?this[c[a]].apply(this,b):h},request:function(){return this.owner.request.apply(this.owner,arguments)}}),e.extend(b.prototype,{_init:function(){var a=this,b=a._widgets=[],c=a.options.disableWidgets||"";return e.each(i,function(d,e){(!c||!~c.indexOf(e._name))&&b.push(new e(a))}),f.apply(a,arguments)},request:function(b,d,e){var f,g,i,j,k=0,l=this._widgets,m=l&&l.length,n=[],o=[];for(d=c(d)?d:[d];m>k;k++)f=l[k],g=f.invoke(b,d),g!==h&&(a.isPromise(g)?o.push(g):n.push(g));return e||o.length?(i=a.when.apply(a,o),j=i.pipe?"pipe":"then",i[j](function(){var b=a.Deferred(),c=arguments;return 1===c.length&&(c=c[0]),setTimeout(function(){b.resolve(c)},1),b.promise()})[e?j:"done"](e||a.noop)):n[0]},destroy:function(){g.apply(this,arguments),this._widgets=null}}),b.register=d.register=function(b,c){var f,g={init:"init",destroy:"destroy",name:"anonymous"};return 1===arguments.length?(c=b,e.each(c,function(a){return"_"===a[0]||"name"===a?void("name"===a&&(g.name=c.name)):void(g[a.replace(/[A-Z]/g,"-$&").toLowerCase()]=a)})):g=e.extend(g,b),c.responseMap=g,f=a.inherits(d,c),f._name=g.name,i.push(f),f},b.unRegister=d.unRegister=function(a){if(a&&"anonymous"!==a)for(var b=i.length;b--;)i[b]._name===a&&i.splice(b,1)},d}),b("widgets/filednd",["base","uploader","lib/dnd","widgets/widget"],function(a,b,c){var d=a.$;return b.options.dnd="",b.register({name:"dnd",init:function(b){if(b.dnd&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{disableGlobalDnd:b.disableGlobalDnd,container:b.dnd,accept:b.accept});return this.dnd=e=new c(h),e.once("ready",g.resolve),e.on("drop",function(a){f.request("add-file",[a])}),e.on("accept",function(a){return f.owner.trigger("dndAccept",a)}),e.init(),g.promise()}},destroy:function(){this.dnd&&this.dnd.destroy()}})}),b("lib/filepaste",["base","mediator","runtime/client"],function(a,b,c){function d(a){a=this.options=e.extend({},a),a.container=e(a.container||document.body),c.call(this,"FilePaste")}var e=a.$;return a.inherits(c,{constructor:d,init:function(){var a=this;a.connectRuntime(a.options,function(){a.exec("init"),a.trigger("ready")})}}),b.installTo(d.prototype),d}),b("widgets/filepaste",["base","uploader","lib/filepaste","widgets/widget"],function(a,b,c){var d=a.$;return b.register({name:"paste",init:function(b){if(b.paste&&"html5"===this.request("predict-runtime-type")){var e,f=this,g=a.Deferred(),h=d.extend({},{container:b.paste,accept:b.accept});return this.paste=e=new c(h),e.once("ready",g.resolve),e.on("paste",function(a){f.owner.request("add-file",[a])}),e.init(),g.promise()}},destroy:function(){this.paste&&this.paste.destroy()}})}),b("lib/blob",["base","runtime/client"],function(a,b){function c(a,c){var d=this;d.source=c,d.ruid=a,this.size=c.size||0,this.type=!c.type&&this.ext&&~"jpg,jpeg,png,gif,bmp".indexOf(this.ext)?"image/"+("jpg"===this.ext?"jpeg":this.ext):c.type||"application/octet-stream",b.call(d,"Blob"),this.uid=c.uid||this.uid,a&&d.connectRuntime(a)}return a.inherits(b,{constructor:c,slice:function(a,b){return this.exec("slice",a,b)},getSource:function(){return this.source}}),c}),b("lib/file",["base","lib/blob"],function(a,b){function c(a,c){var f;this.name=c.name||"untitled"+d++,f=e.exec(c.name)?RegExp.$1.toLowerCase():"",!f&&c.type&&(f=/\/(jpg|jpeg|png|gif|bmp)$/i.exec(c.type)?RegExp.$1.toLowerCase():"",this.name+="."+f),this.ext=f,this.lastModifiedDate=c.lastModifiedDate||(new Date).toLocaleString(),b.apply(this,arguments)}var d=1,e=/\.([^.]+)$/;return a.inherits(b,c)}),b("lib/filepicker",["base","runtime/client","lib/file"],function(b,c,d){function e(a){if(a=this.options=f.extend({},e.options,a),a.container=f(a.id),!a.container.length)throw new Error("鎸夐挳鎸囧畾閿欒");a.innerHTML=a.innerHTML||a.label||a.container.html()||"",a.button=f(a.button||document.createElement("div")),a.button.html(a.innerHTML),a.container.html(a.button),c.call(this,"FilePicker",!0)}var f=b.$;return e.options={button:null,container:null,label:null,innerHTML:null,multiple:!0,accept:null,name:"file"},b.inherits(c,{constructor:e,init:function(){var c=this,e=c.options,g=e.button;g.addClass("webuploader-pick"),c.on("all",function(a){var b;switch(a){case"mouseenter":g.addClass("webuploader-pick-hover");break;case"mouseleave":g.removeClass("webuploader-pick-hover");break;case"change":b=c.exec("getFiles"),c.trigger("select",f.map(b,function(a){return a=new d(c.getRuid(),a),a._refer=e.container,a}),e.container)}}),c.connectRuntime(e,function(){c.refresh(),c.exec("init",e),c.trigger("ready")}),this._resizeHandler=b.bindFn(this.refresh,this),f(a).on("resize",this._resizeHandler)},refresh:function(){var a=this.getRuntime().getContainer(),b=this.options.button,c=b.outerWidth?b.outerWidth():b.width(),d=b.outerHeight?b.outerHeight():b.height(),e=b.offset();c&&d&&a.css({bottom:"auto",right:"auto",width:c+"px",height:d+"px"}).offset(e)},enable:function(){var a=this.options.button;a.removeClass("webuploader-pick-disable"),this.refresh()},disable:function(){var a=this.options.button;this.getRuntime().getContainer().css({top:"-99999px"}),a.addClass("webuploader-pick-disable")},destroy:function(){var b=this.options.button;f(a).off("resize",this._resizeHandler),b.removeClass("webuploader-pick-disable webuploader-pick-hover webuploader-pick")}}),e}),b("widgets/filepicker",["base","uploader","lib/filepicker","widgets/widget"],function(a,b,c){var d=a.$;return d.extend(b.options,{pick:null,accept:null}),b.register({name:"picker",init:function(a){return this.pickers=[],a.pick&&this.addBtn(a.pick)},refresh:function(){d.each(this.pickers,function(){this.refresh()})},addBtn:function(b){var e=this,f=e.options,g=f.accept,h=[];if(b)return d.isPlainObject(b)||(b={id:b}),d(b.id).each(function(){var i,j,k;k=a.Deferred(),i=d.extend({},b,{accept:d.isPlainObject(g)?[g]:g,swf:f.swf,runtimeOrder:f.runtimeOrder,id:this}),j=new c(i),j.once("ready",k.resolve),j.on("select",function(a){e.owner.request("add-file",[a])}),j.init(),e.pickers.push(j),h.push(k.promise())}),a.when.apply(a,h)},disable:function(){d.each(this.pickers,function(){this.disable()})},enable:function(){d.each(this.pickers,function(){this.enable()})},destroy:function(){d.each(this.pickers,function(){this.destroy()}),this.pickers=null}})}),b("file",["base","mediator"],function(a,b){function c(){return f+g++}function d(a){this.name=a.name||"Untitled",this.size=a.size||0,this.type=a.type||"application/octet-stream",this.lastModifiedDate=a.lastModifiedDate||1*new Date,this.id=c(),this.ext=h.exec(this.name)?RegExp.$1:"",this.statusText="",i[this.id]=d.Status.INITED,this.source=a,this.loaded=0,this.on("error",function(a){this.setStatus(d.Status.ERROR,a)})}var e=a.$,f="WU_FILE_",g=0,h=/\.([^.]+)$/,i={};return e.extend(d.prototype,{setStatus:function(a,b){var c=i[this.id];"undefined"!=typeof b&&(this.statusText=b),a!==c&&(i[this.id]=a,this.trigger("statuschange",a,c))},getStatus:function(){return i[this.id]},getSource:function(){return this.source},destroy:function(){this.off(),delete i[this.id]}}),b.installTo(d.prototype),d.Status={INITED:"inited",QUEUED:"queued",PROGRESS:"progress",ERROR:"error",COMPLETE:"complete",CANCELLED:"cancelled",INTERRUPT:"interrupt",INVALID:"invalid"},d}),b("queue",["base","mediator","file"],function(a,b,c){function d(){this.stats={numOfQueue:0,numOfSuccess:0,numOfCancel:0,numOfProgress:0,numOfUploadFailed:0,numOfInvalid:0,numofDeleted:0,numofInterrupt:0},this._queue=[],this._map={}}var e=a.$,f=c.Status;return e.extend(d.prototype,{append:function(a){return this._queue.push(a),this._fileAdded(a),this},prepend:function(a){return this._queue.unshift(a),this._fileAdded(a),this},getFile:function(a){return"string"!=typeof a?a:this._map[a]},fetch:function(a){var b,c,d=this._queue.length;for(a=a||f.QUEUED,b=0;d>b;b++)if(c=this._queue[b],a===c.getStatus())return c;return null},sort:function(a){"function"==typeof a&&this._queue.sort(a)},getFiles:function(){for(var a,b=[].slice.call(arguments,0),c=[],d=0,f=this._queue.length;f>d;d++)a=this._queue[d],(!b.length||~e.inArray(a.getStatus(),b))&&c.push(a);return c},removeFile:function(a){var b=this._map[a.id];b&&(delete this._map[a.id],a.destroy(),this.stats.numofDeleted++)},_fileAdded:function(a){var b=this,c=this._map[a.id];c||(this._map[a.id]=a,a.on("statuschange",function(a,c){b._onFileStatusChange(a,c)}))},_onFileStatusChange:function(a,b){var c=this.stats;switch(b){case f.PROGRESS:c.numOfProgress--;break;case f.QUEUED:c.numOfQueue--;break;case f.ERROR:c.numOfUploadFailed--;break;case f.INVALID:c.numOfInvalid--;break;case f.INTERRUPT:c.numofInterrupt--}switch(a){case f.QUEUED:c.numOfQueue++;break;case f.PROGRESS:c.numOfProgress++;break;case f.ERROR:c.numOfUploadFailed++;break;case f.COMPLETE:c.numOfSuccess++;break;case f.CANCELLED:c.numOfCancel++;break;case f.INVALID:c.numOfInvalid++;break;case f.INTERRUPT:c.numofInterrupt++}}}),b.installTo(d.prototype),d}),b("widgets/queue",["base","uploader","queue","file","lib/file","runtime/client","widgets/widget"],function(a,b,c,d,e,f){var g=a.$,h=/\.\w+$/,i=d.Status;return b.register({name:"queue",init:function(b){var d,e,h,i,j,k,l,m=this;if(g.isPlainObject(b.accept)&&(b.accept=[b.accept]),b.accept){for(j=[],h=0,e=b.accept.length;e>h;h++)i=b.accept[h].extensions,i&&j.push(i);j.length&&(k="\\."+j.join(",").replace(/,/g,"$|\\.").replace(/\*/g,".*")+"$"),m.accept=new RegExp(k,"i")}return m.queue=new c,m.stats=m.queue.stats,"html5"===this.request("predict-runtime-type")?(d=a.Deferred(),this.placeholder=l=new f("Placeholder"),l.connectRuntime({runtimeOrder:"html5"},function(){m._ruid=l.getRuid(),d.resolve()}),d.promise()):void 0},_wrapFile:function(a){if(!(a instanceof d)){if(!(a instanceof e)){if(!this._ruid)throw new Error("Can't add external files.");a=new e(this._ruid,a)}a=new d(a)}return a},acceptFile:function(a){var b=!a||!a.size||this.accept&&h.exec(a.name)&&!this.accept.test(a.name);return!b},_addFile:function(a){var b=this;return a=b._wrapFile(a),b.owner.trigger("beforeFileQueued",a)?b.acceptFile(a)?(b.queue.append(a),b.owner.trigger("fileQueued",a),a):void b.owner.trigger("error","Q_TYPE_DENIED",a):void 0},getFile:function(a){return this.queue.getFile(a)},addFile:function(a){var b=this;a.length||(a=[a]),a=g.map(a,function(a){return b._addFile(a)}),b.owner.trigger("filesQueued",a),b.options.auto&&setTimeout(function(){b.request("start-upload")},20)},getStats:function(){return this.stats},removeFile:function(a,b){var c=this;a=a.id?a:c.queue.getFile(a),this.request("cancel-file",a),b&&this.queue.removeFile(a)},getFiles:function(){return this.queue.getFiles.apply(this.queue,arguments)},fetchFile:function(){return this.queue.fetch.apply(this.queue,arguments)},retry:function(a,b){var c,d,e,f=this;if(a)return a=a.id?a:f.queue.getFile(a),a.setStatus(i.QUEUED),void(b||f.request("start-upload"));for(c=f.queue.getFiles(i.ERROR),d=0,e=c.length;e>d;d++)a=c[d],a.setStatus(i.QUEUED);f.request("start-upload")},sortFiles:function(){return this.queue.sort.apply(this.queue,arguments)},reset:function(){this.owner.trigger("reset"),this.queue=new c,this.stats=this.queue.stats},destroy:function(){this.reset(),this.placeholder&&this.placeholder.destroy()}})}),b("widgets/runtime",["uploader","runtime/runtime","widgets/widget"],function(a,b){return a.support=function(){return b.hasRuntime.apply(b,arguments)},a.register({name:"runtime",init:function(){if(!this.predictRuntimeType())throw Error("Runtime Error")},predictRuntimeType:function(){var a,c,d=this.options.runtimeOrder||b.orders,e=this.type;if(!e)for(d=d.split(/\s*,\s*/g),a=0,c=d.length;c>a;a++)if(b.hasRuntime(d[a])){this.type=e=d[a];break}return e}})}),b("lib/transport",["base","runtime/client","mediator"],function(a,b,c){function d(a){var c=this;a=c.options=e.extend(!0,{},d.options,a||{}),b.call(this,"Transport"),this._blob=null,this._formData=a.formData||{},this._headers=a.headers||{},this.on("progress",this._timeout),this.on("load error",function(){c.trigger("progress",1),clearTimeout(c._timer)})}var e=a.$;return d.options={server:"",method:"POST",withCredentials:!1,fileVal:"file",timeout:12e4,formData:{},headers:{},sendAsBinary:!1},e.extend(d.prototype,{appendBlob:function(a,b,c){var d=this,e=d.options;d.getRuid()&&d.disconnectRuntime(),d.connectRuntime(b.ruid,function(){d.exec("init")}),d._blob=b,e.fileVal=a||e.fileVal,e.filename=c||e.filename},append:function(a,b){"object"==typeof a?e.extend(this._formData,a):this._formData[a]=b},setRequestHeader:function(a,b){"object"==typeof a?e.extend(this._headers,a):this._headers[a]=b},send:function(a){this.exec("send",a),this._timeout()},abort:function(){return clearTimeout(this._timer),this.exec("abort")},destroy:function(){this.trigger("destroy"),this.off(),this.exec("destroy"),this.disconnectRuntime()},getResponse:function(){return this.exec("getResponse")},getResponseAsJson:function(){return this.exec("getResponseAsJson")},getStatus:function(){return this.exec("getStatus")},_timeout:function(){var a=this,b=a.options.timeout;b&&(clearTimeout(a._timer),a._timer=setTimeout(function(){a.abort(),a.trigger("error","timeout")},b))}}),c.installTo(d.prototype),d}),b("widgets/upload",["base","uploader","file","lib/transport","widgets/widget"],function(a,b,c,d){function e(a,b){var c,d,e=[],f=a.source,g=f.size,h=b?Math.ceil(g/b):1,i=0,j=0;for(d={file:a,has:function(){return!!e.length},shift:function(){return e.shift()},unshift:function(a){e.unshift(a)}};h>j;)c=Math.min(b,g-i),e.push({file:a,start:i,end:b?i+c:g,total:g,chunks:h,chunk:j++,cuted:d}),i+=c;return a.blocks=e.concat(),a.remaning=e.length,d}var f=a.$,g=a.isPromise,h=c.Status;f.extend(b.options,{prepareNextFile:!1,chunked:!1,chunkSize:5242880,chunkRetry:2,threads:3,formData:{}}),b.register({name:"upload",init:function(){var b=this.owner,c=this;this.runing=!1,this.progress=!1,b.on("startUpload",function(){c.progress=!0}).on("uploadFinished",function(){c.progress=!1}),this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this.__tick=a.bindFn(this._tick,this),b.on("uploadComplete",function(a){a.blocks&&f.each(a.blocks,function(a,b){b.transport&&(b.transport.abort(),b.transport.destroy()),delete b.transport}),delete a.blocks,delete a.remaning})},reset:function(){this.request("stop-upload",!0),this.runing=!1,this.pool=[],this.stack=[],this.pending=[],this.remaning=0,this._trigged=!1,this._promise=null},startUpload:function(b){var c=this;if(f.each(c.request("get-files",h.INVALID),function(){c.request("remove-file",this)}),b)if(b=b.id?b:c.request("get-file",b),b.getStatus()===h.INTERRUPT)f.each(c.pool,function(a,c){c.file===b&&c.transport&&c.transport.send()}),b.setStatus(h.QUEUED);else{if(b.getStatus()===h.PROGRESS)return;b.setStatus(h.QUEUED)}else f.each(c.request("get-files",[h.INITED]),function(){this.setStatus(h.QUEUED)});c.runing||(c.runing=!0,f.each(c.pool,function(a,b){var d=b.file;d.getStatus()===h.INTERRUPT&&(d.setStatus(h.PROGRESS),c._trigged=!1,b.transport&&b.transport.send())}),b||f.each(c.request("get-files",h.INTERRUPT),function(){this.setStatus(h.PROGRESS)}),c._trigged=!1,a.nextTick(c.__tick),c.owner.trigger("startUpload"))},stopUpload:function(b,c){var d=this;if(b===!0&&(c=b,b=null),d.runing!==!1){if(b){if(b=b.id?b:d.request("get-file",b),b.getStatus()!==h.PROGRESS&&b.getStatus()!==h.QUEUED)return;return b.setStatus(h.INTERRUPT),f.each(d.pool,function(a,c){c.file===b&&(c.transport&&c.transport.abort(),d._putback(c),d._popBlock(c))}),a.nextTick(d.__tick)}d.runing=!1,this._promise&&this._promise.file&&this._promise.file.setStatus(h.INTERRUPT),c&&f.each(d.pool,function(a,b){b.transport&&b.transport.abort(),b.file.setStatus(h.INTERRUPT)}),d.owner.trigger("stopUpload")}},cancelFile:function(a){a=a.id?a:this.request("get-file",a),a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),a.setStatus(h.CANCELLED),this.owner.trigger("fileDequeued",a)},isInProgress:function(){return!!this.progress},_getStats:function(){return this.request("get-stats")},skipFile:function(a,b){a=a.id?a:this.request("get-file",a),a.setStatus(b||h.COMPLETE),a.skipped=!0,a.blocks&&f.each(a.blocks,function(a,b){var c=b.transport;c&&(c.abort(),c.destroy(),delete b.transport)}),this.owner.trigger("uploadSkip",a)},_tick:function(){var b,c,d=this,e=d.options;return d._promise?d._promise.always(d.__tick):void(d.pool.length1&&(f.each(k.blocks,function(a,b){d+=(b.percentage||0)*(b.end-b.start)}),c=d/k.size),i.trigger("uploadProgress",k,c||0)}),c=function(a){var c;return e=l.getResponseAsJson()||{},e._raw=l.getResponse(),c=function(b){a=b},i.trigger("uploadAccept",b,e,c)||(a=a||"server"),a},l.on("error",function(a,d){b.retried=b.retried||0,b.chunks>1&&~"http,abort".indexOf(a)&&b.retried1&&f.extend(m,{chunks:b.chunks,chunk:b.chunk}),i.trigger("uploadBeforeSend",b,m,n),l.appendBlob(j.fileVal,b.blob,k.name),l.append(m),l.setRequestHeader(n),l.send()},_finishFile:function(a,b,c){var d=this.owner;return d.request("after-send-file",arguments,function(){a.setStatus(h.COMPLETE),d.trigger("uploadSuccess",a,b,c)}).fail(function(b){a.getStatus()===h.PROGRESS&&a.setStatus(h.ERROR,b),d.trigger("uploadError",a,b)}).always(function(){d.trigger("uploadComplete",a)})}})}),b("widgets/validator",["base","uploader","file","widgets/widget"],function(a,b,c){var d,e=a.$,f={};return d={addValidator:function(a,b){f[a]=b},removeValidator:function(a){delete f[a]}},b.register({name:"validator",init:function(){var b=this;a.nextTick(function(){e.each(f,function(){this.call(b.owner)})})}}),d.addValidator("fileNumLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileNumLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){return c>=d&&e&&(e=!1,this.trigger("error","Q_EXCEED_NUM_LIMIT",d,a),setTimeout(function(){e=!0},1)),c>=d?!1:!0}),a.on("fileQueued",function(){c++}),a.on("fileDequeued",function(){c--}),a.on("reset",function(){c=0}))}),d.addValidator("fileSizeLimit",function(){var a=this,b=a.options,c=0,d=parseInt(b.fileSizeLimit,10),e=!0;d&&(a.on("beforeFileQueued",function(a){var b=c+a.size>d;return b&&e&&(e=!1,this.trigger("error","Q_EXCEED_SIZE_LIMIT",d,a),setTimeout(function(){e=!0},1)),b?!1:!0}),a.on("fileQueued",function(a){c+=a.size}),a.on("fileDequeued",function(a){c-=a.size}),a.on("reset",function(){c=0}))}),d.addValidator("fileSingleSizeLimit",function(){var a=this,b=a.options,d=b.fileSingleSizeLimit;d&&a.on("beforeFileQueued",function(a){return a.size>d?(a.setStatus(c.Status.INVALID,"exceed_size"),this.trigger("error","F_EXCEED_SIZE",d,a),!1):void 0})}),d.addValidator("duplicate",function(){function a(a){for(var b,c=0,d=0,e=a.length;e>d;d++)b=a.charCodeAt(d),c=b+(c<<6)+(c<<16)-c;return c}var b=this,c=b.options,d={};c.duplicate||(b.on("beforeFileQueued",function(b){var c=b.__hash||(b.__hash=a(b.name+b.size+b.lastModifiedDate));return d[c]?(this.trigger("error","F_DUPLICATE",b),!1):void 0}),b.on("fileQueued",function(a){var b=a.__hash;b&&(d[b]=!0)}),b.on("fileDequeued",function(a){var b=a.__hash;b&&delete d[b]}),b.on("reset",function(){d={}}))}),d}),b("runtime/compbase",[],function(){function a(a,b){this.owner=a,this.options=a.options,this.getRuntime=function(){return b},this.getRuid=function(){return b.uid},this.trigger=function(){return a.trigger.apply(a,arguments)}}return a}),b("runtime/html5/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a={},d=this,e=this.destroy;c.apply(d,arguments),d.type=f,d.exec=function(c,e){var f,h=this,i=h.uid,j=b.slice(arguments,2);return g[c]&&(f=a[i]=a[i]||new g[c](h,d),f[e])?f[e].apply(f,j):void 0},d.destroy=function(){return e&&e.apply(this,arguments)}}var f="html5",g={};return b.inherits(c,{constructor:e,init:function(){var a=this;setTimeout(function(){a.trigger("ready")},1)}}),e.register=function(a,c){var e=g[a]=b.inherits(d,c);return e},a.Blob&&a.FileReader&&a.DataView&&c.addRuntime(f,e),e}),b("runtime/html5/blob",["runtime/html5/runtime","lib/blob"],function(a,b){return a.register("Blob",{slice:function(a,c){var d=this.owner.source,e=d.slice||d.webkitSlice||d.mozSlice; +return d=e.call(d,a,c),new b(this.getRuid(),d)}})}),b("runtime/html5/dnd",["base","runtime/html5/runtime","lib/file"],function(a,b,c){var d=a.$,e="webuploader-dnd-";return b.register("DragAndDrop",{init:function(){var b=this.elem=this.options.container;this.dragEnterHandler=a.bindFn(this._dragEnterHandler,this),this.dragOverHandler=a.bindFn(this._dragOverHandler,this),this.dragLeaveHandler=a.bindFn(this._dragLeaveHandler,this),this.dropHandler=a.bindFn(this._dropHandler,this),this.dndOver=!1,b.on("dragenter",this.dragEnterHandler),b.on("dragover",this.dragOverHandler),b.on("dragleave",this.dragLeaveHandler),b.on("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).on("dragover",this.dragOverHandler),d(document).on("drop",this.dropHandler))},_dragEnterHandler:function(a){var b,c=this,d=c._denied||!1;return a=a.originalEvent||a,c.dndOver||(c.dndOver=!0,b=a.dataTransfer.items,b&&b.length&&(c._denied=d=!c.trigger("accept",b)),c.elem.addClass(e+"over"),c.elem[d?"addClass":"removeClass"](e+"denied")),a.dataTransfer.dropEffect=d?"none":"copy",!1},_dragOverHandler:function(a){var b=this.elem.parent().get(0);return b&&!d.contains(b,a.currentTarget)?!1:(clearTimeout(this._leaveTimer),this._dragEnterHandler.call(this,a),!1)},_dragLeaveHandler:function(){var a,b=this;return a=function(){b.dndOver=!1,b.elem.removeClass(e+"over "+e+"denied")},clearTimeout(b._leaveTimer),b._leaveTimer=setTimeout(a,100),!1},_dropHandler:function(a){var b,f,g=this,h=g.getRuid(),i=g.elem.parent().get(0);if(i&&!d.contains(i,a.currentTarget))return!1;a=a.originalEvent||a,b=a.dataTransfer;try{f=b.getData("text/html")}catch(j){}return f?void 0:(g._getTansferFiles(b,function(a){g.trigger("drop",d.map(a,function(a){return new c(h,a)}))}),g.dndOver=!1,g.elem.removeClass(e+"over"),!1)},_getTansferFiles:function(b,c){var d,e,f,g,h,i,j,k=[],l=[];for(d=b.items,e=b.files,j=!(!d||!d[0].webkitGetAsEntry),h=0,i=e.length;i>h;h++)f=e[h],g=d&&d[h],j&&g.webkitGetAsEntry().isDirectory?l.push(this._traverseDirectoryTree(g.webkitGetAsEntry(),k)):k.push(f);a.when.apply(a,l).done(function(){k.length&&c(k)})},_traverseDirectoryTree:function(b,c){var d=a.Deferred(),e=this;return b.isFile?b.file(function(a){c.push(a),d.resolve()}):b.isDirectory&&b.createReader().readEntries(function(b){var f,g=b.length,h=[],i=[];for(f=0;g>f;f++)h.push(e._traverseDirectoryTree(b[f],i));a.when.apply(a,h).then(function(){c.push.apply(c,i),d.resolve()},d.reject)}),d.promise()},destroy:function(){var a=this.elem;a&&(a.off("dragenter",this.dragEnterHandler),a.off("dragover",this.dragOverHandler),a.off("dragleave",this.dragLeaveHandler),a.off("drop",this.dropHandler),this.options.disableGlobalDnd&&(d(document).off("dragover",this.dragOverHandler),d(document).off("drop",this.dropHandler)))}})}),b("runtime/html5/filepaste",["base","runtime/html5/runtime","lib/file"],function(a,b,c){return b.register("FilePaste",{init:function(){var b,c,d,e,f=this.options,g=this.elem=f.container,h=".*";if(f.accept){for(b=[],c=0,d=f.accept.length;d>c;c++)e=f.accept[c].mimeTypes,e&&b.push(e);b.length&&(h=b.join(","),h=h.replace(/,/g,"|").replace(/\*/g,".*"))}this.accept=h=new RegExp(h,"i"),this.hander=a.bindFn(this._pasteHander,this),g.on("paste",this.hander)},_pasteHander:function(a){var b,d,e,f,g,h=[],i=this.getRuid();for(a=a.originalEvent||a,b=a.clipboardData.items,f=0,g=b.length;g>f;f++)d=b[f],"file"===d.kind&&(e=d.getAsFile())&&h.push(new c(i,e));h.length&&(a.preventDefault(),a.stopPropagation(),this.trigger("paste",h))},destroy:function(){this.elem.off("paste",this.hander)}})}),b("runtime/html5/filepicker",["base","runtime/html5/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(){var a,b,d,e,f=this.getRuntime().getContainer(),g=this,h=g.owner,i=g.options,j=this.label=c(document.createElement("label")),k=this.input=c(document.createElement("input"));if(k.attr("type","file"),k.attr("name",i.name),k.addClass("webuploader-element-invisible"),j.on("click",function(){k.trigger("click")}),j.css({opacity:0,width:"100%",height:"100%",display:"block",cursor:"pointer",background:"#ffffff"}),i.multiple&&k.attr("multiple","multiple"),i.accept&&i.accept.length>0){for(a=[],b=0,d=i.accept.length;d>b;b++)a.push(i.accept[b].mimeTypes);k.attr("accept",a.join(","))}f.append(k),f.append(j),e=function(a){h.trigger(a.type)},k.on("change",function(a){var b,d=arguments.callee;g.files=a.target.files,b=this.cloneNode(!0),b.value=null,this.parentNode.replaceChild(b,this),k.off(),k=c(b).on("change",d).on("mouseenter mouseleave",e),h.trigger("change")}),j.on("mouseenter mouseleave",e)},getFiles:function(){return this.files},destroy:function(){this.input.off(),this.label.off()}})}),b("runtime/html5/transport",["base","runtime/html5/runtime"],function(a,b){var c=a.noop,d=a.$;return b.register("Transport",{init:function(){this._status=0,this._response=null},send:function(){var b,c,e,f=this.owner,g=this.options,h=this._initAjax(),i=f._blob,j=g.server;g.sendAsBinary?(j+=(/\?/.test(j)?"&":"?")+d.param(f._formData),c=i.getSource()):(b=new FormData,d.each(f._formData,function(a,c){b.append(a,c)}),b.append(g.fileVal,i.getSource(),g.filename||f._formData.name||"")),g.withCredentials&&"withCredentials"in h?(h.open(g.method,j,!0),h.withCredentials=!0):h.open(g.method,j),this._setRequestHeader(h,g.headers),c?(h.overrideMimeType&&h.overrideMimeType("application/octet-stream"),a.os.android?(e=new FileReader,e.onload=function(){h.send(this.result),e=e.onload=null},e.readAsArrayBuffer(c)):h.send(c)):h.send(b)},getResponse:function(){return this._response},getResponseAsJson:function(){return this._parseJson(this._response)},getStatus:function(){return this._status},abort:function(){var a=this._xhr;a&&(a.upload.onprogress=c,a.onreadystatechange=c,a.abort(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var a=this,b=new XMLHttpRequest,d=this.options;return!d.withCredentials||"withCredentials"in b||"undefined"==typeof XDomainRequest||(b=new XDomainRequest),b.upload.onprogress=function(b){var c=0;return b.lengthComputable&&(c=b.loaded/b.total),a.trigger("progress",c)},b.onreadystatechange=function(){return 4===b.readyState?(b.upload.onprogress=c,b.onreadystatechange=c,a._xhr=null,a._status=b.status,b.status>=200&&b.status<300?(a._response=b.responseText,a.trigger("load")):b.status>=500&&b.status<600?(a._response=b.responseText,a.trigger("error","server")):a.trigger("error",a._status?"http":"abort")):void 0},a._xhr=b,b},_setRequestHeader:function(a,b){d.each(b,function(b,c){a.setRequestHeader(b,c)})},_parseJson:function(a){var b;try{b=JSON.parse(a)}catch(c){b={}}return b}})}),b("runtime/flash/runtime",["base","runtime/runtime","runtime/compbase"],function(b,c,d){function e(){var a;try{a=navigator.plugins["Shockwave Flash"],a=a.description}catch(b){try{a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(c){a="0.0"}}return a=a.match(/\d+/g),parseFloat(a[0]+"."+a[1],10)}function f(){function d(a,b){var c,d,e=a.type||a;c=e.split("::"),d=c[0],e=c[1],"Ready"===e&&d===j.uid?j.trigger("ready"):f[d]&&f[d].trigger(e.toLowerCase(),a,b)}var e={},f={},g=this.destroy,j=this,k=b.guid("webuploader_");c.apply(j,arguments),j.type=h,j.exec=function(a,c){var d,g=this,h=g.uid,k=b.slice(arguments,2);return f[h]=g,i[a]&&(e[h]||(e[h]=new i[a](g,j)),d=e[h],d[c])?d[c].apply(d,k):j.flashExec.apply(g,arguments)},a[k]=function(){var a=arguments;setTimeout(function(){d.apply(null,a)},1)},this.jsreciver=k,this.destroy=function(){return g&&g.apply(this,arguments)},this.flashExec=function(a,c){var d=j.getFlash(),e=b.slice(arguments,2);return d.exec(this.uid,a,c,e)}}var g=b.$,h="flash",i={};return b.inherits(c,{constructor:f,init:function(){var a,c=this.getContainer(),d=this.options;c.css({position:"absolute",top:"-8px",left:"-8px",width:"9px",height:"9px",overflow:"hidden"}),a='',c.html(a)},getFlash:function(){return this._flash?this._flash:(this._flash=g("#"+this.uid).get(0),this._flash)}}),f.register=function(a,c){return c=i[a]=b.inherits(d,g.extend({flashExec:function(){var a=this.owner,b=this.getRuntime();return b.flashExec.apply(a,arguments)}},c))},e()>=11.4&&c.addRuntime(h,f),f}),b("runtime/flash/filepicker",["base","runtime/flash/runtime"],function(a,b){var c=a.$;return b.register("FilePicker",{init:function(a){var b,d,e=c.extend({},a);for(b=e.accept&&e.accept.length,d=0;b>d;d++)e.accept[d].title||(e.accept[d].title="Files");delete e.button,delete e.id,delete e.container,this.flashExec("FilePicker","init",e)},destroy:function(){this.flashExec("FilePicker","destroy")}})}),b("runtime/flash/transport",["base","runtime/flash/runtime","runtime/client"],function(b,c,d){var e=b.$;return c.register("Transport",{init:function(){this._status=0,this._response=null,this._responseJson=null},send:function(){var a,b=this.owner,c=this.options,d=this._initAjax(),f=b._blob,g=c.server;d.connectRuntime(f.ruid),c.sendAsBinary?(g+=(/\?/.test(g)?"&":"?")+e.param(b._formData),a=f.uid):(e.each(b._formData,function(a,b){d.exec("append",a,b)}),d.exec("appendBlob",c.fileVal,f.uid,c.filename||b._formData.name||"")),this._setRequestHeader(d,c.headers),d.exec("send",{method:c.method,url:g,forceURLStream:c.forceURLStream,mimeType:"application/octet-stream"},a)},getStatus:function(){return this._status},getResponse:function(){return this._response||""},getResponseAsJson:function(){return this._responseJson},abort:function(){var a=this._xhr;a&&(a.exec("abort"),a.destroy(),this._xhr=a=null)},destroy:function(){this.abort()},_initAjax:function(){var b=this,c=new d("XMLHttpRequest");return c.on("uploadprogress progress",function(a){var c=a.loaded/a.total;return c=Math.min(1,Math.max(0,c)),b.trigger("progress",c)}),c.on("load",function(){var d,e=c.exec("getStatus"),f=!1,g="";return c.off(),b._xhr=null,e>=200&&300>e?f=!0:e>=500&&600>e?(f=!0,g="server"):g="http",f&&(b._response=c.exec("getResponse"),b._response=decodeURIComponent(b._response),d=a.JSON&&a.JSON.parse||function(a){try{return new Function("return "+a).call()}catch(b){return{}}},b._responseJson=b._response?d(b._response):{}),c.destroy(),c=null,g?b.trigger("error",g):b.trigger("load")}),c.on("error",function(){c.off(),b._xhr=null,b.trigger("error","http")}),b._xhr=c,c},_setRequestHeader:function(a,b){e.each(b,function(b,c){a.exec("setRequestHeader",b,c)})}})}),b("preset/withoutimage",["base","widgets/filednd","widgets/filepaste","widgets/filepicker","widgets/queue","widgets/runtime","widgets/upload","widgets/validator","runtime/html5/blob","runtime/html5/dnd","runtime/html5/filepaste","runtime/html5/filepicker","runtime/html5/transport","runtime/flash/filepicker","runtime/flash/transport"],function(a){return a}),b("webuploader",["preset/withoutimage"],function(a){return a}),c("webuploader")}); \ No newline at end of file diff --git a/WebContent/Frame/resources/include/ui/include_list.jspf b/WebContent/Frame/resources/include/ui/include_list.jspf index 566bbda87..98228b04a 100644 --- a/WebContent/Frame/resources/include/ui/include_list.jspf +++ b/WebContent/Frame/resources/include/ui/include_list.jspf @@ -33,7 +33,7 @@ function pageSizeChange(){ pagereload(checkText); } $(function(){ - var pagesize=[10,20,50,100,200,500,1000]; + var pagesize=[10,20,50,100,200,500,1000,1000000]; var options=""; var curpage="<%=pagesize%>"; var selected=""; diff --git a/WebContent/Frame/resources/js/base64.min.js b/WebContent/Frame/resources/js/base64.min.js new file mode 100644 index 000000000..0997a1f14 --- /dev/null +++ b/WebContent/Frame/resources/js/base64.min.js @@ -0,0 +1 @@ +(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory(global):typeof define==="function"&&define.amd?define(factory):factory(global)})(typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:this,function(global){"use strict";var _Base64=global.Base64;var version="2.4.3";var buffer;if(typeof module!=="undefined"&&module.exports){try{buffer=require("buffer").Buffer}catch(err){}}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64tab=function(bin){var t={};for(var i=0,l=bin.length;i>>6)+fromCharCode(128|cc&63):fromCharCode(224|cc>>>12&15)+fromCharCode(128|cc>>>6&63)+fromCharCode(128|cc&63)}else{var cc=65536+(c.charCodeAt(0)-55296)*1024+(c.charCodeAt(1)-56320);return fromCharCode(240|cc>>>18&7)+fromCharCode(128|cc>>>12&63)+fromCharCode(128|cc>>>6&63)+fromCharCode(128|cc&63)}};var re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;var utob=function(u){return u.replace(re_utob,cb_utob)};var cb_encode=function(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charCodeAt(0)<<16|(ccc.length>1?ccc.charCodeAt(1):0)<<8|(ccc.length>2?ccc.charCodeAt(2):0),chars=[b64chars.charAt(ord>>>18),b64chars.charAt(ord>>>12&63),padlen>=2?"=":b64chars.charAt(ord>>>6&63),padlen>=1?"=":b64chars.charAt(ord&63)];return chars.join("")};var btoa=global.btoa?function(b){return global.btoa(b)}:function(b){return b.replace(/[\s\S]{1,3}/g,cb_encode)};var _encode=buffer?buffer.from&&buffer.from!==Uint8Array.from?function(u){return(u.constructor===buffer.constructor?u:buffer.from(u)).toString("base64")}:function(u){return(u.constructor===buffer.constructor?u:new buffer(u)).toString("base64")}:function(u){return btoa(utob(u))};var encode=function(u,urisafe){return!urisafe?_encode(String(u)):_encode(String(u)).replace(/[+\/]/g,function(m0){return m0=="+"?"-":"_"}).replace(/=/g,"")};var encodeURI=function(u){return encode(u,true)};var re_btou=new RegExp(["[脌-脽][聙-驴]","[脿-茂][聙-驴]{2}","[冒-梅][聙-驴]{3}"].join("|"),"g");var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=(7&cccc.charCodeAt(0))<<18|(63&cccc.charCodeAt(1))<<12|(63&cccc.charCodeAt(2))<<6|63&cccc.charCodeAt(3),offset=cp-65536;return fromCharCode((offset>>>10)+55296)+fromCharCode((offset&1023)+56320);case 3:return fromCharCode((15&cccc.charCodeAt(0))<<12|(63&cccc.charCodeAt(1))<<6|63&cccc.charCodeAt(2));default:return fromCharCode((31&cccc.charCodeAt(0))<<6|63&cccc.charCodeAt(1))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var cb_decode=function(cccc){var len=cccc.length,padlen=len%4,n=(len>0?b64tab[cccc.charAt(0)]<<18:0)|(len>1?b64tab[cccc.charAt(1)]<<12:0)|(len>2?b64tab[cccc.charAt(2)]<<6:0)|(len>3?b64tab[cccc.charAt(3)]:0),chars=[fromCharCode(n>>>16),fromCharCode(n>>>8&255),fromCharCode(n&255)];chars.length-=[0,0,2,1][padlen];return chars.join("")};var atob=global.atob?function(a){return global.atob(a)}:function(a){return a.replace(/[\s\S]{1,4}/g,cb_decode)};var _decode=buffer?buffer.from&&buffer.from!==Uint8Array.from?function(a){return(a.constructor===buffer.constructor?a:buffer.from(a,"base64")).toString()}:function(a){return(a.constructor===buffer.constructor?a:new buffer(a,"base64")).toString()}:function(a){return btou(atob(a))};var decode=function(a){return _decode(String(a).replace(/[-_]/g,function(m0){return m0=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,""))};var noConflict=function(){var Base64=global.Base64;global.Base64=_Base64;return Base64};global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict};if(typeof Object.defineProperty==="function"){var noEnum=function(v){return{value:v,enumerable:false,writable:true,configurable:true}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)}));Object.defineProperty(String.prototype,"toBase64",noEnum(function(urisafe){return encode(this,urisafe)}));Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,true)}))}}if(global["Meteor"]){Base64=global.Base64}if(typeof module!=="undefined"&&module.exports){module.exports.Base64=global.Base64}else if(typeof define==="function"&&define.amd){define([],function(){return global.Base64})}return{Base64:global.Base64}}); \ No newline at end of file diff --git a/WebContent/Frame/resources/js/jquery/plugins/jquery.validate.extend.js b/WebContent/Frame/resources/js/jquery/plugins/jquery.validate.extend.js index 0d058e960..65eb9f1b0 100644 --- a/WebContent/Frame/resources/js/jquery/plugins/jquery.validate.extend.js +++ b/WebContent/Frame/resources/js/jquery/plugins/jquery.validate.extend.js @@ -5,7 +5,7 @@ function isShortDate(value){ return /^[0-9]{4}\/[0-9]{2}\/[0-9]{2}$/g.test(value); } function isEmail(value){ - return /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/g.test(value); + return /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[-|_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/g.test(value); } function isEmpty(value){ //alert("isEmpty"); @@ -75,7 +75,7 @@ jQuery.validator.prototype.showLabel = function(element,message){ } this.toShow = this.toShow.add(label); }; -/*jquery.validate.js功能扩展*/ +/*jquery.validate.js锟斤拷锟斤拷锟斤拷展*/ jQuery.validator.addMethod("maxlength",function(value,element,params){ if(!value) value = ""; var cArr = value.match(/[^\x00-\xff]/ig); @@ -108,21 +108,21 @@ jQuery.validator.addMethod("maxx",function(value,element,params){ return false; }); -//通过远程赋值 +//通锟斤拷远锟教革拷值 function setItemValueFromRemote(dwname,rowindex,fieldName,javaClassName,params){ var sValue = remoteFetch(dwname,rowindex,javaClassName,params); if(sValue!=null) setItemValue(dwname,rowindex,fieldName,sValue); } -//远程获取数据 +//远锟教伙拷取锟斤拷锟 function remoteFetch(dwname,rowindex,javaClassName,params){ if(!isNaN(dwname))dwname = "myiframe" + dwname; var dwindex = dwname.substring(8); var sUrl = sWebRootPath + "/Frame/page/ow/RemoteFetch.jsp"; var param = "ClassName=" + javaClassName + "&rand="+Math.random(); - var result = ['error','无法连接服务器']; + var result = ['error','锟睫凤拷锟斤拷锟接凤拷锟斤拷锟斤拷']; for(var i=0;i0)sParamValue=sParamValue.replace(/&/g, "⊙≌□"); + if(sParamValue.length>0)sParamValue=sParamValue.replace(/&/g, "锟窖≌★拷"); param += "&"+sParamName+"=" + sParamValue; } } @@ -266,7 +266,7 @@ jQuery.validator.addMethod("classcheck",function(value,element,params,index){ }); return result; }); -//如果是保存则验证非空,如果暂存则不验证 +//锟斤拷锟斤拷潜锟斤拷锟斤拷锟斤拷锟街わ拷强锟,锟斤拷锟斤拷荽锟斤拷锟斤拷锟街 jQuery.validator.addMethod("required0",function(value,element,param){ //alert(value +"|" + element.type + "|" + element.name + "|" +element.outerHTML); if(SAVE_TMP==true){ @@ -325,7 +325,7 @@ jQuery.validator.addMethod("expressions",function(value,element,expressions,inde } if(errorInfos.length>0){ //alert(element.parentNode.innerHTML); - element.setAttribute("errorInfo",errorInfos.join(',并且')); + element.setAttribute("errorInfo",errorInfos.join(',锟斤拷锟斤拷')); return false; } else @@ -358,7 +358,7 @@ function isSpecialCharacter(value){ } function addSpecialCharacterValidate(id2name){ - return; // 关闭特殊校验请打开行首注释 + return; // 锟截憋拷锟斤拷锟斤拷校锟斤拷锟斤拷锟斤拷锟斤拷锟阶拷锟 if(!window._user_validator){ window._user_validator = new Array(); } @@ -375,7 +375,7 @@ function addSpecialCharacterValidate(id2name){ }else{ _user_validator[0]["rules"][id2name[i][0]]["SpecialCharacter"] = true; } - var message = id2name[i][1]+"不允许特殊字符【!#$%^&*()[]{}<>】"; + var message = id2name[i][1]+"锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟街凤拷!#$%^&*()[]{}<>锟斤拷"; if(!_user_validator[0]["messages"][id2name[i][0]]){ _user_validator[0]["messages"][id2name[i][0]] = {"SpecialCharacter":message}; }else{ diff --git a/WebContent/Frame/resources/js/vendor/datatables/images/favicon.ico b/WebContent/Frame/resources/js/vendor/datatables/images/favicon.ico index 6eeaa2a0d..853addc83 100644 Binary files a/WebContent/Frame/resources/js/vendor/datatables/images/favicon.ico and b/WebContent/Frame/resources/js/vendor/datatables/images/favicon.ico differ diff --git a/WebContent/Logon.jsp b/WebContent/Logon.jsp index 38f936b1a..f98574db6 100644 --- a/WebContent/Logon.jsp +++ b/WebContent/Logon.jsp @@ -85,6 +85,39 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S } if (session!= null) { + + com.amarsoft.awe.RuntimeContext CurARCTemp = (com.amarsoft.awe.RuntimeContext) session.getAttribute("CurARC"); + + String sUserIDCom = request.getParameter("UserID"); + + if (sUserIDCom == null || sUserIDCom.equals("")) { + + String sUserIDSelectedCom = request.getParameter("UserIDSelected"); + + sUserIDCom = sUserIDSelectedCom; + + } + + if(sUserIDCom != null && !sUserIDCom.equals("") && CurARCTemp != null && CurARCTemp.getUser()!=null && !sUserIDCom.equals(CurARCTemp.getUser().getUserID())){ + + %><% + + return; + + } + java.util.Enumeration attrs = session.getAttributeNames(); while (attrs.hasMoreElements()) {session.removeAttribute(attrs.nextElement());} if (!session.isNew()) { @@ -93,15 +126,19 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S } Transaction Sqlca = null; + String sUserID = null; + String sPWD = null; + String sScreenWidth = null; + String logonId = null; try { //获得传入的参数:用户登录账号、口令、界面风格 - String sUserID = request.getParameter("UserID"); - - String sPWD = request.getParameter("Password"); - String sScreenWidth = request.getParameter("ScreenWidth"); + sUserID = request.getParameter("UserID"); + logonId = sUserID; + sPWD = request.getParameter("Password"); + sScreenWidth = request.getParameter("ScreenWidth"); //下拉选框用户快速登陆,系统正式运行后可删除 - String sUserIDSelected = ""; + String sUserIDSelected = ""; if (sUserID == null || sUserID.equals("")) { sUserIDSelected = request.getParameter("UserIDSelected"); sUserID = sUserIDSelected; @@ -118,6 +155,32 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S //取当前用户和机构,并将其放入 Session ASUser CurUser = ASUser.getUser(SpecialTools.real2Amarsoft(sUserID),Sqlca); + //读取上下文单点登陆配置 + String singleSignon = pageContext.getServletContext().getInitParameter("singleSignon"); + String loginType = request.getParameter("loginType"); + if(!"compulsive".equals(loginType) && "true".equals(singleSignon)){ + StringBuffer sql = new StringBuffer(); + sql.append("select count(1) num from user_list where userid='"); + sql.append(sUserID); + sql.append("' and (endtime is null or endtime = '') group by userid"); + String num = Sqlca.getString(new SqlObject(sql.toString())); + if(null != num && !"80009U00000001".equals(sUserID) && !"administrator".equals(sUserID)){ + throw new Exception("false"); + } + }else if("compulsive".equals(loginType)){ + StringBuffer updateSql = new StringBuffer(); + updateSql.append("update user_list set endtime='"); + updateSql.append(StringFunction.getTodayNow().replaceAll(":", "△")); + updateSql.append("' where userid='"); + updateSql.append(sUserID); + updateSql.append("'"); + SqlObject so = new SqlObject(updateSql.toString()); + so.setDebugSql(so.getDebugSql().replaceAll("△", ":")); + so.setOriginalSql(so.getOriginalSql().replaceAll("△", ":")); + so.setRunSql(so.getRunSql().replaceAll("△", ":")); + Sqlca.executeSQL(so); + } + //设置运行上下文参数 CurARC 在IncludeBegin.jsp中使用 RuntimeContext CurARC = new RuntimeContext(); CurARC.setAttribute("ScreenWidth",sScreenWidth); @@ -134,12 +197,12 @@ public boolean validUserPassword(HttpServletRequest request, Transaction Sqlca,S %> <% } catch (Exception e) { - e.printStackTrace(); - e.fillInStackTrace(); - e.printStackTrace(new java.io.PrintWriter(System.out)); + //e.printStackTrace(); + //e.fillInStackTrace(); + //e.printStackTrace(new java.io.PrintWriter(System.out)); %> <% return; diff --git a/WebContent/META-INF/context.xml b/WebContent/META-INF/context.xml index 8b1536381..72ea8c453 100644 --- a/WebContent/META-INF/context.xml +++ b/WebContent/META-INF/context.xml @@ -1,19 +1,15 @@ - - - - - - - + + + + + diff --git a/WebContent/Main.jsp b/WebContent/Main.jsp index 2afb3a054..d26adf3a8 100644 --- a/WebContent/Main.jsp +++ b/WebContent/Main.jsp @@ -21,14 +21,14 @@ //查询站内信数量 BizObjectManager messageManager = JBOFactory.getBizObjectManager(LB_BASE_MESSAGE_USER.CLASS_NAME); BizObject interMessage = messageManager.createQuery("select count(*) v.cnumber from o where userid=:userid and MESSAGE_STATUS=0").setParameter("userid",CurUser.getUserID()).getSingleResult(false); - String cnumber=interMessage.getAttribute("cnumber").getString(); + Double cnumber= Double.parseDouble( interMessage.getAttribute("cnumber").getString() ) ; %> <%@ include file="/Frame/resources/include/ui/include_mainmenu.jspf"%> <%@ include file="/Frame/resources/include/include_end_ajax.jspf"%> \ No newline at end of file diff --git a/WebContent/PayRecvFlow/DPayrecv_Info.jsp b/WebContent/PayRecvFlow/DPayrecv_Info.jsp index 659787822..a5d588519 100644 --- a/WebContent/PayRecvFlow/DPayrecv_Info.jsp +++ b/WebContent/PayRecvFlow/DPayrecv_Info.jsp @@ -10,7 +10,7 @@ String sTempletNo = "DPayrecv_Info";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); - doTemp.setColTips("", "测试"); +/* doTemp.setColTips("", "测试"); */ ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "-2";//只读模式 diff --git a/WebContent/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp b/WebContent/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp index 35afdf069..726101a40 100644 --- a/WebContent/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp +++ b/WebContent/ProductManage/ComponentConfig/ComponentLibraryInfo.jsp @@ -22,10 +22,10 @@ %><%@include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/ProductManage/ProductConfig/ProductCatalogInfo.jsp b/WebContent/ProductManage/ProductConfig/ProductCatalogInfo.jsp index 24ea30cb3..6d5fa1fb7 100644 --- a/WebContent/ProductManage/ProductConfig/ProductCatalogInfo.jsp +++ b/WebContent/ProductManage/ProductConfig/ProductCatalogInfo.jsp @@ -29,7 +29,7 @@ include file="/Frame/resources/include/ui/include_info.jspf"%> function saveRecord(){ var catalogName = getItemValue(0, getRow(), "CatalogName"); if(catalogName != null && catalogName != ""){ - var res = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","addProductCatalog","catalogName="+catalogName); + var res = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductManager","addProductCatalog","catalogName="+catalogName + ",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>"); if(res == "true"){ alert("新增成功"); }else{ diff --git a/WebContent/ProductManage/ProductConfig/ProductCatalogList.jsp b/WebContent/ProductManage/ProductConfig/ProductCatalogList.jsp index f2e43cecb..f2e399ec6 100644 --- a/WebContent/ProductManage/ProductConfig/ProductCatalogList.jsp +++ b/WebContent/ProductManage/ProductConfig/ProductCatalogList.jsp @@ -2,6 +2,8 @@ include file="/Frame/resources/include/include_begin_list.jspf"%> <% String sortNo = CurPage.getParameter("SortNo"); + String typeName = CurPage.getParameter("typeName"); + String userId = CurPage.getUserId(); if(sortNo == null) sortNo = ""; ASObjectModel doTemp = new ASObjectModel("PRD_ProductCatalogList"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); @@ -9,17 +11,26 @@ dwTemp.setPageSize(20); dwTemp.setParameter("SortNo", sortNo+"%"); dwTemp.genHTMLObjectWindow(""); + String flag="false"; + if("administrator".equals(userId)||"80009U00000001".equals(userId)){ + flag="true"; + } String sButtons[][] = { - {"true","","Button","新增产品","新增产品","addProduct()","","","","btn_icon_add",""}, - {"true","","Button","修改产品","修改产品","viewEditProduct()","","","","btn_icon_edit",""}, + {flag,"","Button","新增产品","新增产品","addProduct()","","","","btn_icon_add",""}, {"true","","Button","复制产品","复制产品","copyProduct()","","","","btn_icon_copy",""}, + {"true","","Button","修改产品","修改产品","viewEditProduct()","","","","btn_icon_edit",""}, {"true","","Button","启动/停用","启动按钮","publishProduct()","","","","btn_icon_power",""}, {"true","","Button","产品详情","产品详情","viewProduct()","","","","btn_icon_detail",""}, {"true","","Button","删除产品","删除产品","deleteProduct()","","","","btn_icon_delete",""}, - {"true","","Button","产品相关信息配置","产品相关信息配置","productNodeInfoConfig()","","","","btn_icon_setting",""} + {flag,"","Button","产品相关信息配置","产品相关信息配置","productNodeInfoConfig()","","","","btn_icon_setting",""}, + {"true","","Button","更新产品配置","更新产品配置","refreshProduct()","","","","btn_icon_refresh",""} }; %> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/BussinessCancel/LbBusinessOverdateList.jsp b/WebContent/Tenwa/Apzl/BussinessCancel/LbBusinessOverdateList.jsp new file mode 100644 index 000000000..983495413 --- /dev/null +++ b/WebContent/Tenwa/Apzl/BussinessCancel/LbBusinessOverdateList.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LbBusinessOverdateList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp new file mode 100644 index 000000000..dc21c68fc --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/DistributorCustomerGroupCompanyRegister.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + String sTempletNo = "DistrictInfoRegister";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + String typeno= CurPage.getParameter("TYPENO"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + + String sButtons[][] = { + {"true","All","Button","确定","注册区域信息","saveRecord()","","","","btn_icon_submit"}, + {"true","All","Button","取消","取消","goBack()","","","","btn_icon_close"}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/EditProvince.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/EditProvince.jsp new file mode 100644 index 000000000..62c633723 --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/EditProvince.jsp @@ -0,0 +1,39 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-20 + Content: + History Log: + */ + String DISTRICT_CODE=CurPage.getParameter("disCode"); + ASObjectModel doTemp = new ASObjectModel("districtProvinceRelation"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(DISTRICT_CODE); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorList.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorList.jsp new file mode 100644 index 000000000..921786b94 --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorList.jsp @@ -0,0 +1,64 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + String typeno= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("COUNTRY_DISTRICT_INFO"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(typeno); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","关联省份","关联省份","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","区域信息维护","区域信息维护","Edit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorListForProduct.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorListForProduct.jsp new file mode 100644 index 000000000..ecf2c8c9e --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorListForProduct.jsp @@ -0,0 +1,79 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + String typeno= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("lmproductdistrictList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(typeno); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","关联省份","关联省份","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","区域信息维护","区域信息维护","Edit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorToproductList.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorToproductList.jsp new file mode 100644 index 000000000..4bcff77a1 --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/LmDistributorToproductList.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DISTRICT_DISTRIBUTOR_RELATION"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + String districtcode = CurPage.getParameter("district_code"); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(districtcode); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","asDelete()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/LmProductCarInfo.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/LmProductCarInfo.jsp new file mode 100644 index 000000000..14f0ec036 --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/LmProductCarInfo.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LmDistrictInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "1";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("district_code")); + + String sButtons[][] = { + //{"true","All","Button","保存","保存所有修改","save()","","","",""}, + //{"true","All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/DistributorToArea/LmProductDistributorCar.jsp b/WebContent/Tenwa/Apzl/DistributorToArea/LmProductDistributorCar.jsp new file mode 100644 index 000000000..6a8928cef --- /dev/null +++ b/WebContent/Tenwa/Apzl/DistributorToArea/LmProductDistributorCar.jsp @@ -0,0 +1,21 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% +/* + 页面说明: 示例上下联动框架页面 + */ + String districtno = CurPage.getParameter("districtno"); +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/ApproveDetail.jsp b/WebContent/Tenwa/Apzl/FileUpload/ApproveDetail.jsp new file mode 100644 index 000000000..2a5e5f3c6 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/ApproveDetail.jsp @@ -0,0 +1,42 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-27 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "ERPEditInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setRequired("EXPNUMBER", true); + doTemp.setRequired("EXPCOMPANY", true); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","recordsave()","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/AutoFiveAttachmentUpload.jsp b/WebContent/Tenwa/Apzl/FileUpload/AutoFiveAttachmentUpload.jsp new file mode 100644 index 000000000..7d32097f7 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/AutoFiveAttachmentUpload.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-31 + Content: 示例详情页面 + History Log: + */ + String Library_id = CurPage.getParameter("Library_id"); + + //定义变量 + String sObjectNo = "";//--对象编号 + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + + String sPrevUrl = CurPage.getParameter("PrevUrl"); + //if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp"; + + String sTempletNo = "AutoFiveAttachmentUpload";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(Library_id); + String sButtons[][] = { + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","All","Button","取消","返回列表","pull()","","","","btn_icon_close"} + }; + /* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/CheckApplyPassContract.jsp b/WebContent/Tenwa/Apzl/FileUpload/CheckApplyPassContract.jsp new file mode 100644 index 000000000..9d0c8722c --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/CheckApplyPassContract.jsp @@ -0,0 +1,13 @@ +<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME"%> +<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%> +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@page import="java.math.BigDecimal"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String companyId = CurPage.getParameter("belongCompanyid"); + String result = Sqlca.getString(new SqlObject("select case when count(1)>0 then 'true' else 'false' end res from lb_contract_info lci left join lb_file_mailarchiving_info lfmi on lfmi.CONTRACT_ID = lci.ID where (lfmi.ALLHANDOVERSTATUS is null or lfmi.ALLHANDOVERSTATUS = 'part') and not exists (select 1 from LB_FILE_MAILARCHIVING_INFO_TEMP lfmit where lfmit.contract_id = lci.id and lfmit.is_flowing = '0') and lci.PROJECT_DEPT = '"+companyId+"'")); + out.println(result); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/DocMailListMain.jsp b/WebContent/Tenwa/Apzl/FileUpload/DocMailListMain.jsp new file mode 100644 index 000000000..60dadb511 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/DocMailListMain.jsp @@ -0,0 +1,50 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Map" %> +<%@ page import="com.amarsoft.app.util.ProductParamUtil" %> +<% + /* + 页面说明:隐藏左侧区域的Main页面 + */ + String PG_TITLE = ""; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = ""; //默认的内容区标题 + String PG_CONTNET_TEXT = "";//默认的内容区文字 + String PG_LEFT_WIDTH = "0";//默认的treeview宽度 + + + String RightType= CurPage.getParameter("RightType"); + String sFlowunid = CurPage.getParameter("FlowUnid"); + String sFlowNo= CurPage.getParameter("FlowNo"); + String PhaseNo= CurPage.getParameter("PhaseNo"); + sFlowNo = "MortgageFileMailFlow"; + BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowunid); + String product=CurPage.getParameter("productId"); + List list=ProductParamUtil.getProductDocInfo(product,"PRD0412"); + String type="SingleRow"; + String docList=""; + for(int i=0;i map=(Map)list.get(i); + if(sFlowNo.equals(map.get("FLOW_INFO").toString())){ + type=map.get("TYPE").toString(); + if("SingleRow".equals(type)){ + docList=map.get("DOCLIST").toString(); + }else{ + List l=(List)map.get("DOCCONFIG"); + docList=l.toString(); + } + } + } +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/GetDocMailNumber.jsp b/WebContent/Tenwa/Apzl/FileUpload/GetDocMailNumber.jsp new file mode 100644 index 000000000..4c88bac5a --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/GetDocMailNumber.jsp @@ -0,0 +1,6 @@ +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String serialNumber = SerialNumberUtil.getDocMailNumber(Sqlca); + out.println(serialNumber); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/LBPlaceFileTempInfo.jsp b/WebContent/Tenwa/Apzl/FileUpload/LBPlaceFileTempInfo.jsp new file mode 100644 index 000000000..fabb48598 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/LBPlaceFileTempInfo.jsp @@ -0,0 +1,90 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Map" %> +<%@ page import="com.amarsoft.app.util.ProductParamUtil" %> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-07-15 + Content: 示例详情页面 + History Log: + */ + String RightType= CurPage.getParameter("RightType"); + String sFlowunid = CurPage.getParameter("FlowUnid"); + String sFlowNo= CurPage.getParameter("FlowNo"); + String PhaseNo= CurPage.getParameter("PhaseNo"); + String userName = CurUser.getUserName(); + + sFlowNo = "MortgageFileMailFlow"; + BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowunid); + String product=CurPage.getParameter("productId"); + List list=ProductParamUtil.getProductDocInfo(product,"PRD0412"); + String type=""; + String docList=""; + for(int i=0;i map=(Map)list.get(i); + if(sFlowNo.equals(map.get("FLOW_INFO").toString())){ + type=map.get("TYPE").toString(); + if("SingleRow".equals(type)){ + docList=map.get("DOCLIST").toString(); + }else{ + List l=(List)map.get("DOCCONFIG"); + docList=l.toString(); + } + } + } + String ObjectNo = CurPage.getParameter("ObjectNo"); + String contract_id = CurPage.getParameter("contract_id"); + String compClientID = CurPage.getParameter("CompClientID"); + String id = CurPage.getParameter("id"); + System.out.println(id); + String sTempletNo = "LBPlaceFileTempInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if("0020".equals(PhaseNo)){ + doTemp.setDefaultValue("ARCHIVING_PERSON", CurUser.getUserName()); + + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + dwTemp.replaceColumn("placefile", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("opinion", "", CurPage.getObjectWindowOutput()); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"false","All","Button","返回","返回列表","returnList()","","","",""}, + {"0020".equals(CurPage.getParameter("PhaseNo"))&&!"his".equals(type)?"true":"false","","Button","一键归档","一键归档","guidang()","","","",""}, + + }; +// sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverList.jsp b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverList.jsp new file mode 100644 index 000000000..9f9f245d1 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverList.jsp @@ -0,0 +1,84 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-07-11 + Content: + History Log: + */ + ASUser ASuser = CurPage.getUser(); + String orgid = ASuser.getOrgID(); + ASObjectModel doTemp = new ASObjectModel("LBnotAllMailHndHandoverList"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + if("0010".equals(PhaseNo)){ +// doTemp.setVisible("ALLSTATUS", false); +// doTemp.setVisible("ALLHANDOVERSTATUS", false); + } + if("8006011".equals(orgid)){ + doTemp.appendJboWhere(" and O.PROJECT_DEPT=:orgid "); + }else{ + doTemp.appendJboWhere(" and O.PROJECT_MANAGE=:orgid "); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow("8006011".equals(orgid)?ASuser.getOrgID():ASuser.getUserID()); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","添加到本次邮寄列表","添加到本次邮寄列表","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","邮寄详情","邮寄详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp new file mode 100644 index 000000000..b498ab8a2 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp @@ -0,0 +1,174 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-07-11 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("ObjectNo"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + ASObjectModel doTemp = new ASObjectModel("LBnotAllMailHndHandoverTempList"); + if("0010".equals(PhaseNo)){ +// doTemp.setVisible("ALLHANDOVERSTATUS", false);//显示归档状态 + doTemp.setVisible("ARCHIVING_CABINET_NO", false); + doTemp.setVisible("ARCHIVING_TIME", false); + doTemp.setVisible("ARCHIVING_PERSON", false); + } + doTemp.setLockCount(2); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; + //--设置为Grid风格-- + if("0010".equals(PhaseNo)){ +// dwTemp.MultiSelect = true; //多选 + } + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"0010".equals(PhaseNo)?"true":"false","","Button","配置快递信息","配置快递信息","selectApproveDetail()","","","","btn_icon_up",""}, + {"0010".equals(PhaseNo)?"true":"false","","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempInfo.jsp b/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempInfo.jsp new file mode 100644 index 000000000..1630ed025 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempInfo.jsp @@ -0,0 +1,36 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-07-15 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + String contract_id = CurPage.getParameter("contract_id"); + String flowunid = CurPage.getParameter("ObjectNo"); + String sTempletNo = "LmApprovaloppinionDocTempInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("contract_id", contract_id); + doTemp.setDefaultValue("flowunid", flowunid); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {CurPage.getParameter("SerialNo") == null?"true":"false","All","Button","保存","保存所有修改","as_save(0,'doReturn()')","","","",""}, + {CurPage.getParameter("SerialNo") == null?"false":"false","All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempList.jsp b/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempList.jsp new file mode 100644 index 000000000..60f0911f7 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/LmApprovaloppinionDocTempList.jsp @@ -0,0 +1,44 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-07-15 + Content: + History Log: + */ + String contract_id = CurPage.getParameter("contract_id"); + String flowunid = CurPage.getParameter("ObjectNo"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + ASObjectModel doTemp = new ASObjectModel("LmApprovaloppinionDocTempList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contract_id+","+flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"0010".equals(PhaseNo)?"false":"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"0010".equals(PhaseNo)?"false":"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/MortgageFileMailApplyList.jsp b/WebContent/Tenwa/Apzl/FileUpload/MortgageFileMailApplyList.jsp new file mode 100644 index 000000000..cee14a002 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/MortgageFileMailApplyList.jsp @@ -0,0 +1,36 @@ +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/ +ASUser user = CurPage.getUser(); +String orgid = user.getOrgID(); +%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Apzl/FileUpload/PayDocMailList.jsp b/WebContent/Tenwa/Apzl/FileUpload/PayDocMailList.jsp new file mode 100644 index 000000000..8d15c5160 --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/PayDocMailList.jsp @@ -0,0 +1,325 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String flowunid=CurPage.getParameter("FlowUnid"); + String CustomerType=CurPage.getParameter("CustomerType"); + String contract_id=CurPage.getParameter("contract_id"); + String type=CurPage.getParameter("type"); + String carAttributes=CurPage.getParameter("carAttributes");//获取车类型 + if(flowunid==""||flowunid==null){ + flowunid="flowunid"; + } + + BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid);//流程对象 + + String sObjectType = CurPage.getParameter("FlowNo");//流程类型 + + + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType= CurPage.getParameter("RightType"); + String username=CurUser.getUserName(); + String sTempletNo=CurPage.getParameter("TempletNo"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String apply = CurPage.getParameter("ApplyType"); + + String docClassItemno=CurPage.getParameter("docList"); + + String s=""; + if(!"his".equals(type)){ + String[] itemnos=docClassItemno.split(","); + for(int i=0;i0){ + s=s.substring(0, s.length()-1); + } + } + String compClientID = request.getParameter("CompClientID"); + Map docParam=new HashMap(); + Map other=new HashMap(); + other.put("carAttributes", carAttributes); + other.put("CustomerType", CustomerType); + docParam.put("ObjectType",sObjectType); + docParam.put("proj_id", flow.getAttribute("proj_id").getString()); + docParam.put("contract_id", contract_id); + docParam.put("flow_unid", flowunid); + docParam.put("inputtime", StringFunction.getTodayNow()); + docParam.put("inputuserid", CurPage.getUserId()); + docParam.put("inputorgid", CurPage.getUser().getOrgID()); + ASObjectModel doTemp = null; + //判断是否存在,不存在就从配置表倒到临时表 + if(!"his".equals(type)){ + DocListInitAction.initDocListForMail(docParam,other,docClassItemno,CurConfig,Sqlca); + doTemp = new ASObjectModel("FlowPayMailDocList"); + }else{ + doTemp = new ASObjectModel("FlowPayMailDocHisList"); + } + if("0010".equals(CurPage.getParameter("PhaseNo"))&&!"his".equals(type)){ + doTemp.setVisible("HANDOVERSTATUS", false); + } + if("0020".equals(CurPage.getParameter("PhaseNo"))){ + doTemp.setVisible("operation", false); + } + if("his".equals(type)){ + doTemp.setVisible("operation", false); + doTemp.appendJboWhere("and rela.proj_id=:contractid and rela.OBJECTTYPE in('BusinessApplyFlow','FundPaymentCarFlow','MortgageFileFlow')"); + }else{ + doTemp.appendJboWhere("and rela.contract_id=:contractid and rela.OBJECTTYPE ='MortgageFileMailFlow'"); + doTemp.appendJboWhere(" and O.doc_Class_Itemno in ("+s+") and lmdt.flowunid ='"+flowunid+"'"); + } + doTemp.setLockCount(2); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + doTemp.setVisible("operation", false); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; + dwTemp.setPageSize(500); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "1";//只读模式 + RightType="ReadOnly"; + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + + sButtons=new String[][]{ + {"0010".equals(CurPage.getParameter("PhaseNo"))&&!"his".equals(type)?"true":"false","","Button","保存","保存所有修改","0010".equals(CurPage.getParameter("PhaseNo"))?"saveRecord()":"saveRecordForApprove()","","","",""}, + }; + +%> + +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/RentCollectAttachmentUpload.jsp b/WebContent/Tenwa/Apzl/FileUpload/RentCollectAttachmentUpload.jsp new file mode 100644 index 000000000..037a3f23c --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/RentCollectAttachmentUpload.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-31 + Content: 示例详情页面 + History Log: + */ + String Library_id = CurPage.getParameter("Library_id"); + + //定义变量 + String sObjectNo = "";//--对象编号 + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + + String sPrevUrl = CurPage.getParameter("PrevUrl"); + //if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp"; + + String sTempletNo = "RentCollectAttachmentUpload";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(Library_id); + String sButtons[][] = { + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","All","Button","取消","返回列表","pull()","","","","btn_icon_close"} + }; + /* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/FileUpload/showImage.jsp b/WebContent/Tenwa/Apzl/FileUpload/showImage.jsp new file mode 100644 index 000000000..4681d629e --- /dev/null +++ b/WebContent/Tenwa/Apzl/FileUpload/showImage.jsp @@ -0,0 +1,112 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.amarsoft.awe.res.JspfText"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@include file="/Frame/page/jspf/include/jsp_runtime_context.jspf" +%><%@page import="com.amarsoft.web.dw.*"%><%@include file="/Frame/page/jspf/include/jsp_sqlca_head.jspf" +%> + + + +<%@include file="/Frame/page/jspf/include/jsp_head_res.jspf"%> + + + + + + + + + + + + + + + + + + + +<% + String compClientID = request.getParameter("CompClientID"); + String attrid = CurPage.getParameter("attrid"); + String contract_id = CurPage.getParameter("contract_id"); + String projectid = CurPage.getParameter("projectid"); + String docClassItemno = CurPage.getParameter("docClassItemno"); + String objecttype = CurPage.getParameter("objecttype"); + String type = CurPage.getParameter("type"); + List Imagelist = new ArrayList(); + if("his".equals(type)){ + Imagelist=DocListInitAction.nextImageForMailHisDoc(contract_id); + }else if(contract_id!=null&&Imagelist.size()==0){ + Imagelist=DocListInitAction.nextImageForMailDoc(contract_id); + } + int imageattridv = 0; + int index = 0; +%> + + + +
+
    + <% + if(Imagelist.size()>0){ + for(String imageattrid:Imagelist){ + imageattridv++; + if(imageattrid.equals(attrid)){ + index=imageattridv; + } + %> +
  • + <% + } + }else{ + index=1; + %> +
  • + <% + } + %> +
+
+ + + + + + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONList.jsp b/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONList.jsp new file mode 100644 index 000000000..caf8e7451 --- /dev/null +++ b/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONList.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-29 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_GRADE_CLASSIFICATIONList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONinfo.jsp b/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONinfo.jsp new file mode 100644 index 000000000..ca9193052 --- /dev/null +++ b/WebContent/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONinfo.jsp @@ -0,0 +1,35 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-30 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Apzl/Fivelevelclassification/LM_GRADE_CLASSIFICATIONList.jsp"; + + String sTempletNo = "LM_GRADE_CLASSIFICATIONinfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return"} + /* {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} */ + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoiceOthers.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoiceOthers.jsp new file mode 100644 index 000000000..d4aa7a57e --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoiceOthers.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-05 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("BackRentInvoiceOthers"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoicePrintOthers.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoicePrintOthers.jsp new file mode 100644 index 000000000..903de16e1 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/BackRentInvoicePrintOthers.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-05 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("BackRentInvoicePrintOthers"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirect.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirect.jsp new file mode 100644 index 000000000..2531312d9 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirect.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-11 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentDirect"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyRentInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirectE.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirectE.jsp new file mode 100644 index 000000000..4b34427ec --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentDirectE.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-11 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentDirect"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyRentInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirm.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirm.jsp new file mode 100644 index 000000000..9ce888954 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirm.jsp @@ -0,0 +1,82 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentIncomeConfirm"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","退回","退回","gobackInvoice()","","","","btn_icon_return",""}, + {"true","","Button","确认提交","确认提交","submitInvoice()","","","","btn_icon_submit",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirmE.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirmE.jsp new file mode 100644 index 000000000..1503705f4 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentIncomeConfirmE.jsp @@ -0,0 +1,82 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentIncomeConfirmE"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","退回","退回","gobackInvoice()","","","","btn_icon_return",""}, + {"true","","Button","确认提交","确认提交","submitInvoice()","","","","btn_icon_submit",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterest.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterest.jsp new file mode 100644 index 000000000..148f7890c --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterest.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-09 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentInterest"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect=true; + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterestPrint.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterestPrint.jsp new file mode 100644 index 000000000..5564be5cd --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentInterestPrint.jsp @@ -0,0 +1,62 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-09 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentInterestPrint"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect=true; + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","申请开票","申请开票","ApplyInvoice()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirm.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirm.jsp new file mode 100644 index 000000000..b28fe69f3 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirm.jsp @@ -0,0 +1,87 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-03 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentPlanConfirm"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","退回","退回","gobackInvoice()","","","","btn_icon_return",""}, + {"true","","Button","确认提交","确认提交","submitInvoice()","","","","btn_icon_submit",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirmPrint.jsp b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirmPrint.jsp new file mode 100644 index 000000000..23c5303d1 --- /dev/null +++ b/WebContent/Tenwa/Apzl/InvoiceManager/InvoiceRentPlanConfirmPrint.jsp @@ -0,0 +1,83 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-03 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentConfirmPrint"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","退回","退回","gobackInvoice()","","","","btn_icon_return",""}, + {"true","","Button","确认提交","确认提交","submitInvoice()","","","","btn_icon_submit",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmCarBrandseriesList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmCarBrandseriesList.jsp new file mode 100644 index 000000000..e7dd709c2 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmCarBrandseriesList.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_CAR_BRANDSERIES_LIST"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorCar.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorCar.jsp new file mode 100644 index 000000000..5d875ed66 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorCar.jsp @@ -0,0 +1,20 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% +/* + 页面说明: 示例上下联动框架页面 + */ + String distributorId = CurPage.getParameter("distributorId"); +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorInfo.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorInfo.jsp new file mode 100644 index 000000000..4ba45a7b3 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorInfo.jsp @@ -0,0 +1,29 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-08 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LmDistributorInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("distributorId")); + + String sButtons[][] = { + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorList.jsp new file mode 100644 index 000000000..473a591b9 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorList.jsp @@ -0,0 +1,40 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_DISTRIBUTOR_LIST"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToCarList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToCarList.jsp new file mode 100644 index 000000000..5ef5c7cfb --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToCarList.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_DISTRIBUTOR_TO_CAR"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + String distributorId = CurPage.getParameter("DISTRIBUTOR_ID"); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(distributorId); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","asDelete()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToproductList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToproductList.jsp new file mode 100644 index 000000000..9bb72b94e --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmDistributorToproductList.jsp @@ -0,0 +1,79 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_DISTRIBUTOR_TO_PRODUCT"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + String typeno = CurPage.getParameter("TYPENO"); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(typeno); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","asDelete()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmORGPortalList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmORGPortalList.jsp new file mode 100644 index 000000000..5b5e76b01 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmORGPortalList.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LM_ORG_LIST"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); +// String type = CurPage.getParameter("type"); +// if(type == null) type = ""; + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); +// if("portal".equals(type)){ +// doTemp.setVisible("EDIT",false); +// } + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmOrgInfo.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmOrgInfo.jsp new file mode 100644 index 000000000..456948514 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmOrgInfo.jsp @@ -0,0 +1,29 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-08 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LmOrgInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ORGID")); + + String sButtons[][] = { + {"false","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmProductConfigurate.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductConfigurate.jsp new file mode 100644 index 000000000..54f4de8bc --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductConfigurate.jsp @@ -0,0 +1,73 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% + /* + Author: undefined 2018-06-20 + Content: + History Log: + */ + String PG_TITLE = "产品配置"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "  生成树图  "; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "200";//默认的treeview宽度 + + //获得页面参数 + //String sExampleId = CurComp.getParameter("ObjectNo"); + String typeNo = CurComp.getParameter("TYPENO"); + + //定义Treeview + OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "产品配置","right"); + tviTemp.init("productConfig",null); +%><%@include file="/Resources/CodeParts/View04.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorCar.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorCar.jsp new file mode 100644 index 000000000..fedd519ef --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorCar.jsp @@ -0,0 +1,20 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% +/* + 页面说明: 示例上下联动框架页面 + */ + String TYPENO = CurPage.getParameter("TYPENO"); +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorList.jsp b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorList.jsp new file mode 100644 index 000000000..c4e0214d9 --- /dev/null +++ b/WebContent/Tenwa/Apzl/PortalToCarType/LmProductDistributorList.jsp @@ -0,0 +1,61 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + String PG_TITLE ="汽车产品列表"; + String TYPENO= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("LmProductCarList1"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(TYPENO); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/productCar/LmProductAndCarList.jsp b/WebContent/Tenwa/Apzl/productCar/LmProductAndCarList.jsp new file mode 100644 index 000000000..b3bb132e3 --- /dev/null +++ b/WebContent/Tenwa/Apzl/productCar/LmProductAndCarList.jsp @@ -0,0 +1,67 @@ +<%@page import="org.apache.poi.poifs.property.Parent"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-07 + Content: + History Log: + */ + String TYPENO= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("LmProductAndCarList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(TYPENO); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","删除","删除","as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/productCar/LmProductCarInfo.jsp b/WebContent/Tenwa/Apzl/productCar/LmProductCarInfo.jsp new file mode 100644 index 000000000..8ae5bfcb0 --- /dev/null +++ b/WebContent/Tenwa/Apzl/productCar/LmProductCarInfo.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LmProductCarInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("TYPENO")); + + String sButtons[][] = { + //{"true","All","Button","保存","保存所有修改","save()","","","",""}, + //{"true","All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/productCar/LmProductCarList.jsp b/WebContent/Tenwa/Apzl/productCar/LmProductCarList.jsp new file mode 100644 index 000000000..cfe837c06 --- /dev/null +++ b/WebContent/Tenwa/Apzl/productCar/LmProductCarList.jsp @@ -0,0 +1,59 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + String PG_TITLE ="汽车产品列表"; + String TYPENO= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("LmProductCarList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(TYPENO); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Apzl/productCar/LmProductUpAndDown.jsp b/WebContent/Tenwa/Apzl/productCar/LmProductUpAndDown.jsp new file mode 100644 index 000000000..8fe510d67 --- /dev/null +++ b/WebContent/Tenwa/Apzl/productCar/LmProductUpAndDown.jsp @@ -0,0 +1,20 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% +/* + 页面说明: 示例上下联动框架页面 + */ + String TYPENO = CurPage.getParameter("TYPENO"); +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/CarPhoto/CarPhotoList.jsp b/WebContent/Tenwa/CarPhoto/CarPhotoList.jsp index f4bcedc14..1b38748c0 100644 --- a/WebContent/Tenwa/CarPhoto/CarPhotoList.jsp +++ b/WebContent/Tenwa/CarPhoto/CarPhotoList.jsp @@ -1,7 +1,8 @@ <%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% -String orgid=CurUser.getOrgID(); -String userid=CurUser.getUserID(); +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<% + String orgid=CurUser.getOrgID(); + String userid=CurUser.getUserID(); ASObjectModel doTemp = new ASObjectModel("LB_CAR_LICENSE_PLATE_LIST"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; @@ -11,14 +12,141 @@ String userid=CurUser.getUserID(); dwTemp.genHTMLObjectWindow(""); String sButtons[][] = { {"true","All","Button","新增","新增","newRecord()","","","",""}, - {"true","All","Button","修改","修改","edit()","","","",""}, - {"true","All","Button","删除","删除","do_delete()","","","","btn_icon_delete"}, - {"true","All","Button","牌照管理导入","牌照管理导入","importExcel()","","","","btn_icon_import"} + {"true","All","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","All","Button","导入Excel","导入Excel","importExcel()","","","","btn_icon_import"}, + {"true","","Button","牌照模版下载","牌照模版下载","LicensePlateDownload()","","","","btn_icon_down",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +
+
+ +
+
+ <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeList.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeList.jsp new file mode 100644 index 000000000..177170a93 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeList.jsp @@ -0,0 +1,166 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ page import="com.tenwa.comm.dataRightmanager.DataRightManager" %> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + String jboWhere = CurPage.getParameter("JboWhere"); + if(jboWhere == null){ + jboWhere = ""; + } + String RightType=CurPage.getParameter("RightType"); + if(RightType==null) RightType=""; + String curUserId = CurUser.getUserID(); + String curOrgId = CurUser.getOrgID(); + ASObjectModel doTemp = new ASObjectModel("LBContractInfoForAccount"); + String sCondtion=DataRightManager.getRightCondition(CurUser,"O"); + doTemp.appendJboWhere(sCondtion); + doTemp.appendJboWhere(jboWhere); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(pageSize == null ? 20 : Integer.parseInt(pageSize)); + + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][]; + if(jboWhere.endsWith("'approve_status05'")){ + sButtons = new String[][]{ + {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","编辑","编辑","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","取消","取消","del()","","","","btn_icon_delete",""} + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","详情","详情","view()","","","","btn_icon_detail",""} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeListMain.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeListMain.jsp new file mode 100644 index 000000000..03f3c51f6 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/AccountChangeListMain.jsp @@ -0,0 +1,60 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<% + /* + 页面说明:示例模块主页面 + */ + String PG_TITLE = "扣款卡信息变更申请"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "  示例模块主页面  "; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "200";//默认的treeview宽度 + + //获得参数,判断是否直接打开其中某个页面 + String pageType = CurPage.getParameter("pageType"); + if(pageType == null){ + pageType = "我的草稿"; + } + + //定义Treeview + OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "示例模块主页面","right"); + + //定义树图结构 + tviTemp.insertPage("root","我的草稿","",1); + tviTemp.insertPage("root","待审核的申请","",2); + tviTemp.insertPage("root","审核中的申请","",3); + tviTemp.insertPage("root","审核通过的申请","",4); + tviTemp.insertPage("root","审核不通过的申请","",5); + + //另外两种定义树图结构的方法:SQL生成和代码生成 参见View的生成 ExampleView.jsp和ExampleView01.jsp +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/LBDeductChangeDocumentInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/LBDeductChangeDocumentInfo.jsp new file mode 100644 index 000000000..f0ecb5a8c --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/LBDeductChangeDocumentInfo.jsp @@ -0,0 +1,92 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/Frame/resources/include/include_begin_info.jspf"%> +<%@ page import="com.tenwa.doc.action.DocumentListAction" %> +<% + //获得组件参数 + String sObjectType=CurPage.getParameter("ObjectType");// + String contractId=CurPage.getParameter("ContractId"); + + ASObjectModel doTemp = new ASObjectModel("LBAdjustDocumentInfo"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(""); + String[][] sButtons=null; + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","","Button","取消","取消","viewAndEdit_attachment()","","","","btn_icon_close"}}; +%><%@include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyChangeInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyChangeInfo.jsp new file mode 100644 index 000000000..c437635da --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyChangeInfo.jsp @@ -0,0 +1,260 @@ +<%@page import="jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "法人现扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String ID = CurPage.getParameter("id");//租赁物ID + if(ID == null)ID = ""; + String RightType=CurPage.getParameter("RightType"); + String ContractId = CurPage.getParameter("ContractId"); + String applyId = CurPage.getParameter("ApplyId"); + if(ContractId == null) ContractId = ""; + String customerid = CurPage.getParameter("CustomerId"); + String sTempletNo ="LBDeductCardChangeCompany";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("IS_CONSIGN_REPAY", "onchange", "checkIsConsignRepay"); + + //获取变更表里面的数据,根据process判断是否已经签约了,如果已经签约了,现扣款卡信息页面为只读 + BizObject boAccount = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME).createQuery("flow_unid=:applyId and file_flag='yes'").setParameter("applyId", applyId).getSingleResult(false); + if(boAccount!=null){ + String signType = boAccount.getAttribute("SIGN_TYPE").toString(); + if(signType!="" ){ + RightType= "ReadOnly"; + } + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + if((null!=RightType&&RightType.equals("ReadOnly"))){ + dwTemp.ReadOnly = "1";//只读模式 + RightType="ReadOnly"; + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(applyId); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + // {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + }; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyInfo.jsp new file mode 100644 index 000000000..87d53697e --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyInfo.jsp @@ -0,0 +1,330 @@ +<%@page import="jbo.com.tenwa.lease.comm.LB_UNION_LESSEE"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_TEL"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_DEDUCT_CARD_HIS"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "法人原扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String ID = CurPage.getParameter("id");//租赁物ID + if(ID == null)ID = ""; + String RightType=CurPage.getParameter("RightType"); + if(RightType==null)RightType=""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + String PROJECT_ID = CurPage.getParameter("ProjectId"); + if(PROJECT_ID == null) PROJECT_ID = ""; + String CustomerId = CurPage.getParameter("CustomerId"); + if(CustomerId == null) CustomerId = ""; + String customerType=CurPage.getParameter("CustomerType"); + if(customerType == null) customerType = ""; + String applyId = CurPage.getParameter("ApplyId"); + if(applyId == null) applyId = ""; + + //获取电话号码,电子签章用 + BizObjectManager bomTel = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME); + BizObject boTel = bomTel.createQuery("select * from o where customerid=:customerid").setParameter("customerid",CustomerId).getSingleResult(false); + String telephone = boTel.getAttribute("telephone").toString(); + + //获取姓名,电子签章用 + BizObjectManager bomName = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME); + BizObject boName = bomName.createQuery("select * from o where CONTRACT_ID=:contract_id").setParameter("contract_id",ContractId).getSingleResult(false); + String customerName = boName.getAttribute("customer_name").toString(); + + String status = CurPage.getParameter("Status"); + String sTempletNo ="LBDeductCardOld";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if("approve_status02".equals(status)){ + doTemp.setJboClass(LB_DEDUCT_CARD_HIS.CLASS_NAME); + doTemp.appendJboWhere("apply_id='"+CurPage.getParameter("ApplyId")+"'"); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if(RightType!=null && "ReadOnly".equals(RightType)){ + isShowButton=false; + } + dwTemp.genHTMLObjectWindow(ContractId); + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("change", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("contractList", "", CurPage.getObjectWindowOutput()); + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","生成变更材料","生成合同","generateQuotation()","","","","btn_icon_detail",""}, + {"true","","Button","发起电子签约","电子签章合同","signOnLine()","","","","btn_icon_detail",""}, + {"true","","Button","查询签约结果","查询签约结果","getStatus()","","","","btn_icon_detail",""}, + {"true","All","Button","修改","修改","edit()","","","","btn_icon_edit"}, + {"false","","Button","下载合同文件","下载合同","downloadDoc()","","","","btn_icon_down",""} + }; + //sButtonPosition = "south"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyMain.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyMain.jsp new file mode 100644 index 000000000..f6ee03fa9 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/company/AccountChangeCompanyMain.jsp @@ -0,0 +1,98 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<% + /* + 页面说明:示例模块主页面 + */ + String PG_TITLE = "示例模块主页面"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "  示例模块主页面  "; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "200";//默认的treeview宽度 + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + //定义Treeview + OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "扣款信息变更","right"); + + out.write(new Button("关闭", "关闭", "closePage()", "", "btn_icon_close").getHtmlText()); + out.write(new Button("提交", "提交", "doSubmit()", "", "btn_icon_submit").getHtmlText()); + + //定义树图结构 + /* String sFolder1=tviTemp.insertFolder("root","示例信息","",1); + tviTemp.insertPage(sFolder1,"所有的示例信息","",1); + tviTemp.insertPage(sFolder1,"我的示例信息","",2); + tviTemp.insertPage(sFolder1,"他的示例信息","",3); */ + tviTemp.insertPage("root","项目基本信息","",1); + tviTemp.insertPage("root","扣款信息变更","",2); + tviTemp.insertPage("root","合同打印","",3); + + //另外两种定义树图结构的方法:SQL生成和代码生成 参见View的生成 ExampleView.jsp和ExampleView01.jsp +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonChangeInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonChangeInfo.jsp new file mode 100644 index 000000000..93cc996a1 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonChangeInfo.jsp @@ -0,0 +1,213 @@ +<%@page import="jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人现扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String ID = CurPage.getParameter("id");//租赁物ID + if(ID == null)ID = ""; + String RightType=CurPage.getParameter("RightType"); + if(RightType==null)RightType=""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + String applyId = CurPage.getParameter("ApplyId"); + if(applyId == null) applyId = ""; + + String sTempletNo ="LBDeductCardChange";//--模板号-- + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //获取变更表里面的数据,根据process判断是否已经签约了,如果已经签约了,现扣款卡信息页面为只读 + BizObject boAccount = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME).createQuery("flow_unid=:applyId and file_flag='yes'").setParameter("applyId", applyId).getSingleResult(false); + if(boAccount!=null){ + String signType = boAccount.getAttribute("SIGN_TYPE").toString(); + if(signType!="" ){ + RightType= "ReadOnly"; + } + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + if(RightType!=null && RightType.equals("ReadOnly")){ + dwTemp.ReadOnly = "1";//只读模式 + } + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(applyId); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + //{"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + }; + //sButtonPosition = "south"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonInfo.jsp new file mode 100644 index 000000000..7cb215c2b --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonInfo.jsp @@ -0,0 +1,326 @@ +<%@page import="jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_DEDUCT_CARD_CHANGE"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_UNION_LESSEE"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_TEL"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_DEDUCT_CARD_HIS"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人原扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String ID = CurPage.getParameter("id");//租赁物ID + if(ID == null)ID = ""; + String RightType=CurPage.getParameter("RightType"); + if(RightType==null)RightType=""; + String applyId = CurPage.getParameter("ApplyId"); + if(applyId==null)applyId=""; + String customerType=CurPage.getParameter("CustomerType"); + if(customerType==null)customerType=""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId==null)ContractId=""; + String customerId = CurPage.getParameter("CustomerId"); + if(customerId==null)customerId=""; + //获取电话号码 + BizObjectManager bomTel = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME); + BizObject boTel = bomTel.createQuery("select * from o where customerid=:customerid").setParameter("customerid",customerId).getSingleResult(false); + String telephone = boTel.getAttribute("telephone").toString(); + //获取姓名 + BizObjectManager bomName = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME); + BizObject boName = bomName.createQuery("select * from o where CONTRACT_ID=:contract_id").setParameter("contract_id",ContractId).getSingleResult(false); + String customerName = boName.getAttribute("customer_name").toString(); + + + + if(customerId == null) customerId = ""; + String status = CurPage.getParameter("Status"); + String sTempletNo ="LBDeductCardOldPerson";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setVisible("IS_CONSIGN_REPAY", false); + doTemp.setVisible("CONSIGN_REPAY_CERT", false); + doTemp.setVisible("CONSIGN_REPAY_PHONE", false); + if("approve_status02".equals(status)){ + doTemp.setJboClass(LB_DEDUCT_CARD_HIS.CLASS_NAME); + doTemp.appendJboWhere("apply_id='"+CurPage.getParameter("ApplyId")+"'"); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if(RightType!=null && "ReadOnly".equals(RightType)){ + isShowButton=false; + } + + + dwTemp.genHTMLObjectWindow(ContractId); + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("change", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("contractList", "", CurPage.getObjectWindowOutput()); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","生成变更材料","生成合同","generateQuotation()","","","","btn_icon_detail",""}, + {"true","","Button","发起电子签约","电子签章合同","signOnLine()","","","","btn_icon_detail",""}, + {"true","","Button","查询签约结果","查询签约结果","getStatus()","","","","btn_icon_detail",""}, + {"true","All","Button","修改","修改","edit()","","","","btn_icon_edit"}, + {"false","","Button","下载合同文件","下载合同","downloadDoc()","","","","btn_icon_down",""} + }; + //sButtonPosition = "south"; + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonMain.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonMain.jsp new file mode 100644 index 000000000..340314eea --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/AccountChangePersonMain.jsp @@ -0,0 +1,97 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<% + /* + 页面说明:示例模块主页面 + */ + String PG_TITLE = "示例模块主页面"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "  示例模块主页面  "; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "200";//默认的treeview宽度 + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + //定义Treeview + OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "扣款信息变更","right"); + + out.write(new Button("关闭流程", "关闭流程", "closePage()", "", "btn_icon_close").getHtmlText()); + out.write(new Button("提交", "提交", "submitApply()", "", "btn_icon_submit").getHtmlText()); + //定义树图结构 + /* String sFolder1=tviTemp.insertFolder("root","示例信息","",1); + tviTemp.insertPage(sFolder1,"所有的示例信息","",1); + tviTemp.insertPage(sFolder1,"我的示例信息","",2); + tviTemp.insertPage(sFolder1,"他的示例信息","",3); */ + tviTemp.insertPage("root","项目基本信息","",1); + tviTemp.insertPage("root","扣款信息变更","",2); + tviTemp.insertPage("root","合同打印","",3); + + //另外两种定义树图结构的方法:SQL生成和代码生成 参见View的生成 ExampleView.jsp和ExampleView01.jsp +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/ControlForInitChangeAccount.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/ControlForInitChangeAccount.jsp new file mode 100644 index 000000000..6d6082ed1 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/ControlForInitChangeAccount.jsp @@ -0,0 +1,36 @@ +<%@page import="jbo.sys.CHANNEL_SUBMIT_APPLICATIONS"%> +<%@page import="com.tenwa.action.channelportal.channelsubmit.ChannelSubmitAction" %> +<%@page import="com.tenwa.action.channelportal.businesshanding.businesschangeapply.ChannelUpdate" %> +<%@page import="com.amarsoft.are.jbo.*"%> +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBeginMDAJAX.jsp"%><% + try{ + String ContractId = CurPage.getParameter("ContractId"); + String flowNo = "AccountChangeFlow"; + String ProjectId = CurPage.getParameter("ProjectId"); + String CustomerType = CurPage.getParameter("CustomerType"); + String param ="ContractId="+ContractId+"&ProjectId="+ProjectId+"&CustomerType="+CustomerType; + + String curUserId=CurPage.getParameter("CurUserID"); + BizObjectManager bom=JBOFactory.getBizObjectManager(CHANNEL_SUBMIT_APPLICATIONS.CLASS_NAME); + + if(bom!=null){ + List bos = bom.createQuery("select * from O WHERE Objectno=:Objectno and FlowNo='AccountChangeFlow' and status='approve_status01'") + .setParameter("Objectno", ContractId) + .getResultList(); + if(bos.size()>0){ + out.print("请勿重复提交"); + }else{ + String result =ChannelSubmitAction.changeSubmitStatus(curUserId,ContractId,flowNo,param,null); + if("SUCCESS".equals(result)){ + out.print("SUCCESS"); + }else{ + out.print("ERROR"); + } + } + } + }catch(Exception e){ + out.print("ERROR"); + throw e; + } +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/DeductCardDocList.jsp b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/DeductCardDocList.jsp new file mode 100644 index 000000000..bd7eed0e5 --- /dev/null +++ b/WebContent/Tenwa/ChannelPortal/BusinessChangeApply/AccountChange/person/DeductCardDocList.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-28 + Content: + History Log: + */ + String applyId = CurPage.getParameter("applyId"); + if(applyId==null) applyId = ""; + String customerType = CurPage.getParameter("customerType"); + if(customerType==null) customerType = ""; + ASObjectModel doTemp = new ASObjectModel("DeductCardDocList"); + //根据中间表id查询 + doTemp.appendJboWhere("flow_unid='"+applyId+"'"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/BusinessHanding/CarPhoto/LBCarPhotoDocumentInfo.jsp b/WebContent/Tenwa/ChannelPortal/BusinessHanding/CarPhoto/LBCarPhotoDocumentInfo.jsp index 0a644f994..f65013e51 100644 --- a/WebContent/Tenwa/ChannelPortal/BusinessHanding/CarPhoto/LBCarPhotoDocumentInfo.jsp +++ b/WebContent/Tenwa/ChannelPortal/BusinessHanding/CarPhoto/LBCarPhotoDocumentInfo.jsp @@ -5,12 +5,15 @@ //获得组件参数 String sObjectType=CurPage.getParameter("ObjectType");// String contract_id=CurPage.getParameter("contract_id"); - String car_id=CurPage.getParameter("car_id"); + + //String contract_id=CurPage.getParameter("contract_id"); + //String car_id=CurPage.getParameter("car_id"); ASObjectModel doTemp = new ASObjectModel("LB_CAR_LICENSE_PLATE_INFO"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写 - dwTemp.genHTMLObjectWindow(car_id); + //dwTemp.genHTMLObjectWindow(car_id); + dwTemp.genHTMLObjectWindow(contract_id); String[][] sButtons=null; sButtons=new String[][]{ {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, @@ -18,7 +21,7 @@ %><%@include file="/Frame/resources/include/ui/include_info.jspf"%> +<% + } + } +%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/ChannelPortal/DistributorManage/DistributorRegister/CLMSDistributorList.jsp b/WebContent/Tenwa/ChannelPortal/DistributorManage/DistributorRegister/CLMSDistributorList.jsp index 05043a721..61c65f193 100644 --- a/WebContent/Tenwa/ChannelPortal/DistributorManage/DistributorRegister/CLMSDistributorList.jsp +++ b/WebContent/Tenwa/ChannelPortal/DistributorManage/DistributorRegister/CLMSDistributorList.jsp @@ -8,6 +8,8 @@ History Log: */ String id = UUIDUtil.getUUID(); + + //String sFlowUnid = CurPage.getParameter("FlowUnid"); String userId = CurPage.getUserId(); ASObjectModel doTemp = new ASObjectModel("CustomerDistributorList"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); @@ -15,14 +17,21 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(20); dwTemp.genHTMLObjectWindow(""); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","详情","详情","detail()","","","","btn_icon_detail",""}, - {"true","All","Button","合作中","合作中","teaming()","","","","btn_icon_detail",""}, - {"true","","Button","合作暂停","合作暂停","teamingSuspend()","","","","btn_icon_detail",""}, - {"true","","Button","合作终止","合作终止","teamingStop()","","","","btn_icon_detail",""} + boolean flag = CurUser.hasRole("800R00000011"); + String sButtons[][] =null; + if(flag){ + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + sButtons = new String[][]{ + {"true","All","Button","详情","详情","detail()","","","","btn_icon_detail",""}, + {"true","All","Button","激活","激活","teaming()","","","","btn_icon_detail",""}, + {"true","","Button","合作暂停","合作暂停","teamingSuspend()","","","","btn_icon_detail",""}, + {"true","","Button","合作终止","合作终止","teamingStop()","","","","btn_icon_detail",""} + }; + }else{ + sButtons = new String[][]{ + {"true","All","Button","详情","详情","detail()","","","","btn_icon_detail",""} }; + } %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/CustomerDoc/CustomerList.jsp b/WebContent/Tenwa/Comm/CustomerDoc/CustomerList.jsp index f4dae63bd..3ea8c214c 100644 --- a/WebContent/Tenwa/Comm/CustomerDoc/CustomerList.jsp +++ b/WebContent/Tenwa/Comm/CustomerDoc/CustomerList.jsp @@ -10,9 +10,9 @@ String custid=CurPage.getParameter("customerid");//客户ID String mainType= CurPage.getParameter("mainType"); String docClassItemno=""; - if(mainType.equals("Customer")){ + if("Customer".equals(mainType)){ docClassItemno="001001"; - }else if(mainType.equals("Guarantee")){ + }else if("Guarantee".equals(mainType)){ docClassItemno="001002"; } String compClientID = request.getParameter("CompClientID"); @@ -49,6 +49,9 @@ String sButtons[][] =null; sButtons=new String[][]{ + /* {"true","All","Button","新增","新增","newRecord()","","","",""}, + {"true","All","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, */ }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> @@ -58,8 +61,18 @@ window.onload=function(){ $("#DWTD").width( document.body.offsetHeight - 20); document.getElementById('DWTD').innerHTML = '
'+document.getElementById('DWTD').innerHTML+'
'; } -function saveRecord(){ - as_save("myiframe0"); +function newRecord(){ + var sUrl = "/Tenwa/Comm/CustomerDoc/CustomerDoc_Info.jsp"; + AsControl.OpenView(sUrl,'','_self','');<%-- "docClassItemno="+<%=docClassItemno%>+"&custid="+<%=custid%> --%> +} +function viewAndEdit(){ + var sUrl = "/Tenwa/Comm/CustomerDoc/CustomerDoc_Info.jsp"; + var sPara = getItemValue(0,getRow(0),'ID'); + if(typeof(sPara)=="undefined" || sPara.length==0 ){ + alert("参数不能为空!"); + return ; + } + AsControl.OpenView(sUrl,'ID=' +sPara ,'_self',''); } //在加载完表格后调用 function afterSearch(){ @@ -104,7 +117,7 @@ function showWord(id,name){ var param="attrid="+id; AsControl.OpenPage(sUrl,param,"",""); } -//在线编辑 +<%-- //在线编辑 function editOffice(id,filename,sRightType){ var filetype=filename.substr(filename.indexOf(".")+1); var status=2; @@ -121,7 +134,7 @@ function editOffice(id,filename,sRightType){ alert("提交失败!"); } },"编辑文档"); -} +} --%> function showImage(id,name){ var sUrl="/Tenwa/Comm/DocList/showImage.jsp"; var param="attrid="+id; diff --git a/WebContent/Tenwa/Comm/DocList/BussinessApproveDocList.jsp b/WebContent/Tenwa/Comm/DocList/BussinessApproveDocList.jsp new file mode 100644 index 000000000..6184a271b --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/BussinessApproveDocList.jsp @@ -0,0 +1,195 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<% + /* + 带出业务申请时附件的专用页面 + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String flowunid=CurPage.getParameter("FlowUnid"); + String ProjectId=CurPage.getParameter("ProjectId"); + String carAttributes=CurPage.getParameter("carAttributes");//获取车类型 + if(flowunid==""||flowunid==null){ + flowunid="flowunid"; + } + + String sObjectType = CurPage.getParameter("FlowNo");//流程类型 + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType= CurPage.getParameter("RightType"); + String username=CurUser.getUserName(); + String sTempletNo=CurPage.getParameter("TempletNo"); + if(sTempletNo==null){ + sTempletNo="FlowPayDocList"; + } + + String compClientID = request.getParameter("CompClientID"); + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.appendJboWhere(" and rela.proj_id='"+ProjectId+"' and rela.objecttype='BusinessApplyFlow'"); + + doTemp.setLockCount(2); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + doTemp.setVisible("operation", false); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; + dwTemp.setPageSize(50); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "1";//只读模式 + RightType="ReadOnly"; + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.genHTMLObjectWindow(flowunid); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","saveRecord()","","","",""}, + }; + +%> + +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/CustomerDocList.jsp b/WebContent/Tenwa/Comm/DocList/CustomerDocList.jsp index 1f0eaa1b0..4e9af5c48 100644 --- a/WebContent/Tenwa/Comm/DocList/CustomerDocList.jsp +++ b/WebContent/Tenwa/Comm/DocList/CustomerDocList.jsp @@ -46,7 +46,7 @@ customername=cust.get(i).getAttribute("customername").getString(); } %> - +<%--
- + --%>
    @@ -55,7 +55,7 @@ groupid="0010<%=index%>" id="EXP_0010<%=index%>">
diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/ConfirmInvoice/invoice_confirm.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/ConfirmInvoice/invoice_confirm.xml index d842954e4..f87ec60f4 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/ConfirmInvoice/invoice_confirm.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/ConfirmInvoice/invoice_confirm.xml @@ -9,172 +9,172 @@ @@ -182,7 +182,7 @@ UNION ALL =31 + WHERE lccs.PLAN_STATUS>=31 UNION ALL SELECT clrp.id AS id, @@ -89,7 +89,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, clrp.plan_list AS rentlist, clrp.plan_date AS plandate, clrp.corpus AS planmoney, - 'corpus' AS renttype, + CONVERT('corpus' USING utf8) AS renttype, invoiceinfo.corpus_invoice_type AS rentinvoicetype, invoiceinfo.corpus_rate AS rentrate, lccs.contract_id AS contractid @@ -128,7 +128,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, (SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form where lci.sign_date>='2016/05/01' ) invoiceinfo on lci.id= invoiceinfo.id - WHERE lci.rent_invoice_type='invoice_type04' AND lccs.PLAN_STATUS>=31 + WHERE lccs.PLAN_STATUS>=31 UNION ALL SELECT ilrp.id AS id, @@ -136,7 +136,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, ilrp.plan_list AS rentlist, ilrp.plan_date AS plandate, ilrp.interest AS planmoney, - 'interest' AS renttype, + CONVERT('interest' USING utf8) AS renttype, invoiceinfo.interest_invoice_type AS rentinvoicetype, invoiceinfo.interest_rate AS rentrate, lccs.contract_id AS contractid @@ -175,7 +175,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, (SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form where lci.sign_date>='2016/05/01' ) invoiceinfo on lci.id= invoiceinfo.id - WHERE lci.rent_invoice_type IN ('invoice_type01','invoice_type02','invoice_type04','invoice_type06') AND lccs.PLAN_STATUS>=31 + WHERE lccs.PLAN_STATUS>=31 ) rentplan LEFT JOIN LB_CONTRACT_INFO lci ON rentplan.contractid=lci.id LEFT JOIN lb_contract_invoice_type lcit ON lcit.contract_id=lci.id AND lcit.is_main='Y' @@ -265,7 +265,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, LEFT JOIN (SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form ) invoiceinfo on lci.id= invoiceinfo.id - WHERE lci.rent_invoice_type in ('invoice_type03','invoice_type05') AND lccs.PLAN_STATUS>=31 + WHERE lccs.PLAN_STATUS>=31 UNION ALL SELECT clrp.id AS id, @@ -312,7 +312,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, (SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form where lci.sign_date>='2016/05/01' ) invoiceinfo on lci.id= invoiceinfo.id - WHERE lci.rent_invoice_type='invoice_type04' AND lccs.PLAN_STATUS>=31 + WHERE lccs.PLAN_STATUS>=31 UNION ALL SELECT ilrp.id AS id, @@ -359,7 +359,7 @@ select id,contractnumber,paymentnumber,customername,rentlist,plandate,planmoney, (SELECT asset_type,lease_form,tax_reg_type,interest_rate,interest_invoice_type,corpus_rate,corpus_invoice_type,hand_rate,hand_invoice_type,service_rate,service_invoice_type,nominal_rate,nominal_invoice_type,caution_invoice_type FROM TAX_INFO WHERE CONTRACT_DATE='2016/05/01' AND before_after='after' AND asset_type='asset_type01') taxrate2 ON taxrate2.asset_type=lci.asset_type AND taxrate2.tax_reg_type=lcit.tax_reg_type AND taxrate2.lease_form=lci.lease_form where lci.sign_date>='2016/05/01' ) invoiceinfo on lci.id= invoiceinfo.id - WHERE lci.rent_invoice_type IN ('invoice_type01','invoice_type02','invoice_type04','invoice_type06') AND lccs.PLAN_STATUS>=31 + WHERE lccs.PLAN_STATUS>=31 ) rentplan LEFT JOIN LB_CONTRACT_INFO lci ON rentplan.contractid=lci.id LEFT JOIN lb_contract_invoice_type lcit ON lcit.contract_id=lci.id AND lcit.is_main='Y' diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithDeduction.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithDeduction.xml index 9487f482a..fb5e4e037 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithDeduction.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithDeduction.xml @@ -84,12 +84,11 @@ FROM ON lccs.payment_number = lcc.payment_number LEFT JOIN lb_contract_status lcs ON lcs.STATUS_CODE = lccs.plan_status -WHERE IFNULL(l.fact_money, 0) = lcc.CAUTION_MONEY +WHERE lci.businesstype='#businessType' AND IFNULL(l.fact_money, 0) = lcc.CAUTION_MONEY AND ( lcc.CAUTION_DEDUCTION_MONEY - IFNULL(lr.fact_money, 0) ) > 0 - AND lccs.plan_status = '31' { lci, - contract } + AND lccs.plan_status = '31' AND lcc.PAYMENT_NUMBER NOT IN (SELECT payment_number diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithReturn.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithReturn.xml index 47b3c64df..02a704622 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithReturn.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractOnhireWithReturn.xml @@ -74,12 +74,11 @@ FROM ON lccs.payment_number = lcc.payment_number LEFT JOIN lb_contract_status lcs ON lcs.status_code = lccs.plan_status -WHERE IFNULL(l.fact_money, 0) > 0 +WHERE lci.businesstype='#businessType' AND IFNULL(l.fact_money, 0) > 0 AND ( lcc.CAUTION_MONEY_REMAIN - IFNULL(lr.fact_money, 0) ) > 0 - AND lccs.plan_status = '31' { lci, - contract } + AND lccs.plan_status = '31' ]]> diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPayment.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPayment.xml index 59afa1e52..4bedb4273 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPayment.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPayment.xml @@ -9,7 +9,7 @@ 0 + AND fo.phaseno NOT IN ('1000', '8000'))) tab where tab.overmoney>0 + ]]> diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPaymentKE.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPaymentKE.xml new file mode 100644 index 000000000..bef0b75ca --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectContractPaymentKE.xml @@ -0,0 +1,203 @@ + + + +
diff --git a/WebContent/Tenwa/Comm/DocList/DeleteDocFile.jsp b/WebContent/Tenwa/Comm/DocList/DeleteDocFile.jsp new file mode 100644 index 000000000..b5ce50f44 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/DeleteDocFile.jsp @@ -0,0 +1,13 @@ +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String attrId = CurPage.getAttribute("AttributeId"); + String result = "SUCCESS"; + try { + Sqlca.executeSQL(new SqlObject("delete from lb_docattribute where id = '" + attrId + "'")); + } catch(Exception e) { + e.printStackTrace(); + result = "FAILED"; + } + out.print(result); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/DocListInfo.jsp b/WebContent/Tenwa/Comm/DocList/DocListInfo.jsp index 019ffd7fa..a9e43411e 100644 --- a/WebContent/Tenwa/Comm/DocList/DocListInfo.jsp +++ b/WebContent/Tenwa/Comm/DocList/DocListInfo.jsp @@ -44,7 +44,6 @@ var o = document.forms["myiframe0"]; var sFileName = o.FILE2.value; var nameArr = sFileName.split("\\"); - setItemValue(0,0,"FileName",encodeURI(nameArr[nameArr.length-1])); $("#FILENAMEX").val(encodeURI(nameArr[nameArr.length-1])); o.REMARK2.value= encodeURI(getItemValue(0,0,"REMARK")); @@ -77,7 +76,15 @@ return o.submit(); } function CheckStr(filename){ - var s="jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx"; + var s=""; + var fileName =getItemValue(0,0,"DOC_NAME"); + if("车辆视频"==fileName){ + s="mp4,mov,m4v,avi,3gp,rm,rmvb,wmv,asf,mkv,vob"; + }else if("其他"==fileName){ + s="mp4,mov,m4v,avi,3gp,rm,rmvb,wmv,asf,mkv,vob,jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx"; + }else{ + s="jpg,jpeg,png,bmp,gif,pdf,doc,docx,xls,xlsx"; + } var flag="false"; var s2=s.split(","); var filenamelast = filename.lastIndexOf("."); diff --git a/WebContent/Tenwa/Comm/DocList/DocListInfoNew.jsp b/WebContent/Tenwa/Comm/DocList/DocListInfoNew.jsp new file mode 100644 index 000000000..a96beb132 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/DocListInfoNew.jsp @@ -0,0 +1,324 @@ +<%@page import="com.tenwa.util.QuartzPropertiesUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + String sLibraryId = CurPage.getParameter("Library_id"); + String objectType = CurPage.getParameter("ObjectType"); + ASResultSet rs = Sqlca.getASResultSet(new SqlObject("select doc_type,one_classify,doc_name,remark from lb_doclibrary where id = '" + sLibraryId + "'")); + String docType = ""; + String oneClassify = ""; + String docName = ""; + String remark = ""; + if(rs.next()) { + docType = rs.getString("doc_type"); //一级分类 + oneClassify = rs.getString("one_classify"); //二级分类 + docName = rs.getString("doc_name"); //资料名称 + remark = rs.getString("remark"); //备注 + } +%> + + + +File Upload + + + + + + + + + + + +
+
+ + <%-- + + + --%> + + + + +
<%=docName %>
+
+
+
未选择任何文件
+ +
+
+
选择文件
+ <% + if(!"true".equals(QuartzPropertiesUtil.get("autoUpload"))) {%> + + <%} + %> + +
+
+
+ + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/DocListMain.jsp b/WebContent/Tenwa/Comm/DocList/DocListMain.jsp index a24a8fe8b..fbb48e097 100644 --- a/WebContent/Tenwa/Comm/DocList/DocListMain.jsp +++ b/WebContent/Tenwa/Comm/DocList/DocListMain.jsp @@ -40,9 +40,19 @@ var docList="<%=docList%>"; myleft.width=1; if("SingleRow"=="<%=type%>"){ - AsControl.OpenView("/Tenwa/Comm/DocList/PayDocList.jsp","docList="+docList,"right",""); + if("FundPaymentCarFlow"=="<%=sFlowNo%>"||"BusinessApplyFlow"=="<%=sFlowNo%>"||"MortgageFileFlow"=="<%=sFlowNo%>"||"ContractSupportFlow"=="<%=sFlowNo%>"||"ProjectSupportFlow"=="<%=sFlowNo%>"||"ProjectApprovalFlow"=="<%=sFlowNo%>"||"FundPaymentFlow"=="<%=sFlowNo%>"||"ProjectCancelFlow"=="<%=sFlowNo%>"||"Mortgage2FileFlow"=="<%=sFlowNo%>"||"ContractCancelFlow"=="<%=sFlowNo%>"||"ContractChangeFlow"=="<%=sFlowNo%>"){ + AsControl.OpenView("/Tenwa/Comm/DocList/PayDocList.jsp","docList="+docList,"right",""); + }else if("ProjectCreditFlow"=="<%=sFlowNo%>"||"ContractApprovalFlow"=="<%=sFlowNo%>"||"ProjectRecreditFlow"=="<%=sFlowNo%>"){ + AsControl.OpenView("/Tenwa/Comm/DocList/PayDocListTradition.jsp","docList="+docList,"right",""); + }else{ + AsControl.OpenView("/Tenwa/Comm/DocList/BussinessApproveDocList.jsp","docList="+docList,"right",""); + } }else{ - AsControl.OpenView("/Tenwa/Comm/DocList/CustomerDocTab.jsp","docList="+docList,"right",""); + if("ContractApprovalFlow"=="<%=sFlowNo%>"||"ContractChangeFlow"=="<%=sFlowNo%>"||"ProjectChangeFlow"=="<%=sFlowNo%>"){ + AsControl.OpenView("/Tenwa/Comm/DocList/PayDocListTradition.jsp","docList="+docList,"right",""); + }else{ + AsControl.OpenView("/Tenwa/Comm/DocList/CustomerDocTab.jsp","docList="+docList,"right",""); + } } <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/DocListUploadNew.jsp b/WebContent/Tenwa/Comm/DocList/DocListUploadNew.jsp new file mode 100644 index 000000000..43c002d22 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/DocListUploadNew.jsp @@ -0,0 +1,103 @@ +<%@page import="java.io.File" +%><%@page import="org.apache.commons.io.FileUtils" +%><%@page import="com.amarsoft.are.jbo.BizObject" +%><%@page import="com.amarsoft.are.jbo.BizObjectManager" +%><%@page import="com.amarsoft.are.jbo.JBOFactory" +%><%@page import="org.apache.commons.fileupload.FileItem" +%><%@page import="org.apache.commons.fileupload.servlet.ServletFileUpload" +%><%@page import="org.apache.commons.fileupload.disk.DiskFileItemFactory" +%><%@page import="java.net.URLDecoder" +%><%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper" +%><%@page import="com.amarsoft.awe.util.DBKeyHelp" +%><%@page import="com.amarsoft.awe.common.attachment.*" +%><%@ page contentType="text/html; charset=GBK" +%><%@ include file="/IncludeBeginMDAJAX.jsp"%><% + + //1.创建DiskFileItemFactory对象,配置缓存用 + DiskFileItemFactory diskFileItemFactory = new DiskFileItemFactory(); + + // 2. 创建 ServletFileUpload对象 + ServletFileUpload servletFileUpload = new ServletFileUpload(diskFileItemFactory); + + // 3. 设置文件名称编码 + servletFileUpload.setHeaderEncoding("utf-8"); + + List items = servletFileUpload.parseRequest(request); + + String libraryId = "";//附件业务数据表编号 + String inputTime = StringFunction.getTodayNow(); //附件编号上传时间 + String fileSize = ""; //文件大小 + String contentType = ""; //文件类型 + String fileName = ""; //文件名称 + String fileId = ""; + String objectType = ""; + InputStream is = null; + + for (FileItem fileItem : items) { + if (fileItem.isFormField()) { // >> 普通数据 + String fieldValue = fileItem.getString("utf-8"); + String fieldName = fileItem.getFieldName(); + if("LibraryId".equals(fieldName)) { + libraryId = fieldValue; + } else if("size".equals(fieldName)) { + fileSize = fieldValue; + } else if("name".equals(fieldName)) { + fileName = fieldValue; + } else if("type".equals(fieldName)) { + contentType = fieldValue; + } else if("id".equals(fieldName)) { + fileId = fieldValue; + } else if("ObjectType".equals(fieldName)) { + objectType = fieldValue; + } + ARE.getLog().info(fieldName + ": " + fieldValue); + } else { + //获取文件的实际内容 + is = fileItem.getInputStream(); + } + } + + BizObjectManager libBm = JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY", Sqlca); + BizObjectManager attrBm = JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE", Sqlca); + + BizObject lib = libBm.createQuery("id=:id").setParameter("id", libraryId).getSingleResult(false); + BizObject attr = attrBm.newObject(); + attr.setAttributeValue("Library_Id", libraryId); + attr.setAttributeValue("FileName", fileName); + attr.setAttributeValue("InputUserId", CurUser.getUserID()); + attr.setAttributeValue("InputOrgId", CurUser.getOrgID()); + attr.setAttributeValue("InputTime", inputTime); + attr.setAttributeValue("objectType", objectType); + + //定义数据库操作变量 + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + + if (!"".equals(libraryId)){ + try { + String uuid = java.util.UUID.randomUUID().toString().replaceAll("-", ""); + String sFullPath = com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) + uuid + "_" + fileName; + if(Integer.parseInt(fileSize) <= 0){ + throw new Exception("上传文件失败,请联系管理员!"); + } + //保存文件 + FileUtils.copyInputStreamToFile(is, new File(sFullPath)); + + //得到带相对路径的文件名 + String sFilePath = sFullPath.replace(sFileSavePath, ""); + attr.setAttributeValue("FilePath", sFilePath); + attr.setAttributeValue("FullPath", sFullPath); + attr.setAttributeValue("Content_Type", contentType); + attr.setAttributeValue("FileSize", fileSize); + attrBm.saveObject(attr); + + Sqlca.commit(); + }catch(Exception e) { + e.printStackTrace(); + Sqlca.rollback(); + out.print("FAILED"); + } + out.print(attr.getAttribute("id").getString()); + } else { + out.print("FAILED"); + } +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfo.jsp b/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfo.jsp new file mode 100644 index 000000000..fe8bc840e --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfo.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-14 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("ID"); + //if(sPrevUrl == null) sPrevUrl = ""; + String inputuserid = CurUser.getUserID(); + String inputusername = CurUser.getUserName(); + String inputorgid = CurOrg.getOrgID(); + String inputorgname = CurOrg.getOrgName(); + + String sTempletNo = "LB_CAR_LICENSE_PLATE_INFO_Info";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +/* doTemp.setColTips("", "测试"); */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","",""} + }; +/* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfoTemp.jsp b/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfoTemp.jsp new file mode 100644 index 000000000..ad38d8add --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/LbCarLicensePlateInfoTemp.jsp @@ -0,0 +1,120 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-08-09 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + String inputuserid = CurUser.getUserID(); + String inputusername = CurUser.getUserName(); + String inputorgid = CurOrg.getOrgID(); + String inputorgname = CurOrg.getOrgName(); + + String FlowUnid = CurPage.getParameter("FlowUnid"); + String ContractId = CurPage.getParameter("ContractId"); + String ContractNumber = CurPage.getParameter("FlowKey"); + + String framenumber = Sqlca.getString("select FRAME_NUMBER from lb_equipment_car where contract_id ='"+ContractId+"'"); + String license_plate_number = Sqlca.getString("select license_plate_number from lb_equipment_car where contract_id ='"+ContractId+"'"); + //System.out.print(framenumber); + String sTempletNo = "LbCarLicensePlateInfoTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("plate_number", license_plate_number); + doTemp.setHtmlEvent("is_pledge", "onchange", "ispledge"); + doTemp.setHtmlEvent("is_delay", "onchange", "isdelay"); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + /* if("0020".equals(CurPage.getParameter("PhaseNo"))){ + dwTemp.ReadOnly = "-2";//只读模式 + } */ + dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid")); + String sButtons[][]=null; +/* if("0020".equals(CurPage.getParameter("PhaseNo"))){ + sButtons =new String[][] { + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + }else{ */ + sButtons =new String[][] { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + // } + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/PayDocList.jsp b/WebContent/Tenwa/Comm/DocList/PayDocList.jsp index af19ae58c..34dcdadc7 100644 --- a/WebContent/Tenwa/Comm/DocList/PayDocList.jsp +++ b/WebContent/Tenwa/Comm/DocList/PayDocList.jsp @@ -10,6 +10,9 @@ */ String flowunid=CurPage.getParameter("FlowUnid"); + String flowstate=CurPage.getParameter("flowstate"); + String CustomerType=CurPage.getParameter("CustomerType"); + String carAttributes=CurPage.getParameter("carAttributes");//获取车类型 if(flowunid==""||flowunid==null){ flowunid="flowunid"; } @@ -24,28 +27,47 @@ String RightType= CurPage.getParameter("RightType"); String username=CurUser.getUserName(); String sTempletNo=CurPage.getParameter("TempletNo"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String apply = CurPage.getParameter("ApplyType"); if(sTempletNo==null){ sTempletNo="FlowPayDocList"; } + + String type=CurPage.getParameter("type"); + if(type==null)type=""; String docClassItemno=CurPage.getParameter("docList"); String[] itemnos=docClassItemno.split(","); String s=""; + String classItemno =""; for(int i=0;i0){ s=s.substring(0, s.length()-1); + classItemno = s.replace(",", "@"); } - + if("ProjectCreditFlow".equals(sObjectType)){ + sTempletNo = "FlowPayDocList" ; + } String compClientID = request.getParameter("CompClientID"); - + if("ProjectRecreditFlow".equals(sObjectType)){ + sTempletNo = "FlowPayDocList" ; + } Map docParam=new HashMap(); Map other=new HashMap(); + other.put("carAttributes", carAttributes); + other.put("CustomerType", CustomerType); docParam.put("ObjectType",sObjectType); docParam.put("proj_id", flow.getAttribute("proj_id").getString()); docParam.put("contract_id", flow.getAttribute("contract_id").getString()); docParam.put("flow_unid", flowunid); + docParam.put("inputtime", StringFunction.getTodayNow()); + docParam.put("inputuserid", CurPage.getUserId()); + docParam.put("inputorgid", CurPage.getUser().getOrgID()); + + String projectId = flow.getAttribute("proj_id").getString(); + //判断是否存在,不存在就从配置表倒到临时表 DocListInitAction.initDocList(docParam,other,docClassItemno,CurConfig); ASObjectModel doTemp = new ASObjectModel(sTempletNo); @@ -53,13 +75,16 @@ doTemp.appendJboWhere(otherWhere); doTemp.appendJboWhere(" and O.doc_Class_Itemno in ("+s+")"); doTemp.setLockCount(2); + if("ContractSupportApply".equals(apply)&&"0010".equals(phaseNo)){ + RightType = "false"; + } if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ doTemp.setVisible("operation", false); } ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "0"; - dwTemp.setPageSize(50); + dwTemp.setPageSize(500); if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ dwTemp.ReadOnly = "1";//只读模式 RightType="ReadOnly"; @@ -73,6 +98,7 @@ sButtons=new String[][]{ {"true","","Button","保存","保存所有修改","saveRecord()","","","",""}, + {"true","","Button","批量下载","批量下载","downloadZipFile()","","","","btn_icon_down"}, }; %> @@ -83,6 +109,13 @@ <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/PayDocListProject.jsp b/WebContent/Tenwa/Comm/DocList/PayDocListProject.jsp new file mode 100644 index 000000000..db5cd04b1 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/PayDocListProject.jsp @@ -0,0 +1,230 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String flowunid=CurPage.getParameter("FlowUnid"); + String CustomerType=CurPage.getParameter("CustomerType"); + String carAttributes=CurPage.getParameter("carAttributes");//获取车类型 + if(flowunid==""||flowunid==null){ + flowunid="flowunid"; + } + + BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid);//流程对象 + + String sObjectType = CurPage.getParameter("FlowNo");//流程类型 + + + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType= CurPage.getParameter("RightType"); + String username=CurUser.getUserName(); + String sTempletNo=CurPage.getParameter("TempletNo"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String apply = CurPage.getParameter("ApplyType"); + if(sTempletNo==null){ + sTempletNo="FlowPayDocList"; + } + String docClassItemno="013002"; + + String[] itemnos=docClassItemno.split(","); + String s=""; + for(int i=0;i0){ + s=s.substring(0, s.length()-1); + } + + String compClientID = request.getParameter("CompClientID"); + if("ProjectRecreditFlow".equals(sObjectType)){ + sTempletNo = "FlowPayDocList" ; + } + Map docParam=new HashMap(); + Map other=new HashMap(); + other.put("carAttributes", carAttributes); + other.put("CustomerType", CustomerType); + docParam.put("ObjectType",sObjectType); + docParam.put("proj_id", flow.getAttribute("proj_id").getString()); + docParam.put("contract_id", flow.getAttribute("contract_id").getString()); + docParam.put("flow_unid", flowunid); + docParam.put("inputtime", StringFunction.getTodayNow()); + docParam.put("inputuserid", CurPage.getUserId()); + docParam.put("inputorgid", CurPage.getUser().getOrgID()); + + //判断是否存在,不存在就从配置表倒到临时表 + DocListInitAction.initDocList(docParam,other,docClassItemno,CurConfig); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + String otherWhere=DocListInitAction.getFlowWhere(flow,"","rela"); + doTemp.appendJboWhere(otherWhere); + doTemp.appendJboWhere(" and O.doc_Class_Itemno in ("+s+")"); + doTemp.setLockCount(2); + if("ContractSupportApply".equals(apply)&&"0010".equals(phaseNo)){ + RightType = "false"; + } + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + doTemp.setVisible("operation", false); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; + dwTemp.setPageSize(500); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "1";//只读模式 + RightType="ReadOnly"; + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.genHTMLObjectWindow(flowunid); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","saveRecord()","","","",""}, + }; + +%> + +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/PayDocListTradition.jsp b/WebContent/Tenwa/Comm/DocList/PayDocListTradition.jsp new file mode 100644 index 000000000..86f4afad5 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/PayDocListTradition.jsp @@ -0,0 +1,205 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<% + /* + Author: undefined 2016-09-01 + Content: 固定带出项目立项的资料清单列表页面,如要根据流程动态生成资料,请用DocListMain.jsp + History Log: + */ + + String ProjectId=CurPage.getParameter("ProjectId"); + String flowunid=CurPage.getParameter("FlowUnid"); + String CustomerType=CurPage.getParameter("CustomerType"); + String carAttributes=CurPage.getParameter("carAttributes");//获取车类型 + if(flowunid==""||flowunid==null){ + flowunid="flowunid"; + } + + BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid);//流程对象 + + String sObjectType = CurPage.getParameter("FlowNo");//流程类型 + + + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType= CurPage.getParameter("RightType"); + String username=CurUser.getUserName(); + String sTempletNo=CurPage.getParameter("TempletNo"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String apply = CurPage.getParameter("ApplyType"); + if(sTempletNo==null){ + sTempletNo="FlowPayDocList"; + } + String compClientID = request.getParameter("CompClientID"); + if("ProjectRecreditFlow".equals(sObjectType)){ + sTempletNo = "FlowPayDocList" ; + } + if("ProjectCreditFlow".equals(sObjectType)){ + sTempletNo = "FlowPayDocList" ; + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + + doTemp.appendJboWhere(" and rela.proj_id = '"+ProjectId+"' and rela.objecttype = 'ProjectApprovalFlow' "); + doTemp.setLockCount(2); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + doTemp.setVisible("operation", false); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; + dwTemp.setPageSize(500); + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "1";//只读模式 + RightType="ReadOnly"; + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.genHTMLObjectWindow(flowunid); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","saveRecord()","","","",""}, + }; + +%> + +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/PlateAttachmentUpload.jsp b/WebContent/Tenwa/Comm/DocList/PlateAttachmentUpload.jsp new file mode 100644 index 000000000..52a7972c7 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/PlateAttachmentUpload.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-31 + Content: 示例详情页面 + History Log: + */ + String Library_id = CurPage.getParameter("Library_id"); + + //定义变量 + String sObjectNo = "";//--对象编号 + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + + String sPrevUrl = CurPage.getParameter("PrevUrl"); + //if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp"; + + String sTempletNo = "PlateAttachmentUpload";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(Library_id); + String sButtons[][] = { + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","All","Button","取消","返回列表","pull()","","","","btn_icon_close"} + }; + /* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/TriditionDocListInfo.jsp b/WebContent/Tenwa/Comm/DocList/TriditionDocListInfo.jsp new file mode 100644 index 000000000..82725c9fe --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/TriditionDocListInfo.jsp @@ -0,0 +1,110 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //定义变量 + String sObjectNo = "";//--对象编号 + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + String flowunid=CurPage.getParameter("flowunid"); + String contractid = CurPage.getParameter("contractid"); + String projectid = CurPage.getParameter("projectid"); + + ASObjectModel doTemp = new ASObjectModel("FlowDocListUpload"); + doTemp.setVisible("DOC_TYPE",false); + doTemp.setVisible("ONE_CLASSIFY",false); + doTemp.setVisible("Remark",false); + doTemp.setDefaultValue("DOC_NAME", "合同文件"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(""); + String[][] sButtons=null; + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","","Button","取消","取消","viewAndEdit_attachment()","","","","btn_icon_close"}}; +%><%@include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/TriditionDocListUpload.jsp b/WebContent/Tenwa/Comm/DocList/TriditionDocListUpload.jsp new file mode 100644 index 000000000..f92c486ee --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/TriditionDocListUpload.jsp @@ -0,0 +1,106 @@ +<%@page import="java.net.URLDecoder"%> +<%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%> +<%@page import="com.amarsoft.awe.util.DBKeyHelp"%> +<%@page import="com.tenwa.reckon.util.UUIDUtil"%> +<%@page import="com.amarsoft.awe.common.attachment.*"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%><% + AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload(); + myAmarsoftUpload.initialize(pageContext); + myAmarsoftUpload.upload(); + String FileSizejs=(String)myAmarsoftUpload.getRequest().getParameter("FileSize2"); + String docType=(String)myAmarsoftUpload.getRequest().getParameter("DOC_TYPE"); + String oneClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("ONE_CLASSIFY"); + String twoClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("TWO_CLASSIFY"); + String objectType=(String)myAmarsoftUpload.getRequest().getParameter("OBJECTTYPE"); + + String contractid=(String)myAmarsoftUpload.getRequest().getParameter("CONTRACTID"); + String projectid=(String)myAmarsoftUpload.getRequest().getParameter("PROJECTID"); + String flowunid=(String)myAmarsoftUpload.getRequest().getParameter("flowunid"); + + String sFileName =URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"); //文件名称 + System.out.println("文件名"+sFileName); + // System.out.println("文件名==="+ URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8")); + String Remark=URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("REMARK2"),"UTF-8"); //备注InputTime +// String libraryId= (String)myAmarsoftUpload.getRequest().getParameter("ID"); //附件编号 + String InputTime= StringFunction.getTodayNow(); //附件编号上传时间 + BizObjectManager relaBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCRELATIVE"); + BizObjectManager libBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); + BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); + String relaID = UUIDUtil.getUUID(); + BizObject rela = relaBm.newObject(); + rela.setAttributeValue("ID", relaID); + rela.setAttributeValue("OBJECTTYPE", objectType); + rela.setAttributeValue("CONTRACT_ID", contractid); + rela.setAttributeValue("PROJ_ID", projectid); + relaBm.saveObject(rela); + + String libraryId = UUIDUtil.getUUID(); + BizObject lib = libBm.newObject(); + lib.setAttributeValue("ID", libraryId); + lib.setAttributeValue("RELATIVE_ID", relaID); + lib.setAttributeValue("Doc_Nature", "合同文件"); + lib.setAttributeValue("InputTime",InputTime); + lib.setAttributeValue("DOC_NAME", sFileName.substring(0, sFileName.indexOf("."))); + libBm.saveObject(lib); + + BizObject attr=attrBm.newObject(); + attr.setAttributeValue("Library_Id", libraryId); + attr.setAttributeValue("FileName", sFileName); + attr.setAttributeValue("InputUserId", CurUser.getUserID()); + attr.setAttributeValue("InputOrgId", CurUser.getOrgID()); + attr.setAttributeValue("InputTime",InputTime); + attr.setAttributeValue("objectType", objectType); + attr.setAttributeValue("FLOWUNID", flowunid); + + //得到不带路径的文件名 + sFileName = StringFunction.getFileName(sFileName); + sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8"); + //定义数据库操作变量 + SqlObject so = null; + String sNewSql = ""; + String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + String sFileNameType = CurConfig.getConfigure("FileNameType"); + + String trueTable = ((BizObjectTableMapper)attrBm).getTable(); //取得真实的表名 + String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable,"Id"); + + if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){ + try { + //System.out.println("sDocNo="+libraryId+"--sAttachmentNo="+sAttachmentNo+"--sFileName="+sFileName+"--sFileSavePath="+sFileSavePath); + //System.out.println("sFileNameType="+sFileNameType+"--application="+application); + //String sFullPath = com.amarsoft.awe.common.attachment.FileNameHelper.getFullPath(libraryId, sAttachmentNo,sFileName, sFileSavePath, sFileNameType, application); + String uuid=java.util.UUID.randomUUID().toString().replaceAll("-", ""); + String sFullPath =com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) +uuid+"_"+sFileName; + if(myAmarsoftUpload.getFiles().getFile(0).getSize()!=Integer.parseInt(FileSizejs)){ + throw new Exception("上传文件失败,请联系管理员!"); + } + myAmarsoftUpload.getFiles().getFile(0).saveAs(sFullPath); + //得到带相对路径的文件名 + String sFilePath = sFullPath.replace(sFileSavePath, ""); + attr.setAttributeValue("FilePath",sFilePath); + attr.setAttributeValue("FullPath",sFullPath); + attr.setAttributeValue("Content_Type",DataConvert.toString(myAmarsoftUpload.getFiles().getFile(0).getContentType())); + attr.setAttributeValue("FileSize",DataConvert.toString(String.valueOf(myAmarsoftUpload.getFiles().getFile(0).getSize()))); + attrBm.saveObject(attr); + myAmarsoftUpload = null; + }catch(Exception e){ + e.printStackTrace(); + out.println("An error occurs : " + e.toString()); + attrBm.deleteObject(attr); + myAmarsoftUpload = null; +%> + +<% + } + } +%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/contractDocListMain.jsp b/WebContent/Tenwa/Comm/DocList/contractDocListMain.jsp new file mode 100644 index 000000000..8d53567de --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/contractDocListMain.jsp @@ -0,0 +1,58 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="java.util.List" %> +<%@ page import="java.util.Map" %> +<%@ page import="com.amarsoft.app.util.ProductParamUtil" %> +<% + /* + 页面说明:隐藏左侧区域的Main页面 + */ + String PG_TITLE = ""; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = ""; //默认的内容区标题 + String PG_CONTNET_TEXT = "";//默认的内容区文字 + String PG_LEFT_WIDTH = "0";//默认的treeview宽度 + + + String RightType= CurPage.getParameter("RightType"); + String sFlowunid = CurPage.getParameter("FlowUnid"); + String sFlowNo= CurPage.getParameter("FlowNo"); + BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowunid); + String product=CurPage.getParameter("productId"); + List list=ProductParamUtil.getProductDocInfo(product,"PRD0412"); + String type=""; + String docList=""; + for(int i=0;i map=(Map)list.get(i); + if("BContractApproveFlow".equals(map.get("FLOW_INFO").toString())){ + type=map.get("TYPE").toString(); + if("SingleRow".equals(type)){ + docList=map.get("DOCLIST").toString(); + }else{ + List l=(List)map.get("DOCCONFIG"); + docList=l.toString(); + } + } + } +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/showImage.jsp b/WebContent/Tenwa/Comm/DocList/showImage.jsp index b2b05cc87..48b6f9cb8 100644 --- a/WebContent/Tenwa/Comm/DocList/showImage.jsp +++ b/WebContent/Tenwa/Comm/DocList/showImage.jsp @@ -1,5 +1,6 @@ <%@ page contentType="text/html; charset=GBK"%> <%@page import="com.amarsoft.awe.res.JspfText"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> <%@include file="/Frame/page/jspf/include/jsp_runtime_context.jspf" %><%@page import="com.amarsoft.web.dw.*"%><%@include file="/Frame/page/jspf/include/jsp_sqlca_head.jspf" %> @@ -32,9 +33,22 @@ top.status="<%=LanguageManager.getSystemLanguage(CurUser.getLanguage(), JspfText <% String compClientID = request.getParameter("CompClientID"); String attrid = CurPage.getParameter("attrid"); + String flowunid = CurPage.getParameter("flowunid"); + String projectid = CurPage.getParameter("projectid"); + String docClassItemno = CurPage.getParameter("docClassItemno"); + String objecttype = CurPage.getParameter("objecttype"); + List Imagelist = new ArrayList(); + if(flowunid!=null&&Imagelist.size()==0){ + Imagelist=DocListInitAction.nextImagebyFlowunid(flowunid,docClassItemno,objecttype); + } +// if(projectid!=null&&Imagelist.size()==0){ +// Imagelist=DocListInitAction.nextImagebyProjectId(projectid,docClassItemno,objecttype); +// } + int imageattridv = 0; + int index = 0; %> - +
-
    -
  • -
  • -
+
    + <% + if(Imagelist.size()>0){ + for(String imageattrid:Imagelist){ + imageattridv++; + if(imageattrid.equals(attrid)){ + index=imageattridv; + } + %> +
  • + <% + } + }else{ + index=1; + %> +
  • + <% + } + %> +
+ <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/DocList/showImageManage.jsp b/WebContent/Tenwa/Comm/DocList/showImageManage.jsp new file mode 100644 index 000000000..08b772d12 --- /dev/null +++ b/WebContent/Tenwa/Comm/DocList/showImageManage.jsp @@ -0,0 +1,90 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%><% + String compClientID = request.getParameter("CompClientID"); + String attrid = CurPage.getParameter("attrid"); +%> + + +
+ +
+ + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Comm/Document/DocImageShow.jsp b/WebContent/Tenwa/Comm/Document/DocImageShow.jsp index 61763fbdf..33d956a36 100644 --- a/WebContent/Tenwa/Comm/Document/DocImageShow.jsp +++ b/WebContent/Tenwa/Comm/Document/DocImageShow.jsp @@ -20,8 +20,9 @@ border-bottom:1px solid #BCBCBC;} String flowunid=CurPage.getParameter("ObjectNo"); String sObjectType=CurPage.getParameter("FlowNo"); - String type=CurPage.getParameter("type"); + String query = CurPage.getParameter("query");//用于区别是不是合同查询时查询附件 + if(type==null)type=""; @@ -35,11 +36,16 @@ border-bottom:1px solid #BCBCBC;} }else if("contract".equals(type)){ otherWhere=" and (rela.contract_id='"+CurPage.getParameter("contract_id")+"' OR rela.proj_id='"+CurPage.getParameter("proj_id")+"')"; } + if("query".equals(query)){ + otherWhere = otherWhere+" and rela.objecttype in ('BusinessApplyFlow','FundPaymentCarFlow','MortgageFileFlow') "; + }else{ + otherWhere = otherWhere+" and rela.objecttype='"+sObjectType+"' "; + } String compClientID = request.getParameter("CompClientID"); -String sql="select O.id,lib.doc_name,filename from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on o.library_id=lib.id left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on lib.relative_id=rela.id"; -sql+=" where O.content_type LIKE '%image%' "+otherWhere+" order by lib.doc_name,O.filename"; -System.out.println(sql); -List list=JBOFactory.createBizObjectQuery("jbo.app.tenwa.doc.LB_DOCATTRIBUTE", sql).getResultList(false); + String sql="select O.id,lib.doc_name,filename from O left join jbo.app.tenwa.doc.LB_DOCLIBRARY lib on o.library_id=lib.id left join jbo.app.tenwa.doc.LB_DOCRELATIVE rela on lib.relative_id=rela.id"; + sql+=" where O.content_type LIKE '%image%' and (O.DELETEED<>'Y' or O.DELETEED is null)"+otherWhere+" order by lib.doc_name,O.filename"; + System.out.println(sql); + List list=JBOFactory.createBizObjectQuery("jbo.app.tenwa.doc.LB_DOCATTRIBUTE", sql).getResultList(false); %> @@ -76,7 +82,7 @@ for(int i=0;i function showImage(id,name){ var sUrl="/Tenwa/Comm/DocList/showImage.jsp"; - var param="attrid="+id; + var param="attrid="+id+"&flowunid=<%=flowunid%>"; AsDialog.PopView(sUrl,param,"dialogWidth="+(parent.innerWidth-100)+"px;dialogHeight="+(parent.innerHeight+80)+"px;",function(message){ },name); diff --git a/WebContent/Tenwa/Comm/Document/LBDocumentInfo.jsp b/WebContent/Tenwa/Comm/Document/LBDocumentInfo.jsp index 7aead9709..b8f7ae60e 100644 --- a/WebContent/Tenwa/Comm/Document/LBDocumentInfo.jsp +++ b/WebContent/Tenwa/Comm/Document/LBDocumentInfo.jsp @@ -4,6 +4,7 @@ <% //定义变量 String sObjectNo = "";//--对象编号 + String isProduct = CurPage.getParameter("isProduct"); //获得组件参数 String sLibraryId = CurPage.getParameter("Library_id"); String sDocType=CurPage.getParameter("DocType");// @@ -18,25 +19,25 @@ String doc=DocumentListAction.getFlowDocument(flowunid,flowNo); ASObjectModel doTemp = new ASObjectModel("LBDocumentInfo"); - String condition=""; - if(doc.length()>0){ - condition=" LENGTH(itemno)=3 and codeno='DocList' and itemno in ("+doc+")"; - }else{ - condition=" 1=2"; - } - doTemp.setColumnAttribute("Doc_Type","coleditsource","jbo.sys.CODE_LIBRARY,itemno,itemname,"+condition); if("FundCollectionFlow".equalsIgnoreCase(flowNo)){ doTemp.setDefaultValue("Doc_Type", "099"); - doTemp.setReadOnly("Doc_Type", true); } - doTemp.setHtmlEvent("DOC_TYPE","onchange","cleanSelect","0"); - doTemp.setHtmlEvent("one_Classify","onchange","cleanSelect","1"); + if("N".equals(isProduct)){ + doc = "'004','004001'"; +// doTemp.setDefaultValue("DOC_TYPE", "004"); +// doTemp.setDefaultValue("ONE_CLASSIFY", "004"); +// doTemp.setDefaultValue("DOC_NAME", "004"); + /* doTemp.setReadOnly("ONE_CLASSIFY", true); + doTemp.setReadOnly("DOC_NAME", true); */ + } +// doTemp.setHtmlEvent("DOC_TYPE","onchange","cleanSelect","0"); +// doTemp.setHtmlEvent("one_Classify","onchange","cleanSelect","1"); doTemp.setHtmlEvent("CUST_ID","onchange","cleanSelect","2"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写 - dwTemp.genHTMLObjectWindow(""); + dwTemp.genHTMLObjectWindow(sLibraryId); String[][] sButtons=null; sButtons=new String[][]{ {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, @@ -60,8 +61,9 @@ setItemValue(0,0,"InputUserName","<%= CurUser.getUserName()%>"); setItemValue(0,0,"InputOrg","<%=CurUser.getOrgName()%>"); setItemValue(0,0,"InputTime","<%=StringFunction.getToday()%>"); - - cleanSelect(0); + $('#DOC_NAME option').removeAttr('selected'); + $('#DOC_NAME option[value=65f458c3e9f945d59fa378973b0853c6]').attr('selected','selected'); +// cleanSelect(2); hideItem(0,"CUST_ID"); }); @@ -171,7 +173,7 @@ return o.submit(); } function CheckStr(str){ - var s="jpg,jpeg,png,pdf,doc,docx,xls,xlsx"; + var s="jpg,jpeg,png,pdf,doc,docx,xls,xlsx,rar,zip"; var flag="false"; var s2=s.split(","); for(var i=0;i <% } - } +// } %> +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessFlowInstanceTrack.jsp b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessFlowInstanceTrack.jsp new file mode 100644 index 000000000..36c064cbf --- /dev/null +++ b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessFlowInstanceTrack.jsp @@ -0,0 +1,144 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> +<% +/* + Author:lzb 2017-05-12 + Tester: + Content: 本方信息 + Input Param: + Output param: + History Log: + */ +%> +<%/*~END~*/%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "流程实例跟踪"; // 浏览器窗口标题 PG_TITLE +%> +<%/*~END~*/%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel("FlowInstanceTrack"); + doTemp.appendJboWhere(" and O.flowno='BusinessApplyFlow' "); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(15); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + {"true","All","Button","重新分配人员","重新分配人员","changeFlowOperator()","","","","btn_icon_resetuser",""}, + {"true","All","Button","重新路由","重新路由","flowChangeRoute()","","","","btn_icon_resetrouting",""} + }; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessQuery.jsp b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessQuery.jsp new file mode 100644 index 000000000..623263b36 --- /dev/null +++ b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessQuery.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<% + /* + Author: undefined 2018-11-14 + Content: 业务申请查询 + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("VI_BUSINESS_QUERY"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(15); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessSummary.jsp b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessSummary.jsp new file mode 100644 index 000000000..998670cd1 --- /dev/null +++ b/WebContent/Tenwa/Core/FlowInstanceTrack/BusinessSummary.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> +<% + /* + Author: undefined 2018-11-21 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("BusinessSummary"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(14); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowInstanceTrack/FlowInstanceTrack.jsp b/WebContent/Tenwa/Core/FlowInstanceTrack/FlowInstanceTrack.jsp index e03a984cc..55f67eebc 100644 --- a/WebContent/Tenwa/Core/FlowInstanceTrack/FlowInstanceTrack.jsp +++ b/WebContent/Tenwa/Core/FlowInstanceTrack/FlowInstanceTrack.jsp @@ -30,7 +30,18 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> <% - ASObjectModel doTemp = new ASObjectModel("FlowInstanceTrack"); + String soft = CurPage.getParameter("soft"); + //ASObjectModel doTemp = new ASObjectModel("FlowInstanceTrack"); + ASObjectModel doTemp = new ASObjectModel("FlowInstanceTrack3"); + String ros = "true"; + if("业务申请分担".equals(soft)){ + ros = "false"; + doTemp.appendJboWhere(" O.flow_name='业务申请流程' and O.PHASENAME='信审初审'"); + }; + if("付款业务分担".equals(soft)){ + ros = "false"; + doTemp.appendJboWhere(" O.flow_name='付款申请(汽车)' and O.PHASENAME='运营部初审'"); + }; ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 @@ -42,9 +53,10 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> <% + String sButtons[][] = { {"true","All","Button","重新分配人员","重新分配人员","changeFlowOperator()","","","","btn_icon_resetuser",""}, - {"true","All","Button","重新路由","重新路由","flowChangeRoute()","","","","btn_icon_resetrouting",""} + {ros,"All","Button","重新路由","重新路由","flowChangeRoute()","","","","btn_icon_resetrouting",""} }; %> <%/*~END~*/%> @@ -60,6 +72,7 @@ <%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf index 0bf3a04e1..20fe41435 100644 --- a/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf +++ b/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf @@ -35,7 +35,7 @@ $(function(){ } }); function afterSearch(){ - FlowFunction.afterSearch(); + FlowFunction.afterSearchRole(<%=bFlag%>); } <%/*~END~*/%> diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf index 627c5ea00..4cde8a6a1 100644 --- a/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf +++ b/WebContent/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@page import="com.amarsoft.biz.workflow.ApplyManager"%> <%@page import="java.util.Date"%> <%@page import="com.amarsoft.awe.control.model.Parameter" %> @@ -26,14 +27,77 @@ ApplyManager applyManager = new ApplyManager(sApplyType,sPhaseType,CurUser); ASObjectModel doTemp = new ASObjectModel(applyManager.getDono()); doTemp.setLockCount(2); + if("BusinessApplyApply".equals(sApplyType) || "BusinessCancelApply".equals(sApplyType)||"BusinessChangeApply".equals(sApplyType)){ + doTemp.setVisible("flow_key", false); + doTemp.setVisible("PROJECT_NO", true); + } + if("AccountChangeApply".equals(sApplyType) || "AccountChangeApply".equals(sApplyType)){ + doTemp.setVisible("flow_key", false); + doTemp.setVisible("CONTRACT_NO", true); + } //doTemp.appendJboWhere(applyManager.getWhereClause()+" order by objectNo desc "); - doTemp.appendJboWhere(applyManager.getWhereClause()); + //如果是项目立项,则添加申请人是主申请人的where条件TAssetsDisposalEndApply + if("ProjectApproalApply".equals(sApplyType)||"ContractChangeApply".equals(sApplyType)||"ContractCancelApply".equals(sApplyType) + ||"ContractOnhireChangeApply".equals(sApplyType)||"TriditionContractChangeApply".equals(sApplyType)||"ContractSupportApply".equals(sApplyType) + ||"ContractEndApply".equals(sApplyType)||"ProjectChangeApply".equals(sApplyType)||"ProjectCancelApply".equals(sApplyType)||"ProjectCreditApply".equals(sApplyType) + ||"FundPaymentApply".equals(sApplyType)||"ProjectRecreditApply".equals(sApplyType)||"ProjectSupportApply".equals(sApplyType)||"ContractApprovalApply".equals(sApplyType) + ||"TAssetsDisposalApply".equals(sApplyType)||"TAssetsDisposalEndApply".equals(sApplyType)||"TAssetsDisposalFeeApply".equals(sApplyType)){ + doTemp.appendJboWhere(applyManager.getWhereClause()+" and cpt.is_main='Y'"); + }else{ + doTemp.appendJboWhere(applyManager.getWhereClause()); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //设置为Grid风格 //dwTemp.MultiSelect = true;//允许多选 dwTemp.ReadOnly = "1";//编辑模式 dwTemp.genHTMLObjectWindow(""); String sButtons[][] = applyManager.getButtonArr(); + + //control distributor(temporary) + List buttonLists = Arrays.asList(sButtons); + buttonLists = new ArrayList(buttonLists); + int num1 = 0; + boolean flag1 = false; + int num2 = 0; + boolean flag2 = false; + for(int i = 0; i < sButtons.length; i ++) { + for(int j = 0; j < sButtons[i].length; j ++) { + if("viewFlowGraph()".equals(sButtons[i][j])) { + num1 = i; + flag1 = true; + break; + } + if("backButton".equals(sButtons[i][j])) { + num2 = i; + flag2 = true; + break; + } + } + } + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } + if(bFlag) { + if(flag1) { + String[] removeB1 = buttonLists.get(num1); + buttonLists.remove(removeB1); + } + if(flag2) { + String[] removeB2 = buttonLists.get(num2); + buttonLists.remove(removeB2); + } + } + sButtons = new String[buttonLists.size()][]; + for(int i = 0; i < buttonLists.size(); i ++) { + sButtons[i] = buttonLists.get(i); + } %> <%@include file="/Tenwa/Core/FlowManager/BaseFunction/FlowCommButton.jspf"%> <%/*~END~*/%> diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf index 36df38247..2b997e5bf 100644 --- a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf +++ b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf @@ -81,7 +81,7 @@ FlowFunction.doSubmit=function(sObjectType,sObjectNo,sTaskNo,sFlowName,sFlowNo,s } return; }} - autoRiskScan(sFlowName,"TaskNo="+sTaskNo+"&ObjectType="+sObjectType+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo+"&isAutoCommit=true",sPhaseNo,function(riskMessage){ + autoRiskScan(sFlowName,"TaskNo="+sTaskNo+"&ObjectType="+sObjectType+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo+"&isAutoCommit=false",sPhaseNo,function(riskMessage){ if(riskMessage != true){ return; } @@ -96,17 +96,27 @@ FlowFunction.doSubmit=function(sObjectType,sObjectNo,sTaskNo,sFlowName,sFlowNo,s alert("流程提交失败"); } }else{ - AsDialog.PopView("/Common/WorkFlow/FlowSubmitDialog.jsp","TaskNo="+sTaskNo,"dialogWidth=850px;dialogHeight=550px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sPhaseInfo){ - if(typeof(sPhaseInfo)=="undefined" || sPhaseInfo=="" || sPhaseInfo==null || sPhaseInfo=="null" || sPhaseInfo=="_CANCEL_") { - return; - }else if(sPhaseInfo == "Success" || sPhaseInfo == "success"){ - var sFlowLogContent="<%=CurUser.getUserName()%>在"+"@时提交流程"; - this.insertFlowLog(sObjectNo, sTaskNo, sFlowLogContent); - alert("提交成功!"); - FlowFunction.successCallBackReload(); - }else{ - alert("提交失败!"); - } + //处理退回直接提交的任务 + var res = AsControl.RunJavaMethodTrans("com.amarsoft.app.flow.FlowAction","checkBackType","TaskNo="+sTaskNo+",userID=<%=CurUser.getUserID()%>"); + if(res == "success") { + var sFlowLogContent="<%=CurUser.getUserName()%>在"+"@时提交流程"; + this.insertFlowLog(sObjectNo, sTaskNo, sFlowLogContent); + alert("提交成功"); + FlowFunction.successCallBackReload(); + return; + } + + AsDialog.PopView("/Common/WorkFlow/FlowSubmitDialog.jsp","TaskNo="+sTaskNo,"dialogWidth=850px;dialogHeight=550px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sPhaseInfo){ + if(typeof(sPhaseInfo)=="undefined" || sPhaseInfo=="" || sPhaseInfo==null || sPhaseInfo=="null" || sPhaseInfo=="_CANCEL_") { + return; + }else if(sPhaseInfo == "Success" || sPhaseInfo == "success"){ + var sFlowLogContent="<%=CurUser.getUserName()%>在"+"@时提交流程"; + this.insertFlowLog(sObjectNo, sTaskNo, sFlowLogContent); + alert("提交成功!"); + FlowFunction.successCallBackReload(); + }else{ + alert("提交失败!"); + } },"提交下一步");} },sFlowName+":预警检查"); }; @@ -115,7 +125,7 @@ FlowFunction.successCallBackReload=function(){ reloadSelf(); } /*~[Describe=退回申请;InputParam=无;OutPutParam=无;]~*/ -FlowFunction.backStep=function(sObjectType,sObjectNo,sFlowNo,sPhaseNo,sTaskNo,isLoadSignPage){ +FlowFunction.backStep=function(sObjectType,sObjectNo,sFlowNo,sPhaseNo,sTaskNo,sFlowName,isLoadSignPage,assignSubmitType){ if(sPhaseNo=="0010"){alert("第一步能不能再退回");return false;} //检查是否初始化页面的节点 var result=AsControl.RunJavaMethodTrans("com.tenwa.flow.treeview.action.CheckAndSaveTreeView","run","TaskNo="+sTaskNo); @@ -129,13 +139,29 @@ FlowFunction.backStep=function(sObjectType,sObjectNo,sFlowNo,sPhaseNo,sTaskNo,is } return; }} - AsDialog.PopView("/Common/WorkFlow/FlowBackSubmitDialog.jsp","TaskNo="+sTaskNo+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo, - "dialogWidth=850px;dialogHeight=550px;",function(sReturn){ - if(sReturn.length>0){ - if(sReturn!="_CANCEL_"){ - FlowFunction.successCallBackReload(); - }} - },"退回步骤"); + if(sFlowName=="业务申请流程"){ + autoRiskScan(sFlowName,"TaskNo="+sTaskNo+"&ObjectType="+sObjectType+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo+"&isAutoCommit=false",sPhaseNo,function(riskMessage){ + if(riskMessage != true){ + return; + } + + AsDialog.PopView("/Common/WorkFlow/FlowBackSubmitDialog.jsp","TaskNo="+sTaskNo+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo, + "dialogWidth=850px;dialogHeight=550px;",function(sReturn){ + if(sReturn.length>0){ + if(sReturn!="_CANCEL_"){ + FlowFunction.successCallBackReload(); + }} + },"退回步骤"); + },sFlowName+":预警检查"); + }else{ + AsDialog.PopView("/Common/WorkFlow/FlowBackSubmitDialog.jsp","TaskNo="+sTaskNo+"&ObjectNo="+sObjectNo+"&FlowNo="+sFlowNo+"&PhaseNo="+sPhaseNo, + "dialogWidth=850px;dialogHeight=550px;",function(sReturn){ + if(sReturn.length>0){ + if(sReturn!="_CANCEL_"){ + FlowFunction.successCallBackReload(); + }} + },"退回步骤"); + } }; /*~[Describe=申请详情;InputParam=无;OutPutParam=无;]~*/ @@ -199,7 +225,7 @@ FlowFunction.signOpinion=function(sObjectType,sObjectNo,sFlowNo,sPhaseNo,isLoadS } //弹出签意见界面 AsDialog.PopView("/Common/WorkFlow/SignTaskOpinionInfo.jsp","TaskNo="+sTaskNo+"&ObjectType="+sObjectType+"&ObjectNo="+sObjectNo, - {width:"700px",height:"600px",title:"签署意见"},function(sReturn){ + {width:"500px",height:"300px",title:"签署意见"},function(sReturn){ if(sReturn.length>0){ if(sReturn=="SUCCESS"){ alert("签署意见成功"); @@ -245,6 +271,13 @@ FlowFunction.afterSearch=function(){ } setColumnWidth(0,"ACTION",150); }; +/*~[Describe=流程加载之后回调;InputParam=无;OutPutParam=无;]~*/ +FlowFunction.afterSearchRole=function(userRole){ + for(var i=0;i申请详情 ' : '显示流程图    申请详情 '; + } + setColumnWidth(0,"ACTION",150); +}; /*~[Describe=流程指派;InputParam=无;OutPutParam=无;]~*/ FlowFunction.setConfigFlowToOtherUser=function(curUser,sTaskNo,sObjectNo){ var tasknos=sTaskNo.join("@"); diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf index 113cdfb96..84b319ff0 100644 --- a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf +++ b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf @@ -46,7 +46,7 @@ function cancelApply(){ return; } FlowFunction.cancelApply(param["ObjectType"],param["ObjectNo"],param["FlowNo"]); - reloadSelf(); + reloadSelf(); } function setConfigFlowToOtherUser(){ var tasknos=getItemValueArray(0,"SerialNO")||[]; @@ -129,7 +129,7 @@ function backStep(){ if(curUser==agentUser){ alert("指派的任务不能退回");return false; } - FlowFunction.backStep(param["ObjectType"],param["ObjectNo"],param["FlowNo"],param["PhaseNo"],param["TaskNo"],false); + FlowFunction.backStep(param["ObjectType"],param["ObjectNo"],param["FlowNo"],param["PhaseNo"],param["TaskNo"],param["FlowName"],false,assignSubmitType); } function viewHisTab(){ var param=FlowFunction.loadFlowParam(); diff --git a/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunctionForTab.jspf b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunctionForTab.jspf new file mode 100644 index 000000000..c6d0c08f0 --- /dev/null +++ b/WebContent/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunctionForTab.jspf @@ -0,0 +1,180 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowFunction.jspf" %> + \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowManager/CopyFileToOther.jsp b/WebContent/Tenwa/Core/FlowManager/CopyFileToOther.jsp new file mode 100644 index 000000000..2db3ba4a9 --- /dev/null +++ b/WebContent/Tenwa/Core/FlowManager/CopyFileToOther.jsp @@ -0,0 +1,82 @@ +<%@page import="com.tenwa.reckon.copydata.FileCopyToOtherPath"%> +<%@page import="com.tenwa.officetempalte.action.CreateOfficeAction"%> +<%@page import="com.tenwa.officetempalte.exportcallback.impl.ZipUtils"%> +<%@page import="java.text.SimpleDateFormat"%> +<%@page import="java.io.FileOutputStream"%> +<%@page import="java.io.File"%> +<%@page import="java.util.Date"%> +<%@page import="java.util.UUID"%> +<%@page import="jbo.app.tenwa.doc.LC_COPYFILE_LOG"%> +<%@page import="com.amarsoft.are.util.StringFunction"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@page import="com.amarsoft.are.jbo.BizObjectManager"%> +<%@page import="com.amarsoft.are.jbo.BizObjectQuery"%> +<%@page import="com.amarsoft.are.jbo.BizObject"%> + +<%@ page contentType="text/html; charset=GBK"%><%@ include file="/IncludeBeginMDAJAX.jsp"%><% + //创建资料 + String contractNos = CurPage.getParameter("contractNos"); + String batchNos = CurPage.getParameter("batchNos"); + String userid = CurPage.getParameter("userid"); + String sParam = CurPage.getParameter("sParam"); + String templateNo = "8c0b32eefcf349e5b5f76d898df0bbbb"; + String fileSavePath = CurPage.getParameter("fileSavePath"); + //创建临时路径 + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + String time = sdf.format(new Date()); + String uuid=UUID.randomUUID().toString().replaceAll("-", ""); + String fileSavePath_temp = fileSavePath+"/"+time+uuid; + + FileCopyToOtherPath cp = new FileCopyToOtherPath(); + cp.setContractNos(contractNos); + cp.setBatchNos(batchNos); + cp.setUserid(userid); + cp.setFileSavePath_temp(fileSavePath_temp); + + CreateOfficeAction coa = new CreateOfficeAction(); + JBOTransaction tx = JBOFactory.createJBOTransaction(); + + if(sParam.contains("PayFileList")){ + cp.copyFile("PayFileList"); + } + if(sParam.contains("FileList")){ + cp.copyFile("FileList"); + } + if(sParam.contains("RentPlan")){ + + String[] contractNoArray = contractNos.split("@"); + String[] batchNoArray = batchNos.split("@"); + for(int i=0;i<%@ include file="/IncludeEndAJAX.jsp"%> + + \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/CommFlowView.jsp b/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/CommFlowView.jsp index 4acf9b292..3b093b982 100644 --- a/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/CommFlowView.jsp +++ b/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/CommFlowView.jsp @@ -33,7 +33,9 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=View02;Describe=定义变量,获取参数;]~*/%> <% - HashMapFlowFixedParam=GetFlowAction.getFlowParamByTask(CurPage.getParameter("TaskNo"),CurPage); + HashMapFlowFixedParam=GetFlowAction.getFlowParamByTask(CurPage.getParameter("TaskNo"),CurPage); + + FlowFixedParam.putAll(GetFlowAction.getFlowParamByFlowUnid(FlowFixedParam.get("ObjectNo"))); BizObject flowModel = GetFlowAction.getFlowModelParams(FlowFixedParam.get("FlowNo"),FlowFixedParam.get("PhaseNo")); //任务配置 String isPageRead=flowModel.getAttribute("ISREADONLY").getString(); //业务页面是否只读 if(null!=isPageRead&&isPageRead.endsWith("Y")){ diff --git a/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/ProductView.jsp b/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/ProductView.jsp index 7ba9a8138..5ca573ce4 100644 --- a/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/ProductView.jsp +++ b/WebContent/Tenwa/Core/FlowManager/FlowBussinessView/ProductView.jsp @@ -55,6 +55,7 @@ <% OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage,"业务详情","right"); FlowTaskViewTabService.initOHTMLTreeViewProduct(tx,tviTemp,FlowFixedParam); + tx.commit(); %> <%/*~END~*/%> @@ -96,6 +97,13 @@ <%/*~BEGIN~可编辑区[Editable=true;CodeAreaID=View06;Describe=在页面装载时执行,初始化]~*/%> <%/*~END~*/%> <%@ include file="/IncludeEnd.jsp"%> diff --git a/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp b/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp index 70b19df8d..903903b6e 100644 --- a/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp +++ b/WebContent/Tenwa/Core/FlowManager/FlowPage/FlowPageViewTab.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@page import="com.amarsoft.biz.workflow.FlowTask"%> <%@page import="com.amarsoft.dict.als.manage.CodeManager"%> <%@page import="com.amarsoft.app.lc.workflow.action.GetFlowAction"%> @@ -10,10 +11,15 @@ <%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> <% //获得页面参数 - String taskNo= CurPage.getParameter("TaskNo"); - String rightType= CurPage.getParameter("RightType"); - String ViewID= CurPage.getParameter("ViewID"); - String ReaderId= CurPage.getParameter("ReaderId"); + String taskNo = CurPage.getParameter("TaskNo"); + String rightType = CurPage.getParameter("RightType"); + String ViewID = CurPage.getParameter("ViewID"); + String ReaderId = CurPage.getParameter("ReaderId"); + String title = CurComp.getParameter("Title"); + if(title != null && !title.startsWith("传阅")) { + ReaderId = ""; + } + CurComp.getParentComponent().setAttribute("Title", ""); if(ReaderId==null){ReaderId="";} if(rightType==null){rightType="";} if(ViewID==null){ViewID="";} @@ -30,9 +36,24 @@ MapstartMap=GetFlowAction.getFlowParamByFlowUnid(FlowFixedParam.get("ObjectNo")); FlowTaskViewTab viewTab = new FlowTaskViewTab(taskNo,CurUser.getUserName()); + //control distributor(temporary) + boolean flag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + flag = true; + break; + } + } + /* if("BusinessApplyApply".equals(startMap.get("ApplyType"))){ + flag = true; + } */ %> +
@@ -40,15 +61,19 @@ //显示按钮 if(viewTab.getButtonItemList().size()==0) out.write(" "); - if(rightType.equals("ReadOnly")){ + if(rightType.equals("ReadOnly") || !ReaderId.equals("")){ if(ReaderId.equals("")){ out.write(new Button("关闭流程", "关闭流程", "closePage()", "", "btn_icon_close").getHtmlText()); }else{ + rightType = "ReadOnly"; out.write(new Button("关闭流程", "关闭流程", "closePage()", "", "btn_icon_close").getHtmlText()); out.write(new Button("结束传阅", "结束传阅", "closePassed()", "", "btn_icon_add").getHtmlText()); } }else{ - for(Button bt : viewTab.getButtonItemList()){ + for(Button bt : viewTab.getButtonItemList()){ + if(flag && bt.getHtmlText().indexOf("viewFlowGraph") != -1) { + continue; + } out.write(""+bt.getHtmlText()+""); } } @@ -57,10 +82,10 @@ - <%=new Button("流程图", "查看流程图", "viewFlowGraph()", "", "btn_icon_add").getHtmlText()%> - <%=new Button("流程历史", "查看历史信息", "viewFlowTaskOpionion()", "", "btn_icon_add").getHtmlText()%> - <%=new Button("流程日志", "查看日志信息", "viewFlowLog()", "", "btn_icon_add").getHtmlText()%> - <%=new Button("项目总表", "查看项目总表", "viewProjectFlowAllInfo()", "", "btn_icon_add").getHtmlText()%> + <%=flag ? "" : new Button("流程图", "查看流程图", "viewFlowGraph()", "", "btn_icon_add").getHtmlText()%> + <%=flag ? "" : new Button("流程历史", "查看历史信息", "viewFlowTaskOpionion()", "", "btn_icon_add").getHtmlText()%> + <%=flag ? "" : new Button("流程日志", "查看日志信息", "viewFlowLog()", "", "btn_icon_add").getHtmlText()%> + <%=flag ? "" : new Button("项目总表", "查看项目总表", "viewProjectFlowAllInfo()", "", "btn_icon_add").getHtmlText()%>
@@ -141,6 +166,11 @@ $(function(){ paramJson["CUSTOMERTYPE"]="<%=startMap.get("CUSTOMERTYPE")%>"; paramJson["CustomerNature"]="<%=startMap.get("CustomerNature")%>"; paramJson["CUSTOMERID"]="<%=startMap.get("CUSTOMERID")%>"; + paramJson["ContractId"]="<%=startMap.get("ContractId")%>"; + paramJson["carAttributes"]="<%=startMap.get("carAttributes")%>"; + paramJson["leasehold"]="<%=startMap.get("leasehold")%>"; + paramJson["modelid"]="<%=startMap.get("modelid")%>"; + //paramJson["CurFlowUser"]="<%=FlowFixedParam.get("CurFlowUser")%>"; //paramJson["AgentFlowUser"]="<%=FlowFixedParam.get("AgentFlowUser")%>"; //paramJson["Assignfinish"]="<%=FlowFixedParam.get("Assignfinish")%>"; @@ -204,5 +234,23 @@ function deleteConfigFlowToOtherUser(){ FlowFunction.deleteConfigFlowToOtherUser(tasknos.split(","),param["ObjectNo"]); reloadSelf(); } +var viewer=null; +function showImage(){ + if(viewer==null){ + alert("暂无图片信息!"); + return ; + } + viewer.show(); +} + +function editImage(ul){ + if(viewer==null){ + $("body").append(ul); + viewer = new Viewer(document.getElementById('dowebok'), { + url: 'data-original' + }); + } +} + <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/FlowManager/GetObjectInfo.jsp b/WebContent/Tenwa/Core/FlowManager/GetObjectInfo.jsp index 8c2637a5e..93a40821b 100644 --- a/WebContent/Tenwa/Core/FlowManager/GetObjectInfo.jsp +++ b/WebContent/Tenwa/Core/FlowManager/GetObjectInfo.jsp @@ -11,11 +11,12 @@ if(staskNo==null){staskNo="";} BizObject bos = JBOFactory .getBizObjectManager("jbo.sys.FLOW_TASK") - .createQuery("SELECT O.phasename,O.flowname,fb.proj_name FROM O ,jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT fb WHERE O.objectno=fb.flow_unid AND O.SERIALNO=:taskNo ") + .createQuery("SELECT O.phasename,O.flowno,O.flowname,fb.proj_name FROM O ,jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT fb WHERE O.objectno=fb.flow_unid AND O.SERIALNO=:taskNo ") .setParameter("taskNo",staskNo).getSingleResult(false); String sObjectTitle = ""; - if("".equals(bos.getAttribute("proj_name").toString())){ + if("".equals(bos.getAttribute("proj_name").toString()) + ||"DistributorApprovalFlow".equals(bos.getAttribute("flowno").toString())){ sObjectTitle = bos.getAttribute("flowname").toString()+"【"+bos.getAttribute("phasename").toString()+"】"; }else{ sObjectTitle = bos.getAttribute("flowname").toString()+"【"+bos.getAttribute("phasename").toString()+"】-"+bos.getAttribute("proj_name").toString(); diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirm.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirm.jsp index c77c6c6dd..591eaeac3 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirm.jsp +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirm.jsp @@ -49,6 +49,7 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList2.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList2.jsp new file mode 100644 index 000000000..9ac4f319d --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList2.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmDetailList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("invoice_confirm_id")); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList3.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList3.jsp new file mode 100644 index 000000000..6c9dd8839 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList3.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmDetailList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("invoice_confirm_id")); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList4.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList4.jsp new file mode 100644 index 000000000..b987d1b20 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmDetailList4.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmDetailList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("invoice_confirm_id")); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmInfo.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmInfo.jsp new file mode 100644 index 000000000..2e4bb5f0a --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmInfo.jsp @@ -0,0 +1,30 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "InvoiceConfirmInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmList.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmList.jsp new file mode 100644 index 000000000..358b0a45e --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmList.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect=true; + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","查询","查询","selectInvoice()","","","","",""}, + {"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmPrintList.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmPrintList.jsp new file mode 100644 index 000000000..116c2ca6d --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceConfirmPrintList.jsp @@ -0,0 +1,96 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceConfirmPrintList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect=true; + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","查询","查询","selectInvoice()","","","","",""}, + {"true","","Button","发票打印申请","发票打印申请","printInvoice()","","","","",""}, + //{"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidBackE.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidBackE.jsp new file mode 100644 index 000000000..4ce51c8d4 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidBackE.jsp @@ -0,0 +1,64 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-22 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceInvalidList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","发票作废查询","发票作废查询","InvalidQuery()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidDirectZ.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidDirectZ.jsp new file mode 100644 index 000000000..d249d91b2 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceInvalidDirectZ.jsp @@ -0,0 +1,64 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-22 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceInvalidListZ"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","发票作废查询","发票作废查询","InvalidQuery()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultList.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultList.jsp new file mode 100644 index 000000000..db6fff3cb --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultList.jsp @@ -0,0 +1,65 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-27 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoicePrintResultList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","打印","打印","print()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultListBack.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultListBack.jsp new file mode 100644 index 000000000..bdf22fd12 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoicePrintResultListBack.jsp @@ -0,0 +1,65 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-27 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoicePrintResultListBack"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","打印","打印","print()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmList.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmList.jsp new file mode 100644 index 000000000..f386a0399 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmList.jsp @@ -0,0 +1,90 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentDirectConfirmList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","查询","查询","selectInvoice()","","","","",""}, + {"true","","Button","发票打印申请","发票打印申请","printInvoice()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmListE.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmListE.jsp new file mode 100644 index 000000000..863286559 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceRentDirectConfirmListE.jsp @@ -0,0 +1,101 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceRentDirectConfirmListE"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","查询","查询","selectInvoice()","","","","",""}, + {"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultBackE.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultBackE.jsp new file mode 100644 index 000000000..66d24737c --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultBackE.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-22 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceResultList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","发票作废申请","发票作废申请","InvoiceInvalid()","","","","",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultListZ.jsp b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultListZ.jsp new file mode 100644 index 000000000..0daad55f0 --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/ConfirmInvoice/InvoiceResultListZ.jsp @@ -0,0 +1,66 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-22 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("InvoiceResultListZ"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","发票作废申请","发票作废申请","InvoiceInvalid()","","","","",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/RentInvoice/RentInvoicePlan.jsp b/WebContent/Tenwa/Core/InvoiceManager/RentInvoice/RentInvoicePlan.jsp index 9c9a3fef9..535a9f655 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/RentInvoice/RentInvoicePlan.jsp +++ b/WebContent/Tenwa/Core/InvoiceManager/RentInvoice/RentInvoicePlan.jsp @@ -50,8 +50,8 @@
<%=new Button("申请开票", "", "newRecord()","","btn_icon_add").getHtmlText()%> - <%=new Button("暂不开票", "", "novoice()","","btn_icon_add").getHtmlText()%> - <%=new Button("修改开票信息", "", "viewAndEdit()","","btn_icon_edit").getHtmlText()%> + <%-- <%=new Button("暂不开票", "", "novoice()","","btn_icon_add").getHtmlText()%> + <%=new Button("修改开票信息", "", "viewAndEdit()","","btn_icon_edit").getHtmlText()%> --%>
+ + + + 0 + + ]]> + + + + + 0 + ]]> + + + dataSource + false + +
+ \ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectRentReback.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectRentReback.xml index af2df8a29..ee700d0a8 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectRentReback.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectRentReback.xml @@ -11,7 +11,7 @@ '1' GROUP BY CONTRACT_ID,PAYMENT_NUMBER) rentincome ON rentincome.CONTRACT_ID = O.ID LEFT JOIN LB_UNION_LESSEE lul ON O.ID = lul.CONTRACT_ID AND lul.IS_MAIN = 'Y' -LEFT JOIN user_info uinfo ON uinfo.userid = O.PROJECT_MANAGE WHERE (rentincome.rent>0 or rentincome.penalty >0) AND O.CONTRACT_STATUS<100 {O,contract} ORDER BY O.CONTRACT_NUMBER DESC +LEFT JOIN user_info uinfo ON uinfo.userid = O.PROJECT_MANAGE WHERE (rentincome.rent>0 or rentincome.penalty >0) AND O.CONTRACT_STATUS<100 and O.businesstype='#businessType' ORDER BY O.CONTRACT_NUMBER DESC ]]> diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectTraditionContractPayment.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectTraditionContractPayment.xml new file mode 100644 index 000000000..ca4771b8f --- /dev/null +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/SelectCatalog/SelectTraditionContractPayment.xml @@ -0,0 +1,200 @@ + + + + + + + + 0 + ]]> + + + + + 0 + ]]> + + + dataSource + false + +
+
\ No newline at end of file diff --git a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/VatInvoice/li_vat_invoice_confirm.xml b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/VatInvoice/li_vat_invoice_confirm.xml index 5e7a75f01..a8916ff67 100644 --- a/WebContent/Tenwa/Core/InvoiceManager/TablesXML/VatInvoice/li_vat_invoice_confirm.xml +++ b/WebContent/Tenwa/Core/InvoiceManager/TablesXML/VatInvoice/li_vat_invoice_confirm.xml @@ -9,9 +9,9 @@ <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> <%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> @@ -12,11 +13,22 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(CurPage.getUserId()); + //control distributor(temporary) + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } String sButtons[][] = { {"true","","Button","申请详情","申请详情","viewTab()","","","","btn_icon_detail",""}, {"true","All","Button","提交申请","提交申请","doSubmit()","","","","btn_icon_submit",""}, {"true","All","Button","签署意见","签署意见","signOpinion()","","","","btn_icon_othersys",""}, - {"true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""}, + {bFlag ? "false" : "true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""}, {"true","","Button","删除草稿","删除草稿","cancelApply()","","","","btn_icon_delete",""} }; %> @@ -24,7 +36,7 @@ diff --git a/WebContent/Tenwa/Core/MyWork/AppMyWorkHasDo.jsp b/WebContent/Tenwa/Core/MyWork/AppMyWorkHasDo.jsp index e6e6f68b5..c5e20ea3a 100644 --- a/WebContent/Tenwa/Core/MyWork/AppMyWorkHasDo.jsp +++ b/WebContent/Tenwa/Core/MyWork/AppMyWorkHasDo.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> <%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> @@ -15,10 +16,21 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(CurPage.getUserId()); + //control distributor(temporary) + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } String sButtons[][] = { {"true","","Button","申请详情","申请详情","viewHisTab()","","","","btn_icon_detail",""}, {"true","All","Button","撤回申请","撤回申请","takeBack()","","","","btn_icon_refresh",""}, - {"true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} + {bFlag ? "false" : "true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} }; %> <%@include file="/Frame/resources/include/ui/include_list.jspf"%> @@ -38,8 +50,8 @@ function afterSearch(){ flowState=userName+"指派或委托"; } } - if(flowState!=""){getObj(0,i,"flow_key").innerHTML=getObj(0,i,"flow_key").innerHTML+"["+flowState+"]";} - getObj(0,i,"ACTION").innerHTML='显示流程图    申请详情 '; + if(flowState!=""){getObj(0,i,"flow_key").innerHTML=getObj(0,i,"flow_key").innerHTML+"["+flowState+"]";} + getObj(0,i,"ACTION").innerHTML= <%=bFlag%> ? '申请详情 ' : '显示流程图    申请详情 '; } setColumnWidth(0,"ACTION",150); } diff --git a/WebContent/Tenwa/Core/MyWork/AppMyWorkPass.jsp b/WebContent/Tenwa/Core/MyWork/AppMyWorkPass.jsp index c3780fbd8..31134790a 100644 --- a/WebContent/Tenwa/Core/MyWork/AppMyWorkPass.jsp +++ b/WebContent/Tenwa/Core/MyWork/AppMyWorkPass.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> <%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> @@ -12,10 +13,21 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(CurPage.getUserId()); + //control distributor(temporary) + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } String sButtons[][] = { {"true","All","Button","结束传阅","结束传阅","closePassed()","","","","btn_icon_submit",""}, {"true","","Button","申请详情","申请详情","viewHisTabRead()","","","","btn_icon_detail",""}, - {"true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} + {bFlag ? "false" : "true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} }; %> <%@include file="/Frame/resources/include/ui/include_list.jspf"%> @@ -23,7 +35,7 @@ //在加载完表格后调用 function afterSearch(){ for(var i=0;i ? '申请详情 ' : '显示流程图    申请详情 '; } setColumnWidth(0,"ACTION",150); } diff --git a/WebContent/Tenwa/Core/MyWork/AppMyWorkPassClose.jsp b/WebContent/Tenwa/Core/MyWork/AppMyWorkPassClose.jsp index 12db8d187..c54e894ca 100644 --- a/WebContent/Tenwa/Core/MyWork/AppMyWorkPassClose.jsp +++ b/WebContent/Tenwa/Core/MyWork/AppMyWorkPassClose.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> <%@include file="/Tenwa/Core/FlowManager/BaseFunction/BaseFlowListFunction.jspf" %> @@ -12,9 +13,20 @@ String jboWhere=" FLOW_READER.isRead='1' and FLOW_READER.reader='"+custid+"' "; dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(CurPage.getUserId()); + //control distributor(temporary) + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } String sButtons[][] = { {"true","","Button","申请详情","申请详情","viewHisTab()","","","","btn_icon_detail",""}, - {"true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} + {bFlag ? "false" : "true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} }; %> <%@include file="/Frame/resources/include/ui/include_list.jspf"%> @@ -22,7 +34,7 @@ String jboWhere=" FLOW_READER.isRead='1' and FLOW_READER.reader='"+custid+"' "; //在加载完表格后调用 function afterSearch(){ for(var i=0;i ? '申请详情 ' : '显示流程图    申请详情 '; } setColumnWidth(0,"ACTION",150); } diff --git a/WebContent/Tenwa/Core/MyWork/AppMyWorkToDo.jsp b/WebContent/Tenwa/Core/MyWork/AppMyWorkToDo.jsp index 6c5d742d5..ac62fad5b 100644 --- a/WebContent/Tenwa/Core/MyWork/AppMyWorkToDo.jsp +++ b/WebContent/Tenwa/Core/MyWork/AppMyWorkToDo.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%> <%@page import="java.util.Date"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> @@ -23,12 +24,23 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(50); dwTemp.genHTMLObjectWindow(CurPage.getUserId()); + //control distributor(temporary) + boolean bFlag = false; + List roles = CurUser.getRoleTable(); + String distributorRole = QuartzPropertiesUtil.get("distributor_role"); + distributorRole = distributorRole == null ? "" : distributorRole; + for(String role : roles) { + if(distributorRole.indexOf(role) != -1) { + bFlag = true; + break; + } + } String sButtons[][] = { {"true","","Button","申请详情","申请详情","viewTab()","","","","btn_icon_detail",""}, {"true","All","Button","提交申请","提交","doSubmit()","","","","btn_icon_submit",""}, //{"true","","Button","退回申请","退回","backStep()","","","","btn_icon_refresh",""}, {"true","All","Button","签署意见","签署意见","signOpinion()","","","","btn_icon_othersys",""}, - {"true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} + {bFlag ? "false" : "true","","Button","流程图","流程图","viewFlowGraph()","","","","btn_icon_workflow",""} //{"true","","Button","流程指派","流程指派","setConfigFlowToOtherUser()","","","","btn_icon_workflow",""}, //{"true","","Button","取消指派","取消指派","deleteConfigFlowToOtherUser()","","","","btn_icon_workflow",""} }; @@ -63,7 +75,7 @@ function afterSearch(){ } } if(flowState!=""){getObj(0,i,"flow_key").innerHTML=getObj(0,i,"flow_key").innerHTML+"["+flowState+"]";} - getObj(0,i,"ACTION").innerHTML='显示流程图    申请详情 '; + getObj(0,i,"ACTION").innerHTML= <%=bFlag%> ? '申请详情 ' : '显示流程图    申请详情 '; } setColumnWidth(0,"ACTION",150); } diff --git a/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uppdateMessage.jsp b/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uppdateMessage.jsp new file mode 100644 index 000000000..d8654a35a --- /dev/null +++ b/WebContent/Tenwa/Core/OfficeTemplate/TemplateManager/BFTemplateTest/uppdateMessage.jsp @@ -0,0 +1,81 @@ +<%-- <%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%> + + + + + + + + + + + +
是否借入资金:借款银行:借款合同号:
借款本金:借款利率: +
+ + + +<%@ include file="/IncludeEnd.jsp"%> --%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-29 + Content: 示例详情页面 + History Log: + */ + + + String sTempletNo = "sourceOfFundsInfoMultiUpdate";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + /* doTemp.setColTips("", "测试"); */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(""); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Standard/CentralLCStandardInterestList.jsp b/WebContent/Tenwa/Core/Standard/CentralLCStandardInterestList.jsp new file mode 100644 index 000000000..a1b4e0221 --- /dev/null +++ b/WebContent/Tenwa/Core/Standard/CentralLCStandardInterestList.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-08-02 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LCStandardInterestList"); + doTemp.appendJboWhere("O.adjust_interest_source<>'own' or O.adjust_interest_source is null"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo.jsp b/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo.jsp index 663c9f858..5adcd8442 100644 --- a/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo.jsp +++ b/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo.jsp @@ -5,14 +5,32 @@ Content: 示例详情页面 History Log: */ - + String option = CurPage.getParameter("option"); + //新增和修改的查询逻辑不同,需要判断 + String sql = "select max(start_date),BASE_RATE_HALF,BASE_RATE_ONE,BASE_RATE_THREE,BASE_RATE_FIVE,BASE_RATE_ABOVEFIVE from LC_STANDARD_INTEREST "; + if("edit".equals(option)){ + sql += "where start_date<(select start_date from LC_STANDARD_INTEREST where id='"+CurPage.getParameter("id")+"')"; + } + ASResultSet rs = Sqlca.getASResultSet2(sql); + String BASE_RATE_HALF = ""; + String BASE_RATE_ONE = ""; + String BASE_RATE_THREE = ""; + String BASE_RATE_FIVE = ""; + String BASE_RATE_ABOVEFIVE = ""; + if(rs.next()){ + BASE_RATE_HALF = rs.getStringValue("BASE_RATE_HALF"); + BASE_RATE_ONE = rs.getStringValue("BASE_RATE_ONE"); + BASE_RATE_THREE = rs.getStringValue("BASE_RATE_THREE"); + BASE_RATE_FIVE = rs.getStringValue("BASE_RATE_FIVE"); + BASE_RATE_ABOVEFIVE = rs.getStringValue("BASE_RATE_ABOVEFIVE"); + } + String sTempletNo = "LCStandardInterestInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("BASE_RATE_HALF,BASE_RATE_ONE,BASE_RATE_THREE,BASE_RATE_FIVE,BASE_RATE_ABOVEFIVE", "onchange", "getRateByBase"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//只读模式 dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); - String sButtons[][] = { {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} @@ -21,8 +39,29 @@ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo3.jsp b/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo3.jsp new file mode 100644 index 000000000..8bda7ad2e --- /dev/null +++ b/WebContent/Tenwa/Core/Standard/LCStandardInterestInfo3.jsp @@ -0,0 +1,88 @@ +<%@page import="com.tenwa.reckon.product.ASObjectWindowCalc"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-08-02 + Content: 示例详情页面 + History Log: + */ + String option = CurPage.getParameter("option"); + String id = CurPage.getParameter("id"); + //新增和修改的查询逻辑不同,需要判断 + String sql = "select BASE_RATE_HALF,BASE_RATE_ONE,BASE_RATE_THREE,BASE_RATE_FIVE,BASE_RATE_ABOVEFIVE from LC_STANDARD_INTEREST "; + if("edit".equals(option)){ + sql+="where start_date=(select max(start_date) from LC_STANDARD_INTEREST where start_date<(select start_date from LC_STANDARD_INTEREST where id='"+CurPage.getParameter("id")+"'))"; + }else{ + sql += "where start_date=(select max(start_date) from LC_STANDARD_INTEREST)"; + } + ASResultSet rs = Sqlca.getASResultSet2(sql); + String BASE_RATE_HALF = ""; + String BASE_RATE_ONE = ""; + String BASE_RATE_THREE = ""; + String BASE_RATE_FIVE = ""; + String BASE_RATE_ABOVEFIVE = ""; + if(rs.next()){ + BASE_RATE_HALF = rs.getStringValue("BASE_RATE_HALF"); + BASE_RATE_ONE = rs.getStringValue("BASE_RATE_ONE"); + BASE_RATE_THREE = rs.getStringValue("BASE_RATE_THREE"); + BASE_RATE_FIVE = rs.getStringValue("BASE_RATE_FIVE"); + BASE_RATE_ABOVEFIVE = rs.getStringValue("BASE_RATE_ABOVEFIVE"); + } + + String sTempletNo = "LCStandardInterestInfo3";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("BASE_RATE_HALF,BASE_RATE_ONE,BASE_RATE_THREE,BASE_RATE_FIVE,BASE_RATE_ABOVEFIVE", "本次利率"); + doTemp.setColTips("ADJUSTED1,ADJUSTED2,ADJUSTED3,ADJUSTED4,ADJUSTED5", "上一次利率"); + doTemp.setHtmlEvent("BASE_RATE_HALF,BASE_RATE_ONE,BASE_RATE_THREE,BASE_RATE_FIVE,BASE_RATE_ABOVEFIVE", "onchange", "getRateByBase"); + ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(id); + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Standard/LCStandardInterestList.jsp b/WebContent/Tenwa/Core/Standard/LCStandardInterestList.jsp index 513ef2caf..a19281b46 100644 --- a/WebContent/Tenwa/Core/Standard/LCStandardInterestList.jsp +++ b/WebContent/Tenwa/Core/Standard/LCStandardInterestList.jsp @@ -1,37 +1,11 @@ -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% - /* - Author: undefined 2017-08-02 - Content: - History Log: - */ - ASObjectModel doTemp = new ASObjectModel("LCStandardInterestList"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- - dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(""); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, - {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%><% +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Standard/LCStandardInterestforOwnList.jsp b/WebContent/Tenwa/Core/Standard/LCStandardInterestforOwnList.jsp new file mode 100644 index 000000000..e9e7e7d1c --- /dev/null +++ b/WebContent/Tenwa/Core/Standard/LCStandardInterestforOwnList.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-08-02 + Content: + History Log: + */ + String condition=CurPage.getAttribute("forwhere"); + ASObjectModel doTemp = new ASObjectModel("LCStandardInterestList"); + doTemp.appendJboWhere("O.adjust_interest_source='own'"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccount.jsp b/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccount.jsp index 5103d13dd..50fc35e50 100644 --- a/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccount.jsp +++ b/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccount.jsp @@ -10,7 +10,6 @@ Input Param: Output param: History Log: - */ %> <%/*~END~*/%> @@ -37,12 +36,14 @@ <% String sTempletNo = "OwnAccount";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("FbSdk", "onchange", "changeFbSdk"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform if(rightType.equals("ReadOnly")){ dwTemp.ReadOnly = "1";//只读模式 } - dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + String id=CurPage.getParameter("id"); + dwTemp.genHTMLObjectWindow(id); CurPage.getCurComp().setAttribute("RightType", rightType); %> <%/*~END~*/%> @@ -67,8 +68,36 @@ <%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info06;Describe=定义按钮事件-;]~*/%> <%/*~END~*/%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccountList.jsp b/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccountList.jsp index cff41ea5d..7edad3574 100644 --- a/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccountList.jsp +++ b/WebContent/Tenwa/Core/SystemConfig/OwnConfig/BOwnAccount/BOwnAccountList.jsp @@ -32,7 +32,7 @@ <% ASObjectModel doTemp = new ASObjectModel("OwnAccountList"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(""); @@ -61,8 +61,9 @@ <%/*~END~*/%> diff --git a/WebContent/Tenwa/Core/Voucher/StactsConfig/LvStactsConfigList.jsp b/WebContent/Tenwa/Core/Voucher/StactsConfig/LvStactsConfigList.jsp index 3cbfc1413..4b6bb4348 100644 --- a/WebContent/Tenwa/Core/Voucher/StactsConfig/LvStactsConfigList.jsp +++ b/WebContent/Tenwa/Core/Voucher/StactsConfig/LvStactsConfigList.jsp @@ -17,6 +17,7 @@ {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","","Button","导出科目信息","导出科目信息","exportExcel()","","","","btn_icon_up",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp index ac9d5dda4..40ab458ca 100644 --- a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp +++ b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherConfigList.jsp @@ -9,7 +9,7 @@ ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.setPageSize(10); + dwTemp.setPageSize(50); dwTemp.genHTMLObjectWindow(""); //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 @@ -17,6 +17,7 @@ {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","","Button","复制凭证","复制凭证","if(confirm('确定复制凭证?'))copyVoucher()","","","","btn_icon_detail",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherLoanInfo.jsp b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherLoanInfo.jsp index fc5523e2d..01cbe2603 100644 --- a/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherLoanInfo.jsp +++ b/WebContent/Tenwa/Core/Voucher/VoucherConfig/LvVoucherLoanInfo.jsp @@ -27,14 +27,14 @@ AsControl.OpenView(pUrl, "vouid=<%=vouid%>&owned=<%=owned%>","_self",""); } function selectLoanSubject(){ - AsDialog.OpenSelector("SelectLoanSubject","owned,<%=owned%>","dialogWidth=" + parseInt(window.screen.width * 0.5) + "px dialogHeight=" + parseInt(window.screen.height * 0.3) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectLoanSubject_km","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn || sReturn == "_CANCEL_"||sReturn=="_NONE_"||sReturn=="_CLEAR_"){ return; } sReturn = sReturn.split("@"); setItemValue(0,getRow(),"LOAN_SUBJECT",sReturn[0]); setItemValue(0,getRow(),"SUBJECTS_NAME",sReturn[1]); - },"请选项目经理"); + },"请选择科目"); } <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp b/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp index d9498161a..5a6c100d9 100644 --- a/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp +++ b/WebContent/Tenwa/Core/quartz/QrtzTriggersList.jsp @@ -107,7 +107,7 @@ } var jobName = getItemValue(0,getRow(),"JOB_NAME"); var triggerName = getItemValue(0,getRow(),"TRIGGER_NAME"); - var result = RunJavaMethodTrans("com.tenwa.quartz.QuartzServerImpl","triggerJob","jobName="+jobName+",triggerName="+triggerName); + var result = RunJavaMethodTrans("com.tenwa.quartz.QuartzServerImpl","triggerJob","jobName="+jobName+",triggerName="+triggerName+",userId=<%=CurUser.getUserID()%>"); if(result == "SUCCESS"){ alert("成功执行!"); reloadSelf(); diff --git a/WebContent/Tenwa/Customer/Comm/CompanyQuoteCustType.jsp b/WebContent/Tenwa/Customer/Comm/CompanyQuoteCustType.jsp index ba3ee3697..fcb810c7e 100644 --- a/WebContent/Tenwa/Customer/Comm/CompanyQuoteCustType.jsp +++ b/WebContent/Tenwa/Customer/Comm/CompanyQuoteCustType.jsp @@ -32,7 +32,7 @@ var originalType = sCustCheckedTypes[0]; var otherTypes = sCustCheckedTypes[1]; //初始化页面选项 - var custtypes = {'cust_type.cust':'承租人','cust_type.vndr':'合作方-供应商','cust_type.manufacturer':'合作方-制造商','cust_type.assuror':'合作方-担保人','cust_type.othertype':'合作方-其他合作方'}; + var custtypes = {'cust_type.cust':'承租人','cust_type.vndr':'合作方-供应商','cust_type.manufacturer':'合作方-制造商','cust_type.assuror':'合作方-担保人/抵押人','cust_type.othertype':'合作方-其他合作方'}; delete custtypes[originalType];//不显示原始客户类别 var tdCusttypes = $('input[name="custtype"]'); diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompany.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompany.jsp new file mode 100644 index 000000000..5111d6297 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompany.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + String rightType = CurPage.getParameter("rightType"); + if(rightType ==null)rightType=""; + String group_no = CurPage.getParameter("group_no"); + String id = CurPage.getParameter("id"); + if(group_no ==null)group_no=""; + String group_name = CurPage.getParameter("group_name"); + if(group_name ==null)group_name=""; + String sTempletNo = "DistributorCustomerGroupCompany";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if(rightType.equals("ReadOnly")){ + dwTemp.ReadOnly = "1";//只读模式 + } + dwTemp.genHTMLObjectWindow(id); + CurPage.getCurComp().setAttribute("RightType", rightType); + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("groupList", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { + {"true","All","Button","保存","保存","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","返回","返回列表","goBack()","","","","btn_icon_return"} + }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyList.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyList.jsp new file mode 100644 index 000000000..36060735f --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyList.jsp @@ -0,0 +1,73 @@ +<%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + ASObjectModel doTemp = new ASObjectModel("DistributorcustGroupCompanyList"); + String otherWhere=DataRightManager.getRightCondition(CurUser,"O"); + doTemp.appendJboWhere(otherWhere); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","All","Button","修改","修改","edit()","","","","btn_icon_edit",""}, + {"true","","Button","详情","详情","view()","","","","btn_icon_detail",""}, + {"true","All","Button","废弃","废弃","del()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyMain.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyMain.jsp new file mode 100644 index 000000000..d848975f3 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyMain.jsp @@ -0,0 +1,11 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% + String PG_TITLE = "隐藏左侧区域的Main页面"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "集团客户"; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "1";//默认的treeview宽度 +%><%@include file="/Resources/CodeParts/Main04.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyRegister.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyRegister.jsp new file mode 100644 index 000000000..3f13f27e3 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorCustomerGroupCompanyRegister.jsp @@ -0,0 +1,58 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + String sTempletNo = "DistributorGroupCompanyRegister";//--模板号-- + String typeno=CurPage.getParameter("typeno"); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("group_no","onChange","checkGroupNo"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(typeno); + + String sButtons[][] = { + {"true","All","Button","确定","注册集团信息","saveRecord()","","","","btn_icon_submit"}, + {"true","All","Button","取消","取消","goBack()","","","","btn_icon_close"}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupChannelList.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupChannelList.jsp new file mode 100644 index 000000000..dcc176c5a --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupChannelList.jsp @@ -0,0 +1,77 @@ +<%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + String typeno= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("DistributorGroupChannelList"); + String otherWhere=DataRightManager.getRightCondition(CurUser,"O"); + //doTemp.appendJboWhere(otherWhere); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(typeno); + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","All","Button","修改","修改","edit()","","","","btn_icon_edit",""}, + {"true","","Button","详情","详情","view()","","","","btn_icon_detail",""}, + {"true","All","Button","废弃","废弃","del()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupCompanyList.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupCompanyList.jsp new file mode 100644 index 000000000..b6e679cb2 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/DistributorGroupCompanyList.jsp @@ -0,0 +1,77 @@ +<%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + String typeno= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("DistributorGroupCompanyList"); + String otherWhere=DataRightManager.getRightCondition(CurUser,"O"); + //doTemp.appendJboWhere(otherWhere); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(typeno); + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","All","Button","修改","修改","edit()","","","","btn_icon_edit",""}, + {"true","","Button","详情","详情","view()","","","","btn_icon_detail",""}, + {"true","All","Button","废弃","废弃","del()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/Distributorsubordinatedistribution.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/Distributorsubordinatedistribution.jsp new file mode 100644 index 000000000..4cf318b41 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/Distributorsubordinatedistribution.jsp @@ -0,0 +1,58 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + String sTempletNo = "Distributorsubordinate";//--模板号-- + String typeno=CurPage.getParameter("typeno"); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("group_no","onChange","checkGroupNo"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(typeno); + + String sButtons[][] = { + {"true","All","Button","确定","注册集团信息","saveRecord()","","","","btn_icon_submit"}, + {"true","All","Button","取消","取消","goBack()","","","","btn_icon_close"}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/GroupCompany/LmDistributorListForProduct.jsp b/WebContent/Tenwa/Customer/Group/GroupCompany/LmDistributorListForProduct.jsp new file mode 100644 index 000000000..b94b85b72 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/GroupCompany/LmDistributorListForProduct.jsp @@ -0,0 +1,79 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + String typeno= CurPage.getParameter("TYPENO"); + ASObjectModel doTemp = new ASObjectModel("lmproductdistributorgroupList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(typeno); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","关联省份","关联省份","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","区域信息维护","区域信息维护","Edit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelation.jsp b/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelation.jsp new file mode 100644 index 000000000..ac9201bd6 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelation.jsp @@ -0,0 +1,49 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + String rightType = CurPage.getParameter("rightType"); + if(rightType == null) rightType = ""; + String group_id = CurPage.getParameter("group_id"); + String id = CurPage.getParameter("id"); + if(group_id == null) group_id = ""; + String sTempletNo = "DistributorGroupRelation";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if(rightType.equals("ReadOnly")){ + dwTemp.ReadOnly = "1";//只读模式 + } + CurPage.getCurComp().setAttribute("RightType", rightType); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelationList.jsp b/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelationList.jsp new file mode 100644 index 000000000..8c20c0219 --- /dev/null +++ b/WebContent/Tenwa/Customer/Group/Subcompany/DistributorCustomerGroupRelationList.jsp @@ -0,0 +1,90 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + + ASObjectModel doTemp = new ASObjectModel("DistributorGroupRelationList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + String group_id = CurPage.getParameter("group_no"); + String id = CurPage.getParameter("id"); + if(group_id == null)group_id =""; + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(id); + String sButtons[][] = { + {"true","All","Button","新增成员","新增成员","newRecord()","","","","btn_icon_add",""}, + {"true","All","Button","修改","查看/修改详情","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","详情","查看/修改详情","view()","","","","btn_icon_detail",""}, + {"true","All","Button","删除","删除集团成员信息","deleteRecord()","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/Account/CustomerAccount.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/Account/CustomerAccount.jsp index ade36cba2..935ec5b1a 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/Account/CustomerAccount.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/Account/CustomerAccount.jsp @@ -24,6 +24,15 @@ sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/Invoice/CustomerInvoice.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/Invoice/CustomerInvoice.jsp index f011167ab..60974c429 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/Invoice/CustomerInvoice.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/Invoice/CustomerInvoice.jsp @@ -57,15 +57,14 @@ function saveRecord(){ if(!iV_all("0")) return;//先检查填写完整性 var tax_isdefault = getItemValue(0,getRow(),"tax_isdefault"); - var tax_isdefault = getItemValue(0,getRow(),"tax_isdefault"); var id = getItemValue(0,getRow(),"id"); if(id == ''){//新增时 var result = RunJavaMethodTrans("com.tenwa.customer.controller.invoice.CustomerInvoiceController","selectInvoice","customer_id="+"<%=customer_id%>"); if(result == "false"){ - if(tax_isdefault == "no"){ + /* if(tax_isdefault == "no"){ alert("第一条开票信息必须设置为默认开票信息"); return; - } + } */ }else{ if(tax_isdefault == "yes"){ if(!confirm("已有一条默认开票信息,是否确认设为默认?")){ @@ -74,12 +73,12 @@ } } }else{ - if('<%=tax_isdefault%>' == 'yes'){ + <%-- if('<%=tax_isdefault%>' == 'yes'){ if(tax_isdefault == "no"){ alert("默认开票信息不许修改为非默认开票信息"); return; } - } + } --%> var result = RunJavaMethodTrans("com.tenwa.customer.controller.invoice.CustomerInvoiceController","selectEditInvoice","customer_id="+"<%=customer_id%>"+",id="+'<%=id%>'); if(result == 'true'){ if(tax_isdefault == "yes"){ @@ -95,6 +94,7 @@ function validityCheck(){ //验证纳税人识别号 var tax_no = getItemValue(0,getRow(),"tax_no");//纳税人识别号 + var certid=getItemValue(0,getRow() , "certid");//统一社会信用代码 var id = getItemValue(0,getRow(),"id"); var tax_account = getItemValue(0,getRow(),"tax_account");//开户账号 var tax_status = getItemValue(0,getRow(),"tax_status");//开票状态 diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/Stockholder/CustomerStockholder.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/Stockholder/CustomerStockholder.jsp index 88b49484f..8683ae378 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/Stockholder/CustomerStockholder.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/Stockholder/CustomerStockholder.jsp @@ -80,7 +80,8 @@ window.onload=function(){ //判断组织机构代码合法性 if(certType =='Ent01' || certType =='Ent02'){ if(!checkORGRight(certid) ){ - setErrorTips("certid",getBusinessMessage('102')); + //setErrorTips("certid",getBusinessMessage('102')); + setErrorTips("certid","统一社会信用代码有误!"); return false; }else{ setErrorTips("certid",""); diff --git a/WebContent/Tenwa/Customer/Lessee/Comm/Telephone/CustomerTelInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Comm/Telephone/CustomerTelInfo.jsp index c24b9bf92..607b107e7 100644 --- a/WebContent/Tenwa/Customer/Lessee/Comm/Telephone/CustomerTelInfo.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Comm/Telephone/CustomerTelInfo.jsp @@ -53,14 +53,23 @@ function saveRecord(){ } function check(){ -var telephone = getItemValue(0,getRow(),"telephone");//电话 -if(typeof(telephone) != undefined && telephone!= "" ){ - if(!CheckPhoneCode(telephone)){ - alert("电话号码格式错误"); - return false; + var telephone = getItemValue(0,getRow(),"telephone");//电话 + if(typeof(telephone) != undefined && telephone!= "" ){ + if(!CheckPhoneCode(telephone)){ + alert("电话号码格式错误"); + return false; + } + //只校验电话类型是手机的 + var teltype = getItemValue(0,getRow(),"teltype"); + if("010"==teltype){ + var myreg=/^[1][2,3,4,5,6,7,8,9][0-9]{9}$/; + if (!myreg.test(telephone)) { + alert("电话号码格式错误"); + return false; + } + } } -} -return true; + return true; } function checkAreaVisible(){ var area = getItemValue(0,getRow(),"ext");//分机号 diff --git a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp index c317857d7..d692e0f2d 100644 --- a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp @@ -22,13 +22,13 @@ } ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); ASDataObject ado = dwTemp.getDataObject(); - ado.setHtmlEvent("establish_date", "onchange", "getOperationPeriod"); //根据成立日期动态计算营业期限(年) + ado.setHtmlEvent("establish_date,LICENSEMATURITY", "onchange", "getOperationPeriod"); //根据成立日期动态计算营业期限(年) ado.setHtmlEvent("status", "onchange", "changeRegisterInfo"); //客户状态为正式时必填,其他时候非必填 dwTemp.Style = "2";//freeform dwTemp.genHTMLObjectWindow(customerId); String compClientID = request.getParameter("CompClientID"); dwTemp.replaceColumn("invoicelist", "", CurPage.getObjectWindowOutput()); - dwTemp.replaceColumn("othercertlist", "", CurPage.getObjectWindowOutput()); +// dwTemp.replaceColumn("othercertlist", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("addresslist", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("tellist", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("accountlist", "", CurPage.getObjectWindowOutput()); @@ -38,8 +38,11 @@ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisInfo.jsp new file mode 100644 index 000000000..288204a07 --- /dev/null +++ b/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisInfo.jsp @@ -0,0 +1,31 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-08-17 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + String customerId = CurPage.getParameter("customerId"); + if(customerId == null) customerId = ""; + String sTempletNo = "CustPersonHisInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisList.jsp b/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisList.jsp new file mode 100644 index 000000000..a65fa6672 --- /dev/null +++ b/WebContent/Tenwa/Customer/Lessee/Person/CustPersonHisList.jsp @@ -0,0 +1,36 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-17 + Content: + History Log: + */ + String customerId = CurPage.getParameter("customerId"); + ASObjectModel doTemp = new ASObjectModel("CustPersonHisList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(customerId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; + +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp new file mode 100644 index 000000000..7381c2037 --- /dev/null +++ b/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp @@ -0,0 +1,201 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-22 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String flowName = CurPage.getParameter("FlowName"); + String flowUnid = CurPage.getParameter("FlowUnid"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String query = CurPage.getParameter("Query"); + String contractid = CurPage.getParameter("ContractId"); + String userID = CurUser.getUserID(); + String customertype = CurPage.getParameter("customertype"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "CustomerCompanyTempInfo";//--模板号-- + if("01".equals(customertype)&&!("业务申请流程".equals(flowName))&&!("起租后合同变更汽车".equals(flowName))){ + sTempletNo = "MakingCustomerCompanyTempInfo";//--模板号-- + } + if("01".equals(customertype)&&"业务撤销流程".equals(flowName)){ + sTempletNo = "ProjectCustomerCompanyTempInfo";//--模板号-- + flowUnid = CurPage.getParameter("ProjectId"); + } + if("Query".equals(query)){ + sTempletNo = "CustomerCompanyQueryInfo";//--模板号-- + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("", ""); + doTemp.setHtmlEvent("tel","onChange","changetel"); + doTemp.setHtmlEvent("wealth_tel","onChange","changewealth_tel"); + doTemp.setHtmlEvent("company_tel","onChange","changecompany_tel"); + doTemp.setHtmlEvent("IS_NETCAR","onChange","changeNetCarInfo"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + if("Query".equals(query)){ + dwTemp.genHTMLObjectWindow(contractid); + }else{ + dwTemp.genHTMLObjectWindow(flowUnid); + } + + String sButtons[][] = { + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + //sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Person/CustomerPerson.jsp b/WebContent/Tenwa/Customer/Lessee/Person/CustomerPerson.jsp index 2e8976734..691214b34 100644 --- a/WebContent/Tenwa/Customer/Lessee/Person/CustomerPerson.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Person/CustomerPerson.jsp @@ -43,6 +43,7 @@ %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Partner/Comm/Person/PartnerPersonList.jsp b/WebContent/Tenwa/Customer/Partner/Comm/Person/PartnerPersonList.jsp index 8461f7b3a..3c4c2f7da 100644 --- a/WebContent/Tenwa/Customer/Partner/Comm/Person/PartnerPersonList.jsp +++ b/WebContent/Tenwa/Customer/Partner/Comm/Person/PartnerPersonList.jsp @@ -23,8 +23,8 @@ {"true","All","Button","修改","查看/修改详情","viewAndEdit()","","","","btn_icon_edit"}, {"true","","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, {"true","All","Button","废弃","废弃","invalid()","","","","btn_icon_delete"}, - {"true","All","Button","引用为","引用为","quote()","","","","btn_icon_quote"}, - {"true","All","Button","分配归属人","分配归属人","allocation()","","","","btn_icon_distribute"} + {"true","All","Button","引用为","引用为","quote()","","","","btn_icon_quote"} + // {"true","All","Button","分配归属人","分配归属人","allocation()","","","","btn_icon_distribute"} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/customer_list/cust_list.jsp b/WebContent/Tenwa/Customer/customer_list/cust_list.jsp new file mode 100644 index 000000000..53f9dafe8 --- /dev/null +++ b/WebContent/Tenwa/Customer/customer_list/cust_list.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-09-03 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("CUSTOMER_LIST"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(15); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Gps/AreaCodeSelect.jsp b/WebContent/Tenwa/Gps/AreaCodeSelect.jsp new file mode 100644 index 000000000..c5409a4d0 --- /dev/null +++ b/WebContent/Tenwa/Gps/AreaCodeSelect.jsp @@ -0,0 +1,107 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBeginMD.jsp"%><% + /* + 页面说明: 选择行政区划 + */ + String sAreaCodeValue = CurPage.getParameter("AreaCodeValue");//在该页面打开后打开二级分类时传值。 + String sAreaCode = CurPage.getParameter("AreaCode");//已有值时,做初始化传入。 + String sOpen = ""; + String sDefaultItem = ""; + String sDefaultItem2 = ""; + + if(sAreaCode.length()>3) sDefaultItem = sAreaCode.substring(0,4); + if(sAreaCode!=null&&sAreaCode.length()>4){ + sOpen = "YES";//暂不作控制。 + sDefaultItem2 =sAreaCode; + } +%> + + +请选择行政区划 + + + + +
+
+ + + + + + + <% + if(sAreaCodeValue == null){ + %> + + <%}%> + +
+ + + + + + +
<%=new Button("确定","确定","newBusiness()","","").getHtmlText()%><%=new Button("取消","取消","goBack()","","").getHtmlText()%><%=new Button("清空","清空","clearAll()","","").getHtmlText()%>
+
+
+
+ + + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Gps/GpsRegister/GpsRegister.jsp b/WebContent/Tenwa/Gps/GpsRegister/GpsRegister.jsp index 6840f53c7..4961b40bc 100644 --- a/WebContent/Tenwa/Gps/GpsRegister/GpsRegister.jsp +++ b/WebContent/Tenwa/Gps/GpsRegister/GpsRegister.jsp @@ -18,6 +18,22 @@ }; %><%@include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Gps/LmGpsLocationList.jsp b/WebContent/Tenwa/Gps/LmGpsLocationList.jsp new file mode 100644 index 000000000..a391507ae --- /dev/null +++ b/WebContent/Tenwa/Gps/LmGpsLocationList.jsp @@ -0,0 +1,35 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-07-11 + Content: + History Log: + */ + String ProjectNo = CurPage.getParameter("ProjectNo"); + ASObjectModel doTemp = new ASObjectModel("LmGpsLocationList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(ProjectNo); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Gps/LmGpsOrderInfo.jsp b/WebContent/Tenwa/Gps/LmGpsOrderInfo.jsp new file mode 100644 index 000000000..23a714889 --- /dev/null +++ b/WebContent/Tenwa/Gps/LmGpsOrderInfo.jsp @@ -0,0 +1,196 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ page import="java.math.BigDecimal"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-07-11 + Content: 示例详情页面 + History Log: + */ + String userId = CurUser.getUserID(); + String ProjectNo = CurPage.getParameter("ProjectNo"); + String ProjectId = CurPage.getParameter("ProjectId"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + String flowunid = CurPage.getParameter("ObjectNo"); + String compClientID = request.getParameter("CompClientID"); + String frameNumber = Sqlca.getString("select FRAME_NUMBER from LB_EQUIPMENT_CAR_TEMP where FLOWUNID='"+flowunid+"'"); + String id = Sqlca.getString("select id from LM_GPS_ORDER_TEMP where APPLY_NO='"+ProjectNo+"'"); + + String contact_name = Sqlca.getString("select CONTACT_NAME from GPS_config_info where isenable='1' ");//现场联系人 + String contact_phone = Sqlca.getString("select CONTACT_PHONE from GPS_config_info where isenable='1' ");//现场联系人电话 + + String distributor_id = Sqlca.getString("select distributor_id from lb_project_info where id='"+ProjectId+"'");//获取经销商ID + String distributor_name = Sqlca.getString("select distributor_name from distributor_info where distributor_no='"+distributor_id+"'");//获取经销名称 + + + + BigDecimal incomNuber = new BigDecimal(Sqlca.getString("select INCOME_NUMBER from LC_CALC_CONDITION_TEMP where FLOWUNID='"+flowunid+"'")); + List images = new ArrayList(); + String sql = "select lgp.URL from lm_gps_photo lgp where APPLY_NO='"+ProjectNo+"'"; + ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql)); + while(res.next()){ + images.add(res.getString("URL")); + } + + String period = incomNuber.divide(new BigDecimal("12"),0,BigDecimal.ROUND_UP).toString(); + String sTempletNo = "LmGpsOrderInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(ProjectNo); + dwTemp.replaceColumn("LOCATION", "", CurPage.getObjectWindowOutput()); + String [][] sButtons; + if("0010".equals(PhaseNo)){ + sButtons = new String[][]{ + {"true","All","Button","提交工单","提交工单","if(getItemValue(0,getRow(),'STATUS')!='7'){alert('不可重复提交!');return;}as_save(0,'submitOrder()')","","","",""}, + {"true","All","Button","查询工单","查询工单","queryOrder()","","","",""}, + {"true","All","Button","修改工单","修改工单","alterOrder()","","","",""}, + {"true","All","Button","取消工单","取消工单","cancelOrder()","","","",""}, + {"true","All","Button","查看安装图","查看安装图","showGPSImage()","","","",""}, + }; + }else{ + sButtons =new String[][]{{"fasle","All","Button","提交工单","提交工单","if(getItemValue(0,getRow(),'STATUS')!='7'){alert('不可重复提交!');return;}as_save(0,'submitOrder()')","","","",""},}; + } +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Gps/LmGpsOrderList.jsp b/WebContent/Tenwa/Gps/LmGpsOrderList.jsp new file mode 100644 index 000000000..881e5443a --- /dev/null +++ b/WebContent/Tenwa/Gps/LmGpsOrderList.jsp @@ -0,0 +1,64 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-07-16 + Content: + History Log: + */ + String userId = CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("LmGpsOrderList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","查看定位信息","查看定位信息","queryOrder()","","","","",""}, + {"true","","Button","查看安装图","查看安装图","showImage()","","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationList.jsp b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationList.jsp index bcc9d044b..7b5050909 100644 --- a/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationList.jsp +++ b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationList.jsp @@ -5,16 +5,17 @@ String contractId = CurPage.getParameter("ContractId") != null ? CurPage.getParameter("ContractId") : ""; String isRemind = CurPage.getParameter("IsRemind") != null ? CurPage.getParameter("IsRemind") : ""; ASObjectModel doTemp = new ASObjectModel("LBFiveGradeClassificationList"); - String appendSql = ""; + String appendSql = ""; if(!"".equals(contractId)){ appendSql += " and O.id = '"+contractId+"' and lccs.Is_Remind = '"+isRemind+"' AND v.DATEDIFF(v.NOW(),lccs.FIVE_GRADE_DATE) <= 3 "; }else if(!"".equals(isRemind)){ appendSql += " and lccs.Is_Remind = '"+isRemind+"' AND v.DATEDIFF(v.NOW(),lccs.FIVE_GRADE_DATE) <= 3 "; } - String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); + //String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); + String sCondtion=""; if(!"".equals(appendSql)) sCondtion += appendSql; doTemp.appendJboWhere(sCondtion); - doTemp.setDefaultValue("IS_AUTO", "Y"); + doTemp.setDefaultValue("IS_AUTO", "Y"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 @@ -22,10 +23,21 @@ dwTemp.genHTMLObjectWindow(""); String sButtons[][] =new String[][] { {"true","","Button","设置自动分类","设置自动分类","setAutoClassification()","","","","btn_icon_set"}, - {"true","","Button","取消自动分类","取消自动分类","cancelAutoClassification()","","","","btn_icon_delete"} + {"true","","Button","取消自动分类","取消自动分类","cancelAutoClassification()","","","","btn_icon_delete"}, + {"true","","Button","执行定时任务","执行定时任务","execute()","","","",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationListTraditional.jsp b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationListTraditional.jsp new file mode 100644 index 000000000..f2f42724e --- /dev/null +++ b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationListTraditional.jsp @@ -0,0 +1,149 @@ +<%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + + String contractId = CurPage.getParameter("ContractId") != null ? CurPage.getParameter("ContractId") : ""; + String isRemind = CurPage.getParameter("IsRemind") != null ? CurPage.getParameter("IsRemind") : ""; + ASObjectModel doTemp = new ASObjectModel("LBFiveGradeClassificationListTra"); + String appendSql = ""; + if(!"".equals(contractId)){ + appendSql += " and O.id = '"+contractId+"' and lccs.Is_Remind = '"+isRemind+"' AND v.DATEDIFF(v.NOW(),lccs.FIVE_GRADE_DATE) <= 3 "; + }else if(!"".equals(isRemind)){ + appendSql += " and lccs.Is_Remind = '"+isRemind+"' AND v.DATEDIFF(v.NOW(),lccs.FIVE_GRADE_DATE) <= 3 "; + } + //String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); + String sCondtion=""; + if(!"".equals(appendSql)) sCondtion += appendSql; + doTemp.appendJboWhere(sCondtion); + doTemp.setDefaultValue("IS_AUTO", "Y"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(15); + dwTemp.genHTMLObjectWindow(""); + String sButtons[][] =new String[][] { + {"true","","Button","设置自动分类","设置自动分类","setAutoClassification()","","","","btn_icon_set"}, + {"true","","Button","取消自动分类","取消自动分类","cancelAutoClassification()","","","","btn_icon_delete"}, + {"true","","Button","执行定时任务","执行定时任务","execute()","","","",""} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationMainTraditional.jsp b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationMainTraditional.jsp new file mode 100644 index 000000000..2cbe1d661 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/AutoFiveGradeClassification/AutoFiveGradeClassificationMainTraditional.jsp @@ -0,0 +1,11 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/IncludeBegin.jsp"%><% + String PG_TITLE = "隐藏左侧区域的Main页面"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "五级分类"; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "1";//默认的treeview宽度 +%><%@include file="/Resources/CodeParts/Main04.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceDocumentInfo.jsp b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceDocumentInfo.jsp new file mode 100644 index 000000000..d8a919d10 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceDocumentInfo.jsp @@ -0,0 +1,93 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/Frame/resources/include/include_begin_info.jspf"%> +<%@ page import="com.tenwa.doc.action.DocumentListAction" %> +<% + //获得组件参数 + String sObjectType=CurPage.getParameter("ObjectType");// + String contract_id=CurPage.getParameter("contract_id"); + + ASObjectModel doTemp = new ASObjectModel("LBAdjustDocumentInfo"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; // 设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; // 设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(""); + String[][] sButtons=null; + sButtons=new String[][]{ + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","","Button","取消","取消","viewAndEdit_attachment()","","","","btn_icon_close"}}; +%><%@include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceInfoDetail.jsp b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceInfoDetail.jsp index 0b9baa57d..11b645a0a 100644 --- a/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceInfoDetail.jsp +++ b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsuranceInfoDetail.jsp @@ -5,25 +5,34 @@ Content: 示例详情页面 History Log: */ - String sPrevUrl = CurPage.getParameter("PrevUrl"); - if(sPrevUrl == null) sPrevUrl = ""; + String contract_number = CurPage.getParameter("contract_number"); + String contractId = CurPage.getParameter("contractId"); + String customerName = CurPage.getParameter("customerName"); + String leas_form = CurPage.getParameter("leas_form"); +// if(sPrevUrl == null) sPrevUrl = ""; String sTempletNo = "LBInsuranceInfoDetail";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("Contract_Id", contractId); + doTemp.setDefaultValue("Contract_number", contract_number); + doTemp.setDefaultValue("CUSTOMER_NAME", customerName); + doTemp.setDefaultValue("LEAS_FORM", leas_form); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); String sButtons[][] = { {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, - {"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} + {"true","All","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsureAttachmentUpload.jsp b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsureAttachmentUpload.jsp new file mode 100644 index 000000000..9241b0ffc --- /dev/null +++ b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/InsureAttachmentUpload.jsp @@ -0,0 +1,103 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-05-31 + Content: 示例详情页面 + History Log: + */ + String Library_id = CurPage.getParameter("Library_id"); + + //定义变量 + String sObjectNo = "";//--对象编号 + //获得组件参数 + String flowNo=CurPage.getParameter("FlowNo"); + + String sPrevUrl = CurPage.getParameter("PrevUrl"); + //if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyList.jsp"; + + String sTempletNo = "InsureAttachmentUpload";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(Library_id); + String sButtons[][] = { + {"true","","Button","保存","保存所有修改","importRecord()","","","",""}, + {"true","All","Button","取消","返回列表","pull()","","","","btn_icon_close"} + }; + /* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/LBInsuranceInfoList.jsp b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/LBInsuranceInfoList.jsp new file mode 100644 index 000000000..754ff50ab --- /dev/null +++ b/WebContent/Tenwa/Lease/App/BussinessOperation/InsuranceInfo/LBInsuranceInfoList.jsp @@ -0,0 +1,135 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-03 + Content: + History Log: + */ + String contract_number = CurPage.getParameter("contract_number"); + String contractId = CurPage.getParameter("contractId"); + String customerName = CurPage.getParameter("customerName"); + String leas_form = CurPage.getParameter("leas_form"); + ASObjectModel doTemp = new ASObjectModel("LBInsuranceInfoTwoList"); + if (""!=contract_number || null==contract_number){ + doTemp.appendJboWhere("lci.CONTRACT_NUMBER='"+contract_number+"'"); + } +// doTemp.setDefaultValue("", contract_number); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/LBRegisterContractInfoD.jsp b/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/LBRegisterContractInfoD.jsp new file mode 100644 index 000000000..7628cb542 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/LBRegisterContractInfoD.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-10-15 + Content: 示例详情页面 + History Log: + */ + String contract_number = CurPage.getParameter("FlowKey"); + String ContractId = CurPage.getParameter("ContractId"); + String customerName = Sqlca.getString("SELECT customer_name FROM lb_union_lessee WHERE contract_id='"+ContractId+"'"); + String customer_id = Sqlca.getString("SELECT customer_id FROM lb_union_lessee WHERE contract_id='"+ContractId+"'"); + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + + String sTempletNo = "LBRegisterContractInfoD";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "1";//只读模式 + dwTemp.genHTMLObjectWindow(contract_number); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/RegisterExpressInfo.jsp b/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/RegisterExpressInfo.jsp index e85be27bd..b627fef0f 100644 --- a/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/RegisterExpressInfo.jsp +++ b/WebContent/Tenwa/Lease/App/ContractDelivery/RegisterExpress/RegisterExpressInfo.jsp @@ -1,6 +1,7 @@ <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% - + + String userid = CurPage.getUserId(); String sTempletNo = "LBRegisterContractInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); @@ -20,7 +21,8 @@ as_save("myiframe0"); } function selectContract(){ - AsDialog.OpenSelector("SelectContractForRegister","","dialogWidth=" + parseInt(window.screen.width * 0.3) + "px dialogHeight=" + parseInt(window.screen.height * 0.4) + "px",function(sReturn){ + var userid = "<%=userid%>"; + AsDialog.OpenSelector("SelectContractForRegister","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.8) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"){ return; } diff --git a/WebContent/Tenwa/Lease/App/InformationTable/InfoView.jsp b/WebContent/Tenwa/Lease/App/InformationTable/InfoView.jsp index 7776e2920..373976f75 100644 --- a/WebContent/Tenwa/Lease/App/InformationTable/InfoView.jsp +++ b/WebContent/Tenwa/Lease/App/InformationTable/InfoView.jsp @@ -34,6 +34,8 @@ <% OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage,"业务详情","right"); FlowTaskViewTabService.initOHTMLTreeViewProjectContract(tx,tviTemp,CurPage); + tx.commit(); + String FlowUnid=CurPage.getParameter("FlowUnid"); %> <%/*~END~*/%> @@ -47,6 +49,7 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductCarList.jsp b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductCarList.jsp new file mode 100644 index 000000000..301c5774d --- /dev/null +++ b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductCarList.jsp @@ -0,0 +1,50 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-05 + Content: + History Log: + */ + String product_id = CurPage.getParameter("product_id"); + ASObjectModel doTemp = new ASObjectModel("LB_PRODUCT_CAR_LIST"); + if (""!=product_id || null==product_id){ + doTemp.appendJboWhere("lpi.product_id='"+product_id+"'"); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductInfoList.jsp b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductInfoList.jsp new file mode 100644 index 000000000..57be3d5b8 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductInfoList.jsp @@ -0,0 +1,39 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-06 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LB_PRODUCT_INFO_LIST"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvage.jsp b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvage.jsp new file mode 100644 index 000000000..202e8a042 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvage.jsp @@ -0,0 +1,56 @@ +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.app.AWE_DO_LIBRARY"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-06-09 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LB_PRODUCT_SALVAGE"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'getRowCount(0)')","","","","btn_icon_delete",""}, + {"true","All","Button","测试","测试","unit()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvageInfo.jsp b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvageInfo.jsp new file mode 100644 index 000000000..3d5bf5632 --- /dev/null +++ b/WebContent/Tenwa/Lease/App/Interface/CarInfo/LbProductSalvageInfo.jsp @@ -0,0 +1,175 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-09 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("id"); + String edit = CurPage.getParameter("edit"); + String add = CurPage.getParameter("add"); + /* if(sPrevUrl == null) sPrevUrl = ""; */ + + String sTempletNo = "LB_PRODUCT_SALVAGE_INFO";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("dis_attribute", "onchange", "selectcommission"); + + /* doTemp.setColTips("", "测试"); */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","",""} + }; + /* sButtonPosition = "south"; */ +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp index 8955ec426..ab2f4941d 100644 --- a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp +++ b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankInfo.jsp @@ -16,9 +16,9 @@ doTemp.setDefaultValue("InputOrgID",inputorgid); doTemp.setColTips("", ""); doTemp.setDefaultValue("invalid", "N"); - doTemp.setHtmlEvent("fact_money","onkeyup","adjustMayOpemoney"); - doTemp.setHtmlEvent("nowith_money","onkeyup","adjustMayOpemoney"); - doTemp.setHtmlEvent("had_money","onkeyup","adjustMayOpemoney"); + doTemp.setHtmlEvent("fact_money","onchange","adjustMayOpemoney"); + doTemp.setHtmlEvent("nowith_money","onchange","adjustMayOpemoney"); + doTemp.setHtmlEvent("had_money","onchange","adjustMayOpemoney"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "-2";//只读模式 @@ -43,11 +43,16 @@ function goBack(){ AsControl.OpenView("/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp", "","_self",""); } - function saveRecord(sPostEvents){ + function saveRecord(sPostEvents){ + var mayope_money=getItemValue(0,getRow(),"mayope_money"); + if(mayope_money<0){ + alert("可核销金额不能小于0"); + return; + } var sProjID = getItemValue(0,getRow(),"ID"); - - setItemValue(0,0,"ID",sProjID); + setItemValue(0,0,"ID",sProjID); as_save("myiframe0","goBack()"); + // var res=RunJavaMethodTrans("com.tenwa.lease.app.ebank.EbankUse","createEbankVoucher",""); } function adjustMayOpemoney(){ var fact_money=getItemValue(0,getRow(),"fact_money"); @@ -56,8 +61,10 @@ if(nowith_money==null||nowith_money=="") nowith_money=0; var had_money=getItemValue(0,getRow(),"had_money"); if(had_money==null||had_money=="") had_money=0; - var mayope_money=parseFloat(fact_money)-parseFloat(nowith_money)-parseFloat(had_money); - setItemValue(0,0,"mayope_money", mayope_money); + var mayope_money=Number(fact_money)-Number(nowith_money)-Number(had_money); + var mayopeMoney = ""+mayope_money; + setItemValue(0,0,"mayope_money", mayopeMoney); + } function selectOwnAccount(){ AsDialog.OpenSelector("SelectOwnAccount","","dialogWidth=" + parseInt(window.screen.width * 0.9) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ @@ -93,7 +100,7 @@ } //选择承租人 function selectCust(){ - AsDialog.OpenSelector("SelectCustomer","","dialogWidth=" + parseInt(window.screen.width * 0.9) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectCustomerBank","","dialogWidth=" + parseInt(window.screen.width * 0.9) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp index 9c34755bc..217b0753c 100644 --- a/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp +++ b/WebContent/Tenwa/Lease/App/Interface/Ebank/LCEbankList.jsp @@ -9,7 +9,8 @@ */ String userid=CurUser.getUserID(); String department=CurUser.getOrgID(); - ASObjectModel doTemp = new ASObjectModel("LCEbankList"); + //ASObjectModel doTemp = new ASObjectModel("LCEbankList"); + ASObjectModel doTemp = new ASObjectModel("LCEbankListchly"); //String sCondtion=DataRightManager.getRightCondtion(CurUser,(CurUser.hasRole("299")?session.getAttribute("managerPlatFormOrgId").toString():CurUser.getOrgID()), Sqlca, "O.","default"); //doTemp.appendJboWhere(sCondtion); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); @@ -23,12 +24,13 @@ {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, {"false","","Button","废弃","废弃","abandon()","","","","btn_icon_delete",""}, + {"true","","Button","确认收入","确认收入","confirmIncome()","","","","btn_icon_valid",""}, + {"true","","Button","确认退回","确认退回","confirmpayback()","","","","btn_icon_valid",""}, + {"false","","Button","默认导入Excel","导入Excel","MoRen_importExcel()","","","","btn_icon_import",""}, + {"false","","Button","默认网银模版下载","网银模版下载","MoRenebankDownload()","","","","btn_icon_down",""}, + {"false","","Button","生成凭证","生成凭证","createVoucher()","","","","btn_icon_down",""}, {"true","","Button","导入Excel","导入Excel","importExcel()","","","","btn_icon_import",""}, {"true","","Button","网银模版下载","网银模版下载","ebankDownload()","","","","btn_icon_down",""}, - {"true","","Button","导入Excel-平安","导入Excel-平安","importPAExcel()","","","","btn_icon_import",""}, - {"true","","Button","导入Excel-光大","导入Excel-光大","importCEBExcel()","","","","btn_icon_import",""}, - {"true","","Button","光大网银模版下载","光大网银模版下载","ebankCEBDownload()","","","","btn_icon_down",""}, - /* {"true","","Button","挂账","挂账","temporary()","","","","btn_icon_detail",""}, */ }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +
+
+ +
+
+ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountImportInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountImportInfo.jsp new file mode 100644 index 000000000..897bba78d --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountImportInfo.jsp @@ -0,0 +1,88 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-11-22 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DistributorAccountImportInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountReCheckList.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountReCheckList.jsp new file mode 100644 index 000000000..57c18447a --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorAccountReCheckList.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DistributorAccountReCheckList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + String distributor_id = CurPage.getParameter("distributor_no").toString(); + + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(CurPage.getParameter("distributor_no")); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoFirstTrialInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoFirstTrialInfo.jsp new file mode 100644 index 000000000..0fda85361 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoFirstTrialInfo.jsp @@ -0,0 +1,122 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DistributorInfoImportInfoNew";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportInfo.jsp new file mode 100644 index 000000000..28283c63c --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportInfo.jsp @@ -0,0 +1,122 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DistributorInfoImportInfoNew";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportList.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportList.jsp new file mode 100644 index 000000000..8882acbec --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIBatchmportList.jsp @@ -0,0 +1,74 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-11-20 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DistributorInfoIBatchmportList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","导入Excel","导入Excel","importExcel()","","","","btn_icon_import"}, + {"true","","Button","模版下载","模版下载","DistributorDownload()","","","","btn_icon_down",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +
+
+ +
+
+ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIReCheckInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIReCheckInfo.jsp new file mode 100644 index 000000000..d2f336945 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoIReCheckInfo.jsp @@ -0,0 +1,121 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DistributorInfoImportInfoNew";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportRecheck.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportRecheck.jsp new file mode 100644 index 000000000..e6074eb08 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportRecheck.jsp @@ -0,0 +1,104 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DistributorInfoImportRecheck"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","经销商账户","经销商账户","distributorAccountS()","","","","",""}, + {"true","","Button","提交申请","提交申请","submitRecheck()","","","","",""}, + {"true","","Button","退回申请","退回申请","backRecheck()","","","","",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportfirstTrial.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportfirstTrial.jsp new file mode 100644 index 000000000..b51cdf9f6 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/DistributorInfoImportfirstTrial.jsp @@ -0,0 +1,101 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-11-21 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DistributorInfoImportfirstTrial"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","经销商账户","经销商账户","distributorAccount()","","","","",""}, + {"true","","Button","提交申请","提交申请","submitFirstTrial()","","","","",""}, + {"true","","Button","删除","删除","dodelete()","","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountInfo.jsp index 711b086ee..d8c3b1135 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountInfo.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountInfo.jsp @@ -1,42 +1,144 @@ -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% - /* - Author: undefined 2017-10-11 - Content: - History Log: - */ - String id = CurPage.getParameter("id");//账号id - String flowunid=CurPage.getParameter("ObjectNo"); - // String righttrpe=CurPage.getParameter("righttrpe"); - if(id == null) id=""; - String sTempletNo = "LDistributorAccountInfo"; //模板号 - // if(sTempletNo == null) sTempletNo = "LDistributorAccountInfo"; - BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); - String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); - - - ASObjectModel doTemp = new ASObjectModel(sTempletNo); - doTemp.setDefaultValue("FLOWUNID", flowunid); - doTemp.setDefaultValue("DISTRIBUTOR_ID", DISTRIBUTOR_NO); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="2"; //--设置为Grid风格-- - /* if(righttrpe=="ReadOnly"){ - dwTemp.ReadOnly = "1"; //只读模式 - } - */ - dwTemp.genHTMLObjectWindow(id); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","保存","保存","as_save(0)","","","","btn_icon_save"}, - {"true","","Button","返回","返回","returnList()","","","","btn_icon_return"} - }; -%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> - +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: + History Log: + */ + String id = CurPage.getParameter("id");//账号id + String sflowunid = CurPage.getParameter("flowunid"); + String flowunid=CurPage.getParameter("ObjectNo"); + String rightType=CurPage.getParameter("RightType"); + if(id == null) id=""; + String sTempletNo = "LDistributorAccountInfo"; //模板号 + // if(sTempletNo == null) sTempletNo = "LDistributorAccountInfo"; + BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + String DISTRIBUTOR_NO=flow!=null?flow.getAttribute("proj_id").getString():""; + BizObject flow2=JBOFactory.createBizObjectQuery("jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("FLOWUNID", flowunid); + doTemp.setDefaultValue("DISTRIBUTOR_ID", DISTRIBUTOR_NO); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; //--设置为Grid风格-- + if("ReadOnly".equals(rightType)){ + dwTemp.ReadOnly = "1"; //只读模式 + doTemp.setColInnerBtEvent("provinceInfo", ""); + doTemp.setColInnerBtEvent("district", ""); + } + + dwTemp.genHTMLObjectWindow(id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"ReadOnly".equals(rightType)?"false":"true","","Button","保存","保存所有修改","save()","","","","btn_icon_save"}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return"} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountList.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountList.jsp index 5191851da..15ad618e6 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountList.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorAccountList.jsp @@ -1,4 +1,5 @@ <%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% /* Author: undefined 2017-10-11 @@ -6,45 +7,90 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String sFlowName = CurPage.getParameter("applyType");//获取流程名称 + String PhaseNo = CurPage.getParameter("PhaseNo"); + + String ishistory=CurPage.getParameter("IsHistory"); + String RightType=CurPage.getParameter("RightType"); + String disno=""; + List nolist=JBOFactory.getBizObjectManager("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT").createQuery("select di.distributor_no from O ,jbo.app.tenwa.customer.DISTRIBUTOR_INFO di where di.id=O.proj_id and flow_unid=:flowunid") + .setParameter("flowunid",sFlowUnid).getResultList(false); + if(nolist.size()>0){ + disno=nolist.get(0).getAttribute("distributor_no").getString(); + } if(sFlowUnid == null) sFlowUnid=""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 - if(sTempletNo == null) sTempletNo = "LDistributorAccountList"; - - + if(sTempletNo == null) sTempletNo = "LDistributorAccountList"; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sTempletNo = "LDistributorAccountListS"; + sFlowUnid=disno; + } ASObjectModel doTemp = new ASObjectModel(sTempletNo); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- //dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(20); dwTemp.genHTMLObjectWindow(sFlowUnid); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + + String temp = "true"; + if("0020".equals(PhaseNo)){ + temp="false"; + }; + String sButtons[][] =null; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sButtons=new String[][] { + /* {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, */ }; + }else{ + sButtons=new String[][] { + {temp,"All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {temp,"","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {temp,"","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, + //{"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {temp,"All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; + + } + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfo.jsp index 9d58f719a..25810df47 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfo.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfo.jsp @@ -6,6 +6,10 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String PhaseNo=CurPage.getParameter("PhaseNo"); + String RightType=CurPage.getParameter("RightType"); + // String PhaseNo=CurPage.getParameter("PhaseNo"); + // System.out.print("==============="+RightType); if(sFlowUnid == null) sFlowUnid=""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LDistributorInfo"; @@ -15,30 +19,158 @@ ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setDefaultValue("FLOWUNID", sFlowUnid); doTemp.setDefaultValue("DISTRIBUTOR_NO", DISTRIBUTOR_NO); + if("0020".equals(PhaseNo)){ + doTemp.setRequired("RETAIL_OPEN_DATE",true);//(0, "RETAIL_OPEN_DATE", true); + doTemp.setReadOnly("",true);//先把页面所有字段设为只读状态 + //doTemp.setReadOnly("RETAIL_OPEN_DATE",false);//唯独把这个字段设为必填 + doTemp.setColInnerBtEvent("PROVINCES", ""); + doTemp.setColInnerBtEvent("DISTRIBUTOR_ADDRESSNAME", ""); + doTemp.setColInnerBtEvent("SUBSIDIARY_COMPANY", ""); + } + doTemp.setDefaultValue("MARGIN_SCALE_SET", "0"); + if("ReadOnly".equals(RightType)){ + //doTemp.setReadOnly("RETAIL_OPEN_DATE",false);//唯独把这个字段设为必填 + doTemp.setReadOnly("PROVINCES",true);//省份只读 + doTemp.setReadOnly("SUBSIDIARY_COMPANY",true);//所属母公司 + doTemp.setColInnerBtEvent("PROVINCES,SUBSIDIARY_COMPANY,DISTRIBUTOR_ADDRESSNAME", ""); + +// dwTemp.getDataObject().set.setReadOnly("RETAIL_OPEN_DATE", false); +// dwTemp.getDataObject().setRequired("RETAIL_OPEN_DATE", true); + } //doTemp.setColTips("", "测试"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "1";//只读模式 + //dwTemp.ReadOnly = "1";//只读模式 ASDataObject ado = dwTemp.getDataObject(); ado.setHtmlEvent("LIMIT_APPROVAL_DATE", "onchange", "getenddate"); + ado.setHtmlEvent("CHANNELTYPE", "onchange", "changeTotalRequired"); + ado.setHtmlEvent("LIMIT_EFFECTIVE_DATE", "onchange", "getenddate"); + //ado.setReadOnly("BUSINESS_PROPERTY,DISTRIBUTORER",true); dwTemp.genHTMLObjectWindow(sFlowUnid); + String temp = "true"; + if("0020".equals(PhaseNo)){ + temp="false"; + }; String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","save()","","","",""} + {temp,"All","Button","保存","保存所有修改","save()","","","",""} /* {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} */ }; sButtonPosition = "north"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfoSecond.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfoSecond.jsp new file mode 100644 index 000000000..7e68aa0f8 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorInfoSecond.jsp @@ -0,0 +1,150 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: 示例详情页面 + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + if(sFlowUnid == null) sFlowUnid=""; + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + if(sTempletNo == null) sTempletNo = "LDistributorInfoSecond"; + BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", sFlowUnid).getSingleResult(false); + String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("FLOWUNID", sFlowUnid); + doTemp.setDefaultValue("DISTRIBUTOR_NO", DISTRIBUTOR_NO); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "1";//只读模式 + doTemp.setColInnerBtEvent("PROVINCES", ""); + doTemp.setColInnerBtEvent("DISTRIBUTOR_ADDRESSNAME", ""); + doTemp.setColInnerBtEvent("SUBSIDIARY_COMPANY", ""); + ASDataObject ado = dwTemp.getDataObject(); + ado.setHtmlEvent("LIMIT_APPROVAL_DATE", "onchange", "getenddate"); + ado.setHtmlEvent("LIMIT_EFFECTIVE_DATE", "onchange", "getenddate"); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + String sButtons[][] = { + /* {"true","All","Button","保存","保存所有修改","save()","","","",""} */ + /* {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} +*/ }; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryInfo.jsp new file mode 100644 index 000000000..3555c452c --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryInfo.jsp @@ -0,0 +1,129 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: + History Log: + */ + String id = CurPage.getParameter("id");//账号id + String sflowunid = CurPage.getParameter("flowunid"); + String flowunid=CurPage.getParameter("ObjectNo"); + String rightType=CurPage.getParameter("RightType"); + String distributorId=CurPage.getParameter("distributorId"); + if(id == null) id=""; + String sTempletNo = "distributor_subsidiary_temp_info"; //模板号 + // if(sTempletNo == null) sTempletNo = "LDistributorAccountInfo"; + BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + String DISTRIBUTOR_NO=flow!=null?flow.getAttribute("proj_id").getString():""; + + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("FLOWUNID", flowunid); + //doTemp.setDefaultValue("DISTRIBUTOR_ID", DISTRIBUTOR_NO); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; //--设置为Grid风格-- + if("ReadOnly".equals(rightType)){ + dwTemp.ReadOnly = "1"; //只读模式 + //doTemp.setColInnerBtEvent("provinceInfo", ""); + //doTemp.setColInnerBtEvent("district", ""); + } + + dwTemp.genHTMLObjectWindow(id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"ReadOnly".equals(rightType)?"false":"true","","Button","保存","保存所有修改","save()","","","","btn_icon_save"}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return"} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryList.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryList.jsp new file mode 100644 index 000000000..4967a8a78 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorApproval/LDistributorSubsidiaryList.jsp @@ -0,0 +1,97 @@ +<%@page import="com.tenwa.reckon.util.UUIDUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String sFlowName = CurPage.getParameter("applyType");//获取流程名称 + String PhaseNo = CurPage.getParameter("PhaseNo"); + + String ishistory=CurPage.getParameter("IsHistory"); + String RightType=CurPage.getParameter("RightType"); + String disno=""; + List nolist=JBOFactory.getBizObjectManager("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT").createQuery("select di.distributor_no from O ,jbo.app.tenwa.customer.DISTRIBUTOR_INFO di where di.id=O.proj_id and flow_unid=:flowunid") + .setParameter("flowunid",sFlowUnid).getResultList(false); + if(nolist.size()>0){ + disno=nolist.get(0).getAttribute("distributor_no").getString(); + } + if(sFlowUnid == null) sFlowUnid=""; + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + if(sTempletNo == null) sTempletNo = "distributor_susidiary_temp_list"; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sTempletNo = "LDistributorAccountListS"; + sFlowUnid=disno; + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + //dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + String temp = "true"; + if("0020".equals(PhaseNo)){ + temp="false"; + }; + String sButtons[][] =null; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sButtons=new String[][] { + /* {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, */ + }; + }else{ + sButtons=new String[][] { + {temp,"All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {temp,"","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {temp,"","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, + //{"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {temp,"All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; + + } + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/ApplyPassContract.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/ApplyPassContract.jsp new file mode 100644 index 000000000..fff5aa801 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/ApplyPassContract.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-13 + Content: + History Log: + */ + String distributor_no = CurPage.getParameter("distributor_no"); + ASObjectModel doTemp = new ASObjectModel("APPLY_PASS_CONTRACT"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(distributor_no); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/CustomerDistributorChangeApplyList.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/CustomerDistributorChangeApplyList.jsp index 3cf7f3cfa..c1ada97e0 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/CustomerDistributorChangeApplyList.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/CustomerDistributorChangeApplyList.jsp @@ -4,7 +4,17 @@ <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeAccountHis.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeAccountHis.jsp index 46cad5481..b342e59fa 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeAccountHis.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeAccountHis.jsp @@ -6,16 +6,25 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String IsHistory = CurPage.getParameter("IsHistory");//流程编号 + if(sFlowUnid == null) sFlowUnid=""; BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", sFlowUnid).getSingleResult(false); - String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); - - ASObjectModel doTemp = new ASObjectModel("LDistributorChangeAccountHis"); + String DISTRIBUTOR_NO=flow.getAttribute("proj_id").getString(); + String sTempNo = "LDistributorChangeAccountHis"; + if("true".equals(IsHistory)){ + sTempNo = "LDistributorChangeAccountRealHis"; + } + ASObjectModel doTemp = new ASObjectModel(sTempNo); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(20); - dwTemp.genHTMLObjectWindow(DISTRIBUTOR_NO); + if("true".equals(IsHistory)){ + dwTemp.genHTMLObjectWindow(sFlowUnid); + }else{ + dwTemp.genHTMLObjectWindow(DISTRIBUTOR_NO); + } //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { @@ -37,7 +46,7 @@ alert("参数不能为空!"); return ; } - AsDialog.PopView(sUrl,"id="+sPara,"dialogWidth=800px;dialogHeight=200px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(){ + AsDialog.PopView(sUrl,"id="+sPara+"&RightType=ReadOnly","dialogWidth=900px;dialogHeight=200px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(){ //reloadSelf(); },"详情"); } diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeInfoHis.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeInfoHis.jsp index e1229aa13..ef62f7972 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeInfoHis.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorChangeInfoHis.jsp @@ -9,12 +9,15 @@ if(sFlowUnid == null) sFlowUnid=""; String DISTRIBUTOR_NO=CurPage.getParameter("DISTRIBUTOR_NO"); - String sTempletNo = "LDistributorChangeInfoBefore";//--模板号-- + String sTempletNo = "LDistributorInfoS";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); //doTemp.setColTips("", "测试"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform dwTemp.ReadOnly = "1";//只读模式 + doTemp.setColInnerBtEvent("PROVINCES", ""); + doTemp.setColInnerBtEvent("DISTRIBUTOR_ADDRESSNAME", ""); + doTemp.setColInnerBtEvent("SUBSIDIARY_COMPANY", ""); dwTemp.genHTMLObjectWindow(DISTRIBUTOR_NO); String sButtons[][] = { diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorIncludeBandA.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorIncludeBandA.jsp new file mode 100644 index 000000000..61ce06544 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorIncludeBandA.jsp @@ -0,0 +1,32 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: 示例详情页面 + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + if(sFlowUnid == null) sFlowUnid=""; + String sTempletNo ="LDistributorIncludeBandA"; + BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", sFlowUnid).getSingleResult(false); + //String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); + + String DISTRIBUTOR_NO=CurPage.getParameter("distributor_no"); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "1";//只读模式 + ASDataObject ado = dwTemp.getDataObject(); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("beforechange", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("afterchange", "", CurPage.getObjectWindowOutput()); + + String sButtons[][] = {}; + sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorInfo.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorInfo.jsp index f4a4550c3..b898e4c68 100644 --- a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorInfo.jsp +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorInfo.jsp @@ -6,6 +6,7 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String RightType=CurPage.getParameter("RightType"); if(sFlowUnid == null) sFlowUnid=""; ASObjectModel temp = new ASObjectModel("LDistributorChangeInfoHis"); //获取法人原始信息 @@ -20,17 +21,25 @@ } distributorInfo = "{"+distributorInfo.substring(1)+"}"; */ - String sTempletNo = CurPage.getParameter("TempletNo");//模板号 - if(sTempletNo == null) sTempletNo = "LDistributorChangeInfo"; - + //String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + //if(sTempletNo == null) sTempletNo = "LDistributorInfo"; + String sTempletNo ="LDistributorInfoAfterChange"; BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", sFlowUnid).getSingleResult(false); - String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); - + // String DISTRIBUTOR_NO=flow.getAttribute("Flow_Key").getString(); + + String DISTRIBUTOR_NO=CurPage.getParameter("DISTRIBUTOR_NO"); ASObjectModel doTemp = new ASObjectModel(sTempletNo); //doTemp.setColTips("", "测试"); + doTemp.setHtmlEvent("CHANNELTYPE", "onchange", "changeTotalRequired"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "1";//只读模式 + if("ReadOnly".equals(RightType)){ + doTemp.setColInnerBtEvent("PROVINCES", ""); + doTemp.setColInnerBtEvent("DISTRIBUTOR_ADDRESSNAME", ""); + doTemp.setColInnerBtEvent("SUBSIDIARY_COMPANY", ""); + } ASDataObject ado = dwTemp.getDataObject(); ado.setHtmlEvent("LIMIT_APPROVAL_DATE", "onchange", "getenddate"); ado.setHtmlEvent("LIMIT_EFFECTIVE_DATE", "onchange", "getenddate"); @@ -46,11 +55,16 @@ sButtonPosition = "north"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryInfoForChange.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryInfoForChange.jsp new file mode 100644 index 000000000..dc09b4ab5 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryInfoForChange.jsp @@ -0,0 +1,127 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: + History Log: + */ + String id = CurPage.getParameter("id");//账号id + String sflowunid = CurPage.getParameter("flowunid"); + String flowunid=CurPage.getParameter("ObjectNo"); + String rightType=CurPage.getParameter("RightType"); + String distributorId=CurPage.getParameter("distributorId"); + if(id == null) id=""; + String sTempletNo = "distributor_subsidiary_temp_info"; //模板号 + // if(sTempletNo == null) sTempletNo = "LDistributorAccountInfo"; + BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + String DISTRIBUTOR_NO=flow!=null?flow.getAttribute("proj_id").getString():""; + + + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("FLOWUNID", flowunid); + //doTemp.setDefaultValue("DISTRIBUTOR_ID", DISTRIBUTOR_NO); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="2"; //--设置为Grid风格-- + if("ReadOnly".equals(rightType)){ + dwTemp.ReadOnly = "1"; //只读模式 + //doTemp.setColInnerBtEvent("provinceInfo", ""); + //doTemp.setColInnerBtEvent("district", ""); + } + + dwTemp.genHTMLObjectWindow(id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"ReadOnly".equals(rightType)?"false":"true","","Button","保存","保存所有修改","save()","","","","btn_icon_save"}, + {"true","","Button","返回","返回","returnList()","","","","btn_icon_return"} + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryListForChange.jsp b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryListForChange.jsp new file mode 100644 index 000000000..57fd0b121 --- /dev/null +++ b/WebContent/Tenwa/Lease/DistributorManage/DistributorChange/LDistributorSubsidiaryListForChange.jsp @@ -0,0 +1,99 @@ +<%@page import="com.tenwa.reckon.util.UUIDUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-10-11 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String sFlowName = CurPage.getParameter("applyType");//获取流程名称 + String PhaseNo = CurPage.getParameter("PhaseNo"); + String distributor_no=CurPage.getParameter("distributor_no"); + String distributorId=CurPage.getParameter("distributor_no"); + String ishistory=CurPage.getParameter("IsHistory"); + String RightType=CurPage.getParameter("RightType"); + String disno=""; + List nolist=JBOFactory.getBizObjectManager("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT").createQuery("select di.distributor_no from O ,jbo.app.tenwa.customer.DISTRIBUTOR_INFO di where di.id=O.proj_id and flow_unid=:flowunid") + .setParameter("flowunid",sFlowUnid).getResultList(false); + if(nolist.size()>0){ + disno=nolist.get(0).getAttribute("distributor_no").getString(); + } + if(sFlowUnid == null) sFlowUnid=""; + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + if(sTempletNo == null) sTempletNo = "distributor_tempForChange_list"; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sTempletNo = "LDistributorAccountListS"; + sFlowUnid=disno; + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + //dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + String temp = "true"; + if("0020".equals(PhaseNo)){ + temp="false"; + }; + String sButtons[][] =null; + if("DealerDepositReturnApply".equals(sFlowName)||"DealerDepositChargeApply".equals(sFlowName)){ + sButtons=new String[][] { + /* {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, */ + }; + }else{ + sButtons=new String[][] { + {temp,"All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {temp,"","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {temp,"","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, + //{"true","All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + {temp,"All","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; + + } + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyInfo.jsp b/WebContent/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyInfo.jsp index 61d90793e..29ba6f0c4 100644 --- a/WebContent/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyInfo.jsp +++ b/WebContent/Tenwa/Lease/FamilyVisit/fieldSurvey/FieldSurveyInfo.jsp @@ -5,7 +5,10 @@ Content: 示例详情页面 History Log: */ - + String inputuserid = CurUser.getUserID(); + String inputusername = CurUser.getUserName(); + String inputorgid = CurOrg.getOrgID(); + String inputorgname = CurOrg.getOrgName(); String sTempletNo = "LB_CUSTOMER_SURVEY_RECORD_INFO";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setColTips("", ""); @@ -23,7 +26,74 @@ }; sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyChangeInfo.jsp b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyChangeInfo.jsp new file mode 100644 index 000000000..d174fc211 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyChangeInfo.jsp @@ -0,0 +1,156 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人现扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String FlowUnid = CurPage.getParameter("FlowUnid"); + String rightType = CurPage.getParameter("RightType"); + if(FlowUnid == null)FlowUnid = ""; + String ContractId = CurPage.getParameter("ContractId"); + String IsHistory = CurPage.getParameter("IsHistory"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + if(ContractId == null) ContractId = ""; + String sTempletNo ="LBDeductCardChangeCompanyTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly="1"; + dwTemp.genHTMLObjectWindow(FlowUnid); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"false","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + }; + sButtonPosition = "south"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyInfo.jsp b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyInfo.jsp new file mode 100644 index 000000000..af6b7d384 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/company/AccountChangeCompanyInfo.jsp @@ -0,0 +1,106 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人原扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String FlowUnid = CurPage.getParameter("FlowUnid"); + if(FlowUnid == null)FlowUnid = ""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + String applyId = CurPage.getParameter("ChannelApplyId"); + if(applyId==null)applyId=""; + String RightType = CurPage.getParameter("RightType"); + if(RightType!=null)RightType = ""; + String sTempletNo ="LBDeductCardOldTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setVisible("IS_CONSIGN_REPAY", true); + doTemp.setVisible("CONSIGN_REPAY_CERT", true); + doTemp.setVisible("CONSIGN_REPAY_PHONE", true); + doTemp.setVisible("DEBIT_BANK", true); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(FlowUnid); + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("change", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("contractList", "", CurPage.getObjectWindowOutput()); + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"ReadOnly".equals(RightType)?"false":"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + }; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonChangeInfo.jsp b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonChangeInfo.jsp new file mode 100644 index 000000000..aa21b7126 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonChangeInfo.jsp @@ -0,0 +1,173 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人现扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String FlowUnid = CurPage.getParameter("FlowUnid"); + String rightType = CurPage.getParameter("RightType"); + if(FlowUnid == null)FlowUnid = ""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + String applyId = CurPage.getParameter("ChannelApplyId"); + if(applyId == null) applyId = ""; + String sTempletNo ="LBDeductCardChangeTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(FlowUnid); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + /* {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, */ + }; + sButtonPosition = "south"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonInfo.jsp b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonInfo.jsp new file mode 100644 index 000000000..011e41f45 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/AccountChangePersonInfo.jsp @@ -0,0 +1,103 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "自然人原扣款信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> + +<% + String FlowUnid = CurPage.getParameter("FlowUnid"); + if(FlowUnid == null)FlowUnid = ""; + String ContractId = CurPage.getParameter("ContractId"); + if(ContractId == null) ContractId = ""; + String applyId = CurPage.getParameter("ChannelApplyId"); + if(applyId==null)applyId=""; + String RightType = CurPage.getParameter("RightType"); + if(RightType!=null)RightType = ""; + String sTempletNo ="LBDeductCardOldTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(FlowUnid); + String compClientID = request.getParameter("CompClientID"); + dwTemp.replaceColumn("change", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("contractList", "", CurPage.getObjectWindowOutput()); + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"} + }; + sButtonPosition = "north"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/DeductCardDocList.jsp b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/DeductCardDocList.jsp new file mode 100644 index 000000000..bd7eed0e5 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/AccountInfoChange/person/DeductCardDocList.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-28 + Content: + History Log: + */ + String applyId = CurPage.getParameter("applyId"); + if(applyId==null) applyId = ""; + String customerType = CurPage.getParameter("customerType"); + if(customerType==null) customerType = ""; + ASObjectModel doTemp = new ASObjectModel("DeductCardDocList"); + //根据中间表id查询 + doTemp.appendJboWhere("flow_unid='"+applyId+"'"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/AdjustInterest/LCAdjustContractTemp.jsp b/WebContent/Tenwa/Lease/Flow/AdjustInterest/LCAdjustContractTemp.jsp index 018bf86aa..5b95bf5ea 100644 --- a/WebContent/Tenwa/Lease/Flow/AdjustInterest/LCAdjustContractTemp.jsp +++ b/WebContent/Tenwa/Lease/Flow/AdjustInterest/LCAdjustContractTemp.jsp @@ -6,6 +6,14 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String phaseNo = CurPage.getParameter("PhaseNo");//获取当前节点 + String button = "false"; + String repeal = "true"; + if("0030".equals(phaseNo)){ + button = "true"; + repeal = "false"; + } + String projid=""; String contractid=""; BizObject flow=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT","flow_unid='"+sFlowUnid+"'").getSingleResult(false); @@ -31,8 +39,9 @@ } //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { - {"true","","Button","撤销","撤销","runCancel()","","","","btn_icon_delete"}, - {"true","","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, + {repeal,"","Button","撤销","撤销","runCancel()","","","","btn_icon_delete"}, + {button,"","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, + {button,"All","Button","公司盖章","公司盖章","stamp()","","","",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AdjustInterest/TodoAdjustInterestList.jsp b/WebContent/Tenwa/Lease/Flow/AdjustInterest/TodoAdjustInterestList.jsp index 2d3b33e3b..4c16361a7 100644 --- a/WebContent/Tenwa/Lease/Flow/AdjustInterest/TodoAdjustInterestList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AdjustInterest/TodoAdjustInterestList.jsp @@ -7,16 +7,31 @@ */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String applytype = CurPage.getParameter("ApplyType"); String ishistory=CurPage.getParameter("IsHistory"); String RightType=CurPage.getParameter("RightType"); ASObjectModel doTemp = new ASObjectModel("TodoAdjustInterestList"); - + //判断业务类型 + String businessType=""; + String orgId=CurUser.getOrgID().substring(0,7); + if("AdjustInterestCarApply".equals(applytype)){ + businessType="1"; + }else{ + if("8009010".equals(orgId)){ + businessType="2"; + }else if("8009011".equals(orgId)){ + businessType="3"; + }else{ + businessType="2,3"; + } + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.MultiSelect = true; dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(sFlowUnid+","+sFlowUnid); + dwTemp.genHTMLObjectWindow(businessType+","+sFlowUnid+","+sFlowUnid); if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ isShowButton=false; } diff --git a/WebContent/Tenwa/Lease/Flow/AdjustRollBack/LCAdjustContractRollBack.jsp b/WebContent/Tenwa/Lease/Flow/AdjustRollBack/LCAdjustContractRollBack.jsp index d3bace029..9e65bbe1e 100644 --- a/WebContent/Tenwa/Lease/Flow/AdjustRollBack/LCAdjustContractRollBack.jsp +++ b/WebContent/Tenwa/Lease/Flow/AdjustRollBack/LCAdjustContractRollBack.jsp @@ -6,18 +6,34 @@ History Log: */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String applytype = CurPage.getParameter("ApplyType"); String ishistory=CurPage.getParameter("IsHistory"); String RightType=CurPage.getParameter("RightType"); ASObjectModel doTemp = new ASObjectModel("LCAdjustContractRoll"); if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory");//如果是历史则新显示历史数据 } + //判断业务类型 + String businessType=""; + String orgId=CurUser.getOrgID().substring(0,7); + if("AdjustRollBackApply".equals(applytype)){ + businessType="1"; + }else{ + if("8009010".equals(orgId)){ + businessType="2"; + }else if("8009011".equals(orgId)){ + businessType="3"; + }else{ + businessType="2,3"; + } + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.MultiSelect = true; dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(sFlowUnid); + dwTemp.genHTMLObjectWindow(sFlowUnid+","+businessType); if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ isShowButton=false; } diff --git a/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitApplyList.jsp b/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitApplyList.jsp index 74443cd94..a7b878026 100644 --- a/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitApplyList.jsp @@ -13,8 +13,9 @@ sReturn = sReturn.split("@"); var customerid=sReturn[0]; var customername=sReturn[1]; + var contract_id=sReturn[2]; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectName=客户"+customername+"租后巡视,FlowKey="+customername+",CustomerId="+customerid; + sParams =sParams+",ProjectName=客户"+customername+"租后巡视,FlowKey="+customername+",CustomerId="+customerid+",ContractId="+contract_id+",customername="+customername; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.afterleasing.afterleasingvisit.AfterLeasingVisitStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); diff --git a/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitContractList.jsp b/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitContractList.jsp index 7c76cf4d7..d7ab822de 100644 --- a/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitContractList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AfterLeasingPatrol/AfterLeasingVisit/AfterLeasingVisitContractList.jsp @@ -21,11 +21,11 @@ }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndApplyList.jsp b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndApplyList.jsp index fe8e45df4..29511a8a2 100644 --- a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndApplyList.jsp @@ -5,7 +5,24 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectAssetsDisposalForFee","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var flowno="<%=CurPage.getParameter("ApplyType")%>"; + var selname=""; + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + if("AssetsDisposalEndApply"==flowno){ + businessType="1"; + }else{ + if(orgId=="8009013"){ + businessType="3"; + }else if(orgId=="8009010"){ + businessType="2"; + }else{ + alert("当前用户不能发起申请!"); + return; + } + } + + AsDialog.OpenSelector("SelectAssetsDisposalForFee","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndInfo.jsp b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndInfo.jsp index 36f10989d..b85fc9c11 100644 --- a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalEnd/AssetsDisposalEndInfo.jsp @@ -16,6 +16,7 @@ if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 } + doTemp.setDefaultValue("FLOWUNID", sFlowUnid); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); CurPage.getCurComp().setAttribute("RightType", null); dwTemp.Style = "2";// diff --git a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalFeeApply/AssetsDisposalFeeApplyList.jsp b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalFeeApply/AssetsDisposalFeeApplyList.jsp index fe8e45df4..f884e6189 100644 --- a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalFeeApply/AssetsDisposalFeeApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalFeeApply/AssetsDisposalFeeApplyList.jsp @@ -5,7 +5,23 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectAssetsDisposalForFee","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var flowno="<%=CurPage.getParameter("ApplyType")%>"; + var selname=""; + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + if("AssetsDisposalFeeApply"==flowno){ + businessType="1"; + }else{ + if(orgId=="8009013"){ + businessType="3"; + }else if(orgId=="8009010"){ + businessType="2"; + }else{ + alert("当前用户不能发起申请!"); + return; + } + } + AsDialog.OpenSelector("SelectAssetsDisposalForFee","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalMaintenance/AssetsDisposalMaintenanceList.jsp b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalMaintenance/AssetsDisposalMaintenanceList.jsp index b067768d8..ce674882e 100644 --- a/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalMaintenance/AssetsDisposalMaintenanceList.jsp +++ b/WebContent/Tenwa/Lease/Flow/AssetsDisposal/AssetsDisposalMaintenance/AssetsDisposalMaintenanceList.jsp @@ -3,10 +3,10 @@ <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> <% ASObjectModel doTemp = new ASObjectModel("LBAssetsDisposalMaintenanceList"); - String sCondtion=DataRightManager.getRightCondition(CurUser,"lci", "contract"); - doTemp.appendJboWhere(sCondtion); - doTemp.setHtmlEvent("CONDITION_DEMO", "onmouseover", "showMemo"); - doTemp.setHtmlEvent("CONDITION_DEMO", "onmouseout", "hideMemo"); + //String sCondtion=DataRightManager.getRightCondition(CurUser,"lci", "contract"); + //doTemp.appendJboWhere(sCondtion); + //doTemp.setHtmlEvent("CONDITION_DEMO", "onmouseover", "showMemo"); + //doTemp.setHtmlEvent("CONDITION_DEMO", "onmouseout", "hideMemo"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/CarBidApplyList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/CarBidApplyList.jsp index cc8e486c7..f3c39206d 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/CarBidApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/CarBidApplyList.jsp @@ -12,12 +12,12 @@ function newApply() } sReturn = sReturn.split("@"); var framenumber=sReturn[0]; - var customerid=sReturn[1]; + var contractid=sReturn[1]; var contractnumber=sReturn[2]; var customername=sReturn[4]; var ProjectName=framenumber+"-"+customername; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectName="+ProjectName+",FlowKey="+contractnumber+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",ProjectName="+ProjectName+",ContractId="+contractid+",FlowKey="+contractnumber+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.carmanage.carevaluate.CarEvaluateStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidDetail.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidDetail.jsp index bb17996cf..c6c44e359 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidDetail.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidDetail.jsp @@ -4,7 +4,7 @@ Author: undefined 2017-09-11 Content: 示例详情页面 History Log: - */ + */ String sPrevUrl = CurPage.getParameter("PrevUrl"); String framenumber = CurPage.getParameter("FRAME_NUMBER"); String flowunid = CurPage.getParameter("FlowUnid"); @@ -12,12 +12,12 @@ if(RightType == null) RightType = ""; String ishistory=CurPage.getParameter("IsHistory"); if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidList.jsp"; - + String sTempletNo = "LcCarBidDetail";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setDefaultValue("FRAME_NUMBER", framenumber); doTemp.setDefaultValue("flowunid", flowunid); - doTemp.setDefaultValue("BID_STATUS", "N"); + //doTemp.setDefaultValue("BID_STATUS", "N"); if(null!=ishistory&&ishistory.equals("true") && "ReadOnly".equals(RightType)){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 } @@ -27,14 +27,17 @@ dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0,'returnList()')","","","",""}, + {"true","All","Button","保存","保存所有修改","save()","","","",""}, {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} }; sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidGroup.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidGroup.jsp index 043ccaa27..8ffe1f31a 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidGroup.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidGroup.jsp @@ -25,7 +25,7 @@ dwTemp.ReadOnly = "1";//只读模式 dwTemp.genHTMLObjectWindow(flowunid); String ss = dwTemp.getArgsValue(); - dwTemp.replaceColumn("InstituteEvaluation", "", CurPage.getObjectWindowOutput()); + //dwTemp.replaceColumn("InstituteEvaluation", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("bid_apply", "", CurPage.getObjectWindowOutput()); if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ isShowButton=false; diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidList.jsp index ec6b0b7f7..28b1d0d17 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarBid/LcCarBidList.jsp @@ -33,7 +33,7 @@ sButtons = new String[][]{ {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, }; } else{ sButtons = new String[][]{}; @@ -51,7 +51,7 @@ alert("参数不能为空!"); return ; } - AsControl.OpenView(sUrl,'SerialNo=' +sPara ,'_self',''); + AsControl.OpenView(sUrl,'SerialNo=' +sPara +'&FRAME_NUMBER='+"<%=framenumber%>" ,'_self',''); } function changeRecord(){ diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/CarDisposeApplyList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/CarDisposeApplyList.jsp index fc7cb4b1b..ef612a481 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/CarDisposeApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/CarDisposeApplyList.jsp @@ -5,7 +5,7 @@ function newApply() { var userid="<%=CurUser.getUserID()%>"; - AsDialog.OpenSelector("SelectCarBid","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectCarBid","","dialogWidth=" + parseInt(window.screen.width * 0.5) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LCCarBid.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LCCarBid.jsp new file mode 100644 index 000000000..b9d2c4f3e --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LCCarBid.jsp @@ -0,0 +1,39 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-12 + Content: + History Log: + */ + String framenumber = CurPage.getParameter("FRAME_NUMBER"); + ASObjectModel doTemp = new ASObjectModel("LCCarBid"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(framenumber); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeDetail.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeDetail.jsp index 83f7923cd..a99778ef3 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeDetail.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeDetail.jsp @@ -10,6 +10,7 @@ String ishistory=CurPage.getParameter("IsHistory"); String flowunid = CurPage.getParameter("FlowUnid"); String framenumber = Sqlca.getString("select FRAME_NUMBER from LC_CAR_DISPOSE_TEMP where flowunid ='"+flowunid+"'"); + //String contractnumber = Sqlca.getString("select contract_no from LC_CAR_DISPOSE_TEMP where flowunid ='"+flowunid+"'"); if(sPrevUrl == null) sPrevUrl = ""; String sTempletNo = "LcCarDisposeDetail";//--模板号-- @@ -22,6 +23,8 @@ //dwTemp.ReadOnly = "-2";//只读模式 dwTemp.genHTMLObjectWindow(flowunid); //dwTemp.replaceColumn("evaluation", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("evaluation", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeInfo.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeInfo.jsp new file mode 100644 index 000000000..f8bae1f32 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarDispose/LcCarDisposeInfo.jsp @@ -0,0 +1,33 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-04 + Content: 示例详情页面 + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + String sPrevUrl = CurPage.getParameter("PrevUrl"); +/* String sFlowUnid = CurPage.getParameter("FlowUnid"); + if(sFlowUnid == null) sFlowUnid = ""; + alert(sFlowUnid); */ + if(sPrevUrl == null) sPrevUrl = ""; + String sTempletNo = "LcCarDisposeInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(contractId); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/CarEvaluateApplyList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/CarEvaluateApplyList.jsp index cad96e054..e8f95597f 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/CarEvaluateApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/CarEvaluateApplyList.jsp @@ -12,12 +12,17 @@ function newApply() } sReturn = sReturn.split("@"); var framenumber=sReturn[0]; - var contractnumber=sReturn[2]; - var customerid=sReturn[1]; + var contractid=sReturn[1]; + var contractnumber=sReturn[2]; + var customerid=sReturn[3]; var customername=sReturn[4]; + var plate_number=sReturn[6]; + var platetime=sReturn[7]; + var park_place=sReturn[8]; + var having_key=sReturn[9]; var ProjectName=framenumber+"-"+customername; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectName="+ProjectName+",FlowKey="+contractnumber+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",ProjectName="+ProjectName+",ContractId="+contractid+",customerid="+customerid+",customername="+customername+",plate_number="+plate_number+",platetime="+platetime+",park_place="+park_place+",having_key="+having_key+",FlowKey="+contractnumber+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.carmanage.carevaluate.CarEvaluateStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/LcCarEvaluateDetail.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/LcCarEvaluateDetail.jsp index 91622bf99..960d70bf2 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/LcCarEvaluateDetail.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarEvaluate/LcCarEvaluateDetail.jsp @@ -9,6 +9,18 @@ String sPrevUrl = CurPage.getParameter("PrevUrl"); String ishistory=CurPage.getParameter("IsHistory"); String RightType= CurPage.getParameter("RightType"); + + String contractId= CurPage.getParameter("ContractId"); + String contractNumber= CurPage.getParameter("FlowKey"); + String customerid = CurPage.getParameter("customerid"); + String customername = CurPage.getParameter("customername"); + String platetime = CurPage.getParameter("platetime"); + String parkplace = CurPage.getParameter("park_place"); + + String havingkey = CurPage.getParameter("having_key"); + + System.out.print(contractId+"==="+contractNumber+"==="+customerid+"===="+customername); + if(RightType == null) RightType = ""; if(sPrevUrl == null) sPrevUrl = ""; String framenumber = Sqlca.getString("select proj_name from FLOW_BUSSINESS_OBJECT where flow_unid ='"+flowunid+"'"); @@ -25,17 +37,31 @@ dwTemp.genHTMLObjectWindow(flowunid); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","保存","保存所有修改","save()","","","",""} }; + sButtonPosition = "north"; CurPage.getCurComp().setAttribute("RightType", RightType); %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimApplyList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimApplyList.jsp index bc2f94973..f107fdfaa 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimApplyList.jsp @@ -5,7 +5,7 @@ function newApply() { var userid="<%=CurUser.getUserID()%>"; - AsDialog.OpenSelector("SelectCarReclaim","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.5) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectCarReclaim","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.9) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -18,11 +18,13 @@ function newApply() var customerid=sReturn[3]; var customername=sReturn[4]; var license_plate_number=sReturn[5]; + var over_list=sReturn[8]; + var over_days=sReturn[9]; + var over_money=sReturn[10]; var ProjectName=frame_number+"-"+customername; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",contract_id="+contractid+",FlowKey="+contractnumber+",ProjectName="+ProjectName+",customerid="+customerid+",customername="+customername+",frame_number="+frame_number+",license_plate_number="+license_plate_number+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",ContractId="+contractid+",FlowKey="+contractnumber+",ProjectName="+ProjectName+",customerid="+customerid+",customername="+customername+",frame_number="+frame_number+",license_plate_number="+license_plate_number+",over_list="+over_list+",over_days="+over_days+",over_money="+over_money+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.carmanage.CarReclaimApplyStartAction","initFLow",sParams); - if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); if(sReturnInfos[0]=="success") diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimInfoTemp.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimInfoTemp.jsp index 9df9c1925..4a22bf979 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimInfoTemp.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarReclaim/CarReclaimInfoTemp.jsp @@ -38,6 +38,9 @@ setItemValue(0,0,"LESSEE",sReturn[3]); setItemValue(0,0,"LESSEE_NAME",sReturn[4]); setItemValue(0,0,"LICENSE_PLATE_NUMBER",sReturn[5]); + setItemValue(0,0,"over_list",sReturn[6]); + setItemValue(0,0,"over_days",sReturn[7]); + setItemValue(0,0,"over_money",sReturn[8]); } function save(){ diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarReclaimReportList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarReclaimReportList.jsp index 9864bc0e5..87d89b2e9 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarReclaimReportList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarReclaimReportList.jsp @@ -10,7 +10,7 @@ //String ishistory=CurPage.getParameter("IsHistory"); String RightType= CurPage.getParameter("RightType"); ASObjectModel doTemp = new ASObjectModel("CarReclaimRepertList"); - doTemp.setVisible("action", true); + //doTemp.setVisible("action", true); //doTemp.setVisible("filelist", false); //doTemp.appendJboWhere(" and O.uuid=:uuid"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); @@ -39,13 +39,13 @@ function afterSearch(){ var html=""; html+=''+getObj(0,i,"filename").innerHTML+''; getObj(0,i,"filename").innerHTML=html; - if(fileid.length>0){ + <%-- if(fileid.length>0){ if("<%=RightType%>"=="ReadOnly"){ getObj(0,i,"action").innerHTML='     '; }else{ getObj(0,i,"action").innerHTML='        '; } - } + } --%> } } //在线编辑 diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterInfo.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterInfo.jsp index fb337fd8b..01798fdf4 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterInfo.jsp @@ -25,7 +25,9 @@ String sButtons[][] = { {"true","All","Button","保存","保存所有修改","save()","","","",""}, - {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + /* {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; */ + {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} }; sButtonPosition = "north"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> @@ -68,8 +70,11 @@ function selectCar(){ reloadSelf(); },"上传报告"); } */ - function returnList(){ + <%-- function returnList(){ AsControl.OpenView("<%=sPrevUrl%>", "","_self",""); + } --%> + function returnList(){ + AsControl.OpenView("/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterList.jsp", "","_self",""); } diff --git a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterList.jsp b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterList.jsp index 21d1d06f3..02f2fc9ad 100644 --- a/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CarManage/CarRegister/CarRegisterList.jsp @@ -16,7 +16,7 @@ String sButtons[][] = { {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/ChargebackVoucherTotal.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ChargebackVoucherTotal.jsp new file mode 100644 index 000000000..d9bf688f0 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ChargebackVoucherTotal.jsp @@ -0,0 +1,163 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<% + ASObjectModel doTemp = new ASObjectModel("ChargebackVoucherTotal"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + //dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "0"; //只读模式 + // dwTemp.ShowSummary = "1"; //显示小计 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","保存","保存批次号","save()","","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordDetail.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordDetail.jsp new file mode 100644 index 000000000..6d01e0a65 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordDetail.jsp @@ -0,0 +1,45 @@ +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-10-30 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordList.jsp"; + + String sTempletNo = "LbClearFileRecordDetail";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + String currtToday = DateAssistant.getToday(); + //设置默认值 + doTemp.setDefaultValue("INPUTUSERID", CurUser.getUserID()); + doTemp.setDefaultValue("INPUTORGID", CurUser.getOrgID()); + doTemp.setDefaultValue("INPUTTIME", currtToday); + //doTemp.setDefaultValue("CLEAR_DATE", "2017/09/20"); + doTemp.setDefaultValue("CLEAR_DATE", currtToday); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","确认","保存所有修改","save()","","","btn_icon_save",""}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordList.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordList.jsp new file mode 100644 index 000000000..c4401ecd8 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/ClearRecord/LbClearFileRecordList.jsp @@ -0,0 +1,56 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-10-30 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LbClearFileRecordList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcAuditRentFileList.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcAuditRentFileList.jsp new file mode 100644 index 000000000..cf6bdffd7 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcAuditRentFileList.jsp @@ -0,0 +1,79 @@ +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("ViLcFirstAuditRentFileList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","审核","确认审核通过","if(confirm('确定要提交审核吗?')){auditRecord()}","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyInfo.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyInfo.jsp new file mode 100644 index 000000000..5b1e0a697 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyInfo.jsp @@ -0,0 +1,36 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-11 + Content: 示例详情页面 + History Log: + */ + String customerid = CurPage.getParameter("CustomerId"); + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyList.jsp"; + + String sTempletNo = "CustomerBankVertifyInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(customerid); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","saveMobile()","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyList.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyList.jsp new file mode 100644 index 000000000..91997eddb --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcCustomerBankVertifyList.jsp @@ -0,0 +1,91 @@ +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("CustomerBankVertifyList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","验证银行卡信息","验证银行卡信息","verifyBankInfo()","","","","btn_icon_add",""} + //{"true","All","Button","编辑","编辑","viewAndEdit()","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcDistributorMarginCompensation.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcDistributorMarginCompensation.jsp new file mode 100644 index 000000000..213675788 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcDistributorMarginCompensation.jsp @@ -0,0 +1,253 @@ +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanListRepay"); +// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'"); + //默认预查询 + //只有计划日期未收款的都可以收款 + doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款')"); +// doTemp.setJboWhereWhenNoFilter(" and O.COLLECT_STATUS in ('未收款','部分收款') "); +// doTemp.setJboWhere("O.PLAN_DATE <= '"+plan_date+"'"); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "0"; //只读模式 + dwTemp.ShowSummary = "1"; //显示小计 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + // {"true","All","Button","批量扣款及核销","批量扣款","batchCollect()","","","","btn_icon_add",""}, + //{"true","All","Button","实时扣款","实时扣款","timelyCollect()","","","","btn_icon_add",""}, + {"true","All","Button","经销商代偿","经销商代偿","afterCollectManage()","","","","btn_icon_add",""}, + // {"true","All","Button","手动刷新","手动刷新","queryBatchCollect()","","","","btn_icon_add",""}, + //{"true","","Button","退回","审核未通过,退回初审","i f(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcFirstAuditRentPlanList.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcFirstAuditRentPlanList.jsp index 6c17e713a..3d5b7e3e6 100644 --- a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcFirstAuditRentPlanList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcFirstAuditRentPlanList.jsp @@ -1,71 +1,71 @@ -<%@page import="com.tenwa.comm.util.date.DateAssistant"%> -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% - /* - Author: undefined 2017-09-20 - Content: - History Log: - */ - String plan_date = DateAssistant.getToday(); - ASObjectModel doTemp = new ASObjectModel("ViLcFirstAuditRentPlanList"); - //默认预查询 - doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE = '"+plan_date+"' "); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- - dwTemp.MultiSelect = true; //多选 - dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(""); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","审核","确认审核通过","if(confirm('确定要提交审核吗?')){auditRecord()}","","","","btn_icon_add",""}, - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("ViLcFirstAuditRentPlanList"); + //默认预查询 + doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE >= '"+plan_date+"' "); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","审核","确认审核通过","if(confirm('确定要提交审核吗?')){auditRecord()}","","","","btn_icon_add",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList.jsp index 58de2e2e1..dc8fc6765 100644 --- a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList.jsp +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList.jsp @@ -1,126 +1,203 @@ -<%@page import="com.tenwa.comm.util.date.DateAssistant"%> -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% - /* - Author: undefined 2017-09-20 - Content: - History Log: - */ - - String plan_date = DateAssistant.getToday(); - ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanList"); - doTemp.setJboWhere(" O.AUDIT_STATE = 'Y'"); - //默认预查询 - doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE = '"+plan_date+"' and O.COLLECT_STATUS in ('1','2','4','5') "); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- - dwTemp.MultiSelect = true; //多选 - dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.setPageSize(10); - dwTemp.ShowSummary = "1"; //显示小计 - dwTemp.genHTMLObjectWindow(""); - - //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] = { - {"true","All","Button","扣款","扣款","batchCollect()","","","","btn_icon_add",""}, - {"true","","Button","退回","审核未通过,退回初审","if(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""}, - }; -%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("ViLcReviewAuditRentPlanList"); +// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'"); + //默认预查询 + //只有计划日期未收款的都可以收款 + doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款','代偿')"); +// doTemp.setJboWhereWhenNoFilter(" and O.COLLECT_STATUS in ('未收款','部分收款') "); +// doTemp.setJboWhere("O.PLAN_DATE <= '"+plan_date+"'"); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary = "1"; //显示小计 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","批量扣款及核销","批量扣款","batchCollect()","","","","btn_icon_add",""}, + //{"true","All","Button","实时扣款","实时扣款","timelyCollect()","","","","btn_icon_add",""}, + {"true","All","Button","手工核销","手工扣款","afterCollectManage()","","","","btn_icon_add",""}, + {"true","All","Button","手动刷新","手动刷新","queryBatchCollect()","","","","btn_icon_add",""}, + //{"true","","Button","退回","审核未通过,退回初审","i f(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList2.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList2.jsp new file mode 100644 index 000000000..ca19061ee --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/LcReviewAuditRentPlanList2.jsp @@ -0,0 +1,233 @@ +<%@page import="com.tenwa.comm.util.date.DateAssistant"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-20 + Content: + History Log: + */ + + String plan_date = DateAssistant.getToday(); + ASObjectModel doTemp = new ASObjectModel("VI_PAYMENTCERTIFICATE"); +// doTemp.setJboWhere(" O.AUDIT_STATE = 'N'"); + //默认预查询 + //只有计划日期未收款的都可以收款 + //doTemp.setJboWhereWhenNoFilter(" and O.PLAN_DATE <= '"+plan_date+"' and O.COLLECT_STATUS in ('未收款','部分收款')"); +// doTemp.setJboWhereWhenNoFilter(" and O.COLLECT_STATUS in ('未收款','部分收款') "); +// doTemp.setJboWhere("O.PLAN_DATE <= '"+plan_date+"'"); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary = "1"; //显示小计 + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","批量扣款及核销","批量扣款","batchCollect()","","","","btn_icon_add",""}, + //{"true","All","Button","实时扣款","实时扣款","timelyCollect()","","","","btn_icon_add",""}, + //{"true","All","Button","手工核销","手工扣款","afterCollectManage()","","","","btn_icon_add",""}, + //{"true","All","Button","手动刷新","手动刷新","queryBatchCollect()","","","","btn_icon_add",""}, + {"true","All","Button","生成租金凭证","生成租金凭证","Manage()","","","","",""}, + //{"true","","Button","退回","审核未通过,退回初审","i f(confirm('确定要退回吗?')){viewAndEdit()}","","","","btn_icon_detail",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/VERIFICATIONSPARE.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VERIFICATIONSPARE.jsp new file mode 100644 index 000000000..8f2c701e6 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VERIFICATIONSPARE.jsp @@ -0,0 +1,160 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + // 银行账号 + String OWN_NUMBER = CurPage.getParameter("OWN_NUMBER"); + // 银行科目 + String ACC_TITLE = CurPage.getParameter("SUBJECTS_CODE"); + // 扣款成功数量 + String CHARGEBACK_QTY_S = CurPage.getParameter("CHARGEBACK_QTY_S"); + // 扣款成功日期 + String HIRE_DATE = CurPage.getParameter("HIRE_DATE"); + // 扣款成功金额 + String CHARGEBACK_MONEY_S = CurPage.getParameter("CHARGEBACK_MONEY_S"); + // 扣款批次号 + String SPARE_BATCH_NO = CurPage.getParameter("SPARE_BATCH_NO"); + // 判断是否首次核销 + String type = CurPage.getParameter("type"); + // 用于判断页面是否展示核销按钮 + String flag = "true"; + + if(sPrevUrl == null) sPrevUrl = ""; + String sTempletNo = "VERIFICATIONSPARE";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + + // 如过是待核销数据, 将变更记录取消保存 + if("new".equals(type)){ + doTemp.setVisible("UPDATEUSERID",false); + doTemp.setVisible("UPDATETIME",false); + } + // 变更手续费费率触发 + doTemp.setHtmlEvent("SEREVICE_CHARGE_RATE", "onchange", "changeRate"); + // 变更银行到账金额触发 + doTemp.setHtmlEvent("ACHIEVED_MONEY", "onchange", "changeAMoney"); + // 变更手续费金额触发 + doTemp.setHtmlEvent("SEREVICE_CHARGE", "onchange", "changeSMoney"); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + + // 已经核销的, 设置页面只读, 并且隐藏核销按钮 + if(!"new".equals(type)){ + dwTemp.ReadOnly = "1"; + flag = "false"; + } + dwTemp.genHTMLObjectWindow(SPARE_BATCH_NO); + String sButtons[][] = { + {flag,"","Button","核销","保存所有修改","save()","","","",""}, + }; + sButtonPosition = "south"; +%> +<%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHER.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHER.jsp new file mode 100644 index 000000000..f8b85c38b --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHER.jsp @@ -0,0 +1,81 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-12-18 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("VI_SNAP_JOINT_VOUCHER"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary = "1"; //显示小计 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","生成租金凭证","生成租金凭证","Manage()","","","","",""}, + {"true","All","Button","修改记账日期","修改记账日期","viewAndEdit()","","","","",""}, + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHERInfo.jsp b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHERInfo.jsp new file mode 100644 index 000000000..644e1c6f4 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/CollectionAudit/VI_SNAP_JOINT_VOUCHERInfo.jsp @@ -0,0 +1,130 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + <% + /* + Author:guosl 2017-05-05 + Tester: + Content: 项目基本信息-租赁物件列表页面 + Input Param: + Output param: + History Log: + */ + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "记账日期"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> +<% + String income_IDs= CurPage.getParameter("income_IDs");//ID + String sTempletNo="VOUCHERINFO"; + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +%> + +<% + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","All","Button","确定","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} + }; + sButtonPosition = "north"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.jpg b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.jpg new file mode 100644 index 000000000..b0e5c94d4 Binary files /dev/null and b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.jpg differ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.png b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.png new file mode 100644 index 000000000..d8ff3cfd2 Binary files /dev/null and b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image.png differ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbank.jsp b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbank.jsp new file mode 100644 index 000000000..d97d24a0d --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbank.jsp @@ -0,0 +1,179 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@page import="java.util.Map.Entry"%> +<%@page import="com.alibaba.fastjson.JSONArray"%> +<%@page import="com.alibaba.fastjson.JSON"%> +<%@page import="com.alibaba.fastjson.JSONObject"%> +<%@page import="com.tenwa.httpclient.controller.BigDataController"%> +<%@page import="java.util.Date"%> +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/IncludeBegin.jsp"%><% + String flowunid = CurPage.getParameter("ObjectNo"); + String projectId = CurPage.getParameter("ProjectId");//流程编号 + String projectNo = CurPage.getParameter("ProjectNo"); + String ReadyApprove = CurPage.getParameter("ReadyApprove"); + String fullcardNo = CurPage.getParameter("fullcardNo"); + String fullName = CurPage.getParameter("fullName"); + String fullcertId = CurPage.getParameter("fullcertId"); + String applyId = ""; + String getType = CurPage.getParameter("GetType"); + String type = ""; + String count = ""; + String reasonDesc = ""; + String ifY = "N"; + BigDataController bdc = new BigDataController(); + boolean flag = true; + + /* if("GET".equals(getType)) { + JBOTransaction tx = JBOFactory.createJBOTransaction(); + applyId = SerialNumberUtil.getPengyuanNumber(tx); + tx.commit(); + type = "SAVE"; + } else { + String result = bdc.getDataApplyId(CurPage, "ebank_af", Sqlca); + if("false".equals(result)) { + JBOTransaction tx = JBOFactory.createJBOTransaction(); + applyId = SerialNumberUtil.getPengyuanNumber(tx); + tx.commit(); + type = "SAVE"; + } else { + String[] res = result.split("@"); + applyId = res[1]; + count = res[2]; + type = "GET"; + } + } */ + if("GET".equals(getType)){ + String result = bdc.getDataApplyId(CurPage, "ebank_af", Sqlca); + if("false".equals(result)) { + %> + + + <% + return ; + }else{ + String[] res = result.split("@"); + applyId = res[1]; + count = res[2]; + type = "GET"; + } + } + if("SAVE".equals(getType)){ + JBOTransaction tx = JBOFactory.createJBOTransaction(); + applyId = SerialNumberUtil.getPengyuanNumber(tx); + tx.commit(); + type = "SAVE"; + } + Map params = new HashMap(); //初始化参数 + params.put("queryType","25136"); + params.put("name",fullName);//被查询人姓名 + params.put("documentNo",fullcertId);//被查询人证件号码 + params.put("cardNos",fullcardNo);//银行卡号 + params.put("queryReasonID","101"); + params.put("subreportIDs","14501,14518"); + params.put("refID",""); + /* String resultals =bdc.getCustomerInfoPerson(flowunid, Sqlca); + if(!"false".equals(resultals)){ + String[] sReturn = resultals.split("@"); + params.put("queryType","25136"); + params.put("name",sReturn[1]);//被查询人姓名 + params.put("documentNo",sReturn[2]);//被查询人证件号码 + params.put("cardNos",fullcardNo);//银行卡号 + params.put("queryReasonID","101"); + params.put("subreportIDs","14501,14518"); + params.put("refID",""); + } */ + + FileInputStream fr = null; + BufferedReader br = null; + try { + String htmlURL = bdc.getAndSavePengyuanData(params, "ebank_af", Sqlca, type, applyId, CurPage); + File file = new File(htmlURL); + fr = new FileInputStream(file); + br = new BufferedReader(new InputStreamReader(fr, "UTF-8")); + String str; + while((str = br.readLine()) != null) { + String html = str; + if(html.indexOf(".png") != -1 || html.indexOf(".jpg") != -1) { + html = html.replaceAll("image/image_\\d+[.]", "Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image."); + } + if(html.indexOf("width=\"95%\"") != -1) { + html = html.replaceAll("width=\"95%\"", ""); + } + if(html.indexOf("height=\"70\"") != -1) { + html = html.replaceAll("height=\"70\"", ""); + } + if(html.indexOf("width=\"103\"") != -1) { + html = html.replaceAll("width=\"103\"", ""); + } + if(html.indexOf("个人信息报告") != -1) { + // html = html.replaceAll("个人信息报告", "  拉取鹏元数据 个人信用报告"); + html = html.replaceAll("个人信息报告", "  返回 个人信息报告"); + } + if(html.indexOf("") != -1) { + html = html.replaceAll("", ""); + } + if(html.indexOf("") != -1) { + html = html.replaceAll("
", "
"); + } + %> + <%=html%> + <%} + System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------"); + System.out.println(""); + System.out.println(""); + System.out.println("------------------"+StringFunction.getTodayNow()+"----------------------"); + System.out.println(""); + System.out.println(""); + System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------"); + + //查询获取数据次数 + if("SAVE".equals(type)) { + String result = bdc.getDataApplyId(CurPage, "ebank_af", Sqlca); + if("false".equals(result)) { + count = "0"; + } else { + count = result.split("@")[2]; + } + } + } catch(Exception e) { + e.printStackTrace(); + flag = false; + reasonDesc = e.getMessage(); + Sqlca.rollback(); + %> + + + <% + } finally { + if(br != null) br.close(); + if(fr != null) fr.close(); + } +%> + +<%@include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbankList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbankList.jsp new file mode 100644 index 000000000..ba10899ac --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuanEbankList.jsp @@ -0,0 +1,55 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-06-14 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String ProjectId = CurPage.getParameter("ProjectId");//流程编号 + String flag = "true"; + /* String flowunid = CurPage.getParameter("ObjectNo"); + String projectNo = CurPage.getParameter("ProjectNo"); + String ReadyApprove = CurPage.getParameter("ReadyApprove"); + String getType = CurPage.getParameter("GetType"); */ + + ASObjectModel doTemp = new ASObjectModel("VI_LB_IDENTITY_CHECK_EBANK"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","拉取鹏元数据","拉取鹏元数据","newRecord()","","","","btn_icon_add",""}, + {flag,"","Button","详情","查看详情","detail()","","","","btn_icon_detail",""}, +// {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, +// {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp new file mode 100644 index 000000000..5f44127f0 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandata.jsp @@ -0,0 +1,161 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@page import="java.util.Map.Entry"%> +<%@page import="com.alibaba.fastjson.JSONArray"%> +<%@page import="com.alibaba.fastjson.JSON"%> +<%@page import="com.alibaba.fastjson.JSONObject"%> +<%@page import="com.tenwa.httpclient.controller.BigDataController"%> +<%@page import="java.util.Date"%> +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@include file="/IncludeBegin.jsp"%><% + String flowunid = CurPage.getParameter("ObjectNo"); + String projectId = CurPage.getParameter("ProjectId");//流程编号 + String projectNo = CurPage.getParameter("ProjectNo"); + String ReadyApprove = CurPage.getParameter("ReadyApprove"); + String applyId = ""; + String getType = CurPage.getParameter("GetType"); + //String getType ="GET"; + String type = ""; + String count = ""; + String reasonDesc = ""; + BigDataController bdc = new BigDataController(); + boolean flag = true; + + if("GET".equals(getType)) { + /* JBOTransaction tx = JBOFactory.createJBOTransaction(); + applyId = SerialNumberUtil.getPengyuanNumber(tx); + tx.commit(); + type = "SAVE"; */ + String result = bdc.getDataApplyId(CurPage, "pengyuan_af", Sqlca); + if("false".equals(result)) { + %> + + + <% + return ; + } else { + String[] res = result.split("@"); + applyId = res[1]; + count = res[2]; + type = "GET"; + } + + } else { + String result = bdc.getDataApplyId(CurPage, "pengyuan_af", Sqlca); + if("false".equals(result)) { + JBOTransaction tx = JBOFactory.createJBOTransaction(); + applyId = SerialNumberUtil.getPengyuanNumber(tx); + tx.commit(); + type = "SAVE"; + } else { + String[] res = result.split("@"); + applyId = res[1]; + count = res[2]; + type = "GET"; + } + } + Map params = new HashMap(); //初始化参数 +// String resultals =bdc.getCustomerInfoPerson(flowunid, Sqlca); +// if(!"false".equals(resultals)){ +// String[] sReturn = resultals.split("@"); + params.put("queryType","25212"); + params.put("name",CurPage.getParameter("fullName")); + params.put("documentNo",CurPage.getParameter("fullcertId")); + params.put("phone",CurPage.getParameter("fullphone")); + params.put("queryReasonID","101"); + params.put("subreportIDs","96040"); + params.put("refID",""); +// } + FileInputStream fr = null; + BufferedReader br = null; + try { + String htmlURL = bdc.getAndSavePengyuanData(params, "pengyuan_af", Sqlca, type, applyId, CurPage); + File file = new File(htmlURL); + fr = new FileInputStream(file); + br = new BufferedReader(new InputStreamReader(fr, "UTF-8")); + String str; + while((str = br.readLine()) != null) { + String html = str; + if(html.indexOf(".png") != -1 || html.indexOf(".jpg") != -1) { + html = html.replaceAll("image/image_\\d+[.]", "Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/image/image."); + } + if(html.indexOf("width=\"95%\"") != -1) { + html = html.replaceAll("width=\"95%\"", ""); + } + if(html.indexOf("height=\"70\"") != -1) { + html = html.replaceAll("height=\"70\"", ""); + } + if(html.indexOf("width=\"103\"") != -1) { + html = html.replaceAll("width=\"103\"", ""); + } + if(html.indexOf("") != -1) { +// html = html.replaceAll("", ""); + html = html.replaceAll("", ""); + } + if(html.indexOf("") != -1) { + html = html.replaceAll("", ""); + } + if(html.indexOf("
个人反欺诈分析报告个人反欺诈分析报告  拉取鹏元数据 个人信用报告个人反欺诈分析报告  返回 个人信用报告
") != -1) { + html = html.replaceAll("
", "
"); + } + %> + <%=html%> + <%} + System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------"); + System.out.println(""); + System.out.println(""); + System.out.println("------------------"+StringFunction.getTodayNow()+"----------------------"); + System.out.println(""); + System.out.println(""); + System.out.println("------------------鹏元-个人反欺诈解析结束时间----------------------"); + + //查询获取数据次数 + if("SAVE".equals(type)) { + String result = bdc.getDataApplyId(CurPage, "pengyuan_af", Sqlca); + if("false".equals(result)) { + count = "0"; + } else { + count = result.split("@")[2]; + } + } + } catch(Exception e) { + e.printStackTrace(); + flag = false; + reasonDesc = e.getMessage(); + Sqlca.rollback(); + %> + + + <% + } finally { + if(br != null) br.close(); + if(fr != null) fr.close(); + } +%> + +<%@include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandataList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandataList.jsp new file mode 100644 index 000000000..28331c9c1 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/BigdataPengyuan/query_report/pengyuandataList.jsp @@ -0,0 +1,58 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-06-14 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String ProjectId = CurPage.getParameter("ProjectId");//流程编号 + String flag = "true"; + /* String flowunid = CurPage.getParameter("ObjectNo"); + String projectNo = CurPage.getParameter("ProjectNo"); + String ReadyApprove = CurPage.getParameter("ReadyApprove"); + String getType = CurPage.getParameter("GetType"); */ + + ASObjectModel doTemp = new ASObjectModel("VI_LB_IDENTITY_CHECK"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(sFlowUnid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","拉取鹏元数据","拉取鹏元数据","newRecord()","","","","btn_icon_add",""}, + {flag,"","Button","详情","查看详情","detail()","","","","btn_icon_detail",""}, +// {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, +// {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp new file mode 100644 index 000000000..a0684f0d6 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportInfo.jsp @@ -0,0 +1,27 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp"; + String sTempletNo = "li_Property_importS";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp new file mode 100644 index 000000000..8ddafc7d3 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileDownloadImportList.jsp @@ -0,0 +1,145 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "文件下载"; // 浏览器窗口标题 PG_TITLE +%> +<% + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("li_Property_import"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + {"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"}, + {"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""}, + {"true","All","Button","下载","下载资料","copy()","","","","btn_icon_generate"}, + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationInfo.jsp new file mode 100644 index 000000000..6fc5c8ce5 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationInfo.jsp @@ -0,0 +1,55 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationList.jsp"; + String sTempletNo = "file_listconfigurationS";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + doTemp.setHtmlEvent("ITEMNO", "onchange", "Fileinfowen"); + // doTemp.setHtmlEvent("ITEMNO", "onchange", "fileInfoMethods"); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationList.jsp new file mode 100644 index 000000000..9fc50901b --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/FileListConfigUrationList.jsp @@ -0,0 +1,110 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "文件清单配置"; // 浏览器窗口标题 PG_TITLE +%> +<% + ASObjectModel doTemp = new ASObjectModel("file_listconfiguration"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + //dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + //{"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"}, + //{"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""}, + //{"true","All","Button","下载","下载资料","copy()","","","","btn_icon_generate"}, + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelsinfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelsinfo.jsp new file mode 100644 index 000000000..9a6fb49d1 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelsinfo.jsp @@ -0,0 +1,27 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelslist.jsp"; + String sTempletNo = "li_cardata_commercialS";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelslist.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelslist.jsp new file mode 100644 index 000000000..55b742f79 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Introductionofrepairvehiclemodelslist.jsp @@ -0,0 +1,115 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "文件下载"; // 浏览器窗口标题 PG_TITLE + //商用车 +%> +<% + ASObjectModel doTemp = new ASObjectModel("li_cardata_commercial"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + //{"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + {"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"}, + {"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""}, + /* {"true","All","Button","生成租金计划","生成租金计划","createPlan()","","","","btn_icon_generate"}, + {"true","All","Button","测试拷贝","测试拷贝","copyPath()","","","","btn_icon_generate"}, */ + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentInfo.jsp new file mode 100644 index 000000000..41e4ceb13 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentInfo.jsp @@ -0,0 +1,125 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> + <% + /* + Author:guosl 2017-05-05 + Tester: + Content: 项目基本信息-租赁物件列表页面 + Input Param: + Output param: + History Log: + */ + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "资产转出登记信息"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> +<% + String ids= CurPage.getParameter("ids");//ID + String sTempletNo="AssetTransferRegistrationinfo"; + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +%> + +<% + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","All","Button","确定","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} + }; + sButtonPosition = "north"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentList.jsp new file mode 100644 index 000000000..dc49b5fd9 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LBEquipmentList.jsp @@ -0,0 +1,159 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List00;Describe=注释区;]~*/%> +<% +/* + Author:guosl 2017-05-05 + Tester: + Content: 项目基本信息-租赁物件列表页面 + Input Param: + Output param: + History Log: + */ +%> +<%/*~END~*/%> + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "资产转出登记"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> +<% + String sTempletNo="AssetTransferRegistration"; +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + +%> + +<% + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style = "1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% +String sButtons[][] =null; + + sButtons=new String[][]{ + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + {"true","","Button","修改","修改资产转出信息","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"}, + {"true","","Button","资产转出登记模版下载","资产转出登记模版下载","DiscountDownload()","","","","btn_icon_down",""}, + }; + +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> + <%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + + +
+ +
+ + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryList.jsp new file mode 100644 index 000000000..238b1ff0a --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryList.jsp @@ -0,0 +1,75 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "文件下载"; // 浏览器窗口标题 PG_TITLE +%> +<% + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("Automatic_Compensatory"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryinfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryinfo.jsp new file mode 100644 index 000000000..c0f025fb4 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryinfo.jsp @@ -0,0 +1,40 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/LDistributorAutomaticCompensatoryList.jsp"; + String sTempletNo = "Automatic_CompensatoryS";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarinfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarinfo.jsp new file mode 100644 index 000000000..14fb4218d --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarinfo.jsp @@ -0,0 +1,27 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarlist.jsp"; + String sTempletNo = "li_Passenger_carS";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarlist.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarlist.jsp new file mode 100644 index 000000000..05af70d3f --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/Passengercarlist.jsp @@ -0,0 +1,112 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "乘用车车型导入"; // 浏览器窗口标题 PG_TITLE + //乘用车 +%> +<% + ASObjectModel doTemp = new ASObjectModel("li_Passenger_car"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + //{"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + {"true","","Button","excel导入","excel导入","importExcel()","","","","btn_icon_import"}, + {"true","","Button","模版下载","模版下载","DiscountDownload()","","","","btn_icon_down",""}, + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp new file mode 100644 index 000000000..181d410d5 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioInfo.jsp @@ -0,0 +1,57 @@ +<%@page import="com.itextpdf.text.log.SysoCounter"%> +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + + String sTempletNo = "SplittingRatioInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "0";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + String sButtons[][] = { + {"true", "All", "Button", "保存","保存所有修改", "saveRecord()", "", "", "", ""}, + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioList.jsp new file mode 100644 index 000000000..79376a210 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBAssetTransferRegistration/splittingRatioList.jsp @@ -0,0 +1,75 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List01;Describe=定义页面属性;]~*/%> +<% + String PG_TITLE = "分润利率"; // 浏览器窗口标题 PG_TITLE +%> +<% + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("SplittingRatioList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(30); + dwTemp.genHTMLObjectWindow(""); +%> +<%/*~END~*/%> + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List04;Describe=定义按钮;]~*/%> +<% + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","All","Button","删除","删除","deleteRecord()","","","","btn_icon_delete",""}, + }; +%> +<%/*~END~*/%> +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=List05;Describe=主体页面;]~*/%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%/*~END~*/%> + + +
+ +
+ +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBChange/LBChangeInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBChange/LBChangeInfo.jsp index 6086a1d80..b9fc96b80 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBChange/LBChangeInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBChange/LBChangeInfo.jsp @@ -32,12 +32,17 @@ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String PhaseNo = CurPage.getParameter("PhaseNo"); if(sFlowUnid == null) sFlowUnid = ""; String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); String RightType = CurPage.getParameter("RightType");//选择模式 String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBChangeInfoTemp"; + //改动未提前结清使用 + if("ContractTraditionFlow".equals(CurPage.getParameter("FlowNo"))||"ContractTerminateFlow".equals(CurPage.getParameter("FlowNo"))){ + sTempletNo = "LBChangeInfoTempForTqJq"; + } %> <%/*~END~*/%> @@ -53,7 +58,7 @@ CurPage.getCurComp().setAttribute("RightType", null); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + if((null!=RightType&&RightType.equals("ReadOnly")&&(!PhaseNo.equals("0010")))||(null!=ishistory&&ishistory.equals("true"))){ dwTemp.ReadOnly = "-2";//只读模式 isShowButton=false; }else{ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractInfo.jsp index d8ae3580b..dbc2353f4 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractInfo.jsp @@ -26,6 +26,8 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info02;Describe=定义变量,获取参数;]~*/%> <% + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 String IsShowFormal = CurPage.getParameter("IsShowFormal");//流程编号 @@ -45,9 +47,10 @@ if(sFlowUnid == null) sFlowUnid=""; String productid = Sqlca.getString("select PRODUCT_ID from LB_CONTRACT_INFO_TEMP where flowunid = '"+sFlowUnid+"'"); String sTempletNo = "LBContractInfoTemp";//--模板号-- - if("004".equals(productid)){ + //传统,合同审批流程中的合同基本信息页签带错模板(如果产品编号正好为004是就会带错模板 ,所以注释了) + /* if("004".equals(productid)){ sTempletNo = "LBContractInfoTemp_Car"; - } + } */ if(("0030".equals(sPhaseNo)&&("ContractApprovalFlow".equals(FlowNo)||"ContractChangeFlow".equals(FlowNo)))){ sTempletNo="LBContractInfoAtMakeTemp"; } @@ -64,8 +67,9 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info03;Describe=定义数据对象;]~*/%> <% - String rentmethod=ProductParamUtil.getProductParameterValue(product_id,"PRD0313","starttimes");//起租方式 - String planinformation=ProductParamUtil.getProductParameterValue(product_id,"PRD0314","planinformation");//方案类型 + //String rentmethod=ProductParamUtil.getProductParameterValue(product_id,"PRD0313","starttimes");//起租方式 + String rentmethod="N";//起租方式 + String planinformation="SinglePlan";//方案类型 ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setHtmlEvent("LEAS_FORM","onchange","changeLeaseForm"); if(null!=ishistory&&ishistory.equals("true")){ @@ -77,6 +81,12 @@ doTemp.setColInnerBtEvent("PROJECT_ASSIST_NAME", ""); } doTemp.setDefaultValue("FlowUnid", sFlowUnid);//赋值流程编号 + if("TAssetsDisposalFeeFlow".equals(FlowNo)){ + doTemp.setReadOnly("CONTRACT_NUMBER", true); + } + if("currentProduct".equals(product_id)){ + doTemp.setReadOnly("LEAS_FORM", false); + } %> <%@ include file="/Tenwa/Lease/Flow/Comm/baseShowFormal.jspf"%> <% @@ -102,10 +112,16 @@ isAll=""; } String sButtons[][] =null; - sButtons= new String[][]{ + + + + // 原版的 + sButtons= new String[][]{ {"true",isAll,"Button","保存","保存所有修改","saveRecord()","","","",""} }; - + + + %> <%/*~END~*/%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp new file mode 100644 index 000000000..9443cb74b --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp @@ -0,0 +1,353 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-09-28 + Content: + History Log: + */ + String custtype = CurPage.getParameter("CustomerType"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + String projectId = CurPage.getParameter("ProjectId"); +// String signStatus = CurPage.getParameter("SignStatus"); + String contractNumber = CurPage.getParameter("ContractNumber"); + String productId = CurPage.getParameter("ProductId"); + String flowunid = CurPage.getParameter("FlowUnid"); + String action = CurPage.getParameter("action"); + ASObjectModel doTemp = new ASObjectModel("LBContractPrintList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(20); + String id=projectId; + dwTemp.genHTMLObjectWindow(id+","+flowunid); + String btnflag = "true"; + String btnflagcom = "false"; + String signs = "false"; + if("01".equals(custtype)){ + btnflagcom = "true"; + } + if("queryContract".equals(action)){ + btnflag = "false"; + btnflagcom = "false"; + } + //判断是不是流程的第二步 + if("0020".equals(PhaseNo)){ + btnflag = "false"; + signs = "true"; + } + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {btnflag,"","Button","发起电子签约","电子签章合同","signOnLine()","","","","btn_icon_sign",""}, + {btnflag,"","Button","查询签约结果","查询签约结果","getStatus()","","","","btn_icon_obtain",""}, + {btnflag,"","Button","重新发送短信","重新发送短信","sendMessageAgain()","","","","btn_icon_refresh",""}, + {signs,"","Button","公司盖章","公司盖章","sign()","","","","btn_icon_refresh",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/EarlyClearanceList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/EarlyClearanceList.jsp new file mode 100644 index 000000000..9b4c613fd --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/EarlyClearanceList.jsp @@ -0,0 +1,209 @@ +<%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_UNION_LESSEE"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "结清证明"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info02;Describe=定义变量,获取参数;]~*/%> +<% + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + if(sFlowUnid == null) sFlowUnid = ""; + BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowUnid); + String product_id=flow.getAttribute("productId").toString(); + String contractid=flow.getAttribute("contract_id").toString(); + String projectid=flow.getAttribute("proj_id").toString(); + String contract_number=flow.getAttribute("flow_key").toString();//业务合同号 + BizObjectManager bom=JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME); + BizObject cust=bom.createQuery("contract_id=:contract_id and is_main='Y'").setParameter("contract_id", contractid).getSingleResult(false); + String custname=cust.getAttribute("customer_name").toString();;//主承租人 +// String planinformation=ProductParamUtil.getProductParameterValue(product_id,"PRD0314","planinformation");//方案类型 + String money="";//留购价 +// if("SinglePlan".equals(planinformation)){ +// BizObjectManager bom1=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME); +// BizObject condition=bom1.createQuery("contract_id=:contract_id ").setParameter("contract_id", contractid).getSingleResult(false); +// money=condition.getAttribute("NOMINAL_PRICE").toString(); +// } + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType = CurPage.getParameter("RightType");//选择模式 + String sTempletNo = "LBContractTermainateTemp";//模板号 +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("accept_person", custname); + doTemp.setDefaultValue("contract_id", contractid); + doTemp.setDefaultValue("project_id", projectid); + doTemp.setDefaultValue("flowunid", sFlowUnid); + doTemp.setDefaultValue("RESERVE_PRICE", money); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + } + + CurPage.getCurComp().setAttribute("RightType", null); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "-2";//只读模式 + isShowButton=false; + }else{ + isShowButton=true; + } + String compClientID = request.getParameter("CompClientID"); + + dwTemp.genHTMLObjectWindow(sFlowUnid);//得到的参数 + CurPage.getCurComp().setAttribute("RightType",RightType); + dwTemp.replaceColumn("devolution", "", CurPage.getObjectWindowOutput()); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info04;Describe=定义按钮;]~*/%> + <% + String sButtons[][] = { + {"true","All","Button","生成结清证明","生成结清证明","saveRecord()","","","","btn_icon_save"}, + {"true","All","Button","公司盖章","盖公司电子章","stamp()","","","",""}, + }; + sButtonPosition = "north"; + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=Info05;Describe=主体页面;]~*/%> +<%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + + + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LBContractDevolutionInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LBContractDevolutionInfo.jsp index 0f60ca5fc..c19b5cb0c 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LBContractDevolutionInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LBContractDevolutionInfo.jsp @@ -34,13 +34,13 @@ BizObjectManager bom=JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME); BizObject cust=bom.createQuery("contract_id=:contract_id and is_main='Y'").setParameter("contract_id", contractid).getSingleResult(false); String custname=cust.getAttribute("customer_name").toString();;//主承租人 - String planinformation=ProductParamUtil.getProductParameterValue(product_id,"PRD0314","planinformation");//方案类型 +// String planinformation=ProductParamUtil.getProductParameterValue(product_id,"PRD0314","planinformation");//方案类型 String money="";//留购价 - if("SinglePlan".equals(planinformation)){ - BizObjectManager bom1=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME); - BizObject condition=bom1.createQuery("contract_id=:contract_id ").setParameter("contract_id", contractid).getSingleResult(false); - money=condition.getAttribute("NOMINAL_PRICE").toString(); - } +// if("SinglePlan".equals(planinformation)){ +// BizObjectManager bom1=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME); +// BizObject condition=bom1.createQuery("contract_id=:contract_id ").setParameter("contract_id", contractid).getSingleResult(false); +// money=condition.getAttribute("NOMINAL_PRICE").toString(); +// } String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); String RightType = CurPage.getParameter("RightType");//选择模式 @@ -76,7 +76,7 @@ dwTemp.genHTMLObjectWindow(sFlowUnid);//得到的参数 CurPage.getCurComp().setAttribute("RightType",RightType); - dwTemp.replaceColumn("devolution", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("devolution", "", CurPage.getObjectWindowOutput()); %> <%/*~END~*/%> @@ -86,7 +86,8 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info04;Describe=定义按钮;]~*/%> <% String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","All","Button","生成产权转移单","生成产权转移单","saveRecord()","","","","btn_icon_save"}, + {"true","All","Button","公司盖章","盖公司电子章","stamp()","","","",""}, }; sButtonPosition = "north"; %> @@ -109,18 +110,19 @@ /*~[Describe=保存;InputParam=无;OutPutParam=无;]~*/ function saveRecord() { - debugger; var param={}; var tempParam={}; var sparam=""; //模板号 - param["templateNo"]="e1fc3afacfbc46fea0a881ac20de23cc"; + //param["templateNo"]="e1fc3afacfbc46fea0a881ac20de23cc"; + param["templateNo"]="a9335f5624124b6db29f0d721fc8b61c"; //生成文件关联关系 - tempParam["OBJECTTYPE"]="产权转移单"; + tempParam["OBJECTTYPE"]="transfer"; tempParam["FLOW_UNID"]="<%=sFlowUnid%>"; tempParam["PROJ_ID"]="<%=projectid%>"; + tempParam["ID"]="<%=contractid%>"; tempParam["CONTRACT_ID"]="<%=contractid%>"; tempParam["contract_number"]="<%=contract_number%>"; //生成模板固定参数 @@ -133,9 +135,10 @@ if(sparam.length>0){sparam+=",";} sparam+=key+"="+param[key]; } - var deleteparam ="PROJECT_PLAN_NUMBER="+"<%=contractid%>"; + var deleteparam ="PROJECT_PLAN_NUMBER="+"<%=contractid%>"+",objecttype=transfer"; var deleteresult=RunJavaMethodTrans("com.tenwa.officetempalte.controller.QutationAction","deletedevtion",deleteparam); var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam); + RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdfAnnex","contract_id=<%=contractid%>,PLAN_LIST=transfer,FlowUnid=<%=sFlowUnid%>"); if(bIsInsert) { beforeInsert(); @@ -145,6 +148,17 @@ reloadSelf(); } + function stamp(){ +// var flie = getItemValue(0,getRow(0),"FILENAME"); +// if(typeof(flie)=="undefined"||flie==null||flie==""){ +// alert("请先生成产权转移单!!"); +// return; +// } + var result=RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","TcollectionSignA","contract_id=<%=contractid%>,FlowUnid=<%=sFlowUnid%>,flagType=transfer"); + + location.reload(); + + } <%/*~END~*/%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LoanNoticeList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LoanNoticeList.jsp new file mode 100644 index 000000000..2eb107a51 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/LoanNoticeList.jsp @@ -0,0 +1,169 @@ +<%@page import="org.apache.catalina.User"%> +<%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String userId = CurUser.getUserID(); + String orgId =CurUser.getOrgID(); + System.out.print(orgId); + String falg = "true"; + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel("LoanNoticeList"); + if(userId.indexOf("8006")>-1){ + falg = "false"; + if("8006011".equals(orgId)){ + doTemp.appendJboWhere(" and lci.inputorgid='"+orgId+"'"); + }else{ + doTemp.appendJboWhere(" and lci.inputuserid='"+userId+"'"); + } + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(15); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(userId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + sButtons=new String[][]{ + {falg,"All","Button","生成放款通知书","生成放款通知书","generateQuotation()","","","","btn_icon_generate"}, + {"true","All","Button","批量下载","批量下载","lotdown()","","","","btn_icon_down"}, + {"false","All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; + +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/QuotationList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/QuotationList.jsp index e4e779986..263525a38 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/QuotationList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/QuotationList.jsp @@ -16,6 +16,14 @@ String ishistory = CurPage.getParameter("ishistory"); String nodeNo=CurPage.getParameter("NodeNo"); String RightType = CurPage.getParameter("RightType"); + String docname = CurPage.getParameter("docname"); + if("settle".equals(docname)){ + docname = "结清模板"; + }else if("transfer".equals(docname)){ + docname = "产权转移证书"; + }else if("settletradition".equals(docname)){ + docname = "结清证明"; + }; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 sTempletNo = "DevolutionList"; String userName = CurUser.getUserName(); @@ -28,7 +36,7 @@ dwTemp.Style = "1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; dwTemp.setPageSize(50); - dwTemp.genHTMLObjectWindow(contract_id); + dwTemp.genHTMLObjectWindow(docname+","+contract_id); //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = null; diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/rightsFileList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/rightsFileList.jsp new file mode 100644 index 000000000..49ed743f3 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractEnd/rightsFileList.jsp @@ -0,0 +1,177 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% +String userid=CurUser.getUserID().substring(0,5); +String userid1=CurUser.getUserID(); +String Jurisdiction="true"; + + /* + Author: undefined 2018-07-16 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("rightsFileList"); + + //合同信息查询加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid1).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 北财合作方 + String roleId = "800R00000044"; + + //roleid:800R00000045 rolename: bccuishou + //如果登录人属于bccuishou角色,可以看到北财下的所有的合同 + if(roleList.contains("800R00000045")){ + Jurisdiction="false"; + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId = bo.getAttribute("userid").toString(); + useridList.add("'"+userId+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + doTemp.appendJboWhere(" and O.project_manage='"+userid1+"'"); + } + if(roleList.contains(roleId)){ + Jurisdiction="false"; + } + + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.MultiSelect=true; + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + String userId = CurUser.getUserID(); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {Jurisdiction,"All","Button","结清证明","结清证明","saveRecord()","","","","btn_icon_save"}, + {"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}, + {Jurisdiction,"All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; + sButtonPosition = "north"; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractInvoiceInfo/LBContractInvoiceObjectInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractInvoiceInfo/LBContractInvoiceObjectInfo.jsp index 7f3419091..26e6e7dfa 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractInvoiceInfo/LBContractInvoiceObjectInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractInvoiceInfo/LBContractInvoiceObjectInfo.jsp @@ -80,6 +80,12 @@ setItemValue(0,0,"TAX_ACC", sReturn[4]); setItemValue(0,0,"INVOICE_ADD", sReturn[5]); setItemValue(0,0,"INVOICE_PHONE", sReturn[6]); + //添加是否是默认开票 + if("yes"==sReturn[7]){ + document.getElementById("IS_MAIN").selectedIndex = 1; + }else if("no"==sReturn[7]){ + document.getElementById("IS_MAIN").selectedIndex = 2; + } },"请选择开票对象"); } function validityCheck(){ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractPersonBaseInfo/LBContractPersonBaseInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractPersonBaseInfo/LBContractPersonBaseInfo.jsp index f036e4d6b..7b1ff3df7 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractPersonBaseInfo/LBContractPersonBaseInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractPersonBaseInfo/LBContractPersonBaseInfo.jsp @@ -13,6 +13,7 @@ String ishistory=CurPage.getParameter("IsHistory"); String compClientID = request.getParameter("CompClientID"); String RightType = CurPage.getParameter("RightType");//页面是否 是只读 + String custype = CurPage.getParameter("customertype");//获取客户类型 if(sPrevUrl == null) sPrevUrl = ""; if((null!=sPhaseNo&&sPhaseNo.equals("0010")) && "BContractApproveFlow".equals(FlowNo)){ @@ -31,34 +32,45 @@ isShowButton=false; doTemp.setReadOnly("CONTRACT_NUMBER", true); } - if(null!=ishistory&&ishistory.equals("true")){ + /* if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 - } + } */ doTemp.setHtmlEvent("CONTRACT_NUMBER", "onChange", "copyContNumToContNo"); ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); //ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform dwTemp.setGroupHidden("0020"); dwTemp.genHTMLObjectWindow(sFlowUnid); + String userll=null; + userll="/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp?CompClientID="; + if("01".equals(custype)){ + userll="/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp?CompClientID="; + } //dwTemp.replaceColumn("BaseInfo", "", CurPage.getObjectWindowOutput()); - dwTemp.replaceColumn("BaseInfo", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("BaseInfo", "", CurPage.getObjectWindowOutput()); String sButtons[][] = null; - sButtons = new String[][]{ - {"true","","Button","保存","保存所有修改","saveRend()","","","",""}, - }; + if(!"ContractOnhireCarChangeFlow".equals(FlowNo)&&!"BContractApproveFlow".equals(FlowNo)&&!"BContractChangeFlow".equals(FlowNo)){ + sButtons = new String[][]{ + {"true","","Button","保存","保存所有修改","saveRend()","","","",""}, + }; + }else{ + sButtons = new String[][]{ + {"false","","Button","保存","保存所有修改","saveRend()","","","",""}, + }; + } sButtonPosition = "north"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/Bqinfter.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/Bqinfter.jsp new file mode 100644 index 000000000..b031ed3b8 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/Bqinfter.jsp @@ -0,0 +1,36 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-12-15 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "BQ_Test";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +// doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","合同制作","合同制作","returnList()","","","",""}, + {"true","All","Button","生成一维码","生成一维码","returnone()","","","",""}, + {"false","All","Button","返回","返回列表","","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/ContractListUpload.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/ContractListUpload.jsp index fa1ff2b16..33972bba2 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/ContractListUpload.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/ContractListUpload.jsp @@ -41,6 +41,7 @@ if(list.size()>0){ libraryId=list.get(0).get("ID"); } + tx.commit(); } BizObjectManager libBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBCarContractTemplateList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBCarContractTemplateList.jsp index 787141bd8..6f5074a92 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBCarContractTemplateList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBCarContractTemplateList.jsp @@ -8,6 +8,7 @@ */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String flowName = CurPage.getParameter("FlowName");//流程名称 if(sFlowUnid == null)sFlowUnid = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBCarContractTemplateList"; @@ -27,16 +28,24 @@ sProjId=bocl.getAttribute("proj_id").getString(); } ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if("付款申请(汽车)".equals(flowName)){ + doTemp.setVisible("S_filename", false); + doTemp.setVisible("operation", false); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--设置为Grid风格-- - dwTemp.MultiSelect = true; + dwTemp.Style="1"; + //--设置为Grid风格-- + if(!("付款申请(汽车)".equals(flowName))){ + dwTemp.MultiSelect = true; + } + dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(sFlowUnid); //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] =null; - if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))||("付款申请(汽车)".equals(flowName))){ RightType="ReadOnly"; sButtons=new String[][] { {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""} diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateInfo.jsp index db28c15f0..8cee4f7c5 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateInfo.jsp @@ -82,7 +82,7 @@ //加载一级分类选项 function initOneClass(status){ - var oneClass=getItemValue(0,0,"ONE_CLASSIFY");debugger; + var oneClass=getItemValue(0,0,"ONE_CLASSIFY"); var sql=""; if('<%=a%>'=="true"&&'<%=b%>'=="true"){ sql="select itemno,itemname from code_library where codeno='ProductContractTemplate' AND LENGTH(itemno)=3"; @@ -104,7 +104,7 @@ var oneClass=getItemValue(0,0,"ONE_CLASSIFY"); if(oneClass==""){oneClass=" ";} var twoClass=getItemValue(0,0,"TWO_CLASSIFY"); - var sql="";debugger; + var sql=""; if('<%=a%>'=="false"&&'<%=b%>'=="true"){ sql="select itemno,itemname from code_library where codeno='ProductContractTemplate' and itemno like '"+oneClass+"%' AND LENGTH(itemno)=6"; }else{ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateList.jsp index 3c69e843b..6ec464bc1 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/LBContractTemplateList.jsp @@ -8,6 +8,9 @@ */ String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String customertype = CurPage.getParameter("customertype");//获取客户类型,用于判断生成合同的方法 + String productId = CurPage.getParameter("ProjectId"); + String flowName = CurPage.getParameter("FlowName"); if(sFlowUnid == null)sFlowUnid = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBContractTemplateList"; @@ -15,7 +18,9 @@ String taskno=CurPage.getParameter("TaskNo"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); - + String ProjectId=CurPage.getParameter("ProjectId"); + + String sContractId = "";//合同表的主键 String sProjId="";//项目表主键 BizObjectManager bomcl = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); @@ -33,25 +38,31 @@ dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(10); dwTemp.genHTMLObjectWindow(sFlowUnid); - + + //法人客户不能删除 + String falg = "true"; + if("01".equals(customertype)&&!"合同变更流程".equals(flowName)){ + falg = "false"; + } + if(RightType.equals("ReadOnly")){ + falg = "false"; + } //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - String sButtons[][] =null; - if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ - RightType="ReadOnly"; - sButtons=new String[][] { - {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""} - }; - }else{ - sButtons=new String[][]{ + String sButtons[][]=new String[][]{ {"false","","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, {"false","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit",""}, - {"true","","Button","删除","删除","deletecontract()","","","","btn_icon_delete",""}, - {"true","","Button","生成合同","删除","createContractByTemplate()","","","","btn_icon_up",""}, - {"true","","Button","上传","新增文档信息","uploadContract()","","","","btn_icon_up",""} + {falg,"","Button","删除","删除","deletecontract()","","","","btn_icon_delete",""}, + //{"true","","Button","生成合同","删除","createContractByTemplate()","","","","btn_icon_up",""}, + //{"true","","Button","上传","新增文档信息","uploadContract()","","","","btn_icon_up",""} }; - } %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/contract_template.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/contract_template.jsp index 7c45d1cb5..670b18bdf 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/contract_template.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/contract_template.jsp @@ -1,5 +1,9 @@ <%@ page contentType="text/html; charset=GBK"%> <%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_COMPANY_TEMP"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_ADDRESS_TEMP"%> <%@page import="com.amarsoft.app.check.CheckFLowPhaseNo"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% /* @@ -8,19 +12,94 @@ History Log: */ String sPrevUrl = CurPage.getParameter("PrevUrl"); + String customertype = CurPage.getParameter("customertype");//获取客户类型,用于判断生成合同的方法 + + String flowunid=CurPage.getParameter("FlowUnid"); String ishistory=CurPage.getParameter("IsHistory"); String proj_id=CurPage.getParameter("proj_id"); + String projectId=CurPage.getParameter("ProjectId");//获取项目projectID String taskno=CurPage.getParameter("TaskNo"); String nodeNo=CurPage.getParameter("NodeNo"); + String contractNo=CurPage.getParameter("ContractNo"); + String FlowKey=CurPage.getParameter("FlowKey");//获取合同编号 + String flowName=CurPage.getParameter("FlowName");//获取合同名称 + String contractid=CurPage.getParameter("ContractId");//获取合同id + String isnetcar=CurPage.getParameter("isNetCar");//获取是否是网约车 + if(null==contractNo ||"null".equals(contractNo) ){ + contractNo=FlowKey; + } String RightType= CurPage.getParameter("RightType"); String phaseno = CheckFLowPhaseNo.run(flowunid, taskno); String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); String sFileSavePath = CurConfig.getConfigure("FileSavePath"); String sFileNameType = CurConfig.getConfigure("FileNameType"); + //获取租赁方式,用于判断生成的合同类型 + String leasform = CurPage.getParameter("leasform"); if(sPrevUrl == null) sPrevUrl = ""; String sTempletNo = "BaseFileTemplateSelect";//--模板号-- + String product_id = Sqlca.getString("select PRODUCT_ID from lb_project_info where id='"+projectId+"'"); + //获取盖章模式 + String sealType = Sqlca.getString("select sealType from PRD_SPECIFIC_LIBRARY where productid='"+product_id+"'"); + //获取签约模式 + String signType = Sqlca.getString("select signType from PRD_SPECIFIC_LIBRARY where productid='"+product_id+"'"); + + //获取对应的承租信息 + String certid=""; + String mobile=""; + String address=""; + //网约车挂靠方信息 + String NetMortgagor = ""; + String NetCertid = ""; + String NetMobile = ""; + String Netaddress=""; + /* BizObjectManager lultm = JBOFactory.getBizObjectManager(LB_UNION_LESSEE_temp.CLASS_NAME); + String sSql = "select o.CUSTOMER_ID FROM o where o.flowunid =:flowunid"; + BizObject lult = lultm.createQuery(sSql).setParameter("flowunid", flowunid).getSingleResult(false); */ + String customerid = Sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+flowunid+"'"); + if("01".equals(customertype)){ + BizObjectManager cctm = JBOFactory.getBizObjectManager(CUSTOMER_COMPANY_TEMP.CLASS_NAME); + String sSql = "select o.certid,o.tel,o.reg_address,o.company_name FROM o where o.customerid =:customerid"; + BizObject cct = cctm.createQuery(sSql).setParameter("customerid", customerid).getSingleResult(false); + certid=cct.getAttribute("certid").getString(); + mobile=cct.getAttribute("tel").getString(); + address=cct.getAttribute("reg_address").getString(); + NetMortgagor=cct.getAttribute("company_name").getString(); + }else{ + BizObjectManager cptm = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME); + BizObjectManager catm = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME); + String sSql = "select o.certid,o.mobile,o.nativeplace,o.MAILING_ADDRESS,o.fullname,o.WORKADD FROM o where o.customerid =:customerid and o.flowunid=:flowunid"; + String catSql = "select o.FULLADDRESS FROM o where o.customerid =:customerid and o.flowunid=:flowunid"; + BizObject cpt = cptm.createQuery(sSql).setParameter("customerid", customerid).setParameter("flowunid", flowunid).getSingleResult(false); + BizObject cat = catm.createQuery(catSql).setParameter("customerid", customerid).setParameter("flowunid", flowunid).getSingleResult(false); + certid=cpt.getAttribute("certid").getString(); + mobile=cpt.getAttribute("mobile").getString(); + if("居住地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cat.getAttribute("FULLADDRESS").getString(); + }else if("户籍地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cpt.getAttribute("nativeplace").getString(); + }else if("单位地址".equals(cpt.getAttribute("MAILING_ADDRESS").getString())){ + address=cpt.getAttribute("WORKADD").getString(); + } + NetMortgagor=cpt.getAttribute("fullname").getString(); + } + //给网约车模板 + if("1".equals(isnetcar)){ + BizObjectManager cctm = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO_TEMP.CLASS_NAME); + String sSql = "select o.IS_AFFILIATED,o.NETCERTID,o.AFFILIATEDNAME,o.AFFILIATEDACTUALADDRESS FROM o where o.flowunid =:flowunid"; + BizObject cct = cctm.createQuery(sSql).setParameter("flowunid", flowunid).getSingleResult(false); + if("1".equals(cct.getAttribute("IS_AFFILIATED").getString())){ + NetMortgagor = cct.getAttribute("AFFILIATEDNAME").getString(); + NetCertid = cct.getAttribute("NETCERTID").getString(); + Netaddress = cct.getAttribute("AFFILIATEDACTUALADDRESS").getString(); + }else{ + NetCertid = certid; + NetMobile = mobile; + Netaddress = address; + } + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); String a="false";//融资租赁 String b="false";//保理 @@ -39,7 +118,7 @@ sProjId=bocl.getAttribute("proj_id").getString(); sProductId=bocl.getAttribute("productId").getString(); } - if (sProductId.equals("0005")){ + /* if (sProductId.equals("0005")){ LeaseType="DoubleLease"; }else if(sProductId.equals("0001")){ LeaseType="NormalLease"; @@ -47,7 +126,7 @@ LeaseType="CarBusiness"; }else{ LeaseType="NoBusiness"; - } + } */ doTemp.setHtmlEvent("ONECLASSIFY","onchange","initTwoClass"); doTemp.setHtmlEvent("TWOCLASSIFY","onchange","initThreeClass"); @@ -63,17 +142,17 @@ //isShowButton=false; String compClientID = request.getParameter("CompClientID"); String sparm=""; - dwTemp.replaceColumn("LBContractTemplateList", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("LBContractTemplateList", "", CurPage.getObjectWindowOutput()); String sButtons[][] = null; if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ dwTemp.ReadOnly = "-2"; sButtons=new String[][]{ - {phaseno.equals("0010")?"true":"false","","Button","生成合同","生成合同","createContractByTemplate()","","","","btn_icon_up",""} + {phaseno.equals("0010")&&(!RightType.equals("ReadOnly"))?"true":"false","","Button","生成合同","生成合同","createContractByTemplate()","","","","btn_icon_up",""} }; }else{ sButtons=new String[][] { - {phaseno.equals("0010")?"true":"false","","Button","生成合同","生成合同","createContractByTemplate()","","","","btn_icon_up",""} + {phaseno.equals("0010")&&(!RightType.equals("ReadOnly"))?"true":"false","","Button","生成合同","生成合同","createContractByTemplate()","","","","btn_icon_up",""} }; } dwTemp.replaceColumn("contracttemplate", "
请稍等。。。。。。
", CurPage.getObjectWindowOutput()); @@ -82,24 +161,28 @@ var docno = ""; $(document).ready(function(){ var RightType="<%=RightType%>"; - var phaseno="<%=phaseno%>" - if(RightType=="ReadOnly"){ + var phaseno="<%=phaseno%>"; + var operationType = "<%=CurPage.getParameter("operationType")%>"; + /* if(RightType=="ReadOnly"){ $('#A_Group_0010').css('display','none'); $('#A_Group_0020').css('display','none'); - } + } */ if(phaseno=="0015"){ $('#ButtonTR').css('display','block'); $('#A_Group_0010').css('display','none'); $('#A_Group_0020').css('display','none'); } - initOneClass(); + var sReturn = RunJavaMethodSqlca("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","getContractClass","leasform="+"<%=leasform%>"+",isNetCar="+"<%=CurPage.getParameter("isNetCar")%>"+",operationType="+operationType); + var jsonData=eval("("+sReturn+")"); + initFileTemplate(eval("("+jsonData[0].fileTemplate+")")); +// initOneClass(); }); //加载一级分类选项 function initOneClass(status){ var oneClass=getItemValue(0,0,"ONECLASSIFY"); - var sql="SELECT itemno,itemname FROM code_library WHERE codeno='DocList' AND itemno LIKE '005%' AND LENGTH(itemno)=6 and attribute1='<%=LeaseType%>'"; + var sql="SELECT itemno,itemname FROM code_library WHERE codeno='DocList' AND itemno LIKE '005%' AND LENGTH(itemno)=6 "; initSelectOption(sql,"itemname","itemno","ONECLASSIFY"); if(status=="edit"){ setItemValue(0,0,"ONECLASSIFY",oneClass); @@ -198,18 +281,51 @@ alert("请勾选合同模板!"); return; } - + if("BContractChangeApply"!="<%=CurPage.getParameter("ApplyType")%>"){ + var contractNomessage = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","CheckContractNo","contractId="+"<%=sContractId%>"+",contractNo="+"<%=CurPage.getParameter("ContractNo")%>"); + if("error"==contractNomessage){ + alert("合同编号重复,请联系后台人员处理!"); + return; + } + } + var message = RunJavaMethodTrans("com.tenwa.app.baseFileTemplate.handle.FileTemplateUtil","CheckCar","contractId="+"<%=sContractId%>"+",templateIds="+tempids+",flowunid="+"<%=flowunid%>"+",operationType="+"<%=CurPage.getParameter("operationType")%>"); + if(""!=message){ + if("01"=="<%=customertype%>"){ + if(message.indexOf("请先删除后再生成")>0){ + alert("合同已生成,无法再次生成!"); + location.reload(); + return; + } + } + alert(message); + location.reload(); + return; + } + //检查扣款卡信息是否签约 + var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.check.ContractInfoCheck","ProjectSignStatus","projectid=<%=projectId%>"); + if("error"==sReturnInfo){ + alert("请提醒客户查看手机短信,首先完成扣款卡的签约验证!"); + return; + } var param={}; var tempParam={}; var sparam=""; - - + // param["templateNo"]="0010"; tempParam["CurUserId"]="<%=CurUser.getUserID()%>"; tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>"; tempParam["OBJECTTYPE"]="<%=CurPage.getParameter("FLOW_NO")%>"; tempParam["FLOW_UNID"]="<%=flowunid%>"; tempParam["CONTRACT_ID"]="<%=sContractId%>"; tempParam["PROJ_ID"]="<%=sProjId%>"; + tempParam["PROJECT_ID"]="<%=projectId%>"; + tempParam["contractNo"]="<%=contractNo%>"; + tempParam["certid"]="<%=certid%>"; + tempParam["mobile"]="<%=mobile%>"; + tempParam["address"]="<%=address%>"; + tempParam["NETMORTGAGOR"]="<%=NetMortgagor%>"; + tempParam["NETCERTID"]="<%=NetCertid%>"; + tempParam["NETMOBILE"]="<%=NetMobile%>"; + tempParam["NETADDRESS"]="<%=Netaddress%>"; tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>"; @@ -225,6 +341,24 @@ if(sReturn0.length>2){ alert(sReturn0); }else{ + RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdf","FlowUnid=<%=flowunid%>,flagType=word"); +<%-- if("01"=="<%=customertype%>"||"1"=="<%=CurPage.getParameter("isNetCar")%>"||"BAIC_MOTOR"=="<%=CurPage.getParameter("operationType")%>"||"ZYC"=="<%=CurPage.getParameter("operationType")%>"||"KHSQ"=="<%=CurPage.getParameter("operationType")%>"||"KJZL"=="<%=CurPage.getParameter("operationType")%>"){ --%> + var OwmMessage = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","SystemMakeOneDimensionalCode","ProjectId=<%=projectId%>,contract_id=<%=sContractId%>,contractNo=<%=contractNo%>,leasform=<%=leasform%>"); + if("error"==OwmMessage){ + RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","companyUpdateDocContractStatus","FlowUnid=<%=flowunid%>"+",ProjectId=<%=projectId%>"); + alert("生成失败!!!"); + reloadSelf(); + return; + } + if(("01"=="<%=customertype%>"&&"Auto" == "<%=sealType%>" )||("Auto" == "<%=sealType%>" && "Hand" == "<%=signType%>" )){ + var falg = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","compnySignIng","FlowUnid=<%=flowunid%>,flagType=word,ProjectId=<%=projectId%>"); + if("success"!= falg ){ + RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","companyUpdateDocContractStatus","FlowUnid=<%=flowunid%>"+",ProjectId=<%=projectId%>"); + alert("生成失败!!!"); + reloadSelf(); + return; + } + } alert("生成成功"); } reloadSelf(); diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/uploadContract.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/uploadContract.jsp index 3383cd70b..8dc077254 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/uploadContract.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContractTemplate/uploadContract.jsp @@ -78,7 +78,7 @@ return o.submit(); } function CheckStr(str){ - var s="jpg,jpeg,png,pdf,doc,docx,xls,xlsx,txt"; + var s="jpg,jpeg,png,pdf,doc,docx,xls,xlsx,txt,rar,zip"; var flag="false"; var s2=s.split(","); for(var i=0;i +<%@ include file="/IncludeBegin.jsp"%><% + /* + Author: undefined 2018-07-30 + Content: + History Log: + */ +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ChangeDebitCardList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ChangeDebitCardList.jsp new file mode 100644 index 000000000..a9bf722d3 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ChangeDebitCardList.jsp @@ -0,0 +1,143 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-16 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + String contractid = CurPage.getParameter("ContractId"); + String customerType = CurPage.getParameter("CustomerType"); + String falg = "false"; + if("03".equals(customerType)){ + falg = "true"; + } + CurPage.getParameter("PrevUrl"); + ASObjectModel doTemp = new ASObjectModel("ChangeDebitCardList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- +// dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(flowunid); + dwTemp.ReadOnly = "1"; + isShowButton=true; + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","生成模板","生成模板","generatepdf()","","","",""}, + {falg,"All","Button","发起电子签约","发起电子签约","stamp()","","","",""}, + {falg,"All","Button","查询签约结果","查询签约结果","getStatus()","","","",""}, + {falg,"All","Button","重新发送短息","重新发送短息","sendMessageAgain()","","","","btn_icon_refresh"}, + }; + //sButtonPosition = "north"; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfo.jsp index 452ac4c0d..abc51cfdc 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfo.jsp @@ -1,4 +1,5 @@ <%@ page contentType="text/html; charset=GBK"%> +<%@page import="jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%> <% /* @@ -6,20 +7,38 @@ Content: 示例详情页面 History Log: */ + String projectId = CurPage.getParameter("ProjectId"); + String customerId = CurPage.getParameter("customerId"); + String contractId = CurPage.getParameter("ContractId"); String sPrevUrl = CurPage.getParameter("PrevUrl"); if(sPrevUrl == null) sPrevUrl = ""; String RightType=CurPage.getParameter("RightType"); String ishistory=CurPage.getParameter("IsHistory"); String FlowUnid=CurPage.getParameter("FlowUnid"); - + String flowName=CurPage.getParameter("FlowName"); + String CustomerType=CurPage.getParameter("CustomerType"); + String ApplyType=CurPage.getParameter("ApplyType"); + String PhaseNo=CurPage.getParameter("PhaseNo"); + BizObjectManager ldclManager = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); + BizObject ldcls = ldclManager.createQuery("select * from O where file_flag='yes' and ( flow_unid=:flowunid or contract_id=:contractid ) ").setParameter("flowunid", FlowUnid).setParameter("contractid", contractId).getSingleResult(false); + System.out.print("=========="+ldcls+"=========="); /* System.out.print("\n\n\n\t--FlowUnid "+FlowUnid+"\t\n\n\n"); */ String sTempletNo = "DebitCardInfo";//--模板号-- + if("合同制作流程".equals(flowName)||"合同变更流程".equals(flowName)){ + sTempletNo = "DebitCardInfoMcontract";//--模板号-- + } ASObjectModel doTemp = new ASObjectModel(sTempletNo); //doTemp.setColTips("", "测试"); doTemp.setHtmlEvent("acc_number", "onchange", "getNameOfBank"); + if(PhaseNo.equals("0030")||PhaseNo.equals("0040")||PhaseNo.equals("0050")){ + doTemp.setColInnerBtEvent("ACCOUNT", ""); + } + //doTemp.setHtmlEvent("MOBILE", "onchange", "checkMobile"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//只读模式 + if(PhaseNo.equals("0030")||PhaseNo.equals("0040")||PhaseNo.equals("0050")){ + dwTemp.ReadOnly = "-2";//只读模式 + } if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ dwTemp.ReadOnly = "-2";//只读模式 RightType="ReadOnly"; @@ -27,122 +46,235 @@ }else{ isShowButton=true; } - - dwTemp.genHTMLObjectWindow(FlowUnid); + if("合同制作流程".equals(flowName)||"合同变更流程".equals(flowName)){ + dwTemp.genHTMLObjectWindow(projectId); + }else{ + dwTemp.genHTMLObjectWindow(FlowUnid); + } dwTemp.replaceColumn("PaymentCard", "", CurPage.getObjectWindowOutput()); dwTemp.replaceColumn("S_PaymentCard", "", CurPage.getObjectWindowOutput()); String sButtons[][] = { {"true","","Button","保存","保存所有修改","save()","","","",""}, - {"true","All","Button","校验银行卡信息","校验银行卡四要素","verifyFourelementBank()","","","","btn_icon_return"} + {"false","All","Button","校验银行卡信息","校验银行卡四要素","verifyFourelementBank()","","","","btn_icon_return"} } /* {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} } */; sButtonPosition = "north"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfoForm.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfoForm.jsp new file mode 100644 index 000000000..acec21215 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardInfoForm.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-07-30 + Content: 示例详情页面 + History Log: + */ + String ishistory = CurPage.getParameter("IsHistory"); + String ContractId = CurPage.getParameter("ContractId"); + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String flowName = CurPage.getParameter("FlowName"); + String flowUnid = CurPage.getParameter("FlowUnid"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DebitCardInfoForm";//--模板号-- + if("扣款信息变更审核".equals(flowName)&& null!=ishistory&&ishistory.equals("true")){ + sTempletNo = "DebitCardInfoFormHis"; + ContractId = flowUnid; + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +// doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(ContractId); + + String sButtons[][] = { +// {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardQueryInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardQueryInfo.jsp new file mode 100644 index 000000000..fc8d0f950 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/DebitCardQueryInfo.jsp @@ -0,0 +1,30 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-10-25 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String contractId = CurPage.getParameter("ContractId"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "DebitCardQueryInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); +// doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(contractId); + + String sButtons[][] = { + {"false","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ProvisionAllocation.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ProvisionAllocation.jsp new file mode 100644 index 000000000..95a842e43 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBDebitCard/ProvisionAllocation.jsp @@ -0,0 +1,65 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String contractid = CurPage.getParameter("ContractId"); + String contract_no = CurPage.getParameter("contract_no"); + + ASObjectModel doTemp = new ASObjectModel("Provisionallocation"); + doTemp.appendJboWhere("O.contract_no='"+contract_no+"'"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentInfo.jsp index 5207928b1..5e766969d 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentInfo.jsp @@ -121,7 +121,8 @@ function saveRecord(){ <%-- var sFlowUnid = "<%=sFlowUnid%>"; setItemValue(0,getRow(),"FlowUnid",sFlowUnid);//初始化流程编号 --%> - as_save("myiframe0",""); + //as_save("myiframe0",""); + as_save(0,"goBack()"); } diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentList.jsp index 5a0b0077a..38f01b3a8 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment/LBEquipmentList.jsp @@ -31,6 +31,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String FlowNo = CurPage.getParameter("FlowNo");//流程编号 if(sFlowUnid == null)sFlowUnid = ""; String FlowName = CurPage.getParameter("FlowName");//流程名称 if(FlowName == null)FlowName = ""; @@ -51,6 +52,7 @@ String taskno=CurPage.getParameter("TaskNo"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + String CustomerType=CurPage.getParameter("CustomerType"); %> <%/*~END~*/%> @@ -63,7 +65,7 @@ if("中途终止".equals(FlowName)){ doTemp.setVisible("status", true); } - if(null!=ishistory&&ishistory.equals("true")){ + if(null!=ishistory&&ishistory.equals("true")&& !"ProjectApprovalFlow".equals(FlowNo)){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); } %> @@ -103,9 +105,9 @@ if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory. {"true","","Button","新增","新增租赁物信息","newRecord()","","","","btn_icon_add",""}, {"true","","Button","修改","修改租赁物信息","viewAndEdit()","","","","btn_icon_edit"}, {"true","","Button","删除","删除租赁物信息","deleteRecord()","","","","btn_icon_delete",""}, - {"true","","Button","导入Excel","导入租赁物信息Excel","inExcel()","","","","btn_icon_import",""}, - {"true","","Button","导出Excel","导出租赁物信息Excel","exportPage('"+sWebRootPath+"',0,'excel','"+dwTemp.getArgsValue()+"')","","","","btn_icon_export",""}, - {"true","","Button","下载模板","下载租赁物信息模板","downLoad()","","","","btn_icon_down",""} + // {"true","","Button","导入Excel","导入租赁物信息Excel","inExcel()","","","","btn_icon_import",""}, + // {"true","","Button","导出Excel","导出租赁物信息Excel","exportPage('"+sWebRootPath+"',0,'excel','"+dwTemp.getArgsValue()+"')","","","","btn_icon_export",""}, + // {"true","","Button","下载模板","下载租赁物信息模板","downLoad()","","","","btn_icon_down",""} }; } %> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentInfo.jsp index 60a6f4bd5..dd85be5b0 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentInfo.jsp @@ -32,13 +32,21 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String ProjectNo = CurPage.getParameter("ProjectNo"); String projectId = CurPage.getParameter("ProjectId"); + String ApplyType = CurPage.getParameter("ApplyType"); + String flowName = CurPage.getParameter("FlowName");//流程名称 + String contractid = CurPage.getParameter("ContractId"); + String showtype = CurPage.getParameter("ShowType"); + String operationType = CurPage.getParameter("operationType"); + String status = Sqlca.getString("select STATUS from LM_GPS_ORDER_TEMP where APPLY_NO='"+ProjectNo+"'"); BizObject boLPI= JBOFactory.createBizObjectQuery(LB_PROJECT_INFO.CLASS_NAME,"ID='"+projectId+"'").getSingleResult(false); //String carType=boLPI.getAttribute("CAR_TYPE").toString(); String carType="new_car"; - if(sFlowUnid == null)sFlowUnid = ""; + if(sFlowUnid == null)sFlowUnid = ""; String ID = CurPage.getParameter("ID");//租赁物ID - if(ID == null)ID = ""; + if(ID == null)ID = ""; + String sListTempletNo = CurPage.getParameter("ListTempletNo");//List页面模板号 if(sListTempletNo == null) sListTempletNo = "LBEquipmentListTemp_Cars"; String sInfoTempletNo = CurPage.getParameter("InfoTempletNo");//List页面模板号 @@ -49,6 +57,9 @@ String nodeNo=CurPage.getParameter("NodeNo"); String taskno=CurPage.getParameter("TaskNo"); String RightType= CurPage.getParameter("RightType"); + String carAttributes=CurPage.getParameter("carAttributes"); + String Leasehold=CurPage.getParameter("Leasehold"); + String FlowNo=CurPage.getParameter("FlowNo"); %> <%/*~END~*/%> @@ -57,10 +68,16 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> <% + String FlowUnid = CurPage.getParameter("FlowUnid"); + String rightType = CurPage.getParameter("RightType"); String sTempletNo =sInfoTempletNo;//--模板号-- + //如果是合同查询则 查询正式表数据 + if("flow_contract_sum_car".equals(showtype)){ + sTempletNo = "LBEquipmentInfoTemp_Query";//--模板号-- + } ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ - doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + if(null!=ishistory&&ishistory.equals("true")&&(!"起租后合同基本信息变更(汽车)".equals(flowName))){ +// doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 } doTemp.setDefaultValue("equip_type", sEquipType); CurPage.getCurComp().setAttribute("RightType", null); @@ -69,13 +86,42 @@ if((null!=RightType&& !RightType.equals("ReadOnly"))||(null!=ishistory&& !ishistory.equals("true"))){ doTemp.setColumnAttribute(doTemp.getColumnIndex("BRAND"), "COLUNIT", ""); } */ + if("BContractApproveFlow".equals(FlowNo)){ + doTemp.setRequired("FRAME_NUMBER",true); + doTemp.setRequired("ENGINE_NUMBER",true); + doTemp.setRequired("CAR_COLOUR",true); + } + String falg = "false"; + if(("业务申请流程".equals(flowName)||"业务变更流程".equals(flowName))&& !"ReadOnly".equals(rightType)){ + falg ="true"; + } + if(("合同制作流程".equals(flowName)||"合同变更流程".equals(flowName)||"起租后合同基本信息变更(汽车)".equals(flowName))&&(!RightType.equals("ReadOnly"))){ + falg ="true"; + doTemp.setReadOnly("",true);//设置所有字段都只读。 + doTemp.setReadOnly("FRAME_NUMBER",false); + doTemp.setReadOnly("CAR_COLOUR",false); + doTemp.setReadOnly("ENGINE_NUMBER",false); + //第一车贷产品可以修改其他配置说明 + if("DYCD".equals(operationType)){ + doTemp.setReadOnly("MEMO",false); + } + + doTemp.setColInnerBtEvent("BRAND", ""); + doTemp.setColInnerBtEvent("CAR_SERIES", ""); + doTemp.setColInnerBtEvent("MODEL", ""); + doTemp.setColInnerBtEvent("zone", ""); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + if(((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true")))&&!("合同变更流程".equals(flowName))){ dwTemp.ReadOnly = "-2";//只读模式 } - dwTemp.genHTMLObjectWindow(ID); - CurPage.getCurComp().setAttribute("RightType", RightType); + if("flow_contract_sum_car".equals(showtype)){ + dwTemp.genHTMLObjectWindow(contractid); + }else{ + dwTemp.genHTMLObjectWindow(FlowUnid); + } +// CurPage.getCurComp().setAttribute("RightType", RightType); %> <%/*~END~*/%> @@ -86,8 +132,8 @@ <% String sButtons[][] = { //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - {"true","All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, - {"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} + {falg,"All","Button","保存","保存所有修改","saveRecord()","","","","btn_icon_save"}, + //{"true","","Button","返回","返回列表页面","goBack()","","","","btn_icon_return"} }; sButtonPosition = "north"; %> @@ -106,8 +152,85 @@ <%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=定义按钮事件;]~*/%> <%/*~END~*/%> @@ -251,14 +447,25 @@ } function checkFrameNumber(){ + + if("1"=='<%=status%>'||"8"=='<%=status%>'){ + alert("车架号改变后请修改GPS工单!"); + }else if("2"=='<%=status%>'||"3"=='<%=status%>'||"4"=='<%=status%>'||"5"=='<%=status%>'){ + alert("GPS工单当前状态无法线上修改工单,请线下操作!"); + } + var vin = getItemValue(0,getRow(0),"FRAME_NUMBER"); + if((typeof(vin) == "undefined" || vin == "")){ + setErrorTips("FRAME_NUMBER",""); + return true; + } if (!getCheckCode(vin)){ setErrorTips("FRAME_NUMBER","车架号格式有误!"); return false; }else{ setErrorTips("FRAME_NUMBER",""); } - return true; + } @@ -378,6 +585,7 @@ } },"选择车辆"); } + <%/*~END~*/%> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentList.jsp index 7ef3e4279..c80737cce 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBEquipment_Car/LBEquipmentList.jsp @@ -31,7 +31,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 - if(sFlowUnid == null)sFlowUnid = ""; + if(sFlowUnid == null)sFlowUnid = ""; String certid = Sqlca.getString("select cpt.certid from lb_union_lessee_temp lul inner join CUSTOMER_PERSON_TEMP cpt on cpt.customerid = lul.customer_id where lul.flowunid = '"+sFlowUnid+"' group by cpt.certid"); String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBEquipmentListTemp_Cars"; @@ -43,6 +43,16 @@ String taskno=CurPage.getParameter("TaskNo"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + + String carAttributes=CurPage.getParameter("carAttributes"); + String leasehold=CurPage.getParameter("leasehold"); + String productModel=CurPage.getParameter("productModel"); + String carSeries=CurPage.getParameter("carSeries"); + String carSystem=CurPage.getParameter("carSystem"); + System.out.print("+++++++++++++++++++++++++"+productModel+"------------------"); + System.out.print("+++++++++++++++++++++++++"+carSeries+"------------------"); + System.out.print("+++++++++++++++++++++++++"+carSystem+"------------------"); + %> <%/*~END~*/%> @@ -82,12 +92,12 @@ if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory. }else{ sButtons=new String[][]{ //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 - {"true","","Button","新增","新增租赁物信息","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","新增","新增租赁物信息","newRecord()","","","","btn_icon_add",""}, {"true","","Button","修改","修改租赁物信息","viewAndEdit()","","","","btn_icon_edit"}, - {"true","","Button","删除","删除租赁物信息","deleteRecord()","","","","btn_icon_delete",""}, - {"true","","Button","导入Excel","导入租赁物信息Excel","inExcel()","","","","",""}, - {"true","","Button","导出Excel","导出租赁物信息Excel","exportPage('"+sWebRootPath+"',0,'excel','"+dwTemp.getArgsValue()+"')","","","","",""}, - {"true","","Button","下载模板","下载租赁物信息模板","downLoad()","","","","",""} + //{"true","","Button","删除","删除租赁物信息","deleteRecord()","","","","btn_icon_delete",""}, + //{"true","","Button","导入Excel","导入租赁物信息Excel","inExcel()","","","","",""}, + //{"true","","Button","导出Excel","导出租赁物信息Excel","exportPage('"+sWebRootPath+"',0,'excel','"+dwTemp.getArgsValue()+"')","","","","",""}, + //{"true","","Button","下载模板","下载租赁物信息模板","downLoad()","","","","",""} }; } %> @@ -111,6 +121,20 @@ if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory. +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitList.jsp new file mode 100644 index 000000000..8c854cdbc --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitList.jsp @@ -0,0 +1,107 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + String FlowName = CurPage.getParameter("FlowName");//流程名称 + String taskno=CurPage.getParameter("TaskNo"); + String sProjectId = CurPage.getParameter("ProjectId"); + String RightType= CurPage.getParameter("RightType"); + String action= CurPage.getParameter("action"); + String contractid = CurPage.getParameter("ContractId"); + String showtype = CurPage.getParameter("ShowType"); + String PhaseNo = CurPage.getParameter("PhaseNo"); + if("queryContract".equals(action)){ + RightType = "ReadOnly"; + } + String sTempletNoQuery = "GuarantorList";//--模板号-- + //如果是合同查询则 查询正式表数据 + if("flow_contract_sum_car".equals(showtype)){ + sTempletNoQuery = "GuarantorQueryList";//--模板号-- + } + //获取页面属性liux系统暂时不支持 + /* Toolkit toolkit = Toolkit.getDefaultToolkit(); + Dimension screen = toolkit.getScreenSize(); */ + + ASObjectModel doTemp = new ASObjectModel(sTempletNoQuery); +// doTemp.appendHTMLStyle("FULLNAME","width:"+(int)((screen.getWidth()-(screen.getWidth()*0.108))*0.15)+"px;"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(20); + if("flow_contract_sum_car".equals(showtype)){ + dwTemp.genHTMLObjectWindow(contractid); + }else{ + dwTemp.genHTMLObjectWindow(sFlowUnid); + } + String sButtons[][] =null; + if((null!=RightType&&RightType.equals("ReadOnly")) || "合同制作流程".equals(FlowName)||"合同变更流程".equals(FlowName)){ + sButtons=new String[][] { + {"true","","Button","详情","详情","viewAndEdit2()","","","","btn_icon_edit"} + }; + } else{ + sButtons=new String[][]{ + {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add"}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit"}, + {"true","","Button","删除","删除","do_delete()","","","","btn_icon_delete"}, + {"true","","Button","详情","详情","viewAndEdit2()","","","","btn_icon_edit"} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitListForContract.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitListForContract.jsp new file mode 100644 index 000000000..283183991 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteePerUnitListForContract.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-11-19 + Content: + History Log: + */ + String contractid = CurPage.getParameter("ContractId"); + ASObjectModel doTemp = new ASObjectModel("GuarantorQueryListForContract"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contractid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + // {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + // {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + // {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteeUnitList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteeUnitList.jsp index a121094e7..4319316e8 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteeUnitList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit/LBGuaranteeUnitList.jsp @@ -32,6 +32,7 @@ <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 String ProductId = CurPage.getParameter("ProductId");//流程编号 + String FlowNo = CurPage.getParameter("FlowNo");//流程编号 if(sFlowUnid == null)sFlowUnid = ""; if(ProductId == null)ProductId = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 @@ -49,7 +50,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> <% ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ + if(null!=ishistory&&ishistory.equals("true")&& !"ProjectApprovalFlow".equals(FlowNo)){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); } %> diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitInfo.jsp index d01d6af9c..f5ccb5016 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitInfo.jsp @@ -60,9 +60,12 @@ // s=s+"'"+GuaranteeTypes[i]+"'"+","; //} //s=s.substring(0, s.length()-1); + String ProjectId= CurPage.getParameter("ProjectId"); String sTempletNo = "LBGuaranteeUnitInfoTemp_Car";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setDefaultValue("ASSUROR", customerid); + doTemp.setDefaultValue("PROJECT_ID", ProjectId); + doTemp.setDefaultValue("DATA_STATE", "common");//标记该数据是共同申请人 doTemp.setHtmlEvent("CERTID","onChange","changeCertid"); //doTemp.setHtmlEvent("DRIVERLICENSE","onchange","checkDriver"); //doTemp.setDDDWJbo("ASSURE_METHOD","jbo.sys.CODE_LIBRARY,itemno,itemname,codeno='GuaranteeType' and itemno in ("+s+") "); @@ -180,7 +183,8 @@ <%-- var certid=getItemValue(0,0,"CERTID"); var customerid=RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerAction","updateUnitId",'certid='+certid+',flowunid=<%=sFlowUnid%>,custid='+getItemValue(0,0,"ASSUROR")); setItemValue(0,0,"ASSUROR",customerid); --%> - as_save("myiframe0",""); + //as_save("myiframe0",""); + as_save(0,"goBack()"); } function setErrorTips(colName,tips){ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitList.jsp index 09e18ab66..099d5bc2c 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBGuaranteeUnit_Car/LBGuaranteeUnitList.jsp @@ -31,6 +31,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String sProjectId = CurPage.getParameter("ProjectId"); if(sFlowUnid == null)sFlowUnid = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBGuaranteeUnitListTemp_Car"; @@ -93,9 +94,14 @@ if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory. +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBIdentityCheck/LBIdentityCheckResultTemp.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBIdentityCheck/LBIdentityCheckResultTemp.jsp new file mode 100644 index 000000000..42b6fec72 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBIdentityCheck/LBIdentityCheckResultTemp.jsp @@ -0,0 +1,43 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-12 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String fullName = CurPage.getParameter("fullName");//流程编号 + String CertId = CurPage.getParameter("CertId");//流程编号 + ASObjectModel doTemp = new ASObjectModel("LC_IDENTITY_CHECK_RESULT_TEMP"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(sFlowUnid+","+fullName+","+CertId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","返回","返回","goBack()","","","","btn_icon_back",""}, + //{"true","","Button","清空","清空","clearRecord()","","","","btn_icon_detail",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBOtherCondition/LBOtherConditionInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBOtherCondition/LBOtherConditionInfo.jsp index c7e1a482d..9fe6bbb70 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBOtherCondition/LBOtherConditionInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBOtherCondition/LBOtherConditionInfo.jsp @@ -31,6 +31,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid"); + String FlowNo = CurPage.getParameter("FlowNo");//流程编号 if(sFlowUnid == null)sFlowUnid = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBOtherConditionInfoTemp"; @@ -46,7 +47,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> <% ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ + if(null!=ishistory&&ishistory.equals("true")&& !"ProjectApprovalFlow".equals(FlowNo)){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 } CurPage.getCurComp().setAttribute("RightType", null); diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditRiskShow.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditRiskShow.jsp new file mode 100644 index 000000000..63817e295 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditRiskShow.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-18 + Content: + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String CertId = CurPage.getParameter("CertId");//查询条件编号 + String name = CurPage.getParameter("name");//查询条件编号 + ASObjectModel doTemp = new ASObjectModel("LbCarCreditRiskShow"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + String num = sFlowUnid; + if(CertId != null){ + num = sFlowUnid+","+CertId; + } + if(name!=null){ + num = sFlowUnid+","+CertId+","+name; + } + dwTemp.genHTMLObjectWindow(num); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","返回","返回","goBack()","","","","btn_icon_back",""} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempInfo.jsp new file mode 100644 index 000000000..e0a8a9d46 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempInfo.jsp @@ -0,0 +1,34 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-19 + Content: 示例详情页面 + History Log: + */ + String sFlowUnid = CurPage.getParameter("FlowUnid");;//流程编号 + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempList.jsp"; + String sTempletNo = "LbCarCreditTempInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + //doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + doTemp.setDefaultValue("flowunid",sFlowUnid); + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("ID")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","","Button","返回","返回列表","goBack()","","","","btn_icon_return"} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempList.jsp new file mode 100644 index 000000000..2d71dfef2 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBPreLoanAntiFraud/LBCarCreditTempList.jsp @@ -0,0 +1,69 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-18 + Content: + History Log: + */ + String PhaseNo = CurPage.getParameter("PhaseNo"); + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + ASObjectModel doTemp = new ASObjectModel("LbCarCreditTempList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.MultiSelect = true; //添加多选框 + dwTemp.genHTMLObjectWindow(sFlowUnid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","信贷校验","信贷校验","creditVerification()","","","","btn_icon_detail",""} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBProject/LBProjectInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBProject/LBProjectInfo.jsp index 9ca3a5489..668f43469 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBProject/LBProjectInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBProject/LBProjectInfo.jsp @@ -25,6 +25,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info02;Describe=定义变量,获取参数;]~*/%> <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String FlowNo = CurPage.getParameter("FlowNo");//流程编号 if(sFlowUnid == null) sFlowUnid=""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBProjectInfoTemp"; @@ -52,6 +53,7 @@ String RightType=CurPage.getParameter("RightType"); String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + String productId = CurPage.getParameter("ProductId"); %> <%/*~END~*/%> @@ -60,11 +62,18 @@ <% ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ + + if(null!=ishistory&&ishistory.equals("true") && !"ProjectApprovalFlow".equals(FlowNo)){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 } CurPage.getCurComp().setAttribute("RightType", null); doTemp.setDefaultValue("FlowUnid", sFlowUnid);//赋值流程编号 + //通用产品 + if("currentProduct".equals(productId)){ + doTemp.setRequired("LEAS_FORM", false); + doTemp.setVisible("LEAS_FORM", false); + } + %> <%@ include file="/Tenwa/Lease/Flow/Comm/baseShowFormal.jspf"%> <% @@ -77,6 +86,7 @@ }else{ isShowButton=true; } + if(isShowForaml.equals("true")){ dwTemp.genHTMLObjectWindow(sProjectId); }else{ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBRent/LBLessorInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBRent/LBLessorInfo.jsp index bab0871a8..da64a95ae 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBRent/LBLessorInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBRent/LBLessorInfo.jsp @@ -101,6 +101,31 @@ <%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info07;Describe=自定义函数;]~*/%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBTransferHis/LBProjectForTransferList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBTransferHis/LBProjectForTransferList.jsp index a3578283c..9d909d712 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBTransferHis/LBProjectForTransferList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBTransferHis/LBProjectForTransferList.jsp @@ -6,6 +6,8 @@ ASObjectModel doTemp = new ASObjectModel(sTempletNo); String otherWhere=DataRightManager.getRightCondition(CurUser,"O","proj"); doTemp.appendJboWhere(otherWhere); + String userid = CurUser.getUserID(); + doTemp.appendJboWhere(" and O.project_manage='"+userid+"'"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style = "1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeInfo.jsp index 925c62a45..315dedc44 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeInfo.jsp @@ -42,7 +42,8 @@ String nodeNo=CurPage.getParameter("NodeNo"); String taskno = CurPage.getParameter("TaskNo"); String RightType = CurPage.getParameter("RightType"); - + String businesstype=CurPage.getParameter("businesstype"); + %> <%/*~END~*/%> @@ -107,7 +108,7 @@ { beforeInsert(); } - beforeUpdate();debugger; + beforeUpdate(); var sCustomerId = getItemValue(0,getRow(0),"Customer_ID"); var sIsMain = getItemValue(0,getRow(0),"Is_Main"); var id = getItemValue(0,getRow(0),"id"); @@ -190,7 +191,7 @@ if(righttype == "ReadOnly"){ sParam = sParam+"&RightType=<%=RightType%>"; } - sParam = sParam+"&IsHistory=<%=ishistory%>&TaskNo=<%=taskno%>&NodeNo=<%=nodeNo%>&IsShowFormal=<%=isShowForaml%>"; + sParam = sParam+"&IsHistory=<%=ishistory%>&TaskNo=<%=taskno%>&NodeNo=<%=nodeNo%>&IsShowFormal=<%=isShowForaml%>&businesstype=<%=businesstype%>"; AsControl.OpenView(sUrl,sParam,"_self",""); } @@ -224,9 +225,18 @@ /*~[Describe=查询承租人名称;InputParam=无;OutPutParam=无;]~*/ function SelectCustomer() { - AsDialog.OpenSelector("SelectCustomer","","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var orgid = ""; + if("2"=="<%=businesstype%>"){ + orgid="8009010"; + }else if("3"=="<%=businesstype%>"){ + orgid="8009011"; + }else{ + alert("没有找到对应的申请类型,请联系管理员!"); + return; + } + AsDialog.OpenSelector("SelectCustomerScreening","orgid,"+orgid,"dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ - if(!sReturn || sReturn == "_CANCEL_"||sReturn == "_CLEAR_"||sReturn=="_NONE_") + if(!sReturn || sReturn == "_CANCEL_"||sReturn == "_CLEAR_"||sReturn=="_NONE_") { return; } diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeList.jsp index e2173f628..0a23f8114 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeList.jsp @@ -30,6 +30,7 @@ <% String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String FlowNo = CurPage.getParameter("FlowNo");//流程编号 if(sFlowUnid == null) sFlowUnid = ""; String sTempletNo = CurPage.getParameter("TempletNo");//模板号 if(sTempletNo == null) sTempletNo = "LBUnionLesseeListTemp"; @@ -37,6 +38,7 @@ String taskno = CurPage.getParameter("TaskNo"); String ishistory = CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); + String businesstype=CurPage.getParameter("businesstype"); %> <%/*~END~*/%> @@ -47,7 +49,7 @@ <%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=List03;Describe=定义数据对象;]~*/%> <% ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")) + if(null!=ishistory&&ishistory.equals("true")&& !"ProjectApprovalFlow".equals(FlowNo)) { doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); } @@ -106,7 +108,7 @@ function newRecord() { var sUrl = "/Tenwa/Lease/Flow/Comm/LBUnionLessee/LBUnionLesseeInfo.jsp"; - var sParam = "FlowUnid="+"<%=sFlowUnid%>"+"&ListTempletNo="+"<%=sTempletNo%>"+"&TaskNo="+"<%=taskno%>"; + var sParam = "FlowUnid="+"<%=sFlowUnid%>"+"&ListTempletNo="+"<%=sTempletNo%>"+"&TaskNo="+"<%=taskno%>"+"&businesstype="+"<%=businesstype%>"; AsControl.OpenView(sUrl,sParam,"_self",""); reloadSelf(); } @@ -127,7 +129,7 @@ if(righttype == "ReadOnly"){ sParam = sParam+"&RightType=<%=RightType%>"; } - sParam = sParam+"&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>"; + sParam = sParam+"&IsHistory=<%=ishistory%>&NodeNo=<%=nodeNo%>"+"&businesstype="+"<%=businesstype%>"; AsControl.OpenView(sUrl,sParam,"_self",""); reloadSelf(); } diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCCondtionForProject/LCCondtion.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCCondtionForProject/LCCondtion.jsp index fea2d3f21..0aa09b7d0 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCCondtionForProject/LCCondtion.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCCondtionForProject/LCCondtion.jsp @@ -11,6 +11,7 @@ }else{ isShowButton=true; } + ASObjectModel doTemp = new ASObjectModel("LCConditionTemp"); if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); @@ -22,6 +23,9 @@ dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; dwTemp.setPageSize(50); + if("ProjectCreditFlow".equals(CurPage.getParameter("FlowNo"))||"ProjectRecreditFlow".equals(CurPage.getParameter("FlowNo"))){ + isShowButton=true; + } if(isShowForaml.equals("true")){ dwTemp.genHTMLObjectWindow(sProjectId); }else{ diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LBContractTerminateInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LBContractTerminateInfo.jsp new file mode 100644 index 000000000..b60dd8b63 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LBContractTerminateInfo.jsp @@ -0,0 +1,208 @@ +<%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_UNION_LESSEE"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info00;Describe=注释区;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info01;Describe=定义页面属性;]~*/%> + <% + String PG_TITLE = "结清证明"; // 浏览器窗口标题 PG_TITLE + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info02;Describe=定义变量,获取参数;]~*/%> +<% + + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + if(sFlowUnid == null) sFlowUnid = ""; + BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowUnid); + String product_id=flow.getAttribute("productId").toString(); + String contractid=flow.getAttribute("contract_id").toString(); + String projectid=flow.getAttribute("proj_id").toString(); + String contract_number=flow.getAttribute("flow_key").toString();//业务合同号 + BizObjectManager bom=JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME); + BizObject cust=bom.createQuery("contract_id=:contract_id and is_main='Y'").setParameter("contract_id", contractid).getSingleResult(false); + String custname=cust.getAttribute("customer_name").toString();;//主承租人 +// String planinformation=ProductParamUtil.getProductParameterValue(product_id,"PRD0314","planinformation");//方案类型 + String money="";//留购价 +// if("SinglePlan".equals(planinformation)){ +// BizObjectManager bom1=JBOFactory.getBizObjectManager(LC_CALC_CONDITION.CLASS_NAME); +// BizObject condition=bom1.createQuery("contract_id=:contract_id ").setParameter("contract_id", contractid).getSingleResult(false); +// money=condition.getAttribute("NOMINAL_PRICE").toString(); +// } + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); +// String RightType = CurPage.getParameter("RightType");//选择模式 + String RightType =null;//选择模式 + String sTempletNo = "LBContractTermainateTemp";//模板号 +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info03;Describe=定义数据对象;]~*/%> +<% + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("accept_person", custname); + doTemp.setDefaultValue("contract_id", contractid); + doTemp.setDefaultValue("project_id", projectid); + doTemp.setDefaultValue("flowunid", sFlowUnid); + doTemp.setDefaultValue("RESERVE_PRICE", money); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + } + CurPage.getCurComp().setAttribute("RightType", null); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "-2";//只读模式 + isShowButton=false; + }else{ + isShowButton=true; + } + String compClientID = request.getParameter("CompClientID"); + + dwTemp.genHTMLObjectWindow(sFlowUnid);//得到的参数 + CurPage.getCurComp().setAttribute("RightType",RightType); + dwTemp.replaceColumn("devolution", "", CurPage.getObjectWindowOutput()); +%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=true;CodeAreaID=Info04;Describe=定义按钮;]~*/%> + <% + String sButtons[][] = { + {"true","All","Button","结清证明","保存所有修改","saveRecord()","","","","btn_icon_save"}, + {"true","All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; + sButtonPosition = "north"; + %> +<%/*~END~*/%> + + + + +<%/*~BEGIN~不可编辑区~[Editable=false;CodeAreaID=Info05;Describe=主体页面;]~*/%> +<%@ include file="/Frame/resources/include/ui/include_info.jspf"%> +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info06;Describe=定义按钮事件;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info07;Describe=自定义函数;]~*/%> + +<%/*~END~*/%> + + + + +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info08;Describe=页面装载时,进行初始化;]~*/%> + +<%/*~END~*/%> + + + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp index df835378e..f9334392c 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCContractTerminateInfo.jsp @@ -8,21 +8,28 @@ */ String flowunid = CurPage.getParameter("FlowUnid"); -String RightType = CurPage.getParameter("RightType");//选择模式 -String ishistory=CurPage.getParameter("IsHistory"); -String nodeNo=CurPage.getParameter("NodeNo"); + String RightType = CurPage.getParameter("RightType");//选择模式 + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); String paymentnumber=condition.getAttribute("payment_number").getString(); + String yearrate=condition.getAttribute("YEAR_RATE").getString(); String contractId=condition.getAttribute("contract_id").getString(); + String nominalPrice=condition.getAttribute("NOMINAL_PRICE").getString(); + String cautionmoney = Sqlca.getString("select caution_money from lc_calc_condition where CONTRACT_ID='"+contractId+"'"); + String mayopemoney = Sqlca.getString("select sum(MAYOPE_MONEY) from LC_EBANK_TEMP where flowunid='"+flowunid+"'"); BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid); String productId=flow.getAttribute("productId").getString(); - + String ratio = Sqlca.getString("select EarlySettleBreachRatio from PRD_SPECIFIC_LIBRARY where productid='"+productId+"'"); + System.out.println(ratio+"==================="); String sTempletNo = "LCContractTerminate";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setDefaultValue("PAYMENT_NUMBER", paymentnumber); doTemp.setHtmlEvent("PAYDAY_ADJUST","onchange","getTerminateInfo"); + doTemp.setHtmlEvent("ADJUST_TYPE","onchange","changeInfo"); + doTemp.setHtmlEvent("OTHER_IN","onchange","changeContract"); doTemp.setHtmlEvent("REPURCHASE_RATIO","onchange","getRepurchaseMoney"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform @@ -50,20 +57,32 @@ String nodeNo=CurPage.getParameter("NodeNo"); } function getTerminateInfo(){ + var adjusttype = getItemValue(0,0,"ADJUST_TYPE"); + if(adjusttype.length==0){ + alert("请先选择变更类型!!!"); + setItemValue(0,getRow(),"PAYDAY_ADJUST",""); + return; + } //检查约定终止日是否合法 var paydayAdjust = getItemValue(0,getRow(),"PAYDAY_ADJUST"); var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","checkPaydayAdjust","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>,paydayAdjust="+paydayAdjust); if(result.result != "true"){ alert(result.msg); setItemValue(0,getRow(),"PAYDAY_ADJUST",""); - }else{ - var terminateInfo = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateInfo","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>,paydayAdjust="+paydayAdjust); + }else{ + var terminateInfo = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateInfo","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>,paydayAdjust="+paydayAdjust); + var rentPlanDate = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","rentPlanDate","contractId=<%=contractId%>,paydayAdjust="+paydayAdjust); var remaincorpus = terminateInfo.remaincorpus; + var remaincorpusbreak = terminateInfo.remaincorpusbreak; var remaininterest = terminateInfo.remaininterest; var overduerent = terminateInfo.overduerent; - //逾期利息暂时赋值为0 - setItemValue(0,getRow(),"DUN_PENALTY","0"); - setItemValue(0,getRow(),"AGREED_PENALTY","0"); + var remainfpenalty = terminateInfo.remainfpenalty; + var surplusinterest = terminateInfo.remaininterest; + var sumpenalty = terminateInfo.sumpenalty; + //逾期利息暂时赋值为0FIST_RENT +// setItemValue(0,getRow(),"DUN_PENALTY","0"); + setItemValue(0,getRow(),"DUN_PENALTY",sumpenalty); + // setItemValue(0,getRow(),"AGREED_PENALTY","0"); //已到期租金 setItemValue(0,getRow(),"DUN_RENT",overduerent); //未到期本金 @@ -72,17 +91,89 @@ String nodeNo=CurPage.getParameter("NodeNo"); setItemValue(0,getRow(),"INTEREST_HANDLING_CHARGE",remaininterest); //商定利息默认等于未到期利息 setItemValue(0,getRow(),"AGREED_INTEREST",remaininterest); - //计算合同债券总计 - setItemValue(0,getRow(),"CONTRACT_TOTAL",getContractBondTotal()); //回购比例 默认100 setItemValue(0,getRow(),"REPURCHASE_RATIO","100"); //回购本金 setItemValue(0,getRow(),"REPURCHASE_MONEY",remaincorpus); + //setItemValue(0,getRow(),"FIST_RENT",terminateInfo.fist_rent); + // setItemValue(0,getRow(),"FIST_CORPUS","0"); + + var ratio=0; + if("<%=ratio%>"==""||"<%=ratio%>"==null||"<%=ratio%>"=="null"){ + ratio = 0.05; + }else{ + ratio = (Number("<%=ratio%>")/100).toFixed(2); + } + + setItemValue(0,getRow(),"HANDLING_CHARGE",Math.round(Number(remaincorpus*ratio)*100)/100); + var dateRate=Number("<%=yearrate%>")/100;//获取利率 +// var sDate1 = getItemValue(0,getRow(),"PAYDAY_DATE");//获取提出日期 + var idays = datedifference(rentPlanDate,paydayAdjust);//获取约定终止日和提出日期相差天数 + var REPAYMENT=((Number(remaincorpus)*dateRate)/360)*Number(idays);//计算还款日息差 + setItemValue(0,getRow(),"REPAYMENT_INTEREST",REPAYMENT); + // setItemValue(0,getRow(),"AGREED_DATEPENALTY","0"); + // setItemValue(0,getRow(),"SDNOMINAL_PRICE","0"); + // setItemValue(0,getRow(),"SDHANDLING_CHARGE","0"); + setItemValue(0,getRow(),"OTHER_OUT","<%=cautionmoney%>"); + setItemValue(0,getRow(),"SURPLUSINTEREST",surplusinterest); + setItemValue(0,getRow(),"NOMINAL_PRICE","<%=nominalPrice%>"); + var otherIn = getItemValue(0,getRow(),"OTHER_IN"); + setItemValue(0,getRow(),otherIn==""?"0.00":otherIn); + //计算合同债券总计 +// setItemValue(0,getRow(),"CONTRACT_TOTAL",getContractBondTotal()); + if(adjusttype=="02"){ + var fessMoney = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getLcCarDispose","contractId=<%=contractId%>"); + if(fessMoney.length>0){ + var fessMoneys = fessMoney.split("@"); + setItemValue(0,getRow(),"COLLECT_FEES",fessMoneys[0]); + setItemValue(0,getRow(),"DISPOSE_MONEY",fessMoneys[1]); + }else{ + setItemValue(0,getRow(),"COLLECT_FEES","0.00"); + setItemValue(0,getRow(),"DISPOSE_MONEY","0.00"); + } + setItemValue(0,getRow(),"GUARANTEEMONEY","<%=cautionmoney%>"); + setItemValue(0,getRow(),"CONTRACT_TOTAL",parseFloat(getItemValue(0,getRow(),"DUN_RENT"))+parseFloat(getItemValue(0,getRow(),"COLLECT_FEES"))+parseFloat(remaincorpus)); + }else{ + var HandlingCharge = getItemValue(0, 0, "HANDLING_CHARGE"); + //setItemValue(0,getRow(),"OTHER_IN","0.00"); + //setItemValue(0,getRow(),"CONTRACT_TOTAL",Number(overduerent)+Number(sumpenalty)+Number(remaincorpus)+Number(terminateInfo.fist_rent)+Number(HandlingCharge)+Number(getItemValue(0,getRow(),"OTHER_IN"))+Number(getItemValue(0,getRow(),"NOMINAL_PRICE"))-Number(getItemValue(0,getRow(),"OTHER_OUT")).toFixed(2)+REPAYMENT); + setItemValue(0,getRow(),"CONTRACT_TOTAL",Number(overduerent)+Number(sumpenalty)+Number(remaincorpus)+Number(HandlingCharge)+Number(getItemValue(0,getRow(),"OTHER_IN"))+Number(getItemValue(0,getRow(),"NOMINAL_PRICE"))-Number(getItemValue(0,getRow(),"OTHER_OUT")).toFixed(2)+REPAYMENT); + } } } + //计算债券总计 + function getContractBondTotal(){ + var dunrent = getItemValue(0,getRow(),"DUN_RENT"); + var dunPenalty = getItemValue(0,getRow(),"DUN_PENALTY"); + var corpusOverage = getItemValue(0,getRow(),"CORPUS_OVERAGE"); + //var fistRent = getItemValue(0,getRow(),"FIST_RENT"); + var handlingCharge = getItemValue(0,getRow(),"HANDLING_CHARGE"); + var otherin = getItemValue(0,getRow(),"OTHER_IN"); + var otherout = getItemValue(0,getRow(),"OTHER_OUT"); + var nominalPrice=getItemValue(0,getRow(),"NOMINAL_PRICE"); + return Number(dunrent ? dunrent : 0 ) + Number(dunPenalty ? dunPenalty : 0 ) + Number(corpusOverage ? corpusOverage : 0 ) + + Number(handlingCharge ? handlingCharge : 0 ) + Number(otherin ? otherin : 0 ) + - Number(otherout ? otherout : 0 ) + Number(nominalPrice ? nominalPrice : 0 ) ; + } + //计算债券总计 - function getContractBondTotal(){ + function updateContractBondTotal(){ + var dunrent = getItemValue(0,getRow(),"DUN_RENT"); + var agreedPenalty = getItemValue(0,getRow(),"AGREED_PENALTY"); + var corpusOverage = getItemValue(0,getRow(),"CORPUS_OVERAGE"); + //var fistCorpus = getItemValue(0,getRow(),"FIST_CORPUS"); + var sdhandlingCharge = getItemValue(0,getRow(),"SDHANDLING_CHARGE"); + var otherin = getItemValue(0,getRow(),"OTHER_IN"); + var otherout = getItemValue(0,getRow(),"OTHER_OUT"); + var sdnominalPrice=getItemValue(0,getRow(),"SDNOMINAL_PRICE"); + var agreeddatepenalty=getItemValue(0,getRow(),"AGREED_DATEPENALTY"); + return (Number(dunrent ? dunrent : 0 ) + Number(agreedPenalty ? agreedPenalty : 0 ) + Number(corpusOverage ? corpusOverage : 0 ) + + Number(sdhandlingCharge ? sdhandlingCharge : 0 ) + Number(otherin ? otherin : 0 ) + - Number(otherout ? otherout : 0 ) + Number(sdnominalPrice ? sdnominalPrice : 0 ) +Number(agreeddatepenalty ? agreeddatepenalty : 0 )).toFixed(2); + } + //计算债券总计 +/* function getContractBondTotal(){ var dunrent = getItemValue(0,getRow(),"DUN_RENT"); var corpusoverage = getItemValue(0,getRow(),"CORPUS_OVERAGE"); var corpusinterest = 0; @@ -94,7 +185,7 @@ String nodeNo=CurPage.getParameter("NodeNo"); return Number(otherin ? otherin : 0 ) - Number(otherout ? otherout : 0 ) + Number(dunrent ? dunrent : 0 ) + Number(corpusoverage ? corpusoverage : 0 ) + Number(corpusinterest ? corpusinterest : 0 ) + Number(agreedinterest ? agreedinterest : 0 ) + Number(agreepenalty ? agreepenalty : 0 ) + Number(dunpenalty ? dunpenalty : 0 ) ; - } + } */ function cancelChange(){ openDWDialog(); @@ -111,10 +202,44 @@ String nodeNo=CurPage.getParameter("NodeNo"); //保存数据 function saveRecord(sPostEvents) { + //校验是否有保证金代偿 + var isCompensation = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","isCompensation","contractId=<%=contractId%>"); + if("false" == isCompensation){ + alert("该合同有保证金代偿,无法发起提请结清!"); + return ; + } //检查是否进行过变更 var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.CreateTransactionExecutor","checkIsRentChange","flowunid=<%=flowunid%>,plannumber=<%=paymentnumber%>"); if(result == 'true'){ - as_save("myiframe0","run()"); + var adjusttype = getItemValue(0,0,"ADJUST_TYPE"); + if("01"==adjusttype){ + setItemValue(0,getRow(),"MAXIMUM_TOTAL",updateContractBondTotal()); + var maximumtotal = updateContractBondTotal(); + if(Number(maximumtotal)>Number(<%=mayopemoney%>)){ + alert('最终还款金额大于网银核销金额!!!'); + return; + } + //更新lc_ebank_temp中的值 + var mage = AsControl.RunJavaMethodTrans("com.tenwa.reckon.executor.CreateTransactionExecutor","updateEbank","flowunid=<%=flowunid%>,cleanLeasemoney="+maximumtotal); + if("Success"!=mage){ + alert('提前结清失败!!!'); + return; + } + }else{ + var contractTotal = getItemValue(0,0,"CONTRACT_TOTAL"); + if(Number(contractTotal)>Number(<%=mayopemoney%>)){ + alert('最终还款金额大于网银核销金额!!!'); + return; + } + //更新lc_ebank_temp中的值 + var mage = AsControl.RunJavaMethodTrans("com.tenwa.reckon.executor.CreateTransactionExecutor","updateEbank","flowunid=<%=flowunid%>,cleanLeasemoney="+contractTotal); + if("Success"!=mage){ + alert('提前结清失败!!!'); + return; + } + } + as_save("myiframe0","run()"); + }else{ alert('请先撤销变更,再进行变更操作!!!'); } @@ -128,17 +253,78 @@ String nodeNo=CurPage.getParameter("NodeNo"); jQuery(function(){ setItemValue(0,0,"flowunid","<%=flowunid%>"); + var payday_date = getItemValue(0,getRow(),"PAYDAY_DATE"); + if(""==payday_date || "undefined"==payday_date || null == payday_date){ + setItemValue(0,0,"PAYDAY_DATE","<%=StringFunction.getToday()%>"); + } + //设置商定罚息带出逾期罚息 + //setItemValue(0,0,"AGREED_PENALTY",getItemValue(0,0,'DUN_PENALTY')); //判断其他应收和其他应退是否为空 var otherIn = getItemValue(0,getRow(),"OTHER_IN"); var otherOut = getItemValue(0,getRow(),"OTHER_OUT"); if(!otherIn && !otherOut){ //其他应收和其他应退 - var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateOtherInfo","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>"); + var result = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","getTerminateOtherInfoFinish","contractId=<%=contractId%>,paymentnumber=<%=paymentnumber%>"); for(var p in result){ - setItemValue(0,getRow(),p,result[p]); + if(result[p]!=null){ + setItemValue(0,getRow(),p,result[p]); + } } } + changeInfo(); }); + + function changeInfo(){ + var adjusttype = getItemValue(0,0,"ADJUST_TYPE"); + if(adjusttype=="02"){ + $("#A_div_1698").attr("style","display:block;"); + $("#A_div_1896").attr("style","display:block;"); + $("#A_div_2094").attr("style","display:block;"); + $("#A_div_2712").attr("style","display:block;"); + $("#A_div_1061").attr("style","display:none;"); + $("#A_div_1062").attr("style","display:none;"); + $("#A_div_1303").attr("style","display:none;"); + $("#A_div_1302").attr("style","display:none;"); + $("#A_div_1064").attr("style","display:none;"); + $("#A_div_1065").attr("style","display:none;"); + $("#A_div_2506").attr("style","display:none;"); + }else{ + $("#A_div_1698").attr("style","display:none;"); + $("#A_div_1896").attr("style","display:none;"); + $("#A_div_2094").attr("style","display:none;"); + $("#A_div_2712").attr("style","display:none;"); + $("#A_div_1061").attr("style","display:block;"); + $("#A_div_1062").attr("style","display:block;"); + $("#A_div_1303").attr("style","display:block;"); + $("#A_div_1302").attr("style","display:block;"); + $("#A_div_1064").attr("style","display:block;"); + $("#A_div_1065").attr("style","display:block;"); + $("#A_div_2506").attr("style","display:block;"); + } + var ID = getItemValue(0,0,"ID"); + if(typeof(ID) == "undefined" || ID.length == 0){ + var paydayadjust = getItemValue(0,0,"PAYDAY_ADJUST"); + if(!(typeof(paydayadjust) == "undefined" || paydayadjust.length == 0)){ + getTerminateInfo(); + } + } + } + function changeContract(){ + getTerminateInfo(); + // setItemValue(0,0,"CONTRACT_TOTAL",(Number(getItemValue(0,getRow(),"CONTRACT_TOTAL"))+Number(getItemValue(0,getRow(),"OTHER_IN"))).toFixed(2)); + } + + function datedifference(sDate1, sDate2) { + var dateSpan, + tempDate, + iDays; + sDate1 = Date.parse(sDate1); + sDate2 = Date.parse(sDate2); + dateSpan = sDate2 - sDate1; + dateSpan = Math.abs(dateSpan); + iDays = Math.floor(dateSpan / (24 * 3600 * 1000)); + return iDays + }; <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCEbankTempList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCEbankTempList.jsp new file mode 100644 index 000000000..fc769e457 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/LCEbankTempList.jsp @@ -0,0 +1,78 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-08-26 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + String flowName = CurPage.getParameter("FlowName"); + //获取是否已经生成提提前结清数据 + String number = Sqlca.getString("select COUNT(*) from LC_FUND_RENT_ADJUST_TEMP where flowunid='"+flowunid+"'"); + String userID = CurUser.getUserID(); + String orgID = CurUser.getOrgID(); + ASObjectModel doTemp = new ASObjectModel("LCEbankTempList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary = "1"; + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","do_delete()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/TriditionLCContractTerminateInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/TriditionLCContractTerminateInfo.jsp new file mode 100644 index 000000000..3ef59ed79 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCContractTerminate/TriditionLCContractTerminateInfo.jsp @@ -0,0 +1,179 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-06-26 + Content: 示例详情页面 + History Log: + */ + + String flowunid = CurPage.getParameter("FlowUnid"); + String contractid = CurPage.getParameter("ContractId"); + String RightType = CurPage.getParameter("RightType");//选择模式 + String ishistory=CurPage.getParameter("IsHistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + + BizObject condition=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP","flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false); + String paymentnumber=condition.getAttribute("payment_number").getString(); + String contractId=condition.getAttribute("contract_id").getString(); + //获取项目违约金(只有传统的有) + String total_all = JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_CALC_CONDITION","CONTRACT_ID=:contractid").setParameter("contractid", contractid).getSingleResult(false).getAttribute("TOTAL_ALL").getString(); + + BizObject flow=GetFlowAction.getFlowBussinessObject(flowunid); + String productId=flow.getAttribute("productId").getString(); + + String sTempletNo = "TriditionLCContractTerminate";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("PAYMENT_NUMBER", paymentnumber); + doTemp.setHtmlEvent("PAYDAY_ADJUST","onchange","getTerminateInfo"); + doTemp.setHtmlEvent("REPURCHASE_RATIO","onchange","getRepurchaseMoney"); + + doTemp.setHtmlEvent("HANDLING_CHARGE","onchange","changeContract"); + doTemp.setHtmlEvent("AGREED_PENALTY","onchange","changeContract"); + doTemp.setHtmlEvent("AGREED_INTEREST","onchange","changeContract"); + doTemp.setHtmlEvent("COLLECT_FEES","onchange","changeContract"); + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + if((null!=RightType&&RightType.equals("ReadOnly"))||(null!=ishistory&&ishistory.equals("true"))){ + dwTemp.ReadOnly = "-2";//只读模式 + isShowButton=false; + }else{ + isShowButton=true; + } + dwTemp.genHTMLObjectWindow(flowunid); + + String sButtons[][] = { + {"true","","Button","提前结清","提前结清","saveRecord()","","","","btn_icon_settle"}, + {"true","","Button","撤销结清","撤销结清","cancelChange()","","","","btn_icon_delete"} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtion/LCPayCondtionList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtion/LCPayCondtionList.jsp index e9db9bdca..2805df122 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtion/LCPayCondtionList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtion/LCPayCondtionList.jsp @@ -170,7 +170,7 @@ /*~[Describe=导入;InputParam=无;OutPutParam=无;]~*/ function importCondition(){ var sParam = "FlowUnid="+"<%=sFlowUnid%>"+",Plan_Number="+"<%=sPlanNumber%>"+",Fee_Type="+"<%=sFeeType%>"+",Plan_List="+"<%=sPlanList%>"; - AsDialog.OpenSelector("SelectPayCondition","ProjectId,"+"<%=projectId%>","dialogWidth=" + parseInt(window.screen.width * 0.6) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectPayConditionScreening","ProjectId,"+"<%=projectId%>","dialogWidth=" + parseInt(window.screen.width * 0.6) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ return; diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtionPayment/LCPayCondtionInfo.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtionPayment/LCPayCondtionInfo.jsp index 3230d8052..9dfc904b2 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtionPayment/LCPayCondtionInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCPayCondtionPayment/LCPayCondtionInfo.jsp @@ -120,7 +120,6 @@ /*~[Describe=返回;InputParam=无;OutPutParam=无;]~*/ function goBack()//页面的返回 { - debugger; //要跳转的url var sUrl = "/Tenwa/Lease/Flow/Comm/LCPayCondtionPayment/LCPayCondtionList.jsp"; //要传的参数 diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/LCStandardInterestTempInof.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/LCStandardInterestTempInof.jsp index 7d5b79cbe..ddf9b9128 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/LCStandardInterestTempInof.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/LCStandardInterestTempInof.jsp @@ -1,27 +1,43 @@ -<%@ page contentType="text/html; charset=GBK"%> -<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% - /* - Author: undefined 2017-08-02 - Content: 示例详情页面 - History Log: - */ - - String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 - String ishistory=CurPage.getParameter("IsHistory"); - String sTempletNo = "LCStandardInterestTempInfo";//--模板号-- - - CurPage.getCurComp().setAttribute("RightType", null); - ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ - doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 - } - ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); - dwTemp.Style = "2";//freeform - dwTemp.ReadOnly = "-2";//只读模式 - dwTemp.genHTMLObjectWindow(sFlowUnid); - - String sButtons[][] = { - }; - sButtonPosition = "south"; -%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> -<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file +<%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.tenwa.reckon.util.TbBeanTools"%> +<%@page import="com.tenwa.reckon.bean.TabCalBean"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@page import="com.tenwa.comm.util.jboutil.DataOperatorUtil"%> +<%@ include file="/IncludeBegin.jsp"%><% + /* + Author: undefined 2017-08-02 + Content: 示例详情页面 + History Log: + */ + JBOTransaction tx=null; + tx=JBOFactory.createJBOTransaction(); + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + BizObject flow=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_STANDARD_INTEREST_TEMP","flowunid=:flowunid").setParameter("flowunid", sFlowUnid).getSingleResult(false); + String startdate=""; + if(flow!=null){ + startdate=flow.getAttribute("start_date").getString(); + } + BizObject flowold=null; + String oldid=""; + if(!startdate.equals("")&&startdate!=null){ + String sql="SELECT id FROM LC_STANDARD_INTEREST WHERE start_date<:start_date ORDER BY start_date DESC LIMIT 0,1"; + Map param=new HashMap(); + param.put("start_date", startdate); + List>list= DataOperatorUtil.getDataBySql(tx, sql, param); + //flowold=JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LC_STANDARD_INTEREST","SELECT id FROM O WHERE O.start_date<:start_date ORDER BY O.start_date DESC LIMIT 0,1").setParameter("start_date", startdate).getSingleResult(false); + if(list.size()>0){ + oldid=list.get(0).get("id"); + } + + } + tx.commit(); +%><%@include file="/Resources/CodeParts/Frame02.jsp"%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/NowLCStandardInterestTempInof.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/NowLCStandardInterestTempInof.jsp new file mode 100644 index 000000000..3c74b027e --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/NowLCStandardInterestTempInof.jsp @@ -0,0 +1,34 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-08-02 + Content: 示例详情页面 + History Log: + */ + + String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号 + String ishistory=CurPage.getParameter("IsHistory"); + String sTempletNo = "LCStandardInterestTempInfo";//--模板号-- + + CurPage.getCurComp().setAttribute("RightType", null); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(sFlowUnid); + //dwTemp.replaceColumn("other", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/OldLCStandardInterestTempInof.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/OldLCStandardInterestTempInof.jsp new file mode 100644 index 000000000..39679c803 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Comm/LCStandard/OldLCStandardInterestTempInof.jsp @@ -0,0 +1,34 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-08-02 + Content: 示例详情页面 + History Log: + */ + + String id = (String)CurPage.getParameter("sid");//流程编号 + String ishistory=CurPage.getParameter("IsHistory"); + String sTempletNo = "OldLCStandardInterestTempInfo";//--模板号-- + + CurPage.getCurComp().setAttribute("RightType", null); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(id); + //dwTemp.replaceColumn("other", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/QuotationList/QuotationList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/QuotationList/QuotationList.jsp index d9264d8c3..6e8ac152e 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/QuotationList/QuotationList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/QuotationList/QuotationList.jsp @@ -75,9 +75,9 @@ if("".equals(PROJECT_PLAN_NUMBER)||PROJECT_PLAN_NUMBER.length()==0){ getObj(0,i,"FILENAME").innerHTML=html; }; for(var i=0;i <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractCancle/ContractCancelApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractCancle/ContractCancelApplyList.jsp index 5f277339d..aac581a79 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractCancle/ContractCancelApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractCancle/ContractCancelApplyList.jsp @@ -4,7 +4,31 @@ <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList.jsp index d83536b24..b07cc41f4 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList.jsp @@ -5,7 +5,16 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectContractForSupport","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var orgId="<%=CurUser.getOrgID()%>".substring(0, 7); + var businessType=""; + if(orgId=="8009010"){ + businessType="2"; + }else if(orgId=="8009011"){ + businessType="3"; + }else{ + businessType="false"; + } + AsDialog.OpenSelector("SelectContractForSupport","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList_Car.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList_Car.jsp index d83536b24..e62e1307c 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList_Car.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractDataSupport/ContractDataSupportApplyList_Car.jsp @@ -5,7 +5,7 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectContractForSupport","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectContractForSupport_Car","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -16,8 +16,11 @@ var product_id=sReturn[2]; var contract_number = sReturn[3]; var project_name = sReturn[4]; + var CustomerType = sReturn[5]; + var carAttributes = sReturn[6]; + var leasehold = sReturn[7]; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",customertype="+CustomerType+",carAttributes="+carAttributes+",leasform="+leasehold+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractEnd/ContractEndApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractEnd/ContractEndApplyList.jsp index 9ac3e9276..e0dc21e30 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractEnd/ContractEndApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractEnd/ContractEndApplyList.jsp @@ -5,7 +5,17 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectContractForEnd","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + if(orgId=="8009010"){ + businessType="2"; + }else if(orgId=="8009011"){ + businessType="3"; + }else{ + alert("当前用户不能发起申请!"); + return; + } + AsDialog.OpenSelector("SelectContractForEnd","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -16,8 +26,9 @@ var product_id=sReturn[2]; var contract_number = sReturn[3]; var project_name = sReturn[4]; + var customertype = sReturn[5]; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",customertype="+customertype+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractInsurance/LBClaimsBookDetailTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractInsurance/LBClaimsBookDetailTempInfo.jsp index f7c9efdaf..592bcb04a 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractInsurance/LBClaimsBookDetailTempInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractInsurance/LBClaimsBookDetailTempInfo.jsp @@ -47,7 +47,6 @@ var libId = AsControl.RunJsp("/Tenwa/Lease/Flow/Contract/ContractInsurance/GetLBDocAttributeIDsForClaimsBook.jsp", "FLOW_UNID=<%=ID%>&OBJECTTYPE=InsuranceClaimsFlow"); var sParams="libId="+libId; - debugger; var sReturnInfo = RunJavaMethodTrans("com.tenwa.doc.action.DocListAction","recoveryAttr",sParams); } $(function(){ diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhire/ContractOnhireApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhire/ContractOnhireApplyList.jsp index 3380bd7d5..a3012394e 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhire/ContractOnhireApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhire/ContractOnhireApplyList.jsp @@ -5,7 +5,16 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("selectContractPaymentPlan","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var orgId="<%=CurUser.getOrgID()%>".substring(0, 7); + var businessType=""; + if(orgId=="8009010"){ + businessType="2"; + }else if(orgId=="8009011"){ + businessType="3"; + }else{ + businessType="false"; + } + AsDialog.OpenSelector("selectContractPaymentPlanBusiness","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -18,7 +27,7 @@ var project_name = sReturn[4]; var payment_number = sReturn[5]; var sParams = "applyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",payment_number="+payment_number+",ProjectId="+project_id+",FlowKey="+payment_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name; + sParams =sParams+",payment_number="+payment_number+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name; var sReturnInfo = RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); @@ -29,7 +38,7 @@ } else { - var mes=sReturnInfos[1]; + var mes=sReturnInfos[0]; alert(mes); } reloadSelf(); @@ -47,7 +56,6 @@ SviewTab(param["ObjectType"],param["ObjectNo"],param["FlowNo"],param["PhaseNo"],param["TaskNo"]); } function SviewTab(sObjectType,sObjectNo,sFlowNo,sPhaseNo,sTaskNo){ - debugger; var flowkey=getItemValue(0,getRow(0),"FLOW_KEY"); //根据flow_object的数据,获取Flow_Task表中未完成的任务流水号 if(sTaskNo==""){ diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/ContractOnhireChangeApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/ContractOnhireChangeApplyList.jsp index 49bef31e2..cd5212213 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/ContractOnhireChangeApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/ContractOnhireChangeApplyList.jsp @@ -5,7 +5,23 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("selectContractOnhireChange","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var flowno="<%=CurPage.getParameter("ApplyType")%>"; + var selname=""; + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + if("ContractOnhireCarChangeApply"==flowno||"ContractBasicInfoChangeApply"==flowno){ + businessType="1"; + }else{ + if(orgId=="8009011"){ + businessType="3"; + }else if(orgId=="8009010"){ + businessType="2"; + }else{ + alert("当前用户不能发起申请!"); + return; + } + } + AsDialog.OpenSelector("selectContractOnhireChange","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -16,8 +32,10 @@ var product_id=sReturn[2]; var contract_number = sReturn[3]; var project_name = sReturn[4]; + var carType = sReturn[5]; + var customerType = sReturn[6]; var sParams = "applyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name; + sParams =sParams+",customertype="+customerType+",carAttributes="+carType+",ProjectId="+project_id+",FlowKey="+contract_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.onhirechange.OnhireChangeFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/TriditionContractOnhireChangeApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/TriditionContractOnhireChangeApplyList.jsp new file mode 100644 index 000000000..1d1642861 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractOnhireChange/TriditionContractOnhireChangeApplyList.jsp @@ -0,0 +1,50 @@ +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Contract/ContractTerminate/ContractTerminateApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/ContractTerminate/ContractTerminateApplyList.jsp index 3b20da482..d223d2691 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/ContractTerminate/ContractTerminateApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/ContractTerminate/ContractTerminateApplyList.jsp @@ -17,6 +17,12 @@ var contract_number = sReturn[3]; var project_name = sReturn[4]; var payment_number = sReturn[5]; + //校验是否有保证金代偿 + /* var isCompensation = AsControl.RunJavaMethod("com.tenwa.reckon.executor.RentCalHelper","isCompensation","contractId="+contract_id); + if("false" == isCompensation){ + alert("该合同有保证金代偿,无法发起提请结清!"); + return ; + } */ var sParams = "applyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; sParams =sParams+",payment_number="+payment_number+",ProjectId="+project_id+",FlowKey="+payment_number+",ProductId="+product_id+",ContractId="+contract_id+",ProjectName="+project_name; var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.contract.terminate.TerminateFlowStartAction","initFLow",sParams); diff --git a/WebContent/Tenwa/Lease/Flow/Contract/TraditionContractTerminate/TraditionContractTerminateApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/TraditionContractTerminate/TraditionContractTerminateApplyList.jsp new file mode 100644 index 000000000..041716859 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Contract/TraditionContractTerminate/TraditionContractTerminateApplyList.jsp @@ -0,0 +1,49 @@ +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Contract/contractInfoAllView/contractInfoAllViewList.jsp b/WebContent/Tenwa/Lease/Flow/Contract/contractInfoAllView/contractInfoAllViewList.jsp index fa9e8d019..7d59032ce 100644 --- a/WebContent/Tenwa/Lease/Flow/Contract/contractInfoAllView/contractInfoAllViewList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Contract/contractInfoAllView/contractInfoAllViewList.jsp @@ -1,10 +1,75 @@ +<%@page import="jbo.app.tenwa.customer.DISTRIBUTOR_INFO"%> <%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> <% - ASObjectModel doTemp = new ASObjectModel("ContractInfoAllView"); - String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); - doTemp.appendJboWhere(sCondtion); + + String InfoForType=CurPage.getParameter("InfoForType"); + String userid=CurUser.getUserID().substring(0,5); + String userid1=CurUser.getUserID(); + String Orgid=CurUser.getOrgID(); + String Model=""; + String distributor_id=""; + if(InfoForType.equals("02")){ + Model="ContractInfoAllViewFroCT"; + }else{ + if("8006U".equals(userid)){ + String sSql = "select distributor_no from O where orgid = :orgid"; + BizObject bo = JBOFactory.createBizObjectQuery(DISTRIBUTOR_INFO.CLASS_NAME, sSql).setParameter("orgid", Orgid).getSingleResult(false); + distributor_id=bo.getAttribute("distributor_no").toString(); + + Model="ContractInfoAllViewFroJXS"; + }else{ + Model="ContractInfoAllViewFroQC"; + } + } + ASObjectModel doTemp = new ASObjectModel(Model); + if("ContractInfoAllViewFroJXS".equals(Model)){ + /* String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); */ + //做合同信息查询加权限时将此代码注释掉了 + //doTemp.appendJboWhere(" and O.distributor_id='"+distributor_id+"'"); + } + //合同信息查询加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid1).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 北财合作方 + String roleId = "800R00000044"; + if(InfoForType.equals("02")){//传统和汽车类传统 + String orgidB = Orgid.substring(0,7); + if("8009011".equals(orgidB)){ + doTemp.appendJboWhere(" and O.businesstype='3' "); + }else if("8009010".equals(orgidB)){ + doTemp.appendJboWhere(" and O.businesstype='2' "); + }else{ + doTemp.appendJboWhere(" and (O.businesstype='2' or O.businesstype='3' )"); + } + }else{//C端汽车 + //roleid:800R00000045 rolename: bccuishou + //如果登录人属于bccuishou角色,可以看到北财下的所有的合同 + if(roleList.contains("800R00000045")){ + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId = bo.getAttribute("userid").toString(); + useridList.add("'"+userId+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + doTemp.appendJboWhere(" and O.project_manage='"+userid1+"'"); + } + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 @@ -37,19 +102,27 @@ function viewAllFlowAttachment(){ alert("参数不能为空!"); return ; } - var sparm='proj_id='+proj_id+'&contract_id='+sPara+"&type=contract&IsHistory=true"; + var sparm='proj_id='+proj_id+'&contract_id='+sPara+"&type=contract&IsHistory=true&query=query"; AsControl.OpenTab(sUrl,sparm,{title:'流程附件信息'}); } function viewContractInfo(){ var sUrl = "/Tenwa/Lease/App/InformationTable/InfoView.jsp"; var sPara = getItemValue(0,getRow(0),'id'); + var contract_no = getItemValue(0,getRow(0),'contract_no'); + var productId = getItemValue(0,getRow(0),'PRODUCT_ID'); + var FlowUnid = getItemValue(0,getRow(0),'flowunid'); if(typeof(sPara)=="undefined" || sPara.length==0 ){ alert("参数不能为空!"); return ; } - var sparm='ContractId='+sPara+"&ProjectId="+getItemValue(0,getRow(0),'project_id')+"&ShowType=flow_contract_sum&RightType=ReadOnly&IsHistory=false"; - AsControl.OpenTab(sUrl,sparm,{title:'合同基本信息【'+ getItemValue(0,getRow(0),'contract_number')+'】'}); + var ShowType="flow_contract_sum"; + //判断是汽车的还是传统的合同查询 + if("01"=="<%=InfoForType%>"){ + ShowType="flow_contract_sum_car"; + } + var sparm='ContractId='+sPara+"&ProjectId="+getItemValue(0,getRow(0),'project_id')+"&ShowType="+ShowType+"&RightType=ReadOnly&IsHistory=false"+"&contract_no="+contract_no+"&productId="+productId+"&FlowUnid="+FlowUnid; + AsControl.OpenTab(sUrl,sparm,{title:'合同基本信息【'+ getItemValue(0,getRow(0),'contract_number')+'】'}); } <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/FileArchiving/FileArchivingInfo.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/FileArchiving/FileArchivingInfo.jsp index 761e841ef..702661c8e 100644 --- a/WebContent/Tenwa/Lease/Flow/FileManager/FileArchiving/FileArchivingInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/FileManager/FileArchiving/FileArchivingInfo.jsp @@ -9,8 +9,14 @@ BizObjectManager ftManager = JBOFactory.getBizObjectManager(FLOW_TASK.CLASS_NAME); List fts = ftManager.createQuery("select * from o left join jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT fbo on o.objectno=fbo.flow_unid where fbo.contract_id=:contractid and o.flowno='FundPaymentFlow' and o.phasetype='1040' order by endtime desc").setParameter("contractid",Id).getResultList(false); String flowUnid = ""; + String flowNo = ""; if(fts.size()>0){ flowUnid = fts.get(0).getAttribute("objectno").getString(); + flowNo = "FundPaymentFlow"; + }else{ + fts = ftManager.createQuery("select * from o left join jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT fbo on o.objectno=fbo.flow_unid where fbo.contract_id=:contractid and o.flowno='FundPaymentCarFlow' and o.phasetype='1040' order by endtime desc").setParameter("contractid",Id).getResultList(false); + flowUnid = fts.get(0).getAttribute("objectno").getString(); + flowNo = "FundPaymentCarFlow"; } ASObjectModel doTemp = new ASObjectModel("LBFileArchivingInfo"); doTemp.setDefaultValue("ARCHIVING_PERSON", curUserId); @@ -20,7 +26,7 @@ dwTemp.Style = "2"; dwTemp.genHTMLObjectWindow(Id); String compClientID = request.getParameter("CompClientID"); - dwTemp.replaceColumn("doclist", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("doclist", "", CurPage.getObjectWindowOutput()); String sButtons[][] =new String[][] { {"true","","Button","返回","返回","goBack()","","","","btn_icon_return"}, {"true","","Button","归档并返回","归档并返回","fileArchiving()","","","","btn_icon_edit"} diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/FileReturn/FileReturnList.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/FileReturn/FileReturnList.jsp index c673e6fde..4b683ef18 100644 --- a/WebContent/Tenwa/Lease/Flow/FileManager/FileReturn/FileReturnList.jsp +++ b/WebContent/Tenwa/Lease/Flow/FileManager/FileReturn/FileReturnList.jsp @@ -17,9 +17,9 @@ Map flowParam = GetFlowAction.getFlowParamByFlowUnid(sFlowUnid); String borrowId = flowParam.get("BorrowId"); ASObjectModel doTemp = new ASObjectModel(sTempletNo); - BizObject lfbit = JBOFactory.getBizObjectManager(LB_FILE_BORROWING_INFO_TEMP.CLASS_NAME).createQuery("FLOWUNID=:flowunid ").setParameter("flowunid",sFlowUnid).getSingleResult(false); - String fileIds = lfbit.getAttribute("DOCIDS").getString(); - doTemp.setJboWhere("ID IN "+fileIds); + BizObject lfbit = JBOFactory.getBizObjectManager(LB_FILE_BORROWING_INFO_TEMP.CLASS_NAME).createQuery("FLOWUNID=:flowunid ").setParameter("flowunid",sFlowUnid).getSingleResult(false); + String fileIds = lfbit.getAttribute("DOCIDS").getString(); + //doTemp.setJboWhere("ID IN "+fileIds); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; dwTemp.ReadOnly = "1"; diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/FileUpload.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/FileUpload.jsp new file mode 100644 index 000000000..db68babc7 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/FileUpload.jsp @@ -0,0 +1,86 @@ +<%@page import="java.net.URLDecoder"%> +<%@page import="com.amarsoft.are.jbo.impl.BizObjectTableMapper"%> +<%@page import="com.amarsoft.awe.util.DBKeyHelp"%> +<%@page import="com.amarsoft.awe.common.attachment.*"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBegin.jsp"%><% + AmarsoftUpload myAmarsoftUpload = new AmarsoftUpload(); + myAmarsoftUpload.initialize(pageContext); + myAmarsoftUpload.upload(); + String FileSizejs=(String)myAmarsoftUpload.getRequest().getParameter("FileSize2"); + String docType=(String)myAmarsoftUpload.getRequest().getParameter("DOC_TYPE"); + String oneClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("ONE_CLASSIFY"); + String twoClassfiy=(String)myAmarsoftUpload.getRequest().getParameter("TWO_CLASSIFY"); + String objectType=(String)myAmarsoftUpload.getRequest().getParameter("OBJECTTYPE"); +// String sFileName =URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8"); //文件名称 + String sFileName = myAmarsoftUpload.getFiles().getFile(0).getFileName(); +// System.out.println("文件名==="+ URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("FILENAMEX"),"UTF-8")); +// String Remark=URLDecoder.decode((String)myAmarsoftUpload.getRequest().getParameter("REMARK2"),"UTF-8"); //备注InputTime + String Remark= (String)myAmarsoftUpload.getRequest().getParameter("REMARK"); //备注InputTime + String libraryId= (String)myAmarsoftUpload.getRequest().getParameter("ID"); //附件编号 + String InputTime= StringFunction.getTodayNow(); //附件编号上传时间 + + BizObjectManager libBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCLIBRARY"); + BizObjectManager attrBm=JBOFactory.getBizObjectManager("jbo.app.tenwa.doc.LB_DOCATTRIBUTE"); + BizObject lib=libBm.createQuery("id=:id").setParameter("id", libraryId).getSingleResult(true); +// lib.setAttributeValue("Remark", Remark); +// libBm.saveObject(lib); + BizObject attr=attrBm.newObject(); + attr.setAttributeValue("Library_Id", libraryId); + attr.setAttributeValue("FileName", sFileName); + attr.setAttributeValue("InputUserId", CurUser.getUserID()); + attr.setAttributeValue("InputOrgId", CurUser.getOrgID()); + attr.setAttributeValue("InputTime",InputTime); + attr.setAttributeValue("objectType", objectType); + + //得到不带路径的文件名 + sFileName = StringFunction.getFileName(sFileName); + sFileName = URLDecoder.decode(URLDecoder.decode(sFileName,"UTF-8"),"UTF-8"); + //定义数据库操作变量 + SqlObject so = null; + String sNewSql = ""; + String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + String sFileNameType = CurConfig.getConfigure("FileNameType"); + + String trueTable = ((BizObjectTableMapper)attrBm).getTable(); //取得真实的表名 + String sAttachmentNo = DBKeyHelp.getSerialNo(trueTable,"Id"); + + if (!myAmarsoftUpload.getFiles().getFile(0).isMissing()){ + try { + //System.out.println("sDocNo="+libraryId+"--sAttachmentNo="+sAttachmentNo+"--sFileName="+sFileName+"--sFileSavePath="+sFileSavePath); + //System.out.println("sFileNameType="+sFileNameType+"--application="+application); + //String sFullPath = com.amarsoft.awe.common.attachment.FileNameHelper.getFullPath(libraryId, sAttachmentNo,sFileName, sFileSavePath, sFileNameType, application); + String uuid=java.util.UUID.randomUUID().toString().replaceAll("-", ""); + String sFullPath =com.tenwa.officetempalte.util.FileOperatorUtil.getuploadFileDir(sFileSavePath) +uuid+"_"+sFileName; +// if(myAmarsoftUpload.getFiles().getFile(0).getSize()!=Integer.parseInt(FileSizejs)){ +// throw new Exception("上传文件失败,请联系管理员!"); +// } + myAmarsoftUpload.getFiles().getFile(0).saveAs(sFullPath); + //得到带相对路径的文件名 + String sFilePath = sFullPath.replace(sFileSavePath, ""); + attr.setAttributeValue("FilePath",sFilePath); + attr.setAttributeValue("FullPath",sFullPath); + attr.setAttributeValue("Content_Type",DataConvert.toString(myAmarsoftUpload.getFiles().getFile(0).getContentType())); + attr.setAttributeValue("FileSize",DataConvert.toString(String.valueOf(myAmarsoftUpload.getFiles().getFile(0).getSize()))); + attrBm.saveObject(attr); + myAmarsoftUpload = null; + }catch(Exception e){ + e.printStackTrace(); + out.println("An error occurs : " + e.toString()); + attrBm.deleteObject(attr); + myAmarsoftUpload = null; +%> + +<% + } + } +%> + +<%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbContactInfo.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbContactInfo.jsp index db4b9c28e..87d61020d 100644 --- a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbContactInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbContactInfo.jsp @@ -13,12 +13,12 @@ doTemp.setColTips("", ""); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.ReadOnly = "-2";//只读模式 dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid")); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, - {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} }; //sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryInfo.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryInfo.jsp new file mode 100644 index 000000000..10c179595 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryInfo.jsp @@ -0,0 +1,99 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-07 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LbDoclibraryInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("", ""); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryList.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryList.jsp index 8e0fa30a7..09a0500a0 100644 --- a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryList.jsp +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbDoclibraryList.jsp @@ -22,7 +22,22 @@ {"true","All","Button","保存","保存","saveRecord()","","","","btn_icon_add",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> - +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingListTemp.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingListTemp.jsp new file mode 100644 index 000000000..6d9097289 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingListTemp.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-17 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LbFileArchivingListTemp"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingList_CTTemp.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingList_CTTemp.jsp new file mode 100644 index 000000000..3715052a3 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchivingList_CTTemp.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-17 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LbFileArchivingListTemp"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchiving_CTInfo.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchiving_CTInfo.jsp new file mode 100644 index 000000000..27263d15c --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/LbFileArchiving_CTInfo.jsp @@ -0,0 +1,50 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-07-17 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String FLOWUNID = CurPage.getParameter("ObjectNo"); + if(sPrevUrl == null) sPrevUrl = ""; + String inputuserid = CurUser.getUserID(); + String inputusername = CurUser.getUserName(); + String inputorgid = CurOrg.getOrgID(); + String inputorgname = CurOrg.getOrgName(); + + String sTempletNo = "LbFileArchivingInfoTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("", ""); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(FLOWUNID); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{"true","All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/Mortgage2FileApplyList.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/Mortgage2FileApplyList.jsp new file mode 100644 index 000000000..8a85b2066 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/Mortgage2FileApplyList.jsp @@ -0,0 +1,39 @@ + +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/MortgageFileApplyList.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/MortgageFileApplyList.jsp index 95090a348..f5c511d7a 100644 --- a/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/MortgageFileApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/FileManager/MortgageFile/MortgageFileApplyList.jsp @@ -5,8 +5,15 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FileManager/fileList/rentFileList.jsp b/WebContent/Tenwa/Lease/Flow/FileManager/fileList/rentFileList.jsp new file mode 100644 index 000000000..dbf52603a --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FileManager/fileList/rentFileList.jsp @@ -0,0 +1,38 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-07-16 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("RentFileList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- +// dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增一条记录","newRecord()","","","","btn_icon_add"}, + {"false","All","Button","修改","查看/修改详情","viewAndEdit()","","","","btn_icon_edit"}, +// {"true","","Button","详情","查看/修改详情","view()","","","","btn_icon_detail"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationApplyList.jsp b/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationApplyList.jsp index dd69e3874..e5dd50615 100644 --- a/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationApplyList.jsp @@ -5,7 +5,7 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectPaymentForFiveGrade","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + AsDialog.OpenSelector("SelectPaymentForFiveGrade","businessType,1","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; diff --git a/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationTriditionApplyList.jsp b/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationTriditionApplyList.jsp new file mode 100644 index 000000000..ca54e4075 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/FiveGradeClassification/ManualFiveGradeClassification/FiveGradeClassificationTriditionApplyList.jsp @@ -0,0 +1,41 @@ +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentApplyList.jsp index 3a61e0b07..f85a9f5f4 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentApplyList.jsp @@ -5,7 +5,17 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply() { - AsDialog.OpenSelector("SelectPassPaymentPlan","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + if(orgId=="8009010"){ + businessType="2"; + }else if(orgId=="8009011"){ + businessType="3"; + }else{ + alert("当前用户不能发起申请!"); + return; + } + AsDialog.OpenSelector("SelectPassPaymentPlan","businessType,"+businessType,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -17,6 +27,8 @@ var feeTypes = ""; var allPayMoney = 0; var equipAmtIDs = ""; + var payment_number=""; + var contract_id=""; for(var i=0;i<%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentCarTempList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentCarTempList.jsp new file mode 100644 index 000000000..3e0c53bc1 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentCarTempList.jsp @@ -0,0 +1,388 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String sFileSaveMode = CurConfig.getConfigure("FileSaveMode"); + String sFileSavePath = CurConfig.getConfigure("FileSavePath"); + String sFileNameType = CurConfig.getConfigure("FileNameType"); + + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurComp.getParameter("RightType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String ishistory = CurPage.getParameter("IsHistory"); + String contract_id = CurPage.getParameter("contract_id"); + String projectId = CurPage.getParameter("ProjectId"); + String payType = Sqlca.getString(new SqlObject("SELECT payType FROM LC_FUND_INCOME_TEMP_HXM WHERE flowunid='"+flowunid+"'")); + ASObjectModel doTemp = new ASObjectModel("ActualPaymentCarTempList"); +/* if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); + } */ + String customertype = null; + String customer_id = null; + String project_id = null; + String product_id = null; + String contract_number = null; + ASResultSet rs = Sqlca.getASResultSet(new SqlObject("select customertype,contract_number,customer_id,LC_FUND_INCOME_TEMP.project_id,Product_Id from LC_FUND_INCOME_TEMP left join LB_CONTRACT_INFO lpi on lpi.PROJECT_ID=LC_FUND_INCOME_TEMP.PROJECT_ID left join LB_UNION_LESSEE ul on LC_FUND_INCOME_TEMP.contract_id=ul.contract_id and ul.is_main='Y' left join CUSTOMER_INFO cu on ul.customer_id=cu.customerid where LC_FUND_INCOME_TEMP.contract_id = "+contract_id)); + if(rs.next()){ + customertype = rs.getString("customertype"); + customer_id = rs.getString("customer_id"); + project_id = rs.getString("project_id"); + product_id = rs.getString("Product_Id"); + contract_number = rs.getString("contract_number"); + }else{ + customertype = "gaoxiao"; + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; + dwTemp.ReadOnly = "0"; + dwTemp.ShowSummary = "1"; +/* if("0030".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + } */ + if("ReadOnly".equals(rightType)){ + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(pageSize == null?10:Integer.parseInt(pageSize)); + ASDataObject ado = dwTemp.getDataObject(); + ado.setLockCount(3); + ado.setReadOnly("PAYMENT_NUMBER", true); + ado.setReadOnly("PROJECT_NAME", true); + ado.setReadOnly("PLAN_ID", true); + ado.setReadOnly("FEE_TYPE", true); + ado.setReadOnly("SETTLE_METHOD", true); + ado.setReadOnly("PLAN_DATE", true); + ado.setReadOnly("ACCOUNT", true); + ado.setReadOnly("ACC_NUMBER", true); + ado.setReadOnly("FACT_DATE", true); + ado.setReadOnly("BANK", true); + if("0010".equals(phaseNo)){ + ado.setReadOnly("ACCOUNTING_DATE", true); + } + if("0020".equals(phaseNo)){ + ado.setReadOnly("ACCOUNTING_DATE", false); + ado.setReadOnly("FACT_DATE", false); + } + if("0030".equals(phaseNo)){ + ado.setReadOnly("ACCOUNTING_DATE", true); + } + ado.setHtmlEvent("FACT_MONEY", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("FEE_ADJUST", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("MEMO", "onmouseover", "showMemo"); + ado.setHtmlEvent("MEMO", "onmouseout", "hideMemo"); + ado.setHtmlEvent("MEMO", "onkeyup", "synchMemo"); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if("ReadOnly".equals(rightType)){ + sButtons = new String[][]{ + }; + }else if("0010".equals(phaseNo)){ + sButtons = new String[][]{ + {"true","","Button","删除","删除","doDelete()","","","","btn_icon_delete",""}, }; + }else if("0020".equals(phaseNo)){ + if("0010".equals(payType)){ + sButtons = new String[][]{ + {"true","","Button","保存","保存","as_save(0,'setColRequired()')","","","","btn_icon_saveNew",""} , + {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_detail",""}, + {"true","","Button","发起付款申请","保存","cmb_tp_pay()","","","","btn_icon_save",""} + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","保存","保存","as_save(0,'setColRequired()')","","","","btn_icon_saveNew",""} , + {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_detail",""}, + }; + } + + }else if("0030".equals(phaseNo)&&"0010".equals(payType)){ + sButtons = new String[][]{ + {"true","","Button","付款结果回盘","付款结果回盘","cmb_tp_callback()","","","","btn_icon_delete",""}, + }; + }else{ + sButtons = new String[][]{ + // {"true","","Button","保存","保存","as_save(0,'setColRequired()')","","","","btn_icon_saveNew",""}, + // {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_detail",""}, + // {"true","","Button","导出付款明细","导出付款明细","createFundIncomeExcel()","","","","btn_icon_up",""}, + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempList.jsp index 962458071..8919432d0 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempList.jsp @@ -1,4 +1,11 @@ <%@ page contentType="text/html; charset=GBK"%> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOException"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT"%> +<%@page import="jbo.app.tenwa.customer.DISTRIBUTOR_ACCOUNT"%> +<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%> +<%@page import="jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% /* Author: undefined 2017-06-06 @@ -9,6 +16,7 @@ String rightType = CurComp.getParameter("RightType"); String flowunid = CurPage.getParameter("FlowUnid"); String ishistory = CurPage.getParameter("IsHistory"); + String applyType = CurPage.getParameter("applyType"); ASObjectModel doTemp = new ASObjectModel("ActualPaymentTempList"); if(null!=ishistory&&ishistory.equals("true")){ doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); @@ -18,7 +26,7 @@ dwTemp.MultiSelect = true; dwTemp.ReadOnly = "0"; dwTemp.ShowSummary = "1"; - if("0030".equals(phaseNo)){ + if(!"0020".equals(phaseNo)){ rightType = "ReadOnly"; dwTemp.ReadOnly = "1"; } @@ -41,7 +49,34 @@ ado.setHtmlEvent("MEMO", "onmouseover", "showMemo"); ado.setHtmlEvent("MEMO", "onmouseout", "hideMemo"); ado.setHtmlEvent("MEMO", "onkeyup", "synchMemo"); + dwTemp.genHTMLObjectWindow(flowunid); + + //添加本方银行默认值 + BizObject bo = JBOFactory.createBizObjectQuery(OWN_ACCOUNT.CLASS_NAME,"select * from O where state_=:state AND ACC_TYPE=:accType AND ACCOUNT_TYPE=:accountType") + .setParameter("state","0010").setParameter("accType", "0010").setParameter("accountType", "out_account").getSingleResult(false); + String bank = bo.getAttribute("acc_bank").getString(); + String accName = bo.getAttribute("acc_name").getString(); + String accNumber = bo.getAttribute("acc_number").getString(); + //添加对方银行默认值 ActualPaymentApply + BizObject bo2 =null; + if("FundPaymentApply".equals(applyType)){ + bo2=JBOFactory.createBizObjectQuery(DISTRIBUTOR_ACCOUNT.CLASS_NAME, + "SELECT DISTINCT O.acc_number,O.open_bank,O.account FROM O RIGHT JOIN jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO lci ON lci.DISTRIBUTOR_ID = O.DISTRIBUTOR_ID AND O.is_main = 'Y' RIGHT JOIN jbo.app.tenwa.calc.LC_FUND_PLAN_TEMP lfit ON lfit.CONTRACT_ID = lci.ID WHERE lfit.FLOWUNID =:flowunid AND lfit.PAY_TYPE = 'pay_type_out'") + .setParameter("flowunid", flowunid).getSingleResult(false); + }else if("ActualPaymentApply".equals(applyType)){ + bo2=JBOFactory.createBizObjectQuery(DISTRIBUTOR_ACCOUNT.CLASS_NAME, + "SELECT DISTINCT O.acc_number,O.open_bank,O.account FROM O RIGHT JOIN jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO lci ON lci.DISTRIBUTOR_ID = O.DISTRIBUTOR_ID AND O.is_main = 'Y' RIGHT JOIN jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP lfit ON lfit.CONTRACT_ID = lci.ID WHERE lfit.FLOWUNID =:flowunid AND lfit.PAY_TYPE = 'pay_type_out'") + .setParameter("flowunid", flowunid).getSingleResult(false); + } + String bank2 = ""; + String accName2 = ""; + String accNumber2 = ""; + if(bo2!=null){ + bank2 = bo2.getAttribute("open_bank").getString(); + accName2 = bo2.getAttribute("account").getString(); + accNumber2 = bo2.getAttribute("acc_number").getString(); + } //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String[][] sButtons = null; @@ -50,16 +85,46 @@ }; }else{ sButtons = new String[][]{ - {"true","","Button","保存","保存","as_save(0,'setColRequired()')","","","","btn_icon_save",""}, + {"true","","Button","保存","确认信息","as_save(0,'setColRequired()')","","","","btn_icon_save",""}, {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_delete",""} }; } %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempListBySubtotal1.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempListBySubtotal1.jsp new file mode 100644 index 000000000..fe7ae3d20 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/ActualPaymentTempListBySubtotal1.jsp @@ -0,0 +1,86 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurPage.getParameter("RightType"); + //此页面以后只作为显示页面。 + rightType="ReadOnly"; + String flowunid = CurPage.getParameter("FlowUnid"); + String ishistory = CurPage.getParameter("IsHistory"); + ASObjectModel doTemp = new ASObjectModel("LC_FUND_INCOME_TEMP_HXM"); + /* if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); + } */ + String IS_FLOWING = Sqlca.getString(new SqlObject("select IS_FLOWING from lc_fund_income_temp where flowunid='"+flowunid+"'")); + String payType = Sqlca.getString(new SqlObject("SELECT payType FROM LC_FUND_INCOME_TEMP_HXM WHERE flowunid='"+flowunid+"'")); + doTemp.appendJboWhere("AND O.IS_FLOWING='"+IS_FLOWING+"'"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; + dwTemp.ReadOnly = "0"; + dwTemp.ShowSummary = "1"; + if("0010".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + } + if("ReadOnly".equals(rightType)){ + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(10); + ASDataObject ado = dwTemp.getDataObject(); + ado.setLockCount(5); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if("ReadOnly".equals(rightType)||"0020".equals(payType)||"0030".equals(payType)){ + sButtons = new String[][]{ + }; + }else if("0020".equals(phaseNo)){ + sButtons = new String[][]{ + {"true","","Button","发起付款申请","保存","cmb_tp_pay()","","","","btn_icon_save",""}, + }; + }else if("0030".equals(phaseNo)){ + sButtons = new String[][]{ + {"true","","Button","付款结果回盘","付款结果回盘","cmb_tp_callback()","","","","btn_icon_delete",""}, + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLog.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLog.jsp new file mode 100644 index 000000000..37493e65b --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLog.jsp @@ -0,0 +1,59 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-11 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("BC_PAY_INFO_LOG"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","发起更新","向北财发起更新付款信息","updateBC()","","","","btn_icon_detail",""}, + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLogInfo.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLogInfo.jsp new file mode 100644 index 000000000..27da3568e --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/BCpayInfoLogInfo.jsp @@ -0,0 +1,29 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-01-16 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "BC_PAY_INFO_LOG_INFO";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.genHTMLObjectWindow(CurPage.getParameter("SerialNo")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0,'returnList()')","","","",""}, + {"true","All","Button","返回","返回列表","returnList()","","","",""} + // {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/CheckApplyPassContract.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/CheckApplyPassContract.jsp new file mode 100644 index 000000000..b9605deb7 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/CheckApplyPassContract.jsp @@ -0,0 +1,13 @@ +<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME"%> +<%@page import="jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP"%> +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@page import="com.amarsoft.are.jbo.BizObject"%> +<%@page import="com.amarsoft.are.jbo.JBOFactory"%> +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@page import="java.math.BigDecimal"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + //String result = Sqlca.getString(new SqlObject("select case when count(1)>0 then 'true' else 'false' end from lc_fund_income O left join(select contract_id,sum(nvl(overmoney,0)) overmoney from vi_lc_fund_plan where fee_type in ('feetype1','feetype2','feetype27') group by contract_id) vlfp on vlfp.contract_id=O.contract_id where O.pay_status='apply_pass' and vlfp.overmoney = 0 and not exists (select 1 from lc_fund_income_temp where O.plan_id=plan_id and is_flowing='0')")); + String result = Sqlca.getString(new SqlObject("select case when count(1)>0 then 'true' else 'false' end from vi_actual_fund_plan")); + out.println(result); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/GetActualPayNumber.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/GetActualPayNumber.jsp new file mode 100644 index 000000000..94188459a --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/GetActualPayNumber.jsp @@ -0,0 +1,6 @@ +<%@page import="com.tenwa.util.SerialNumberUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String serialNumber = SerialNumberUtil.getActualPayNumber(Sqlca); + out.println(serialNumber); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/LBActualPaymentInfoTemp.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/LBActualPaymentInfoTemp.jsp new file mode 100644 index 000000000..253be410f --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/LBActualPaymentInfoTemp.jsp @@ -0,0 +1,22 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-12-28 + Content: 示例详情页面 + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + String sTempletNo = "LBActualPaymentInfoTemp";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "1";//只读模式 + dwTemp.genHTMLObjectWindow(flowunid); + + String sButtons[][] = { + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/TraditionActualPaymentTempList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/TraditionActualPaymentTempList.jsp new file mode 100644 index 000000000..aa090259c --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/TraditionActualPaymentTempList.jsp @@ -0,0 +1,189 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurComp.getParameter("RightType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String ishistory = CurPage.getParameter("IsHistory"); + ASObjectModel doTemp = new ASObjectModel("ActualPaymentTempListBusiness"); + if(!"0050".equals(phaseNo)){ + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); + } + } + doTemp.setVisible("CUST_NAME",false); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; + dwTemp.ReadOnly = "0"; + dwTemp.ShowSummary = "1"; + if("0030".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + } + if("ReadOnly".equals(rightType)){ + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(10); + ASDataObject ado = dwTemp.getDataObject(); + ado.setLockCount(4); + ado.setReadOnly("PAYMENT_NUMBER", true); + ado.setReadOnly("PROJECT_NAME", true); + ado.setReadOnly("PLAN_ID", true); + ado.setReadOnly("FEE_TYPE", true); + ado.setReadOnly("SETTLE_METHOD", true); + ado.setReadOnly("PLAN_DATE", true); + ado.setReadOnly("ACCOUNT", true); + ado.setReadOnly("ACC_NUMBER", true); + ado.setHtmlEvent("FACT_MONEY", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("FEE_ADJUST", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("MEMO", "onmouseover", "showMemo"); + ado.setHtmlEvent("MEMO", "onmouseout", "hideMemo"); + ado.setHtmlEvent("MEMO", "onkeyup", "synchMemo"); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if("ReadOnly".equals(rightType)){ + sButtons = new String[][]{ + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","保存","保存","as_save(0,'setColRequired()')","","","","btn_icon_save",""}, + {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_delete",""} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/VIActualFundPlan.jsp b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/VIActualFundPlan.jsp new file mode 100644 index 000000000..780c37f0d --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/ActualPayment/VIActualFundPlan.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-12-28 + Content: + History Log: + */ + String flowunid = CurPage.getAttribute("FlowUnid"); + String phaseNo = CurPage.getAttribute("PhaseNo"); + String ishistory = CurPage.getAttribute("IsHistory"); + ASObjectModel doTemp = new ASObjectModel("VIActualFundPlan"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + if(!ishistory.equals("true")&&"0010".equals(phaseNo)){ + dwTemp.MultiSelect = true; //多选 + } + dwTemp.ShowSummary="1"; //汇总 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(pageSize == null ? 30 : Integer.parseInt(pageSize)); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if(null!=ishistory&&ishistory.equals("true")){ + sButtons = new String[][]{}; + }else if("0010".equals(phaseNo)){ + sButtons = new String[][]{ + {"true","All","Button","生成本次付款明细","生成本次付款明细","createIncome()","","","","btn_icon_add",""} + }; + }else{ + sButtons = new String[][]{ + }; + } + +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundCollection/FundCollectionApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundCollection/FundCollectionApplyList.jsp index 7c2d136cd..46f5b293e 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/FundCollection/FundCollectionApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundCollection/FundCollectionApplyList.jsp @@ -5,7 +5,17 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbFundIncome.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbFundIncome.jsp new file mode 100644 index 000000000..00c407454 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbFundIncome.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-03-14 + Content: + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + ASObjectModel doTemp = new ASObjectModel("LBFundIncome"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contractId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbRentIncome.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbRentIncome.jsp new file mode 100644 index 000000000..3160c711e --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/LbRentIncome.jsp @@ -0,0 +1,46 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-03-14 + Content: + History Log: + */ + String contractId = CurPage.getParameter("ContractId"); + ASObjectModel doTemp = new ASObjectModel("LBRentIncome"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contractId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/VILCFundEquipAMTList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/VILCFundEquipAMTList.jsp index 86d8db8b6..5895360a4 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/VILCFundEquipAMTList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundPayment/VILCFundEquipAMTList.jsp @@ -31,19 +31,19 @@ }; }else{ sButtons = new String[][]{ - {"true","","Button","生成本次付款","生成本次付款","openFundPlanList()","","","","btn_icon_add",""} + {"true","","Button","申请放款","申请放款","openFundPlanList()","","","","btn_icon_add",""} }; } %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Fund/FundReback/FundRebackApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/FundReback/FundRebackApplyList.jsp index 3b5d12446..240719224 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/FundReback/FundRebackApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/FundReback/FundRebackApplyList.jsp @@ -4,7 +4,14 @@ +<%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Fund/PaymentPlan/PaymentPlanList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/PaymentPlan/PaymentPlanList.jsp index 41a45628e..e67b85898 100644 --- a/WebContent/Tenwa/Lease/Flow/Fund/PaymentPlan/PaymentPlanList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Fund/PaymentPlan/PaymentPlanList.jsp @@ -47,6 +47,7 @@ JBOTransaction tx=JBOFactory.createJBOTransaction(); Map params=new HashMap(); list=DataOperatorUtil.getDataBySql(tx, sql, params); + tx.commit(); displayData = new String[list.size()][headers.length]; for(int i=0;i +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurComp.getParameter("RightType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String contractNumber = CurPage.getParameter("contract_number"); + String ishistory = CurPage.getParameter("IsHistory"); + ASObjectModel doTemp = new ASObjectModel("ActualPaymentTempListBusiness"); + /* if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); + } */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; + dwTemp.ReadOnly = "0"; + dwTemp.ShowSummary = "1"; + if(!"0060".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + } + if("ReadOnly".equals(rightType)){ + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(50); + ASDataObject ado = dwTemp.getDataObject(); + ado.setLockCount(4); + ado.setReadOnly("PAYMENT_NUMBER", true); + ado.setReadOnly("PROJECT_NAME", true); + ado.setReadOnly("PLAN_ID", true); + ado.setReadOnly("FEE_TYPE", true); + ado.setReadOnly("SETTLE_METHOD", true); + ado.setReadOnly("PLAN_DATE", true); + ado.setHtmlEvent("FACT_MONEY", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("FEE_ADJUST", "onchange", "checkEquipAmtMoney"); + ado.setHtmlEvent("MEMO", "onmouseover", "showMemo"); + ado.setHtmlEvent("MEMO", "onmouseout", "hideMemo"); + ado.setHtmlEvent("MEMO", "onkeyup", "synchMemo"); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if("ReadOnly".equals(rightType)){ + sButtons = new String[][]{ + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","保存","保存","save()","","","","btn_icon_save",""}, + {"true","","Button","批量修改","批量修改","batchModify()","","","","btn_icon_delete",""}, + {"true","","Button","导出放款信息","导出放款信息","exportExcel()","","","",""} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/ContractInfo.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/ContractInfo.jsp new file mode 100644 index 000000000..7c8a590ba --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/ContractInfo.jsp @@ -0,0 +1,30 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-06-17 + Content: 示例详情页面 + History Log: + */ + String ishistory = CurPage.getParameter("IsHistory"); + String flowunid = CurPage.getParameter("FlowUnid"); + String productid = Sqlca.getString("select PRODUCT_ID from LB_CONTRACT_INFO_TEMP where flowunid = '"+flowunid+"'"); + String sTempletNo = "LBContractInfoTemp";//--模板号-- + if("004".equals(productid)){ + sTempletNo = "LBContractInfoTemp_Car"; + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2"; + dwTemp.ReadOnly = "-2"; + dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid")); + + String sButtons[][] = { + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentApplyList.jsp new file mode 100644 index 000000000..7a2954b82 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentApplyList.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html; charset=GBK"%> + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListStart.jspf"%> +<%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=List06;Describe=自定义函数;]~*/%> + + <%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentPayCondition.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentPayCondition.jsp new file mode 100644 index 000000000..2791ab7ad --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/FundPaymentPayCondition.jsp @@ -0,0 +1,47 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String FlowUnid=CurPage.getParameter("FlowUnid"); + if(FlowUnid==""||FlowUnid==null){ + FlowUnid="flowunid"; + } + String rightType = CurPage.getParameter("RightType"); + String ishistory = CurPage.getParameter("IsHistory"); + String phaseNo = CurPage.getParameter("PhaseNo"); + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel("FundPaymentPayCondition"); + if(null!=ishistory&&ishistory.equals("true")){ + doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataListHistory"); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; + dwTemp.ReadOnly="0"; + if("0030".equals(phaseNo)){ + dwTemp.getDataObject().setReadOnly("BUSINESS_CHECK", true); + dwTemp.getDataObject().setReadOnly("OPERATE_CHECK", false); + } + dwTemp.setPageSize(50); + dwTemp.genHTMLObjectWindow(FlowUnid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + }; + +%> +<%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundIncomeList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundIncomeList.jsp new file mode 100644 index 000000000..d8c393112 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundIncomeList.jsp @@ -0,0 +1,22 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + + String flowunid = CurPage.getParameter("FlowUnid"); + String contract_id = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:FlowUnid") + .setParameter("FlowUnid", flowunid).getSingleResult(false).getAttribute("contract_id").getString(); + ASObjectModel doTemp = new ASObjectModel("LCFundIncomeList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.ShowSummary = "1"; + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundPaymentList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundPaymentList.jsp new file mode 100644 index 000000000..a82ec1ffc --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/LCFundPaymentList.jsp @@ -0,0 +1,27 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + String contract_id = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:FlowUnid") + .setParameter("FlowUnid", flowunid).getSingleResult(false).getAttribute("contract_id").getString(); + ASObjectModel doTemp = new ASObjectModel("LCFundPaymentList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.ShowSummary = "1"; + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundEquipAMTList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundEquipAMTList.jsp new file mode 100644 index 000000000..9c6e3c258 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundEquipAMTList.jsp @@ -0,0 +1,73 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurComp.getParameter("RightType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String contract_id = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:FlowUnid") + .setParameter("FlowUnid", flowunid).getSingleResult(false).getAttribute("contract_id").getString(); + ASObjectModel doTemp = new ASObjectModel("VILCFundEquipAMTList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.ShowSummary = "1"; + if("0030".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = null; + if("ReadOnly".equals(rightType)){ + sButtons = new String[][]{ + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","生成本次付款","生成本次付款","openFundPlanList()","","","","btn_icon_add",""} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundOtherList.jsp b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundOtherList.jsp new file mode 100644 index 000000000..dca8f131b --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Fund/TraditionFundPayment/VILCFundOtherList.jsp @@ -0,0 +1,65 @@ +<%@page import="jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-06-06 + Content: + History Log: + */ + String phaseNo = CurPage.getParameter("PhaseNo"); + String rightType = CurComp.getParameter("RightType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String contract_id = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:FlowUnid") + .setParameter("FlowUnid", flowunid).getSingleResult(false).getAttribute("contract_id").getString(); + ASObjectModel doTemp = new ASObjectModel("VILCFundOtherList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.ShowSummary = "1"; + dwTemp.MultiSelect = true; + if("0030".equals(phaseNo)){ + rightType = "ReadOnly"; + dwTemp.ReadOnly = "1"; + dwTemp.MultiSelect = false; + } + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(contract_id); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String[][] sButtons = null; + if("ReadOnly".equals(rightType)){ + sButtons = new String[][]{ + }; + }else{ + sButtons = new String[][]{ + {"true","","Button","生成本次付款","生成本次付款","createFundIncome()","","","","btn_icon_add",""} + }; + } +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ApprovalForm.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ApprovalForm.jsp index 004b2905d..13b98a676 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ApprovalForm.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ApprovalForm.jsp @@ -1,3 +1,5 @@ +<%@page import="java.lang.Integer"%> +<%@page import="java.lang.Double"%> <%@page import="com.tenwa.reckon.product.ASObjectWindowCalc"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% @@ -6,39 +8,62 @@ Content: 示例详情页面 History Log: */ - String ishistory=CurPage.getParameter("IsHistory"); String nodeNo=CurPage.getParameter("NodeNo"); String phaseNo = CurPage.getAttribute("PhaseNo"); String taskno=CurPage.getParameter("TaskNo"); String RightType= CurPage.getParameter("RightType"); + String customerType= CurPage.getParameter("CustomerType"); + String flowstate = CurPage.getParameter("flowstate"); String flowunid = CurPage.getParameter("FlowUnid"); + String flowName = CurPage.getParameter("FlowName");//获取流程名称 + String projectId = CurPage.getParameter("ProjectId");//获取项目id + String clean_lease_money = Sqlca.getString("select CLEAN_LEASE_MONEY from LC_CALC_CONDITION_TEMP where flowunid='"+flowunid+"'"); + //获取合同状态 + String projectstatus = Sqlca.getString("select PROJECT_STATUS from lb_project_info where id='"+projectId+"'"); + //int money = Integer.parseInt(clean_lease_money); + if(clean_lease_money==null){ + clean_lease_money="0"; + } + double money = Double.parseDouble(clean_lease_money); CurPage.getCurComp().setAttribute("RightType", null); - String sTempletNo = "VI_BUSINESS_APPROVAL";//--模板号-- + String sTempletNo = "VI_PROJECTINFO_APPROVAL";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); - if(null!=ishistory&&ishistory.equals("true")){ - doTemp.setDataQueryClass("com.tenwa.flow.flowHistory.FlowDataInfoHistory");//如果是历史则新显示历史数据 + if("01".equals(customerType)){ + doTemp.setVisible("SEX",false);//如果是法人客户隐藏性别字段 } + doTemp.setHtmlEvent("firstchoice","onChange","changeFirstChoice"); + doTemp.setHtmlEvent("secondchoice","onChange","changeSecondChoice"); + doTemp.setHtmlEvent("thirdchoice","onChange","changeThirdChoice"); ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); dwTemp.Style = "2";//freeform dwTemp.setAttr("inputWidth", "163"); if(null!=ishistory&&ishistory.equals("true")){ - dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.ReadOnly = "1";//只读模式 isShowButton=false; }else{ isShowButton=true; } - if("0010".equals(phaseNo)){ + if("0010".equals(phaseNo)){//经销商 dwTemp.setGroupHidden("0020,0030,0040,0050"); - }else if("0020".equals(phaseNo)){ + }else if("0030".equals(phaseNo)){//初审 dwTemp.getDataObject().setVisible("firstchoice", true); dwTemp.getDataObject().setVisible("firstopinion", true); dwTemp.getDataObject().setRequired("firstchoice", true); dwTemp.getDataObject().setRequired("firstopinion", true); dwTemp.setGroupHidden("0030,0040,0050"); - }else if("0030".equals(phaseNo)){ + if("BACK".equals(flowstate)||"ANYBACK".equals(flowstate)){ + dwTemp.getDataObject().setVisible("secondchoice", true); + dwTemp.getDataObject().setVisible("secondopinion", true); + dwTemp.getDataObject().setReadOnly("secondchoice", true); + dwTemp.getDataObject().setReadOnly("secondopinion", true); +// dwTemp.getDataObject().setVisible("InterOpinion2", true); +// dwTemp.getDataObject().setReadOnly("InterOpinion2", true); + dwTemp.setGroupHidden("0040,0050"); + } + }else if("0040".equals(phaseNo)||"0050".equals(phaseNo)){//复审 dwTemp.getDataObject().setVisible("firstchoice", true); dwTemp.getDataObject().setVisible("firstopinion", true); dwTemp.getDataObject().setReadOnly("firstchoice", true); @@ -47,77 +72,573 @@ dwTemp.getDataObject().setVisible("secondopinion", true); dwTemp.getDataObject().setRequired("secondchoice", true); dwTemp.getDataObject().setRequired("secondopinion", true); - dwTemp.setGroupHidden("0040,0050"); - }else if("0040".equals(phaseNo)){ + dwTemp.setGroupHidden("0040"); + if(("BACK".equals(flowstate)||"ANYBACK".equals(flowstate))&&"0050".equals(phaseNo)){ + dwTemp.getDataObject().setVisible("thirdchoice", true); + dwTemp.getDataObject().setVisible("thirdopinion", true); + dwTemp.getDataObject().setReadOnly("thirdchoice", true); + dwTemp.getDataObject().setReadOnly("thirdopinion", true); +// dwTemp.getDataObject().setVisible("INTEROPINION3", true); +// dwTemp.getDataObject().setReadOnly("INTEROPINION3", true); + dwTemp.setGroupHidden("0050"); + } + if(CurUser.hasRole("401")){ + dwTemp.setGroupHidden("0030,0040"); + } + }else if("0060".equals(phaseNo)){//信审 + if(!"true".equals(ishistory)){ + dwTemp.getDataObject().setVisible("firstchoice", true); + dwTemp.getDataObject().setVisible("firstopinion", true); + dwTemp.getDataObject().setReadOnly("firstchoice", true); + dwTemp.getDataObject().setReadOnly("firstopinion", true); + dwTemp.getDataObject().setVisible("secondchoice", true); + dwTemp.getDataObject().setVisible("secondopinion", true); + dwTemp.getDataObject().setReadOnly("secondchoice", true); + dwTemp.getDataObject().setReadOnly("secondopinion", true); + dwTemp.getDataObject().setVisible("thirdchoice", true); + dwTemp.getDataObject().setVisible("thirdopinion", true); + dwTemp.getDataObject().setRequired("thirdchoice", true); + dwTemp.getDataObject().setRequired("thirdopinion", true); + }else{ + dwTemp.getDataObject().setVisible("firstchoice", true); + dwTemp.getDataObject().setVisible("firstopinion", true); + dwTemp.getDataObject().setReadOnly("firstchoice", true); + dwTemp.getDataObject().setReadOnly("firstopinion", true); + dwTemp.getDataObject().setVisible("secondchoice", false); + dwTemp.getDataObject().setVisible("secondopinion", false); + dwTemp.getDataObject().setVisible("thirdchoice", false); + dwTemp.getDataObject().setVisible("thirdopinion", false); +// dwTemp.getDataObject().setVisible("INTEROPINION2", false); +// dwTemp.getDataObject().setVisible("DISTRIOPINION2", false); +// dwTemp.getDataObject().setVisible("INTEROPINION3", false); +// dwTemp.getDataObject().setVisible("DISTRIOPINION3", false); + + dwTemp.setGroupHidden("0030,0040,0050"); + } + }else if("0020".equals(phaseNo)){//经销商 dwTemp.getDataObject().setVisible("firstchoice", true); dwTemp.getDataObject().setVisible("firstopinion", true); dwTemp.getDataObject().setReadOnly("firstchoice", true); dwTemp.getDataObject().setReadOnly("firstopinion", true); - dwTemp.getDataObject().setVisible("secondchoice", true); - dwTemp.getDataObject().setVisible("secondopinion", true); - dwTemp.getDataObject().setReadOnly("secondchoice", true); - dwTemp.getDataObject().setReadOnly("secondopinion", true); - dwTemp.getDataObject().setVisible("thirdchoice", true); - dwTemp.getDataObject().setVisible("thirdopinion", true); - dwTemp.getDataObject().setRequired("thirdchoice", true); - dwTemp.getDataObject().setRequired("thirdopinion", true); - dwTemp.setGroupHidden("0050"); - }else if("0050".equals(phaseNo)){ - dwTemp.getDataObject().setVisible("firstchoice", true); - dwTemp.getDataObject().setVisible("firstopinion", true); - dwTemp.getDataObject().setReadOnly("firstchoice", true); - dwTemp.getDataObject().setReadOnly("firstopinion", true); - dwTemp.getDataObject().setVisible("secondchoice", true); - dwTemp.getDataObject().setVisible("secondopinion", true); - dwTemp.getDataObject().setReadOnly("secondchoice", true); - dwTemp.getDataObject().setReadOnly("secondopinion", true); - dwTemp.getDataObject().setVisible("thirdchoice", true); - dwTemp.getDataObject().setVisible("thirdopinion", true); - dwTemp.getDataObject().setRequired("thirdchoice", true); - dwTemp.getDataObject().setRequired("thirdopinion", true); - dwTemp.getDataObject().setReadOnly("thirdchoice", true); - dwTemp.getDataObject().setReadOnly("thirdopinion", true); - dwTemp.getDataObject().setVisible("fourchoice", true); - dwTemp.getDataObject().setVisible("fouropinion", true); - dwTemp.getDataObject().setRequired("fourchoice", true); - dwTemp.getDataObject().setRequired("fourdopinion", true); + dwTemp.getDataObject().setVisible("secondchoice", false); + dwTemp.getDataObject().setVisible("secondopinion", false); + dwTemp.getDataObject().setReadOnly("secondchoice", false); + dwTemp.getDataObject().setReadOnly("secondopinion", false); + dwTemp.getDataObject().setVisible("thirdchoice", false); + dwTemp.getDataObject().setVisible("thirdopinion", false); + dwTemp.getDataObject().setRequired("thirdchoice", false); + dwTemp.getDataObject().setRequired("thirdopinion", false); + dwTemp.getDataObject().setReadOnly("thirdchoice", false); + dwTemp.getDataObject().setReadOnly("thirdopinion", false); + dwTemp.setGroupHidden("0030,0040,0050"); + }else if("0070".equals(phaseNo)){//添加业务分管领导 + if(!"true".equals(ishistory)){//显示初审和复审意见 + dwTemp.getDataObject().setVisible("firstchoice", true); + dwTemp.getDataObject().setVisible("firstopinion", true); + dwTemp.getDataObject().setReadOnly("firstchoice", true); + dwTemp.getDataObject().setReadOnly("firstopinion", true); + dwTemp.getDataObject().setVisible("secondchoice", true); + dwTemp.getDataObject().setVisible("secondopinion", true); + dwTemp.getDataObject().setReadOnly("secondchoice", true); + dwTemp.getDataObject().setReadOnly("secondopinion", true); + if(money>200000){//如果大约20万显示负责人审批意见 + dwTemp.getDataObject().setVisible("thirdchoice", true); + dwTemp.getDataObject().setVisible("thirdopinion", true); + dwTemp.getDataObject().setReadOnly("thirdchoice", true); + dwTemp.getDataObject().setReadOnly("thirdopinion", true); + }else{ + dwTemp.setGroupHidden("0040"); + } + + }else{ + dwTemp.getDataObject().setVisible("firstchoice", true); + dwTemp.getDataObject().setVisible("firstopinion", true); + dwTemp.getDataObject().setReadOnly("firstchoice", true); + dwTemp.getDataObject().setReadOnly("firstopinion", true); + dwTemp.getDataObject().setVisible("secondchoice", false); + dwTemp.getDataObject().setVisible("secondopinion", false); + dwTemp.getDataObject().setVisible("thirdchoice", false); + dwTemp.getDataObject().setVisible("thirdopinion", false); +// dwTemp.getDataObject().setVisible("INTEROPINION2", false); +// dwTemp.getDataObject().setVisible("DISTRIOPINION2", false); +// dwTemp.getDataObject().setVisible("INTEROPINION3", false); +// dwTemp.getDataObject().setVisible("DISTRIOPINION3", false); + + dwTemp.setGroupHidden("0030,0040,0050"); + } } dwTemp.genHTMLObjectWindow(flowunid); String sButtons[][] = { - {"true","","Button","保存","保存所有修改","save()","","","",""} + {"0010,0020".indexOf(phaseNo)>-1?"false":"true","","Button","保存","保存所有修改","save()","","","",""} }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BCopinions.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BCopinions.jsp new file mode 100644 index 000000000..a055659b6 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BCopinions.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-11-22 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String projectid = CurPage.getParameter("ProjectId"); + String flowunid = CurPage.getParameter("FlowUnid"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "LBOPINIONSINFO";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setDefaultValue("projectid", projectid); + doTemp.setDefaultValue("flowunid", flowunid); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(projectid+","+flowunid); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""}, + {"false","All","Button","返回","返回列表","returnList()","","","",""} + }; + //sButtonPosition = "north"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplicationOpinions.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplicationOpinions.jsp new file mode 100644 index 000000000..df61a2d15 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplicationOpinions.jsp @@ -0,0 +1,40 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-02-26 + Content: + History Log: + */ + String FlowKey=CurPage.getParameter("FlowKey"); + String flowUnid = Sqlca.getString("select flow_unid from flow_bussiness_object where flow_key='"+FlowKey+"' and flow_name='业务申请流程'"); + + ASObjectModel doTemp = new ASObjectModel("BusinessApplicationOpinions"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(flowUnid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"false","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"false","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"false","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplyApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplyApplyList.jsp index 88e6f144f..ef3bbf196 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplyApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessApplyApplyList.jsp @@ -7,7 +7,14 @@ function newApply() { - AsDialog.PopView("/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp","ApplyType=<%=sApplyType%>", + var CurOrgID=<%=CurOrg.getOrgID()%>; + //var sReturn = AsControl.RunJsp("/Tenwa/Lease/Flow/Project/BusinessApplication/CheckDistributorStatus.jsp","CurOrgID="+CurOrgID); + var sReturn = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkDistributorStatus","id="+CurOrgID); + if(sReturn!="true"){ + AsDebug.alert("警告","当前经销商未激活!"); + return; + } + AsDialog.PopView("/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp","ApplyType=<%=sApplyType%>", "dialogWidth=500px;dialogHeight=300px;resizable=no;scrollbars=no;status:yes;maximize:no;help:no;",function(sReturnInfo){ if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessCancelApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessCancelApplyList.jsp index 9b2e4179d..a4ac6fd7b 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessCancelApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessCancelApplyList.jsp @@ -7,7 +7,8 @@ function newApply(){ - AsDialog.OpenSelector("selectBusinessRecreditProject","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var userid = "<%=CurUser.getUserID()%>"; + AsDialog.OpenSelector("selectBusinessRecreditProject","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -17,8 +18,11 @@ var product_id=sReturn[1]; var project_id = sReturn[2]; var project_name = sReturn[3]; + var CustomerType = sReturn[4]; + var carAttributes = sReturn[5]; + var leasehold = sReturn[6]; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectId="+id+",ProductId="+product_id+",FlowKey="+project_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",customertype="+CustomerType+",carAttributes="+carAttributes+",leasform="+leasehold+",ProjectId="+id+",ProductId="+product_id+",FlowKey="+project_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); @@ -33,7 +37,7 @@ alert(mes); } reloadSelf(); - },"请选择撤销项目"); + },"请选择撤销编号"); } @@ -50,7 +54,7 @@ } else { - var mes=sReturnInfos[1]; + var mes=sReturnInfos[0]; alert(mes); } reloadSelf(); diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessChangeApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessChangeApplyList.jsp index 795c8c2a0..e9ef557d6 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessChangeApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessChangeApplyList.jsp @@ -6,7 +6,8 @@ /*~[Describe=新增记录;InputParam=无;OutPutParam=无;]~*/ function newApply(){ - AsDialog.OpenSelector("selectBusinessRecreditProject","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ + var userid = "<%=CurUser.getUserID()%>"; + AsDialog.OpenSelector("selectBusinessRecreditProject","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.6) + "px",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="_NONE_"){ //alert(getHtmlMessage('1'));//请选择一条信息! return; @@ -16,8 +17,13 @@ var product_id=sReturn[1]; var project_id = sReturn[2]; var project_name = sReturn[3]; + var CustomerType = sReturn[4]; + var carAttributes = sReturn[5]; + var leasehold = sReturn[6]; + var operationType = sReturn[7]; + var certtype = sReturn[8]; var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",ProjectId="+id+",ProductId="+product_id+",FlowKey="+project_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; + sParams =sParams+",certtype="+certtype+",customertype="+CustomerType+",carAttributes="+carAttributes+",leasform="+leasehold+",operationType="+operationType+",ProjectId="+id+",ProductId="+product_id+",FlowKey="+project_id+",ProjectName="+project_name+",ApplyType=<%=sApplyType%>"; var sReturnInfo = RunJavaMethodTrans("com.tenwa.flow.action.comm.BaseFlowStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_") return; var sReturnInfos=sReturnInfo.split("@"); @@ -28,11 +34,11 @@ } else { - var mes=sReturnInfos[1]; + var mes=sReturnInfos[0]; alert(mes); } reloadSelf(); - },"请选择变更项目"); + },"请选择变更编号"); } diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp index 39a2209a4..2439981d9 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp @@ -11,60 +11,124 @@ String sPhaseNo=CurPage.getParameter("PhaseNo");//阶段号 String FlowNo=CurPage.getParameter("FlowNo");//流程名称 String sPrevUrl = CurPage.getParameter("PrevUrl"); + String operationType = CurPage.getParameter("operationType");//获取产品类型 if(sPrevUrl == null) sPrevUrl = ""; String compClientID = CurPage.getParameter("CompClientID"); String rightType = CurPage.getParameter("RightType"); String sTempletNo = "BusinessProjectTempInfo";//--模板号-- - - //BizObject bo=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT", "flow_unid=:flowunid").setParameter("flowunid",sFlowUnid).getSingleResult(false); - //String a=bo.getAttribute("CustomerType").toString(); - String carSeries = CurPage.getParameter("carSeries"); - String certtype = CurPage.getParameter("certtype"); - String carSystem = CurPage.getParameter("carSystem"); - String productModel = CurPage.getParameter("productModel"); + BizObject bo=JBOFactory.createBizObjectQuery("jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT", "flow_unid=:flowunid").setParameter("flowunid",sFlowUnid).getSingleResult(false); String custype = CurPage.getParameter("CustomerType"); - String certid =CurPage.getParameter("certid"); - //String sTempletNo = "BusinessProjectTempInfo_temp";//--模板号-- + String customertype = CurPage.getParameter("customertype"); ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("inputTel","onChange","checkTel"); //租赁形式set只读 if((null!=sPhaseNo&&sPhaseNo.equals("0010")) && ("BusinessApplyFlow".equals(FlowNo) ||"BusinessChangeFlow".equals(FlowNo))){ - doTemp.setReadOnly("LEAS_FORM", false); + doTemp.setReadOnly("LEAS_FORM", true); doTemp.setReadOnly("PROJECT_SOURCE", false); } + if("ReadOnly".equals(rightType)){ + doTemp.setReadOnly("INPUTNAME", true); + doTemp.setReadOnly("INPUTTEL", true); + } + //如果是北汽的产品,业务申请号可编辑 + if(!"ReadOnly".equals(rightType)&&sPhaseNo.equals("0010")&&"BAIC_MOTOR".equals(operationType)&&"BusinessApplyFlow".equals(FlowNo)){ + doTemp.setReadOnly("PROJECT_NO", false); + }else{ + doTemp.setReadOnly("PROJECT_NO", true); + } String userll=null; userll="/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp?CompClientID="; - if("01".equals(custype)){ - userll="/Tenwa/Customer/Lessee/Person/LegalPersonApplicationInfo.jsp?CompClientID="; + if("01".equals(custype)||"01".equals(customertype)){ + userll="/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp?CompClientID="; } - ASObjectWindowCalc dwTemp = new ASObjectWindowCalc(CurPage, doTemp,request); dwTemp.Style = "2";//freeform dwTemp.setGroupHidden("0020"); dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid")); - dwTemp.replaceColumn("customer_info", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("customer_info", "", CurPage.getObjectWindowOutput()); String sButtons[][] = { {"ReadOnly".equals(rightType)?"false":"true","","Button","保存","保存","save()","","","","btn_icon_saveNew",""} }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckDistributorStatus.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckDistributorStatus.jsp new file mode 100644 index 000000000..874697c88 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckDistributorStatus.jsp @@ -0,0 +1,11 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String CurOrgID = CurPage.getParameter("CurOrgID"); + + String sReturn = "false"; + String jobName = Sqlca.getString("SELECT distributor_status FROM distributor_info WHERE orgid='"+CurOrgID+"'"); + if(jobName != null&&jobName!="distributor_status08"){ + sReturn = "true"; + } + out.println(sReturn); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckSplittingRatio.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckSplittingRatio.jsp new file mode 100644 index 000000000..9ff1d6bed --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CheckSplittingRatio.jsp @@ -0,0 +1,12 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String CurOrgID = CurPage.getParameter("CurOrgID"); + String productId = CurPage.getParameter("product_id"); + String distributorId = CurPage.getParameter("distributor_id"); + String sReturn = "false"; + String jobName = Sqlca.getString("SELECT id FROM lb_splitting_ratio WHERE product_id='"+productId+"' and distributor_id='"+distributorId+"'"); + if(jobName != null){ + sReturn = "true"; + } + out.println(sReturn); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ContractRepeatList.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ContractRepeatList.jsp new file mode 100644 index 000000000..0c49fd5e8 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ContractRepeatList.jsp @@ -0,0 +1,55 @@ +<%@page import="com.tenwa.reckon.product.ASObjectWindowCalc"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-15 + Content: + History Log: + */ + String customertype = CurPage.getParameter("CustomerType"); + String flowunid = CurPage.getParameter("FlowUnid"); + String certid = ""; + if("03".equals(customertype)){ + certid = Sqlca.getString("select cpt.certid from lb_union_lessee_temp lul inner join CUSTOMER_PERSON_TEMP cpt on cpt.customerid = lul.customer_id where lul.flowunid = '"+flowunid+"' group by cpt.certid"); + }else{ + certid = Sqlca.getString("select cct.certid from lb_union_lessee_temp lul inner join CUSTOMER_COMPANY_TEMP cct on cct.customerid = lul.customer_id where lul.flowunid = '"+flowunid+"' group by cct.certid"); + } + ASObjectModel doTemp = new ASObjectModel("ContractRepeatList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(certid+","+certid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { +// {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, +// {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp index e361d2804..b439ad05e 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerAddress.jsp @@ -92,6 +92,8 @@ var isnew = getItemValue(0,getRow(),"isnew");//是否最新 var addtype = getItemValue(0,getRow(),"addtype");//地址类型 var id = getItemValue(0,getRow(),"id"); + var dressdetail = getItemValue(0,0,"dressdetail"); + setItemValue(0,0,"dressdetail",dressdetail); setItemValue(0,0,"fulladdress",getItemValue(0,0,"provincename")+getItemValue(0,0,"dressdetail")); setItemValue(0,0,"flowunid","<%=flowunid%>"); if(flag == "edit"){ diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyJoinTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyJoinTempInfo.jsp new file mode 100644 index 000000000..e32fd29d5 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyJoinTempInfo.jsp @@ -0,0 +1,361 @@ +<%@page import="com.tenwa.reckon.util.UUIDUtil"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-06-27 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String customerType = CurPage.getParameter("CustomerType"); + String ProjectId = CurPage.getParameter("ProjectId"); + String flowunid = CurPage.getParameter("FlowUnid"); + String flowName = CurPage.getParameter("FlowName"); + String contractid = CurPage.getParameter("ContractId"); + String showtype = CurPage.getParameter("ShowType"); + String sPhaseNo=CurPage.getParameter("PhaseNo"); + String IsHistory = CurPage.getParameter("IsHistory"); + if(sPrevUrl == null) sPrevUrl = ""; + + String falg = "true"; + if("合同制作流程".equals(flowName)){ + falg = "false"; + } + String sTempletNo = "CustomerFamilyJoinTempInfo";//--模板号-- + //如果是合同查询则 查询正式表数据 + if("flow_contract_sum_car".equals(showtype)){ + sTempletNo = "CustomerFamilyJoinQueryInfo";//--模板号-- + } + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("", ""); + doTemp.setDefaultValue("project_id", ProjectId); + doTemp.setHtmlEvent("tel","onChange","checkTelRepeat"); + doTemp.setHtmlEvent("certId","onChange","checkCertId"); + doTemp.setHtmlEvent("suphone","onChange","checkSuphone"); + doTemp.setHtmlEvent("certtype", "onChange", "setSexRead"); + doTemp.setHtmlEvent("certid","onChange","ValidityCheck"); + doTemp.setHtmlEvent("CERTTYPE","onChange","checkCertidSex"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + String FlowUnid = CurPage.getParameter("FlowUnid"); + String customerid = Sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+FlowUnid+"'"); +// dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid"));flowunid + "," + customerid + String Partner = Sqlca.getString("select Partner_ from CUSTOMER_FAMILY_TEMP where flowunid='"+FlowUnid+"'"); + if("flow_contract_sum_car".equals(showtype)){ + dwTemp.genHTMLObjectWindow(contractid); + }else{ + if(Partner==null){ + dwTemp.genHTMLObjectWindow(FlowUnid); + }else if(Partner.equals("Y")){ + dwTemp.genHTMLObjectWindow(FlowUnid + "," + customerid); + }else{ + dwTemp.genHTMLObjectWindow(FlowUnid); + } + } + String sButtons[][] = { + //{"true","","Button","新增","新增","newRecord()","","","","btn_icon_add"}, + {falg,"","Button","保存","保存","viewAndEdit()","","","","btn_icon_edit"}, + //{"true","All","Button","保存","保存所有修改","save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + //sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyQueryInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyQueryInfo.jsp new file mode 100644 index 000000000..ac9f86f00 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyQueryInfo.jsp @@ -0,0 +1,23 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2017-07-10 + Content: 示例详情页面 + History Log: + */ + String contractid = CurPage.getParameter("ContractId"); + + String sTempletNo = "CustomerFamilyQueryInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(contractid); + + String sButtons[][] = { + }; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyTempInfo.jsp index cc78c92b8..ce6469332 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyTempInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerFamilyTempInfo.jsp @@ -6,12 +6,21 @@ History Log: */ String sPrevUrl = CurPage.getParameter("PrevUrl"); + String projectId = CurPage.getParameter("ProjectId"); String flowunid = CurPage.getParameter("FlowUnid"); - String customerid = CurPage.getParameter("customerid"); + String sPhaseNo=CurPage.getParameter("sPhaseNo"); + String IsHistory = CurPage.getParameter("IsHistory"); + String customerid = Sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+flowunid+"'"); + String marriage = Sqlca.getString("select MARRIAGE from CUSTOMER_PERSON_TEMP where flowunid='"+flowunid+"'"); if(sPrevUrl == null) sPrevUrl = ""; String sTempletNo = "CustomerFamilyTempInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("Partner_","onChange","changePartner"); + doTemp.setHtmlEvent("tel","onChange","checkTelRepeat"); + doTemp.setHtmlEvent("certtype","onChange", "setSexRead"); + doTemp.setHtmlEvent("sex","onChange","checkSex"); + doTemp.setHtmlEvent("certid","onChange","ValidityCheck"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "-2";//只读模式 @@ -21,27 +30,254 @@ }; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp index 9f9b805a5..7258d15f4 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp @@ -1,3 +1,4 @@ +<%@page import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%> <%@page import="jbo.app.tenwa.customer.CUSTOMER_TYPE"%> <%@page import="jbo.app.tenwa.customer.CUSTOMER_INFO"%> <%@page import="java.util.Date"%> @@ -8,13 +9,39 @@ Date curdate = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy/MM/dd"); String dateString = formatter.format(curdate); - + String sPhaseNo=CurPage.getParameter("sPhaseNo"); String flowunid = CurPage.getParameter("FlowUnid"); + String FlowName = CurPage.getParameter("FlowName");//获取流程名称 + String IsHistory = CurPage.getParameter("IsHistory");//获取流程名称 + String projectId = CurPage.getParameter("ProjectId"); String customerid = Sqlca.getString("select customer_id from lb_union_lessee_temp where flowunid='"+flowunid+"'"); - String sTempletNo = "BusinessCustomerInfo";//--模板号-- + String sTempletNo = "";//--模板号-- + String sexChange=""; + if("合同制作流程".equals(FlowName)||"合同变更流程".equals(FlowName)){ + sTempletNo = "ContractBusinessCustomerInfo"; + }else{ + sTempletNo = "BusinessCustomerInfo"; + String certtype= CurPage.getParameter("certtype"); + if(!"Ind01".equals(certtype)){ + sexChange="1"; + } + } ASObjectModel doTemp = new ASObjectModel(sTempletNo); - + String custname=CurPage.getParameter("custname"); doTemp.setHtmlEvent("CERTID","onChange","changeCertid"); + //doTemp.setHtmlEvent("MARRIAGE","onChange","changeFamilyRequired"); + if(sexChange.equals("1")){ + doTemp.setReadOnly("SEX", false); + }else{ + doTemp.setReadOnly("SEX", true); + } + doTemp.setHtmlEvent("MARRIAGE","onChange","changeChildrensNumber"); + doTemp.setHtmlEvent("IS_NETCAR","onChange","changeNetCarInfo"); + doTemp.setHtmlEvent("sex","onChange","changeSex"); + doTemp.setHtmlEvent("Mailing_Address","onChange","checkMailingAddress"); + //doTemp.setHtmlEvent("mobile","onChange","checkMobileRepeat"); + //doTemp.setHtmlEvent("EMERGENCY_CONTACT_TEL","onChange","checkEmergencyRepeat"); + //doTemp.setHtmlEvent("REMARK","onChange","checkRemarkRepeat"); String rightType = CurPage.getParameter("RightType");//页面只读与否 if(rightType==null)rightType=""; ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); @@ -25,23 +52,246 @@ dwTemp.Style = "2";//freeform dwTemp.genHTMLObjectWindow(flowunid + "," + customerid); CurPage.getCurComp().setAttribute("RightType", rightType); - if(rightType.equals("ReadOnly")){ - dwTemp.ReadOnly = "1";//只读模式 + if(rightType.equals("ReadOnly")||FlowName.equals("合同制作流程")){ + dwTemp.ReadOnly = "-1";//只读模式 } String customerType = "03"; String compClientID = request.getParameter("CompClientID"); //自然人标识 String person = "person"; - dwTemp.replaceColumn("family", "", CurPage.getObjectWindowOutput()); + dwTemp.replaceColumn("family", "", CurPage.getObjectWindowOutput()); + String sButtons[][] = { + //{"true","","Button","身份校验","身份校验","identityVerification()","","","","btn_icon_check",""} }; + + %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerQueryInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerQueryInfo.jsp new file mode 100644 index 000000000..968c1ab59 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerQueryInfo.jsp @@ -0,0 +1,42 @@ +<%@page import="com.sun.org.apache.xalan.internal.xsltc.compiler.sym"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_TYPE"%> +<%@page import="jbo.app.tenwa.customer.CUSTOMER_INFO"%> +<%@page import="java.util.Date"%> +<%@page import="java.text.SimpleDateFormat"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + +// String sPrevUrl = CurPage.getParameter("PrevUrl"); + String compClientID = request.getParameter("CompClientID"); + String contractid = CurPage.getParameter("ContractId"); +// if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "CustomerQueryInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + // doTemp.setColTips("", "测试"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(contractid); + //自然人标识 + String person = "person"; + dwTemp.replaceColumn("family", "", CurPage.getObjectWindowOutput()); + + String sButtons[][] = { + //{"true","","Button","身份校验","身份校验","identityVerification()","","","","btn_icon_check",""} + }; + + +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyName.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyName.jsp new file mode 100644 index 000000000..9c0cf2bf6 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyName.jsp @@ -0,0 +1,20 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String codeno = CurPage.getParameter("codeno"); + String attribute1 = CurPage.getParameter("attribute1"); + try{ + String sql = "select c.itemno,c.itemname from code_library c where c.codeno='"+codeno+"' and c.attribute1="+attribute1; + ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql)); + StringBuilder sb = new StringBuilder(); + sb.append(""); + while(res.next()){ + sb.append(""); + } + if(sb.length()>0){ + out.print(sb.toString()); + } + }catch(Exception e){ + e.printStackTrace(); + out.print("FALSE"); + } +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyNameSelect.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyNameSelect.jsp new file mode 100644 index 000000000..4ab8c3016 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/GetApplyNameSelect.jsp @@ -0,0 +1,25 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String codeno = CurPage.getParameter("codeno"); + String attribute1 = CurPage.getParameter("attribute1"); + String selectOpinion = CurPage.getParameter("selectOpinion"); + try{ + String sql = "select c.itemno,c.itemname from code_library c where c.codeno='"+codeno+"' and c.attribute1="+attribute1; + ASResultSet res = Sqlca.getASResultSet(new SqlObject(sql)); + StringBuilder sb = new StringBuilder(); + sb.append(""); + while(res.next()){ + if(res.getString("itemno").toString().equals(selectOpinion)){ + sb.append(""); + }else{ + sb.append(""); + } + } + if(sb.length()>0){ + out.print(sb.toString()); + } + }catch(Exception e){ + e.printStackTrace(); + out.print("FALSE"); + } +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ProjectDistriborInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ProjectDistriborInfo.jsp new file mode 100644 index 000000000..834a5f096 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/ProjectDistriborInfo.jsp @@ -0,0 +1,52 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2018-12-20 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String flowunid = CurPage.getParameter("FlowUnid"); + String phaseNo = CurPage.getParameter("PhaseNo"); + if(sPrevUrl == null) sPrevUrl = ""; + + String sTempletNo = "ProjectDistriborInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + String flag = "false"; + if("0010".equals(phaseNo)||"0020".equals(phaseNo)){ + doTemp.setColInnerBtEvent("DISTRIBUTOR_NAME", "selectDistributor()"); + flag = "true"; + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(flowunid); + + String sButtons[][] = { + {flag,"All","Button","保存","保存所有修改","as_save(0)","","","",""}, +// {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; +// sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp index 6f28a9388..9368f5c31 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApproval/ProjectApprovalCreationInfo.jsp @@ -39,9 +39,13 @@ <% String sTempletNo = "BusnessApprovalApplyCreationInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setHtmlEvent("Customer_type", "onchange", "setCertType"); + doTemp.setHtmlEvent("carAttributes", "onchange", "changeProductName"); + doTemp.setHtmlEvent("leasehold", "onchange", "changeProductName"); + //doTemp.setHtmlEvent("CustomerName", "onchange", "checkNameAndCertId"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - dwTemp.genHTMLObjectWindow(""); + dwTemp.genHTMLObjectWindow(""); %> <%/*~END~*/%> @@ -70,24 +74,61 @@ <%/*~BEGIN~可编辑区~[Editable=false;CodeAreaID=Info06;Describe=定义按钮事件-;]~*/%> <%/*~END~*/%> @@ -266,13 +490,13 @@ var sReturn = RunJavaMethodSqlca("com.tenwa.lease.flow.project.projectapproval.BusinessTypeController","getBusinessType",""); sReturn = sReturn.split("@"); setItemValue(0,0,"productId",sReturn[0]); - setItemValue(0,0,"productName",sReturn[1]); + setItemValue(0,0,"productName",sReturn[1]); }else if(num>1){ showItem(0,"productName");//字段显示 showItem(0,"product_id");//字段显示 } } - initRow(); + //initRow(); <%/*~END~*/%> diff --git a/WebContent/Tenwa/Lease/Flow/Project/ProjectApproval/ProjectApprovalCreationInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/ProjectApproval/ProjectApprovalCreationInfo.jsp index c65f8e397..d3981b543 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/ProjectApproval/ProjectApprovalCreationInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/ProjectApproval/ProjectApprovalCreationInfo.jsp @@ -80,9 +80,19 @@ alert("请选择业务品种和客户"); return; } + var businesstype = "";//业务类型,1是汽车业务,2是传统业务,3是汽车传统业务 + var orgid = "<%=CurUser.getOrgID()%>".substring(0,7); + if(orgid=="8009011"){ + businesstype="3"; + }else if(orgid=="8009010"){ + businesstype="2"; + }else{ + alert("该用户无权限发起申请!"); + return; + } var sParams = "ApplyType=<%=sApplyType%>,CurUserID=<%=CurUser.getUserID()%>"; - sParams =sParams+",CustId="+custid+",CustName=" + custname+",ProductId="+productid+",ProductName="+productname; - var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.projectapproval.ProjectApprovalStartAction","initFLow",sParams); + sParams =sParams+",CustId="+custid+",CustName=" + custname+",ProductId="+productid+",ProductName="+productname+",businesstype="+businesstype; + var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.projectapproval.ProjectApprovalStartAction","initFLow",sParams); if(typeof(sReturnInfo)=="undefined" || sReturnInfo=="" || sReturnInfo=="_CANCEL_" ) { doCancel(); @@ -119,7 +129,8 @@ <%/*~[Describe=选择客户;]~*/%> function selectCustomerName() { - AsDialog.OpenSelector("SelectCustomerForProjectApprove","","dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px", + var userid="<%=CurUser.getUserID()%>"; + AsDialog.OpenSelector("SelectCustomerForProjectApprove","userid,"+userid,"dialogWidth=" + parseInt(window.screen.width * 0.8) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px", function(sReturn){ if(!sReturn||sReturn=="_CANCEL_"||sReturn=="") { @@ -134,19 +145,29 @@ <%/*~[Describe=选择业务品种;]~*/%> - function selectBusinessType() - { - AsDialog.OpenSelector("SelectBusinessType","ProductType,1@3,TypeNo,004","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px", - function(sReturn){ - if(!sReturn||sReturn=="_CANCEL_"||sReturn==""||sReturn=="_NONE_") - { - //alert(getHtmlMessage('1'));//请选择一条信息! - return; - } - sReturn = sReturn.split("@"); - setItemValue(0,0,"productId",sReturn[0]); - setItemValue(0,0,"productName",sReturn[1]); - },"请选择业务品种",''); + function selectBusinessType(){ + var orgid = "<%=CurUser.getOrgID()%>"; + orgid = orgid.substring(0,7); + var selectNo = ""; + if("8009010" == orgid){//传统 + selectNo = "SelectBusinessType2"; + }else if("8009011" == orgid){//汽车类传统 + selectNo = "SelectBusinessTypeCar"; + }else{ + alert("该用户不能发起流程,请联系管理员!"); + return; + } + AsDialog.OpenSelector(selectNo,"ProductType,1@3,TypeNo,004","dialogWidth=" + parseInt(window.screen.width * 0.4) + "px dialogHeight=" + parseInt(window.screen.height * 0.5) + "px", + function(sReturn){ + if(!sReturn||sReturn=="_CANCEL_"||sReturn==""||sReturn=="_NONE_") + { + //alert(getHtmlMessage('1'));//请选择一条信息! + return; + } + sReturn = sReturn.split("@"); + setItemValue(0,0,"productId",sReturn[0]); + setItemValue(0,0,"productName",sReturn[1]); + },"请选择业务品种",''); } <%/*~END~*/%> diff --git a/WebContent/Tenwa/Lease/Flow/Project/ProjectCancel/ProjectCancelApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Project/ProjectCancel/ProjectCancelApplyList.jsp index cc4d042a8..875dcb2df 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/ProjectCancel/ProjectCancelApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/ProjectCancel/ProjectCancelApplyList.jsp @@ -4,7 +4,17 @@ diff --git a/WebContent/Tenwa/Lease/Flow/Project/ProjectRecredit/ProjectRecreditApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Project/ProjectRecredit/ProjectRecreditApplyList.jsp index acb215f2f..43dc59381 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/ProjectRecredit/ProjectRecreditApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/ProjectRecredit/ProjectRecreditApplyList.jsp @@ -4,7 +4,18 @@ +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CheckCardExport.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CheckCardExport.jsp new file mode 100644 index 000000000..17ddcba77 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/CheckCardExport.jsp @@ -0,0 +1,10 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String bankType = CurPage.getParameter("BankType"); + String result = Sqlca.getString(new SqlObject("select count(1) cou from lc_card_deduct_info where import_date is null")); + if("0".equals(result)){ + out.println("true"); + }else{ + out.println("false"); + } +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/DeleteRentOccupy.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/DeleteRentOccupy.jsp index ee62f6399..37202d091 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/DeleteRentOccupy.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/DeleteRentOccupy.jsp @@ -5,9 +5,22 @@ <%@page import="java.math.BigDecimal"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/IncludeBeginMDAJAX.jsp"%><% - SqlObject so = new SqlObject("delete from lc_occupy_rent_list where flow_name='卡扣核销'"); + String id = CurPage.getParameter("ID"); + String bankType = CurPage.getParameter("ObjectType"); + String fileId = CurPage.getParameter("FileId"); String result = ""; try{ + SqlObject so = new SqlObject("delete from lc_occupy_rent_list where flow_name='卡扣核销' and flowunid='"+id+"'"); + Sqlca.executeSQL(so); + so = new SqlObject("delete from lc_"+bankType+"_export_data where deduct_info_id='"+id+"'"); + Sqlca.executeSQL(so); + so = new SqlObject("delete from lb_docrelative where id=(select ldl.relative_id from lb_doclibrary ldl left join lb_docattribute lda on ldl.id=lda.library_id where lda.id='"+fileId+"')"); + Sqlca.executeSQL(so); + so = new SqlObject("delete from lb_doclibrary where id=(select library_id from lb_docattribute where id='"+fileId+"')"); + Sqlca.executeSQL(so); + so = new SqlObject("delete from lb_docattribute where id='"+fileId+"'"); + Sqlca.executeSQL(so); + so = new SqlObject("delete from lc_card_deduct_info where id='"+id+"'"); Sqlca.executeSQL(so); result = "SUCCESS"; }catch(Exception e){ diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/GetLBDocAttributeIDByCard.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/GetLBDocAttributeIDByCard.jsp new file mode 100644 index 000000000..cfff4514d --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/GetLBDocAttributeIDByCard.jsp @@ -0,0 +1,23 @@ +<%@page import="com.amarsoft.are.jbo.JBOTransaction"%> +<%@page import="java.math.BigDecimal"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/IncludeBeginMDAJAX.jsp"%><% + String objecttype = CurPage.getAttribute("OBJECTTYPE"); + String flowunid = CurPage.getAttribute("FLOW_UNID"); + String type = CurPage.getAttribute("TYPE"); + String id = CurPage.getAttribute("ID"); + String docattributeID = ""; + try{ + SqlObject so = new SqlObject("SELECT la.id FROM lb_docrelative lr INNER JOIN LB_DOCLIBRARY ll ON ll.relative_id=lr.id INNER JOIN LB_DOCATTRIBUTE la ON la.library_id=ll.id WHERE lr.objecttype=:objecttype AND lr.flow_unid=:flowunid"); + so.setParameter("objecttype", objecttype); + so.setParameter("flowunid", flowunid); + docattributeID = Sqlca.getString(so); + if("save".equals(type) && docattributeID != null){ + Sqlca.executeSQL(new SqlObject("UPDATE LC_CARD_DEDUCT_INFO SET FILE_ID = '" + docattributeID + "' WHERE ID = '" + id + "'")); + } + }catch(Exception e){ + e.printStackTrace(); + docattributeID = ""; + } + out.println(docattributeID); +%><%@ include file="/IncludeEndAJAX.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp index 2c0653f61..586f5ea67 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductDocList.jsp @@ -15,11 +15,37 @@ //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { - {"true","All","Button","删除","删除","doDelete()","","","","btn_icon_delete",""}, - {"true","","Button","卡扣数据上传","卡扣数据上传","importExcel()","","","","btn_icon_importNew",""} + {"true","","Button","卡扣数据上传","卡扣数据上传","importExcel()","","","","btn_icon_importNew",""}, + {"true","","Button","跳转到核销页面","跳转到核销页面","openIncomePage()","","","","btn_icon_return",""} + //{"true","","Button","卡扣模版下载","卡扣模版下载","CardDownload()","","","","btn_icon_down",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + + +
+
+ +
+ + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductMain.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductMain.jsp new file mode 100644 index 000000000..072e744c5 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LCCardDeductMain.jsp @@ -0,0 +1,42 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin.jspf"%> +<% + /* + 页面说明:示例模块主页面 + */ + String PG_TITLE = "卡扣导出"; // 浏览器窗口标题 PG_TITLE + String PG_CONTENT_TITLE = "  通联数据明细  "; //默认的内容区标题 + String PG_CONTNET_TEXT = "请点击左侧列表";//默认的内容区文字 + String PG_LEFT_WIDTH = "200";//默认的treeview宽度 + + //定义Treeview + OHTMLTreeView tviTemp = new OHTMLTreeView(CurPage, "示例模块主页面","right"); + + //定义树图结构 + tviTemp.insertPage("root","卡扣数据","",1); + tviTemp.insertPage("root","已导出卡扣信息","",2); + + //另外两种定义树图结构的方法:SQL生成和代码生成 参见View的生成 ExampleView.jsp和ExampleView01.jsp +%> +<%@ include file="/Frame/resources/include/include_main.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LcCardDeductDataList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LcCardDeductDataList.jsp new file mode 100644 index 000000000..6e20f07f3 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/LcCardDeductDataList.jsp @@ -0,0 +1,85 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2017-10-23 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("LCCardDeductDataList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(pageSize != null?Integer.parseInt(pageSize):20); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","划扣核销","划扣核销","rentIncome()","","","","btn_icon_get",""}, + {"true","","Button","删除","删除","doDelete()","","","","btn_icon_delete",""} + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/VILCContractRentPlanList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/VILCContractRentPlanList.jsp index 5be3ae4b8..2fb442752 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/VILCContractRentPlanList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CardDeduct/VILCContractRentPlanList.jsp @@ -1,3 +1,4 @@ +<%@page import="com.tenwa.reckon.util.UUIDUtil"%> <%@page import="com.amarsoft.app.util.ProductParamUtil"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% @@ -8,7 +9,7 @@ */ ASObjectModel doTemp = new ASObjectModel("VILCContractRentPlanList"); String sql = doTemp.getJboWhere(); - ASResultSet rs = Sqlca.getASResultSet("select distinct O.id,O.product_id from vi_lc_contract_rent_plan O where "+sql.replaceAll("v.", "")); + /* ASResultSet rs = Sqlca.getASResultSet("select distinct O.id,O.product_id from vi_lc_contract_rent_plan O where "+sql.replaceAll("v.", "")); String contractIDs = ""; while(rs.next()){ String productID = rs.getString("PRODUCT_ID"); @@ -21,11 +22,11 @@ contractIDs = contractIDs.substring(1); }else{ contractIDs = "' '"; - } - doTemp.appendJboWhere(" and ((O.id in ("+contractIDs+") and O.fee_type<>'罚息') or O.id not in ("+contractIDs+"))"); + } */ + //doTemp.appendJboWhere(" and ((O.id in ("+contractIDs+") and O.fee_type<>'罚息') or O.id not in ("+contractIDs+"))"); //doTemp.appendJboWhere("(case when O.id in("+contractIDs+") then O.fee_type<>'罚息' else 1 end)"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - String jboWhere = dwTemp.getDataObject().getJboWhere().replaceAll("v.", "").replaceAll("O.", "");//用于卡扣数据导出过滤 + //String jboWhere = dwTemp.getDataObject().getJboWhere().replaceAll("v.", "").replaceAll("O.", "");//用于卡扣数据导出过滤 dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 dwTemp.setPageSize(pageSize!=null?Integer.parseInt(pageSize):10); @@ -33,12 +34,20 @@ //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { - {"true","All","Button","卡扣数据导出","卡扣数据导出","exportExcel()","","","","btn_icon_exportNew",""}, - {"true","All","Button","卡扣导出撤回","卡扣数据撤回","doDelete()","","","","btn_icon_delete",""} + {"true","All","Button","卡扣数据导出","卡扣数据导出","exportExcel()","","","","btn_icon_exportNew",""} }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/LCFundIncomeTempDeductionList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/LCFundIncomeTempDeductionList.jsp index 09e04b9cf..5892d2ee3 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/LCFundIncomeTempDeductionList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/LCFundIncomeTempDeductionList.jsp @@ -16,10 +16,10 @@ doTemp.setHtmlEvent("MEMO", "onmouseover", "showMemo"); doTemp.setHtmlEvent("MEMO", "onmouseout", "hideMemo"); doTemp.setHtmlEvent("MEMO", "onkeyup", "synchMemo"); - if("0020".equals(phaseNo)){ + /* if("0020".equals(phaseNo)){ doTemp.setRequired("ACCOUNTING_DATE", true); doTemp.setReadOnly("FACT_DATE", true); - } + } */ ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; if(!"ReadOnly".equals(rightType)){ diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/VILCRentPlanForDeductionList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/VILCRentPlanForDeductionList.jsp index 27a6e30a7..de6fa0a53 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/VILCRentPlanForDeductionList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyDeduction/VILCRentPlanForDeductionList.jsp @@ -8,9 +8,13 @@ String phaseNo = CurPage.getParameter("PhaseNo"); String flowunid = CurPage.getParameter("FlowUnid"); String rightType = CurPage.getParameter("RightType"); + String FlowNo = CurPage.getParameter("FlowNo"); String paymentNumber = JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid") .setParameter("flowunid", flowunid).getSingleResult(false).getAttribute("flow_key").getString(); ASObjectModel doTemp = new ASObjectModel("VILCRentPlanForDeductionList"); + if("CautionMoneyDeductionFlow".equals(FlowNo)){ + doTemp.appendJboWhere(" and O.plan_list =(select max(pl.plan_list) from jbo.app.tenwa.calc.VI_LC_RENT_PLAN pl WHERE pl.payment_number ='"+paymentNumber+"' AND (pl.rent_over > 0 OR pl.penalty_over > 0 ))"); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 diff --git a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyReturn/CautionMoneyReturnApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyReturn/CautionMoneyReturnApplyList.jsp index d04660162..b3353317b 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyReturn/CautionMoneyReturnApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/CautionMoneyReturn/CautionMoneyReturnApplyList.jsp @@ -4,7 +4,22 @@ +<%@ include file="/Tenwa/Core/FlowManager/BaseFlowList/BaseFlowApplyListEnd.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/Rent/RentReback/RentRebackApplyList.jsp b/WebContent/Tenwa/Lease/Flow/Rent/RentReback/RentRebackApplyList.jsp index 6f3023b97..e1d834363 100644 --- a/WebContent/Tenwa/Lease/Flow/Rent/RentReback/RentRebackApplyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Rent/RentReback/RentRebackApplyList.jsp @@ -4,7 +4,24 @@ <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/TriditionGeneratedReminderLetterList.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/TriditionGeneratedReminderLetterList.jsp new file mode 100644 index 000000000..a6cb1c923 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/TriditionGeneratedReminderLetterList.jsp @@ -0,0 +1,162 @@ +<%@page import="java.util.Date"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<% + /* + Author: undefined 2016-08-06 + Content: + History Log: + */ + Date d=new Date(); + SimpleDateFormat df=new SimpleDateFormat("yyyy/MM/dd"); + String now=df.format(new Date(d.getTime()));//yyyy/MM/dd格式 + ASObjectModel doTemp = new ASObjectModel("TGeneratedReminderLetterList"); +/* String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); + doTemp.appendJboWhere(sCondtion); */ + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect=true; + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + //dwTemp.genHTMLObjectWindow(StringFunction.getToday("yyyy/MM/dd")); + + dwTemp.genHTMLObjectWindow("3"); + + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","生成催收函","生成催收函","exportExcel('1')","","","","btn_icon_transfer",""}, + {"true","","Button","批量下载","批量下载","lotdown()","","","","btn_icon_transfer",""}, + {"true","All","Button","生成电子章","盖公司电子章","stamp()","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/generatededitshow.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/generatededitshow.jsp index f4bd52ea5..f09f614cd 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/generatededitshow.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/generatedreminderletter/generatededitshow.jsp @@ -24,12 +24,10 @@ alert("请选择发送日期!"); return false; } - /* var fparams="payment_number="+'<%=CurPage.getParameter("payment_number")%>'+",senddate="+senddate+",contractlist=<%=CurPage.getParameter("contractlist")%>"+",inputuserid=<%=inputuserid%>"+",inputorgid=<%=inputorgid%>,userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>"; var sReturnInfo = RunJavaMethodTrans("com.amarsoft.app.lc.reminder.GeneratedReminderLetterAction","saveGeneratedReminderLetter",fparams); - */ AsDialog.ClosePage(senddate); - + } <%@ include file="/IncludeEnd.jsp"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/DayDistribute.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/DayDistribute.jsp new file mode 100644 index 000000000..87127eaac --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/DayDistribute.jsp @@ -0,0 +1,77 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-10-15 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("DayDistribute"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "0"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","All","Button","保存","保存所有修改","as_Save()","","","",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningInfo.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningInfo.jsp index 49d90593f..55746e047 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningInfo.jsp @@ -7,19 +7,39 @@ */ String sPrevUrl = CurPage.getParameter("PrevUrl"); if(sPrevUrl == null) sPrevUrl = ""; - + String overDays = CurPage.getParameter("overDays"); + //此功能如果需要再使用 + //获取天数配置表中中催组的开始结束天数 + BizObject dayDistribute = JBOFactory.createBizObjectQuery("jbo.com.tenwa.lease.comm.DAY_DISTRIBUTE", "id=:id") + .setParameter("id", "f7957025d1dc11e8a63e00163e0ad612").getSingleResult(false); + String begin_day = dayDistribute.getAttribute("begin_day").toString(); + String end_day = dayDistribute.getAttribute("end_day").toString(); + int beginDay = Integer.parseInt(begin_day); + int endDay = Integer.parseInt(end_day); + int overDay = Integer.parseInt(overDays); + //800R00000041 轻 + //800R00000042 中 + //800R00000043 重 + String roleId = ""; + if(overDayendDay){ + roleId="800R00000043";//重 + }else{ + roleId="800R00000042";//中 + } String sTempletNo = "OverdueDunningInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform - //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.ReadOnly = "0";//只读模式 dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + //{"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, {"true","All","Button","返回","返回列表","goBack()","","","","btn_icon_return"} }; - sButtonPosition = "south"; + sButtonPosition = "north"; String orgCompany=CurUser.getOrgID(); if(orgCompany.length()>13){ orgCompany=orgCompany.substring(0,13); @@ -27,11 +47,30 @@ orgCompany=orgCompany.substring(0,orgCompany.length()-4); %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningList.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningList.jsp index 59bf45edb..087823363 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningList.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/overduedunning/OverdueDunningList.jsp @@ -1,26 +1,62 @@ <%@page import="com.tenwa.comm.dataRightmanager.DataRightManager"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> <% /* Author: undefined 2016-07-26 Content: History Log: */ + String userid=CurUser.getUserID(); ASObjectModel doTemp = new ASObjectModel("OverdueDunningList"); - String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); - doTemp.appendJboWhere(sCondtion); + //String sCondtion=DataRightManager.getRightCondition(CurUser,"O", "contract"); + //doTemp.appendJboWhere(sCondtion); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 北财合作方 + String roleId = "800R00000044"; + + //roleid:800R00000045 rolename: bccuishou + //如果登录人属于bccuishou角色,可以看到北财下的所有的合同 + if(roleList.contains("800R00000045")){ + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId = bo.getAttribute("userid").toString(); + useridList.add("'"+userId+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + doTemp.appendJboWhere(" and O.project_manage='"+userid+"'"); + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.MultiSelect = true; //多选 dwTemp.ReadOnly = "1"; //只读模式 - dwTemp.setPageSize(10); + //dwTemp.setPageSize(10); + dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize)); dwTemp.genHTMLObjectWindow(""); //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_edit",""}, - {"true","","Button","批量修改","批量修改","viewAndEditAll()","","","","btn_icon_edit",""}, + //{"true","","Button","批量修改","批量修改","viewAndEditAll()","","","","btn_icon_edit",""}, + {"true","","Button","批量修改","批量修改","selectPartDept()","","","","btn_icon_edit",""}, }; String orgCompany=CurUser.getOrgID(); if(orgCompany.length()>13){ @@ -30,18 +66,53 @@ %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/CapgeminiReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/CapgeminiReport.jsp new file mode 100644 index 000000000..d09d26ddb --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/CapgeminiReport.jsp @@ -0,0 +1,102 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("Capgemini_rent_plan"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + + //导出模板编号 + String template = ""; + + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401") && !roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); + //导出有权限 + template = "cff950db664c4faeb1f4656629176004"; + }else{ + template = "cff950db664c4faeb1f4656629176004"; + } + String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); + String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); + + if(roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and O.distributor_no='"+distributor_no+"'"); + template = "5addef5e8b56470688949d554cad4b24"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/ClearingDataReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/ClearingDataReport.jsp new file mode 100644 index 000000000..a81b101cc --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/ClearingDataReport.jsp @@ -0,0 +1,101 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("Clearing_data_report"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + + //导出模板编号 + String template = ""; + + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401") && !roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); + //导出有权限 + template = "6d2b46cb97c84867b38e1f39d4e9a092"; + }else{ + template = "6d2b46cb97c84867b38e1f39d4e9a092"; + } + String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); + String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); + + if(roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and O.distributor_no='"+distributor_no+"'"); + template = "6a3c4a11c86048928d8823f796ee9423"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/DealerCollection.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/DealerCollection.jsp new file mode 100644 index 000000000..28cd07a23 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/DealerCollection.jsp @@ -0,0 +1,102 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("dealer_collection"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + + //导出模板编号 + String template = ""; + + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401") && !roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); + //导出有权限 + template = "05d55e01017a4d80945d5b6c8a8c5faf"; + }else{ + template = "05d55e01017a4d80945d5b6c8a8c5faf"; + } + String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); + String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); + + if(roleList.contains("800R00000051")){ + doTemp.appendJboWhere(" and O.distributor_no='"+distributor_no+"'"); + template = "c5af519f27ec4b62bacde30b0014f101"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp new file mode 100644 index 000000000..6bb823e58 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/FundIncomeReport.jsp @@ -0,0 +1,135 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2018-10-30 + Content: + History Log: + */ + String userid=CurUser.getUserID(); + ASObjectModel doTemp = new ASObjectModel("FundIncomeReport"); + + //加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 北财合作方 + //String roleId = "800R00000044"; + + //roleid:800R00000045 rolename: bccuishou + //如果登录人属于bccuishou角色,可以看到北财下的所有的合同 + /* if(roleList.contains("800R00000045")){ + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId = bo.getAttribute("userid").toString(); + useridList.add("'"+userId+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } */ + + //导出模板编号 + String template = ""; + + + String belongorg = Sqlca.getString("select belongorg from user_info where userid='"+userid+"'"); + String distributor_no = Sqlca.getString("select distributor_no from distributor_info where orgid='"+belongorg+"'"); + +// if("DSTB20190516003654".equals(distributor_no)){//测试环境18 + if("DSTB20190510003636".equals(distributor_no)){//正式环境 + doTemp.appendJboWhere(" and lci.distributor_id ='"+distributor_no+"'"); + template = "56c237b623a54732b61196c0b64b8238"; + + }else if(roleList.contains("401")){ + doTemp.appendJboWhere(" and lci.project_manage='"+userid+"'"); + //导出有权限 + template = "2cd25a9b1c6248c8abacaeeaf7cda303"; + }else{ + //导出无权限 + template = "a87e9bea25694013b9cc39216cac831e"; + } + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.ShowSummary="1"; //汇总 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","导出excel","导出excel","exportExcel()","","","","btn_icon_up",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/OverdueDunningDirectivesInfo.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/OverdueDunningDirectivesInfo.jsp index 3c7314659..eed6ba2f8 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/OverdueDunningDirectivesInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/OverdueDunningDirectivesInfo.jsp @@ -23,12 +23,16 @@ dwTemp.genHTMLObjectWindow(CurPage.getParameter("id")); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","保存","保存所有修改","save()","","","",""}, {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} }; sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overDuedunningRecordList.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overDuedunningRecordList.jsp index 2991ff2ff..c3911cee9 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overDuedunningRecordList.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overDuedunningRecordList.jsp @@ -7,6 +7,7 @@ */ ASObjectModel doTemp = new ASObjectModel("OverdueDunningRecordList"); String cust_name=CurPage.getParameter("cust_name"); + String contract_number=CurPage.getParameter("contract_number"); ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; //只读模式 @@ -20,21 +21,113 @@ {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%-- +
+
+ +
+ --%> <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overdueProjectInfo.jsp b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overdueProjectInfo.jsp index 8c39fe779..b1cf02e7b 100644 --- a/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overdueProjectInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentCollection/rentcollection/overdueProjectInfo.jsp @@ -10,22 +10,30 @@ String id=CurPage.getParameter("id"); String contractid=CurPage.getParameter("contractid"); String contract_id=CurPage.getParameter("contract_id"); - + String orgName = CurOrg.getOrgName(); String sTempletNo = "OverdueProjectInfo";//--模板号-- ASObjectModel doTemp = new ASObjectModel(sTempletNo); doTemp.setDefaultValue("contract_id", contractid); + //doTemp.setDefaultValue("rent_assist", orgName); ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); dwTemp.Style = "2";//freeform //dwTemp.ReadOnly = "-2";//只读模式 dwTemp.genHTMLObjectWindow(id); String sButtons[][] = { - {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {"true","All","Button","保存","保存所有修改","save()","","","",""}, {"true","All","Button","返回","返回列表","returnList()","","","","btn_icon_return"} }; sButtonPosition = "south"; %><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> diff --git a/WebContent/Tenwa/Lease/Flow/RentNotify/LetterApprovalList.jsp b/WebContent/Tenwa/Lease/Flow/RentNotify/LetterApprovalList.jsp new file mode 100644 index 000000000..c6d7b97ef --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentNotify/LetterApprovalList.jsp @@ -0,0 +1,167 @@ +<%@page import="org.apache.catalina.User"%> +<%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<%@ page import="org.apache.commons.lang.StringUtils" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + String userid1=CurUser.getUserID(); + String userId = CurUser.getUserID(); + String orgId =CurUser.getOrgID(); + System.out.print(orgId); + String falg = "true"; + if(userId.indexOf("8006")>-1){ + falg = "false"; + } + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel("LetterApprovaList"); + /* if(userId.indexOf("8006")>-1){ + doTemp.appendJboWhere(" O.orgid="+CurUser.getOrgID()+""); + } */ + + //合同信息查询加权限 + BizObjectManager manager = JBOFactory.getBizObjectManager("jbo.awe.USER_ROLE"); + List roleListObject = manager.createQuery("userid=:userid").setParameter("userid", userid1).getResultList(false); + List roleList = new ArrayList(); + String roleid = ""; + + for(BizObject bo : roleListObject){ + roleid = bo.getAttribute("roleid").toString(); + roleList.add(roleid); + } + //roleid:800R00000044 北财合作方 + String roleId = "800R00000044"; + + //roleid:800R00000045 rolename: bccuishou + //如果登录人属于bccuishou角色,可以看到北财下的所有的合同 + if(roleList.contains("800R00000045")){ + List userObjectList = manager.createQuery("roleid=:roleid").setParameter("roleid", roleId).getResultList(false); + String userId2 = ""; + List useridList = new ArrayList(); + for(BizObject bo : userObjectList){ + userId2 = bo.getAttribute("userid").toString(); + useridList.add("'"+userId2+"'"); + } + String useridStr = StringUtils.join(useridList.toArray(), ","); + doTemp.appendJboWhere(" and O.project_manage in (" + useridStr + ")"); + } + //登录人属于经销商角色 401:经销商roleid + if(roleList.contains("401")){ + doTemp.appendJboWhere(" and O.project_manage='"+userid1+"'"); + } + + + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(15); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(userId); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + sButtons=new String[][]{ + {"true","All","Button","生成批准函","生成批准函","generateQuotation()","","","","btn_icon_generate"}, + {"false","All","Button","批量下载","批量下载","lotdown()","","","","btn_icon_down"}, + {"false","All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; + +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentNotify/RentNotifyList.jsp b/WebContent/Tenwa/Lease/Flow/RentNotify/RentNotifyList.jsp index 13688dd16..fd7f0902b 100644 --- a/WebContent/Tenwa/Lease/Flow/RentNotify/RentNotifyList.jsp +++ b/WebContent/Tenwa/Lease/Flow/RentNotify/RentNotifyList.jsp @@ -1,3 +1,4 @@ +<%@page import="org.apache.catalina.User"%> <%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP"%> <%@ page contentType="text/html; charset=GBK"%> <%@ include file="/Frame/resources/include/include_begin_list.jspf"%> @@ -11,10 +12,18 @@ History Log: */ - + String userId = CurUser.getUserID(); + String orgId =CurUser.getOrgID(); + System.out.print(orgId); + String falg = "true"; String compClientID = request.getParameter("CompClientID"); - ASObjectModel doTemp = new ASObjectModel("RentNotify"); +// ASObjectModel doTemp = new ASObjectModel("RentNotify"); + ASObjectModel doTemp = new ASObjectModel("RnetList"); + if(userId.indexOf("8006")>-1){ + falg = "false"; + doTemp.appendJboWhere(" O.orgid="+orgId+""); + } ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); dwTemp.Style="1"; //--设置为Grid风格-- dwTemp.ReadOnly = "1"; @@ -25,8 +34,9 @@ //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] =null; sButtons=new String[][]{ - {"true","All","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, + {falg,"All","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, {"true","All","Button","批量下载","批量下载","lotdown()","","","","btn_icon_down"}, + {falg,"All","Button","公司盖章","公司盖章","stamp()","","","",""}, }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> @@ -49,48 +59,70 @@ if(!frames["downloadTemplate"]) $("").appendTo("body"); window.open(sWebRootPath+"/servlet/view/docDownloadServlet?CompClientID=<%=sCompClientID%>&sqlString=save@"+id, "downloadTemplate"); } - function generateQuotation() - { + function generateQuotation(){ + /* var paymentnumber=getItemValue(0,getRow(0),"PAYMENT_NUMBER"); + var planlist=getItemValue(0,getRow(0),"PLAN_LIST"); + alert(sss); + return; */ var PAYMENT_NUMBERS=getItemValueArray(0,"PAYMENT_NUMBER"); var PLAN_LISTS=getItemValueArray(0,"PLAN_LIST"); + + var contract_ids=getItemValueArray(0,"contract_id"); + var customernames=getItemValueArray(0,"customername"); + var contract_numbers=getItemValueArray(0,"contract_number"); + var number = 0; if(typeof(PAYMENT_NUMBERS)=="undefined"||PAYMENT_NUMBERS==null||PAYMENT_NUMBERS==""){alert("请选择");return;} for(var i=0;i"; - - param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据 - for(var key in param){ - if(sparam.length>0){sparam+=",";} - sparam+=key+"="+param[key]; + //生成文件关联关系 + tempParam["OBJECTTYPE"]="租金通知书"; + tempParam["contract_id"]=contract_ids[i]; + tempParam["payment_number"]=PAYMENT_NUMBERS[i]; + tempParam["PLAN_LIST"]=PLAN_LISTS[i]; + tempParam["PLAN_NUMBER"]=PAYMENT_NUMBERS[i]; + tempParam["customername"]=customernames[i]; + tempParam["contract_number"]=contract_numbers[i]; + + + //生成模板固定参数 + tempParam["CurUserId"]="<%=CurUser.getUserID()%>"; + tempParam["CurOrgId"]="<%=CurUser.getOrgID()%>"; + tempParam["fileSavePath"]="<%=CurConfig.getConfigure("FileSavePath")%>"; + + param["templateParam"]=JSON.stringify(tempParam).replace(/,/g,"@");//生成模板的参数据 + for(var key in param){ + if(sparam.length>0){sparam+=",";} + sparam+=key+"="+param[key]; + } + var plan_number=PAYMENT_NUMBERS[i];//投放编号 + var plan_list=PLAN_LISTS[i];//期次 + var deleteresult=RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentNotinyDeleteAction","deletequtation","plan_number="+plan_number+",plan_list="+plan_list); + var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam); + //word转pdf + var id = RunJavaMethodTrans("com.tenwa.channelportal.action.ContractSignAction","wordToPdfAnnex","PAYMENT_NUMBER="+plan_number+",PLAN_LIST="+plan_list); + if(typeof(id)=="undefined" || id.length <= 0 || id==""){ + RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentNotinyDeleteAction","deletequtation","plan_number="+plan_number+",plan_list="+plan_list); + }else{ + number++; + } } - var plan_number=PAYMENT_NUMBERS[i];//投放编号 - var plan_list=PLAN_LISTS[i];//期次 - var deleteresult=RunJavaMethodTrans("com.tenwa.officetempalte.controller.RentNotinyDeleteAction","deletequtation","plan_number="+plan_number+",plan_list="+plan_list); - var result=RunJavaMethodTrans("com.tenwa.officetempalte.action.CreateOfficeAction","createOfficeByTemplate",sparam); - - - - } - alert("生成成功!"); - reloadSelf(); + if(PAYMENT_NUMBERS.length==0){ + alert("请先选择数据!!!"); + return; + }else if(number==0){ + alert("生成失败!!!"); + }else if(number==PAYMENT_NUMBERS.length){ + alert("生成成功!!!"); + }else{ + alert("部分生成成功!!!"); + } + reloadSelf(); } function lotdown(){ var attrids=getItemValueArray(0,"attrid"); @@ -108,5 +140,39 @@ if(!frames["downloadTemplate"]) $("").appendTo("body"); window.open(sWebRootPath+"/servlet/view/DownloadZipServlet?CompClientID=<%=sCompClientID%>&id="+id, "downloadTemplate"); } + + function stamp(){ + var flie = getItemValue(0,getRow(0),"FILENAME"); + if(typeof(flie)=="undefined"||flie==null||flie==""){ + alert("请先生成租金通知书!"); + return; + } + var number = 0; + var PAYMENT_NUMBERS=getItemValueArray(0,"PAYMENT_NUMBER"); + var PLAN_LISTS=getItemValueArray(0,"PLAN_LIST"); + var contract_ids=getItemValueArray(0,"contract_id"); + for(var i=0;i <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyAdjust.jsp b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyAdjust.jsp new file mode 100644 index 000000000..19b7f9c51 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyAdjust.jsp @@ -0,0 +1,164 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid); + String projid = flow.getAttribute("proj_id").getString(); + String contract_id = flow.getAttribute("contract_id").getString(); + String ishistory = CurPage.getParameter("ishistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType = CurPage.getParameter("RightType"); + + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + sTempletNo = "AdjustmentNotice"; + String userName = CurUser.getUserName(); + + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setVisible("ACTION", true); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(50); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + sButtons=new String[][]{ + {"true","All","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, + {"true","All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyList.jsp b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyList.jsp new file mode 100644 index 000000000..ffc33d11e --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionRentNotifyList.jsp @@ -0,0 +1,172 @@ +<%@page import="org.apache.catalina.User"%> +<%@page import="jbo.app.tenwa.calc.LC_CALC_CONDITION_TEMP"%> +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + + String userId = CurUser.getUserID(); + String orgId =CurUser.getOrgID(); + System.out.print(orgId); + String falg = "true"; + if(userId.indexOf("8006")>-1){ + falg = "false"; + } + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel("TriditionRentNotify"); + if(userId.indexOf("8006")>-1){ + doTemp.appendJboWhere(" O.orgid="+CurUser.getOrgID()+""); + } + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(15); + dwTemp.MultiSelect = true; + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + sButtons=new String[][]{ + {falg,"All","Button","生成租金通知书","生成租金通知书","generateQuotation()","","","","btn_icon_generate"}, + {"true","All","Button","批量下载","批量下载","lotdown()","","","","btn_icon_down"}, + {falg,"All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; + +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionSuspensionList.jsp b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionSuspensionList.jsp new file mode 100644 index 000000000..757800d58 --- /dev/null +++ b/WebContent/Tenwa/Lease/Flow/RentNotify/TriditionSuspensionList.jsp @@ -0,0 +1,155 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_simplelist.jspf"%> +<%@ page import="com.tenwa.doc.action.DocListInitAction" %> +<%@ page import="com.amarsoft.app.lc.workflow.action.GetFlowAction" %> +<%@ page import="com.amarsoft.app.util.*" %> +<% + /* + Author: undefined 2016-09-01 + Content: + History Log: + */ + String flowunid = CurPage.getParameter("FlowUnid"); + BizObject flow = GetFlowAction.getFlowBussinessObject(flowunid); + String projid = flow.getAttribute("proj_id").getString(); + String contract_id = flow.getAttribute("contract_id").getString(); + String ishistory = CurPage.getParameter("ishistory"); + String nodeNo=CurPage.getParameter("NodeNo"); + String RightType = CurPage.getParameter("RightType"); + + String sTempletNo = CurPage.getParameter("TempletNo");//模板号 + sTempletNo = "TriditionSuspensionList"; + String userName = CurUser.getUserName(); + + String compClientID = request.getParameter("CompClientID"); + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setVisible("ACTION", true); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; + dwTemp.setPageSize(50); +// dwTemp.genHTMLObjectWindow(docname+","+contract_id); + dwTemp.genHTMLObjectWindow(flowunid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] =null; + sButtons=new String[][]{ + {"true","All","Button","生成提前终止模板","生成提前终止模板","generateQuotation()","","","","btn_icon_generate"}, + {"true","All","Button","公司盖章","公司盖章","stamp()","","","",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/RiskAlert/RiskAlertInfo.jsp b/WebContent/Tenwa/Lease/Flow/RiskAlert/RiskAlertInfo.jsp index 20daaca47..1b1150734 100644 --- a/WebContent/Tenwa/Lease/Flow/RiskAlert/RiskAlertInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/RiskAlert/RiskAlertInfo.jsp @@ -63,13 +63,30 @@ } } function selectCustomer(){ - AsDialog.OpenSelector("SelectCustomerForRiskAlert","","",function(sReturn){ + + var flowno="<%=CurPage.getParameter("FlowNo")%>"; + var selname=""; + var orgId="<%=CurUser.getOrgID()%>".substring(0,7); + var businessType=""; + var businessType1=""; + if(flowno=="RiskAlertFlow"){ + businessType="1"; + businessType1="1"; + }else{ + businessType="2"; + businessType1="3"; + } + + + var userid="<%=CurUser.getUserID()%>"; + AsDialog.OpenSelector("SelectCustomerForRiskAlert","userid,"+userid+",businessType,"+businessType+",businessType1,"+businessType1,"",function(sReturn){ if(!sReturn||sReturn=="_CANCEL_" || sReturn=="_NONE_"){ return; } sReturn = sReturn.split("@"); setItemValue(0,0,"ALERT_CUSTOMER", sReturn[0]); setItemValue(0,0,"customername", sReturn[1]); + setItemValue(0,0,"contract_no", sReturn[2]); },"请选择预警客户"); } function selectProviceCode(){//选择省份 diff --git a/WebContent/Tenwa/Lease/voucher/Contract_NC_Log.jsp b/WebContent/Tenwa/Lease/voucher/Contract_NC_Log.jsp new file mode 100644 index 000000000..e7a8bcdc1 --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/Contract_NC_Log.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-07 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("NCXML_DETAIL_RECORDS_CONTRACT"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/CustomerService_log.jsp b/WebContent/Tenwa/Lease/voucher/CustomerService_log.jsp new file mode 100644 index 000000000..53dc5642c --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/CustomerService_log.jsp @@ -0,0 +1,39 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2018-12-25 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("CUSTOMER_LOG"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.MultiSelect = true; //多选 + // dwTemp.ShowSummary="1"; //汇总 + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + /* {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, */ + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/Customer_NC_Log.jsp b/WebContent/Tenwa/Lease/voucher/Customer_NC_Log.jsp new file mode 100644 index 000000000..96cd5d121 --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/Customer_NC_Log.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-07 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("NCXML_DETAIL_RECORDS_CUSTOMER"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/Distributor_NC_Log.jsp b/WebContent/Tenwa/Lease/voucher/Distributor_NC_Log.jsp new file mode 100644 index 000000000..966e45f0b --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/Distributor_NC_Log.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-07 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("NCXML_DETAIL_RECORDS_DISTRIBUTOR"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/NCXML_TOTAL_RECORDS.jsp b/WebContent/Tenwa/Lease/voucher/NCXML_TOTAL_RECORDS.jsp new file mode 100644 index 000000000..bbd29c260 --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/NCXML_TOTAL_RECORDS.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-14 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("NCXML_TOTAL_RECORDS"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/TAX_CODE_INFO.jsp b/WebContent/Tenwa/Lease/voucher/TAX_CODE_INFO.jsp new file mode 100644 index 000000000..9f9250ad5 --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/TAX_CODE_INFO.jsp @@ -0,0 +1,30 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-03-17 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/Lease/voucher/TAX_CODE_LIST.jsp"; + + String sTempletNo = "TAX_CODE_INFO";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + doTemp.setColTips("", ""); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(CurPage.getParameter("TaxId")); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","as_save(0)","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/TAX_CODE_LIST.jsp b/WebContent/Tenwa/Lease/voucher/TAX_CODE_LIST.jsp new file mode 100644 index 000000000..a6b9d970a --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/TAX_CODE_LIST.jsp @@ -0,0 +1,38 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-03-16 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("TAX_CODE"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete",""}, + + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/Voucher_NC_Log.jsp b/WebContent/Tenwa/Lease/voucher/Voucher_NC_Log.jsp new file mode 100644 index 000000000..386dd4a90 --- /dev/null +++ b/WebContent/Tenwa/Lease/voucher/Voucher_NC_Log.jsp @@ -0,0 +1,37 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-01-07 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("NCXML_DETAIL_RECORDS_VOUCHER"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + //{"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + //{"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + //{"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/voucher/voucherass_detail.jsp b/WebContent/Tenwa/Lease/voucher/voucherass_detail.jsp index cf7066be9..e2e49eadb 100644 --- a/WebContent/Tenwa/Lease/voucher/voucherass_detail.jsp +++ b/WebContent/Tenwa/Lease/voucher/voucherass_detail.jsp @@ -16,10 +16,15 @@ dwTemp.MultiSelect = false; // dwTemp.setPageSize(50); dwTemp.genHTMLObjectWindow(""); + dwTemp.MultiSelect = true; doTemp.setLockCount(2); //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 String sButtons[][] = { {"true","","Button","导出凭证","导出凭证","createContractByTemplate()","","","","btn_icon_up",""}, + {"false","","Button","1.传输经销商信息入NC","1.传输经销商信息入NC","DistributorToNCInterface()","","","","btn_icon_up",""}, + {"true","","Button","1.NC客户传输","1.NC客户传输","CustomerToNCInterface()","","","","btn_icon_up",""}, + {"true","","Button","2.NC合同传输","2.NC合同传输","ContractToNCInterface()","","","","btn_icon_up",""}, + {"true","","Button","3.NC凭证传输","3.NC凭证传输","VoucherToNCInterface()","","","","btn_icon_up",""}, //{"true","","Button","刷新辅助账编码","刷新辅助账编码","synVoucherCode()","","","","btn_icon_save",""}, //{"true","","Button","明细","明细","showContractInsurance()","","","","btn_icon_detail",""}, //{"true","","Button","导入金蝶系统","导入金蝶系统","importFK()","","","","btn_icon_up",""}, @@ -29,9 +34,53 @@ }; %><%@include file="/Frame/resources/include/ui/include_list.jspf"%> +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/platform/PfTaskAllocationRoleList.jsp b/WebContent/Tenwa/platform/PfTaskAllocationRoleList.jsp new file mode 100644 index 000000000..5682984ff --- /dev/null +++ b/WebContent/Tenwa/platform/PfTaskAllocationRoleList.jsp @@ -0,0 +1,57 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-10-11 + Content: + History Log: + */ + ASObjectModel doTemp = new ASObjectModel("PfTaskAllocationRoleList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(""); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","角色下用户","角色下用户","viewUser()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","deleteRole()","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/platform/PfTaskAllocationUserInfo.jsp b/WebContent/Tenwa/platform/PfTaskAllocationUserInfo.jsp new file mode 100644 index 000000000..461a80414 --- /dev/null +++ b/WebContent/Tenwa/platform/PfTaskAllocationUserInfo.jsp @@ -0,0 +1,60 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_info.jspf"%><% + /* + Author: undefined 2019-10-11 + Content: 示例详情页面 + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String roleid = CurPage.getParameter("roleid"); + String id = CurPage.getParameter("id"); + System.out.println(roleid); + System.out.println(id); + String sTempletNo = "PfTaskAllocationUserInfo";//--模板号-- + ASObjectModel doTemp = new ASObjectModel(sTempletNo); + if(id!=null) + doTemp.setVisible("USERNAME",false); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/platform/PfTaskAllocationUserList.jsp"; + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp,request); + dwTemp.Style = "2";//freeform + //dwTemp.ReadOnly = "-2";//只读模式 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","saveUser()","","","",""}, + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""} + }; + sButtonPosition = "south"; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/platform/PfTaskAllocationUserList.jsp b/WebContent/Tenwa/platform/PfTaskAllocationUserList.jsp new file mode 100644 index 000000000..363a1056a --- /dev/null +++ b/WebContent/Tenwa/platform/PfTaskAllocationUserList.jsp @@ -0,0 +1,46 @@ +<%@ page contentType="text/html; charset=GBK"%> +<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><% + /* + Author: undefined 2019-10-11 + Content: + History Log: + */ + String sPrevUrl = CurPage.getParameter("PrevUrl"); + String roleid = CurPage.getParameter("roleid"); + if(sPrevUrl == null) sPrevUrl = "/Tenwa/platform/PfTaskAllocationRoleList.jsp"; + ASObjectModel doTemp = new ASObjectModel("PfTaskAllocationUserList"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + dwTemp.Style="1"; //--设置为Grid风格-- + dwTemp.ReadOnly = "1"; //只读模式 + dwTemp.setPageSize(10); + dwTemp.genHTMLObjectWindow(roleid); + + //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格 + String sButtons[][] = { + {String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","返回","返回列表","returnList()","","","",""}, + {"true","All","Button","新增","新增","newRecord()","","","","btn_icon_add",""}, + {"true","","Button","详情","详情","viewAndEdit()","","","","btn_icon_detail",""}, + {"true","","Button","删除","删除","if(confirm('确实要删除吗?'))as_delete(0)","","","","btn_icon_delete",""}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/TestCase/BizletTest.jsp b/WebContent/TestCase/BizletTest.jsp index 78b3e4111..8156908be 100644 --- a/WebContent/TestCase/BizletTest.jsp +++ b/WebContent/TestCase/BizletTest.jsp @@ -5,7 +5,7 @@ /* sExpression = "!CustomerManager.GetCustomerName(2000042779)"; sExpression = Expression.pretreatMethod(sExpression,Sqlca); - String sReturn = Expression.getExpressionValue(sExpression,Sqlca).stringValue(); + String sReturn = Expression.getExpressionValue(sExpression,Sqlca).stringValue(); out.println(sReturn); */ ASMethod asm = new ASMethod("CustomerManager","GetCustomerName",Sqlca); diff --git a/WebContent/Version/VersionInfo.jsp b/WebContent/Version/VersionInfo.jsp new file mode 100644 index 000000000..bd926275c --- /dev/null +++ b/WebContent/Version/VersionInfo.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ +include + file="/Frame/resources/include/include_begin_info.jspf"%> +<% + //获得参数 + String id = CurPage.getParameter("id"); + if (id == null) + id = ""; + + String sUserID = CurPage.getParameter("UserID"); + if (sUserID == null) + sUserID = ""; + + java.util.Date dateNow = new java.util.Date(); + SimpleDateFormat sdfTemp = new SimpleDateFormat( + "yyyy/MM/dd"); + String date = sdfTemp.format(dateNow); + + ASObjectModel doTemp = new ASObjectModel("VERSION_INFO"); + ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, + request); + dwTemp.Style = "2"; //设置DW风格 1:Grid 2:Freeform + dwTemp.ReadOnly = "0"; //设置是否只读 1:只读 0:可写 + dwTemp.genHTMLObjectWindow(id); + + String sButtons[][] = {{"true", "All", "Button", "保存", + "保存所有修改", "saveRecord()", "", "", "", "btn_icon_save"},}; +%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/WebContent/Version/VersionList.jsp b/WebContent/Version/VersionList.jsp new file mode 100644 index 000000000..ac6e280ba --- /dev/null +++ b/WebContent/Version/VersionList.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html; charset=GBK"%><%@ + include + file="/Frame/resources/include/include_begin_list.jspf"%> + +<% + ASObjectModel doTemp = new ASObjectModel("VERSION_LIST"); + doTemp.setLockCount(2); //锁定两列 + ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); + + dwTemp.Style="1"; //设置为Grid风格 + dwTemp.ReadOnly = "1";//编辑模式 + dwTemp.setPageSize(10); + dwTemp.ConvertCode2Title = "1"; + dwTemp.genHTMLObjectWindow(""); + String userName =CurUser.getUserID();//登录人 + String Jurisdiction=""; + if("administrator".equals(userName)){ + Jurisdiction="true"; + + }else{ + Jurisdiction="false"; + } + String sButtons[][] = { + {Jurisdiction,"","Button","新增应用","新增一个版本","newRecord()","","","","btn_icon_add"}, + {Jurisdiction,"","Button","应用信息","查看版本信息","viewAndEdit()","","","","btn_icon_detail"}, + {Jurisdiction,"","Button","删除该应用","删除该版本","if(confirm('确实要删除吗?'))as_delete(0,'')","","","","btn_icon_delete"}, + }; +%><%@include file="/Frame/resources/include/ui/include_list.jspf"%> + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/WEB-INF/.gitignore b/WebContent/WEB-INF/.gitignore index 268b84f12..fe4b522aa 100644 --- a/WebContent/WEB-INF/.gitignore +++ b/WebContent/WEB-INF/.gitignore @@ -1,2 +1,10 @@ +锘/.project +/src_jbo/ +/璧勬簮绠$悊/ +/work/ +/.settings/ +/.classpath +/.project +/.gitignore +/bin/ /classes/ -/log/ diff --git a/WebContent/WEB-INF/etc/a3web.xml b/WebContent/WEB-INF/etc/a3web.xml index cfbb717f9..fbb734d30 100644 --- a/WebContent/WEB-INF/etc/a3web.xml +++ b/WebContent/WEB-INF/etc/a3web.xml @@ -7,14 +7,14 @@ als als_rpt - + 1 1 2 - + 1 1000000 20 @@ -26,32 +26,40 @@ Development Disk - + - d:/tmp/als/Upload + /data/files/Upload + > + /data/sftp/caiwu/upload + + /data/files/Upload/TFT/OneDimensionalCode/ + + /data/files/Upload/TFT/BQcontract/ + + /data/files/tmp/InterFace fileTemplate - /tmp/als/WorkDoc + /data/files/als/WorkDoc Disk - /tmp/als/offlineworkdoc + /data/files/als/offlineworkdoc - /tmp/DownLoad + /data/files/tmp/DownLoad true - d:/tmp/DW + /data/files/tmp/DW SRC true - + - /home/amarsoft/als/Download - + /data/files/als/Download + true @@ -68,35 +76,61 @@ Leasing Cloud 安硕 - + true - + BusinessDueBill - http://localhost:8080/report - http://localhost:8080/report - + https://ret.ap-leasing.com/report + https://ret.ap-leasing.com/report + true WZ5jwvsdAFzo+sDY7wrZgA== com.tenwa.sinopharmEleasing rfL+5IFP/fHrsIiCZlJu5Q== + + + + a6b83424b55410c36415178002f8415e + http://api.che300.com/service/getCarBrandList + http://api.che300.com/service/getCarSeriesList + http://api.che300.com/service/getCarModelList + http://api.che300.com/service/getNewCarPrice + http://api.che300.com/service/getUsedCarPrice + + + http://172.28.1.59/skeleton/remoting/api + + + + + + + + /etc/app_config.properties + + http://172.28.1.59:8086 + 30000 安鹏经办 + + http://fpfw2.aiee.fun:8899/fpfw2/api/kpbusiness + 6797763f-e55a-421c-9fe1-07a9fbd1d87a + 3060109010000000000 + /data/files/apzl_leasing/tmp/MO + /data/files/apzl_leasing/tmp/LZ + /data/files/apzl_leasing/tmp/LIUZ + + /soft/files/pengyuan/apgjs.jks + 123456 - - ee450692cbd24e8bacb27b6f46b4d752 - http://api.che300.com/service/getCarBrandList - http://api.che300.com/service/getCarSeriesList - http://api.che300.com/service/getCarModelList - http://api.che300.com/service/getNewCarPrice - http://api.che300.com/service/getUsedCarPrice - - - - http://111.205.51.131:27203/clms_proxy/remoting/api - + /soft/files/pengyuan/apgjs.jks + 123456 + + http://finance.baicfc.com:7999/UpdateStatusService/NFS.Business.UpdateStatusService.ServicesImpl.UpdateStatus.svc \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app/component/component-config.xml b/WebContent/WEB-INF/etc/app/component/component-config.xml index f0cfdfc40..04cdf8a0c 100644 --- a/WebContent/WEB-INF/etc/app/component/component-config.xml +++ b/WebContent/WEB-INF/etc/app/component/component-config.xml @@ -1,424 +1,434 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml index b50a5d0f2..18890578a 100644 --- a/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml +++ b/WebContent/WEB-INF/etc/app/component/component-parameter-config.xml @@ -1,118 +1,199 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app/component/componenttype-config.xml b/WebContent/WEB-INF/etc/app/component/componenttype-config.xml index 093d1cb3a..9eb993026 100644 --- a/WebContent/WEB-INF/etc/app/component/componenttype-config.xml +++ b/WebContent/WEB-INF/etc/app/component/componenttype-config.xml @@ -1,59 +1,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/app_config.properties b/WebContent/WEB-INF/etc/app_config.properties new file mode 100644 index 000000000..1fa3fb749 --- /dev/null +++ b/WebContent/WEB-INF/etc/app_config.properties @@ -0,0 +1,74 @@ +############################################################################### +# APP_CONFIG properties +############################################################################### + +############################################################################### +# APP_BASE_CONFIG +############################################################################### +# base.data. +base.data.source=als +base.data.encoding=UTF-8 +base.data.fource.encoding=true + +# base.param.key. +base.param.key.hold.time=TokenHoldTime +base.param.key.encoding=encoding +base.param.key.no.check.uri=NoCheckURI + +# session check. +base.session.check.token=token +base.session.check.user.id=userid +base.session.check.dev.id=devid +base.session.check.dev.os=devos +base.session.check.expire=expire + +# session. +base.session.web.api.page=WebApiPage +base.session.req.uri=ReqURI + +# base.return. +base.return.code.500=500 +base.return.msg.500=\u540e\u53f0\u670d\u52a1\u51fa\u73b0\u5f02\u5e38! +base.return.code.404=404 +base.return.code.406=406 +base.return.msg.406=\u8bbf\u95ee\u670d\u52a1\u540e\u53f0\u6743\u9650\u65e0\u6548! +base.return.result.success.code=SUCCESS +base.return.result.fail.code=FAIL +base.return.msg.save.fail=\u4fdd\u5b58\u5931\u8d25 +base.return.msg.save.success=\u4fdd\u5b58\u6210\u529f +base.return.msg.edit.fail=\u7f16\u8f91\u5931\u8d25 +base.return.msg.edit.success=\u7f16\u8f91\u6210\u529f +base.return.msg.del.fail=\u5220\u9664\u5931\u8d25 +base.return.msg.del.success=\u5220\u9664\u6210\u529f +base.return.msg.init.display.fail=\u521d\u59cb\u5316\u9875\u9762\u5931\u8d25 +base.return.msg.init.display.success=\u521d\u59cb\u5316\u9875\u9762\u6210\u529f + +base.return.type.void=void +base.return.type.app.att=AppAtt + +# base pwd encryption des. +base.pwd.encryption.des.one=0123456789abc +base.pwd.encryption.des.two=1234567890abc +base.pwd.encryption.des.three=1234567890!@# + +# customer type +base.customer.type.company=01 +base.customer.type.person=03 + + +############################################################################### +# APP_PUSH_MESSAGE_CONFIG +############################################################################### +push.message.switch=true +push.message.secret.key.android=xpStkADS2IUJk10PejtJvQ== +push.message.secret.key.ios=WZ5jwvsdAFzo+sDY7wrZgA== +push.message.package.name=com.tenwa.test + + +#base.filter.user.role.id='800090001R00000004','800090001R00000005','099','299','399','800090001R00000010','800090002R00000001','800090002R00000003','800090002R00000045','800090001R00000006','800090001R00000007','800090001R00000008','800090001R00000009','800090001R00000013','800090001R00000014','800090001R00000022','800090001R00000019','800090001R00000020','800090001R00000015','800090001R00000025' +base.filter.user.role.id=none + +base.business.type=1 +base.company.doc.name=\u7533\u8bf7\u4eba\u8425\u4e1a\u6267\u7167\uff08\u6b63\u672c\u6216\u526f\u672c\uff09@\u7533\u8bf7\u4eba\u8425\u4e1a\u6267\u7167\uff08\u6b63\u672c\u6216\u526f\u672c\uff09,\u7533\u8bf7\u4eba\u516c\u53f8\u7ae0\u7a0b\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09@\u7533\u8bf7\u4eba\u516c\u53f8\u7ae0\u7a0b\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09,\u7533\u8bf7\u4eba\u9a8c\u8d44\u62a5\u544a\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09@\u7533\u8bf7\u4eba\u9a8c\u8d44\u62a5\u544a\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09,\u8d22\u52a1\u8d1f\u8d23\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u8d22\u52a1\u8d1f\u8d23\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u5171\u540c\u7533\u8bf7\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u5171\u540c\u7533\u8bf7\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u62c5\u4fdd\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u62c5\u4fdd\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u80a1\u4e1c\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u80a1\u4e1c\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u8fd8\u6b3e\u5361\uff08\u6b63\u53cd\u9762\uff09@\u8fd8\u6b3e\u5361\uff08\u6b63\u53cd\u9762\uff09,\u7ecf\u8425\u573a\u6240\u79df\u8d41\u534f\u8bae@\u7ecf\u8425\u573a\u6240\u79df\u8d41\u534f\u8bae,\u4e0a\u5e74\u5ea6\u53ca\u8fd11\u4e2a\u6708\u7684\u8d22\u52a1\u62a5\u8868\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09@\u4e0a\u5e74\u5ea6\u53ca\u8fd11\u4e2a\u6708\u7684\u8d22\u52a1\u62a5\u8868\uff08\u878d\u8d44\u989d50\u4e07\u4ee5\u4e0a\u63d0\u4f9b\uff09,\u516c\u53f8\u94f6\u884c\u6d41\u6c34\uff08\u6216\u80a1\u4e1c\u540d\u4e0b\u94f6\u884c\u6d41\u6c34\uff09@\u516c\u53f8\u94f6\u884c\u6d41\u6c34\uff08\u6216\u80a1\u4e1c\u540d\u4e0b\u94f6\u884c\u6d41\u6c34\uff09,\u4e1a\u52a1\u5f80\u6765\u5408\u540c@\u4e1a\u52a1\u5f80\u6765\u5408\u540c,\u80a1\u4e1c\u7b80\u5386@\u80a1\u4e1c\u7b80\u5386,\u540c\u610f\u7533\u8bf7\u878d\u8d44\u79df\u8d41\u4e1a\u52a1\u7684\u80a1\u4e1c\u4f1a\u51b3\u8bae@\u540c\u610f\u7533\u8bf7\u878d\u8d44\u79df\u8d41\u4e1a\u52a1\u7684\u80a1\u4e1c\u4f1a\u51b3\u8bae,\u878d\u8d44\u79df\u8d41\u7533\u8bf7\u8868@\u878d\u8d44\u79df\u8d41\u7533\u8bf7\u8868,\u7ecf\u8425\u8bb8\u53ef\u8bc1\uff08\u7279\u6b8a\u884c\u4e1a\u5982\u6709\u63d0\u4f9b\uff09@\u7ecf\u8425\u8bb8\u53ef\u8bc1\uff08\u7279\u6b8a\u884c\u4e1a\u5982\u6709\u63d0\u4f9b\uff09,\u4e2a\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u4e66@\u4e2a\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u4e66,\u4f01\u4e1a\u5f81\u4fe1\u67e5\u8be2@\u4f01\u4e1a\u5f81\u4fe1\u67e5\u8be2,\u6cd5\u4eba\u4ee3\u8868\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u6cd5\u4eba\u4ee3\u8868\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09 +base.person.doc.name=\u627f\u79df\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u627f\u79df\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u878d\u8d44\u79df\u8d41\u7533\u8bf7\u8868@\u878d\u8d44\u79df\u8d41\u7533\u8bf7\u8868,\u8fd8\u6b3e\u5361\uff08\u6b63\u53cd\u9762\uff09@\u8fd8\u6b3e\u5361\uff08\u6b63\u53cd\u9762\uff09,\u9a7e\u9a76\u8bc1\uff08\u6b63\u526f\u672c\uff09@\u9a7e\u9a76\u8bc1\uff08\u6b63\u526f\u672c\uff09,\u5171\u540c\u627f\u79df\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u5171\u540c\u627f\u79df\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u62c5\u4fdd\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09@\u62c5\u4fdd\u4eba\u8eab\u4efd\u8bc1\uff08\u6b63\u53cd\u9762\uff09,\u6237\u53e3\u672c\u53ca\u6237\u7c4d\u8bc1\u660e@\u6237\u53e3\u672c\u53ca\u6237\u7c4d\u8bc1\u660e,\u5a5a\u59fb\u5173\u7cfb\u8bc1\u660e@\u5a5a\u59fb\u5173\u7cfb\u8bc1\u660e,\u6536\u5165\u8bc1\u660e@\u6536\u5165\u8bc1\u660e,\u94f6\u884c\u6d41\u6c34\u5bf9\u8d26\u5355@\u94f6\u884c\u6d41\u6c34\u5bf9\u8d26\u5355,\u7a0e\u5355@\u7a0e\u5355,\u8425\u4e1a\u6267\u7167@\u8425\u4e1a\u6267\u7167,\u7ecf\u8425\u6750\u6599@\u7ecf\u8425\u6750\u6599,\u8d44\u683c\u8bc1\u4e66@\u8d44\u683c\u8bc1\u4e66,\u623f\u4ea7\u8bc1\u660e@\u623f\u4ea7\u8bc1\u660e,\u627f\u79df\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66@\u627f\u79df\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66,\u5171\u540c\u627f\u79df\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66@\u5171\u540c\u627f\u79df\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66,\u62c5\u4fdd\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66@\u62c5\u4fdd\u4eba\u5f81\u4fe1\u67e5\u8be2\u6388\u6743\u59d4\u6258\u4e66,\u8f66\u8f86\u7167\u7247@\u8f66\u8f86\u7167\u7247,\u8f66\u8f86\u89c6\u9891@\u8f66\u8f86\u89c6\u9891,\u627f\u79df\u4eba\u5f81\u4fe1\u62a5\u544a@\u627f\u79df\u4eba\u5f81\u4fe1\u62a5\u544a,\u5171\u540c\u627f\u79df\u4eba\u5f81\u4fe1\u62a5\u544a@\u5171\u540c\u627f\u79df\u4eba\u5f81\u4fe1\u62a5\u544a,\u62c5\u4fdd\u4eba\u5f81\u4fe1\u62a5\u544a@\u62c5\u4fdd\u4eba\u5f81\u4fe1\u62a5\u544a,\u5176\u4ed6@\u5176\u4ed6 +base.calculation.tool.flow.unid=TENWA123 \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/are.xml b/WebContent/WEB-INF/etc/are.xml index 8f2221d23..40423d160 100644 --- a/WebContent/WEB-INF/etc/are.xml +++ b/WebContent/WEB-INF/etc/are.xml @@ -76,6 +76,7 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/cache_app.xml b/WebContent/WEB-INF/etc/cache_app.xml new file mode 100644 index 000000000..10899c9d2 --- /dev/null +++ b/WebContent/WEB-INF/etc/cache_app.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/cache_develop.xml b/WebContent/WEB-INF/etc/cache_develop.xml new file mode 100644 index 000000000..10899c9d2 --- /dev/null +++ b/WebContent/WEB-INF/etc/cache_develop.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/cache_web.xml b/WebContent/WEB-INF/etc/cache_web.xml new file mode 100644 index 000000000..215b63aa7 --- /dev/null +++ b/WebContent/WEB-INF/etc/cache_web.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/jbo/jbo_app.xml b/WebContent/WEB-INF/etc/jbo/jbo_app.xml index 63ac8bb19..2f1d5a6b5 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_app.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_app.xml @@ -4012,7 +4012,7 @@ - + @@ -4161,7 +4161,7 @@ - + @@ -4289,7 +4289,7 @@ - + @@ -4306,6 +4306,9 @@ + + + @@ -4316,7 +4319,7 @@ - + @@ -4368,6 +4371,7 @@ + @@ -4380,6 +4384,8 @@ + + @@ -4441,7 +4447,126 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4449,7 +4574,7 @@ - + @@ -4509,37 +4634,172 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + + + - + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml b/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml new file mode 100644 index 000000000..86067438d --- /dev/null +++ b/WebContent/WEB-INF/etc/jbo/jbo_app_fresh.xml @@ -0,0 +1,461 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_awe.xml b/WebContent/WEB-INF/etc/jbo/jbo_awe.xml index 021c8222c..4fa083819 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_awe.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_awe.xml @@ -130,6 +130,7 @@ + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml index ab783ffd5..5b497a11b 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_calc.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_calc.xml @@ -13,6 +13,7 @@ + @@ -38,6 +39,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -279,6 +308,18 @@ + + + + + + + + + + + + @@ -319,6 +360,18 @@ + + + + + + + + + + + + @@ -327,124 +380,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -546,7 +482,8 @@ - + + @@ -582,15 +519,74 @@ - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -633,8 +629,8 @@ - - + + @@ -642,23 +638,23 @@ - + - - - - + + + + - - + + @@ -701,10 +697,10 @@ - - - + + + @@ -714,9 +710,9 @@ - - - + + + @@ -728,10 +724,44 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -891,8 +921,8 @@ - - + + @@ -900,23 +930,23 @@ - + - - - - + + + + - - + + @@ -959,10 +989,10 @@ - - - + + + @@ -971,10 +1001,10 @@ - / - - - + + + + @@ -986,10 +1016,43 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1190,8 +1253,9 @@ - - + + + @@ -1199,23 +1263,23 @@ - + - - - - + + + + - - + + @@ -1258,10 +1322,10 @@ - - - + + + @@ -1271,9 +1335,9 @@ - - - + + + @@ -1285,10 +1349,42 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1365,9 +1461,10 @@ - + + - + @@ -1377,7 +1474,6 @@ - @@ -1398,18 +1494,78 @@ + - + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1455,6 +1611,17 @@ + + + + + + + + + + + @@ -1511,6 +1678,17 @@ + + + + + + + + + + + @@ -1532,7 +1710,7 @@ - + @@ -1567,6 +1745,8 @@ + + @@ -1589,7 +1769,7 @@ - + @@ -1625,6 +1805,8 @@ + + @@ -2034,30 +2216,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -2072,6 +2230,8 @@ + + @@ -2080,39 +2240,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -2223,6 +2350,7 @@ + @@ -2253,6 +2381,7 @@ + @@ -2307,9 +2436,10 @@ + - + @@ -2343,15 +2473,23 @@ - + + + + + + + + - + + @@ -2425,8 +2563,8 @@ - - + + @@ -2434,23 +2572,23 @@ - + - - - - + + + + - - + + @@ -2493,10 +2631,10 @@ - - - + + + @@ -2506,9 +2644,9 @@ - - - + + + @@ -2520,10 +2658,43 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2594,32 +2765,32 @@ - - + + - - + + - - - - + + + + - + @@ -2661,11 +2832,11 @@ - + - + - + @@ -2675,9 +2846,9 @@ - - - + + + @@ -2689,10 +2860,43 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2920,6 +3124,960 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_comm.xml b/WebContent/WEB-INF/etc/jbo/jbo_comm.xml index e4bac7336..b7c1e1525 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_comm.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_comm.xml @@ -130,6 +130,24 @@ + + + + + + + + + + + + + + + + + + @@ -149,6 +167,9 @@ + + + @@ -167,7 +188,7 @@ - + @@ -202,6 +223,15 @@ + + + + + + + + + @@ -210,6 +240,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -506,7 +654,7 @@ - + @@ -543,9 +691,9 @@ - + - + @@ -556,6 +704,12 @@ + + + + + + @@ -568,9 +722,9 @@ - + - + @@ -581,6 +735,11 @@ + + + + + @@ -589,12 +748,12 @@ - + - + - + @@ -605,6 +764,14 @@ + + + + + + + + @@ -617,9 +784,9 @@ - + - + @@ -630,6 +797,10 @@ + + + + @@ -661,6 +832,11 @@ + + + + + @@ -891,6 +1067,7 @@ + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_customer.xml b/WebContent/WEB-INF/etc/jbo/jbo_customer.xml index 5b8d4bedf..59869bf25 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_customer.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_customer.xml @@ -25,6 +25,8 @@ + + @@ -110,67 +112,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -193,6 +135,9 @@ + + + @@ -249,7 +194,7 @@ - + @@ -323,6 +268,7 @@ + @@ -355,6 +301,8 @@ + + @@ -383,7 +331,7 @@ - + @@ -457,6 +405,7 @@ + @@ -554,92 +503,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -668,83 +532,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -887,6 +676,7 @@ + @@ -942,43 +732,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -1155,7 +909,7 @@ - + @@ -1164,6 +918,9 @@ + + + @@ -1171,9 +928,9 @@ - + - + @@ -1186,9 +943,87 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1213,6 +1048,12 @@ + + + + + + @@ -1241,6 +1082,10 @@ + + + + @@ -1253,7 +1098,7 @@ - + @@ -1269,9 +1114,9 @@ - + - + @@ -1286,9 +1131,12 @@ - + - + + + + @@ -1341,7 +1189,10 @@ - + + + + @@ -1354,9 +1205,9 @@ - + - + @@ -1374,9 +1225,9 @@ - + - + @@ -1392,9 +1243,9 @@ - + - + @@ -1405,7 +1256,7 @@ - + @@ -1445,7 +1296,7 @@ - + @@ -1453,9 +1304,22 @@ - + - + + + + + + + + + + + + + + @@ -1541,7 +1405,7 @@ - + @@ -1558,9 +1422,9 @@ - + - + @@ -1576,9 +1440,9 @@ - + - + @@ -1611,7 +1475,7 @@ - + @@ -1628,6 +1492,11 @@ + + + + + @@ -1640,7 +1509,7 @@ - + @@ -1657,9 +1526,9 @@ - + - + @@ -1675,9 +1544,9 @@ - + - + @@ -1915,70 +1784,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2124,6 +1930,7 @@ + @@ -2197,5 +2004,1285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_doc.xml b/WebContent/WEB-INF/etc/jbo/jbo_doc.xml index 1a600ed19..b5c35eb7f 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_doc.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_doc.xml @@ -111,7 +111,8 @@ - + + @@ -120,8 +121,255 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml index 02d90f564..f0731226c 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_lease.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_lease.xml @@ -1,13 +1,16 @@ + + + @@ -18,6 +21,11 @@ + + + + + @@ -55,6 +63,8 @@ + + @@ -66,9 +76,11 @@ + + - + @@ -98,6 +110,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -171,6 +207,9 @@ + + + @@ -181,9 +220,10 @@ + - + @@ -214,6 +254,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -300,6 +364,9 @@ + + + @@ -567,40 +634,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -654,8 +688,8 @@ - - + + @@ -665,6 +699,8 @@ + + @@ -720,6 +756,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -786,7 +852,10 @@ - + + + + @@ -818,6 +887,9 @@ + + + @@ -877,42 +949,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -951,7 +988,7 @@ - + @@ -985,6 +1022,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1017,6 +1084,7 @@ + @@ -1083,7 +1151,19 @@ - + + + + + + + + + + + + @@ -1091,6 +1171,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1177,8 +1299,8 @@ - - + + @@ -1288,7 +1410,7 @@ - + @@ -1304,7 +1426,7 @@ - + @@ -1353,79 +1475,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1487,6 +1536,18 @@ + + + + + + + + + + + + @@ -1520,6 +1581,7 @@ + @@ -1530,6 +1592,11 @@ + + + + + @@ -1829,6 +1896,7 @@ + @@ -1864,6 +1932,7 @@ + @@ -1908,7 +1977,7 @@ - + @@ -2022,42 +2091,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2331,43 +2365,46 @@ + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + @@ -2581,6 +2618,7 @@ + @@ -2667,6 +2705,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2782,6 +2848,22 @@ + + + + + + + + + + + + + + + + @@ -2790,35 +2872,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -2980,13 +3034,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -2995,6 +3096,7 @@ + @@ -3009,7 +3111,7 @@ - + @@ -3019,6 +3121,7 @@ + @@ -3048,6 +3151,10 @@ + + + + @@ -3079,6 +3186,9 @@ + + + @@ -3126,6 +3236,10 @@ + + + + @@ -3155,6 +3269,9 @@ + + + @@ -3176,6 +3293,10 @@ + + + + @@ -3204,6 +3325,9 @@ + + + @@ -3212,35 +3336,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3273,9 +3368,10 @@ - - - + + + + @@ -3288,6 +3384,9 @@ + + + @@ -3296,8 +3395,1767 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -3364,19 +5222,233 @@ - + - - + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3386,42 +5458,57 @@ - + - + + + - - - - - - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_prd.xml b/WebContent/WEB-INF/etc/jbo/jbo_prd.xml index 4f0d80d73..d02072f29 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_prd.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_prd.xml @@ -72,6 +72,20 @@ + + + + + + + + + + + + + + @@ -149,6 +163,22 @@ + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml index e707d5787..6d21ca6ae 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_sys.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_sys.xml @@ -605,47 +605,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -998,7 +958,8 @@ - + + @@ -1391,7 +1352,7 @@ - + @@ -1757,6 +1718,7 @@ + @@ -1861,6 +1823,7 @@ + @@ -2182,5 +2145,1087 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml index 5d8744b74..a9a0949a7 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_voucher.xml @@ -76,11 +76,13 @@ - + + + @@ -124,6 +126,158 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebContent/WEB-INF/etc/simplelog.properties b/WebContent/WEB-INF/etc/simplelog.properties index 0deb89482..952260e40 100644 --- a/WebContent/WEB-INF/etc/simplelog.properties +++ b/WebContent/WEB-INF/etc/simplelog.properties @@ -7,18 +7,17 @@ com.amarsoft.are.log.SimpleLog.handlers=com.amarsoft.are.log.impl.ConsoleHandler com.amarsoft.are.log.impl.simple.WarnFileHandler.level = error; -com.amarsoft.are.log.impl.simple.WarnFileHandler.pattern = d:/tmp/log/a3web_warn_%g.log +com.amarsoft.are.log.impl.simple.WarnFileHandler.pattern = /data/files/apzl_leasing/tmp/log/a3web_warn_%g.log com.amarsoft.are.log.impl.simple.WarnFileHandler.limit = 1024000 -com.amarsoft.are.log.impl.FileHandler.level = debug -#com.amarsoft.are.log.impl.FileHandler.pattern = {$ARE.APP_HOME}/log/a3web_%D_%g.log +com.amarsoft.are.log.impl.FileHandler.level = info#com.amarsoft.are.log.impl.FileHandler.pattern = {$ARE.APP_HOME}/log/a3web_%D_%g.log -com.amarsoft.are.log.impl.FileHandler.pattern = d:/tmp/log/a3web_%D_%g.log +com.amarsoft.are.log.impl.FileHandler.pattern = /data/files/apzl_leasing/tmp/log/a3web_%D_%g.log com.amarsoft.are.log.impl.FileHandler.limit = 10240000 com.amarsoft.are.log.impl.FileHandler.count = 10 com.amarsoft.are.log.impl.FileHandler.append = true com.amarsoft.are.log.impl.FileHandler.formatter = com.amarsoft.are.log.impl.simple.SimpleFormatter -com.amarsoft.are.log.impl.ConsoleHandler.level = all +com.amarsoft.are.log.impl.ConsoleHandler.level = info \ No newline at end of file diff --git a/WebContent/WEB-INF/etc/template/log4jlog.properties b/WebContent/WEB-INF/etc/template/log4jlog.properties index 9cff22f12..35238f1cd 100644 --- a/WebContent/WEB-INF/etc/template/log4jlog.properties +++ b/WebContent/WEB-INF/etc/template/log4jlog.properties @@ -50,8 +50,8 @@ log4j.appender.MAIL.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p log4j.appender.DATABASE=org.apache.log4j.jdbc.JDBCAppender log4j.appender.DATABASE.URL=jdbc:mysql://localhost:3306/test log4j.appender.DATABASE.driver=com.mysql.jdbc.Driver -log4j.appender.DATABASE.user=root -log4j.appender.DATABASE.password= +log4j.appender.DATABASE.user=apzl +log4j.appender.DATABASE.password=apzl@2018 log4j.appender.DATABASE.sql=INSERT INTO LOG4J (Message) VALUES ('[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n') log4j.appender.DATABASE.layout=org.apache.log4j.PatternLayout log4j.appender.DATABASE.layout.ConversionPattern=[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n diff --git a/WebContent/WEB-INF/lib/XmlSchema-1.1.jar b/WebContent/WEB-INF/lib/XmlSchema-1.1.jar new file mode 100644 index 000000000..a52c56211 Binary files /dev/null and b/WebContent/WEB-INF/lib/XmlSchema-1.1.jar differ diff --git a/WebContent/WEB-INF/lib/aspose-words-18.1-jdk16.jar b/WebContent/WEB-INF/lib/aspose-words-18.1-jdk16.jar new file mode 100644 index 000000000..25610609d Binary files /dev/null and b/WebContent/WEB-INF/lib/aspose-words-18.1-jdk16.jar differ diff --git a/WebContent/WEB-INF/lib/axis.jar b/WebContent/WEB-INF/lib/axis.jar new file mode 100644 index 000000000..20b09a595 Binary files /dev/null and b/WebContent/WEB-INF/lib/axis.jar differ diff --git a/WebContent/WEB-INF/lib/commons-discovery-0.2.jar b/WebContent/WEB-INF/lib/commons-discovery-0.2.jar new file mode 100644 index 000000000..b88554847 Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-discovery-0.2.jar differ diff --git a/WebContent/WEB-INF/lib/commons-lang3-3.4.jar b/WebContent/WEB-INF/lib/commons-lang3-3.4.jar new file mode 100644 index 000000000..8ec91d454 Binary files /dev/null and b/WebContent/WEB-INF/lib/commons-lang3-3.4.jar differ diff --git a/WebContent/WEB-INF/lib/gnete-bc-139.jar b/WebContent/WEB-INF/lib/gnete-bc-139.jar new file mode 100644 index 000000000..ac7bf8ef8 Binary files /dev/null and b/WebContent/WEB-INF/lib/gnete-bc-139.jar differ diff --git a/WebContent/WEB-INF/lib/gnete-security-1.1.jar b/WebContent/WEB-INF/lib/gnete-security-1.1.jar new file mode 100644 index 000000000..f2d9a6db2 Binary files /dev/null and b/WebContent/WEB-INF/lib/gnete-security-1.1.jar differ diff --git a/WebContent/WEB-INF/lib/itextpdf-5.5.13.jar b/WebContent/WEB-INF/lib/itextpdf-5.5.13.jar new file mode 100644 index 000000000..fb2ecf1a6 Binary files /dev/null and b/WebContent/WEB-INF/lib/itextpdf-5.5.13.jar differ diff --git a/WebContent/WEB-INF/lib/itextpdf-5.5.5.jar b/WebContent/WEB-INF/lib/itextpdf-5.5.5.jar new file mode 100644 index 000000000..02eed5300 Binary files /dev/null and b/WebContent/WEB-INF/lib/itextpdf-5.5.5.jar differ diff --git a/WebContent/WEB-INF/lib/javassist-3.18.2-GA.jar b/WebContent/WEB-INF/lib/javassist-3.18.2-GA.jar new file mode 100644 index 000000000..c8761c8ef Binary files /dev/null and b/WebContent/WEB-INF/lib/javassist-3.18.2-GA.jar differ diff --git a/WebContent/WEB-INF/lib/jaxen-1.1-beta-9.jar b/WebContent/WEB-INF/lib/jaxen-1.1-beta-9.jar new file mode 100644 index 000000000..6402d3273 Binary files /dev/null and b/WebContent/WEB-INF/lib/jaxen-1.1-beta-9.jar differ diff --git a/WebContent/WEB-INF/lib/jaxrpc.jar b/WebContent/WEB-INF/lib/jaxrpc.jar new file mode 100644 index 000000000..a2c13d9a2 Binary files /dev/null and b/WebContent/WEB-INF/lib/jaxrpc.jar differ diff --git a/WebContent/WEB-INF/lib/jbarcode-0.2.8.jar b/WebContent/WEB-INF/lib/jbarcode-0.2.8.jar new file mode 100644 index 000000000..6bc429de1 Binary files /dev/null and b/WebContent/WEB-INF/lib/jbarcode-0.2.8.jar differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar new file mode 100644 index 000000000..be09493c0 Binary files /dev/null and b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.38.jar differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java-5.1.44-bin.jar b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.44-bin.jar new file mode 100644 index 000000000..2f2e32d51 Binary files /dev/null and b/WebContent/WEB-INF/lib/mysql-connector-java-5.1.44-bin.jar differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java-commercial-5.1.25-bin.jar b/WebContent/WEB-INF/lib/mysql-connector-java-commercial-5.1.25-bin.jar deleted file mode 100644 index efef016d4..000000000 Binary files a/WebContent/WEB-INF/lib/mysql-connector-java-commercial-5.1.25-bin.jar and /dev/null differ diff --git a/WebContent/WEB-INF/lib/mysql-connector-java.jar b/WebContent/WEB-INF/lib/mysql-connector-java.jar deleted file mode 100644 index 0170c3e53..000000000 Binary files a/WebContent/WEB-INF/lib/mysql-connector-java.jar and /dev/null differ diff --git a/WebContent/WEB-INF/lib/saaj.jar b/WebContent/WEB-INF/lib/saaj.jar new file mode 100644 index 000000000..4ea696e74 Binary files /dev/null and b/WebContent/WEB-INF/lib/saaj.jar differ diff --git a/WebContent/WEB-INF/lib/security.jar b/WebContent/WEB-INF/lib/security.jar deleted file mode 100644 index 0503f2b31..000000000 Binary files a/WebContent/WEB-INF/lib/security.jar and /dev/null differ diff --git a/WebContent/WEB-INF/lib/wsdl4j.jar b/WebContent/WEB-INF/lib/wsdl4j.jar new file mode 100644 index 000000000..67a35fcba Binary files /dev/null and b/WebContent/WEB-INF/lib/wsdl4j.jar differ diff --git a/WebContent/WEB-INF/lib/wstx-asl-3.2.0.jar b/WebContent/WEB-INF/lib/wstx-asl-3.2.0.jar new file mode 100644 index 000000000..24c895ca7 Binary files /dev/null and b/WebContent/WEB-INF/lib/wstx-asl-3.2.0.jar differ diff --git a/WebContent/WEB-INF/lib/xbean-spring-2.8.jar b/WebContent/WEB-INF/lib/xbean-spring-2.8.jar new file mode 100644 index 000000000..9bb829a8b Binary files /dev/null and b/WebContent/WEB-INF/lib/xbean-spring-2.8.jar differ diff --git a/WebContent/WEB-INF/lib/xfire-aegis-1.2.6.jar b/WebContent/WEB-INF/lib/xfire-aegis-1.2.6.jar new file mode 100644 index 000000000..83e17f7f3 Binary files /dev/null and b/WebContent/WEB-INF/lib/xfire-aegis-1.2.6.jar differ diff --git a/WebContent/WEB-INF/lib/xfire-all-1.2.6.jar b/WebContent/WEB-INF/lib/xfire-all-1.2.6.jar new file mode 100644 index 000000000..828b6805a Binary files /dev/null and b/WebContent/WEB-INF/lib/xfire-all-1.2.6.jar differ diff --git a/WebContent/WEB-INF/lib/xfire-core-1.2.6.jar b/WebContent/WEB-INF/lib/xfire-core-1.2.6.jar new file mode 100644 index 000000000..0ff443aa7 Binary files /dev/null and b/WebContent/WEB-INF/lib/xfire-core-1.2.6.jar differ diff --git a/WebContent/WEB-INF/lib/xfire-ws-security-1.2.6.jar b/WebContent/WEB-INF/lib/xfire-ws-security-1.2.6.jar new file mode 100644 index 000000000..b45f25b42 Binary files /dev/null and b/WebContent/WEB-INF/lib/xfire-ws-security-1.2.6.jar differ diff --git a/WebContent/WEB-INF/lib/xml-apis.jar b/WebContent/WEB-INF/lib/xml-apis.jar new file mode 100644 index 000000000..243eaeaeb Binary files /dev/null and b/WebContent/WEB-INF/lib/xml-apis.jar differ diff --git a/WebContent/WEB-INF/lib/xmlParserAPIs-2.6.2.jar b/WebContent/WEB-INF/lib/xmlParserAPIs-2.6.2.jar new file mode 100644 index 000000000..2dd837714 Binary files /dev/null and b/WebContent/WEB-INF/lib/xmlParserAPIs-2.6.2.jar differ diff --git a/WebContent/WEB-INF/tlds/web.xml b/WebContent/WEB-INF/tlds/web.xml new file mode 100644 index 000000000..68ad32b80 --- /dev/null +++ b/WebContent/WEB-INF/tlds/web.xml @@ -0,0 +1,557 @@ + + + A3Web + + + JSPConfiguration + *.jsp + GBK + + + JSPConfiguration + *.jspf + GBK + + + + RunFilter + com.amarsoft.awe.control.RunFilter + + RunTimeDebug + true + + + ShowFramePage + true + + + DbLog + false + + + encoding + GBK + + + DataSource + als + + + ExcludedURLs + ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp,^/.*appDownload.jsp + + + + RunFilter + *.jsp + REQUEST + FORWARD + + + RunFilter + /servlet/view/* + + + InitAREServlet + com.amarsoft.are.InitAREServlet + + ConfigFile + /WEB-INF/etc/are.xml + + + AppHome + /WEB-INF + + 1 + + + InitAWEServlet + com.amarsoft.awe.control.InitAWEServlet + + ConfigFile + /WEB-INF/etc/a3web.xml + + + CacheFile + /WEB-INF/etc/cache.xml + + + SkinConfig + /WEB-INF/etc/skin.xml + + + ButtonConfig + /WEB-INF/etc/button.xml + + + DataSource + als + + 2 + + + RedirectorServlet + com.amarsoft.awe.control.RedirectorServlet + + encoding + GBK + + + + + InitSecondHandCarConfig + com.amarsoft.app.awe.config.InitSecondHandCarConfig + + shutdown-on-unload + true + + 1 + + + + InitCollectConfig + com.amarsoft.app.awe.config.InitCollectConfig + + shutdown-on-unload + true + + 1 + + + + RewriteRunJavaMethodServlet + com.tenwa.workflow.RewriteRunJavaMethodServlet + + DataSource + als + + + + + RedirectorDialogServlet + com.amarsoft.awe.control.RedirectorDialogServlet + + encoding + GBK + + + + ForwardServlet + com.amarsoft.awe.control.ForwardServlet + + encoding + GBK + + + + RunJavaMethodServlet + com.amarsoft.awe.control.RunJavaMethodServlet + + DataSource + als + + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + MessageServlet + com.amarsoft.awe.message.MessageServlet + + + WorkDocFileServlet + com.amarsoft.awe.common.attachment.WorkDocFileServlet + + + AttachmentViewServlet + com.amarsoft.awe.common.attachment.AttachmentViewServlet + + + EditOfficeServlet + com.tenwa.onlineoperation.servlet.EditOfficeServlet + + + FileTemplateViewServlet + com.amarsoft.filetemplate.servlet.FileTemplateViewServlet + + + DocDownloadServlet + com.tenwa.doc.servlet.DocDownloadServlet + + + DocDownloadZipServlet + com.tenwa.doc.servlet.DocDownloadZipServlet + + + DocFlowDownloadZipServlet + com.tenwa.doc.servlet.DocFlowDownloadZipServlet + + + DownloadZipServlet + com.tenwa.officetempalte.controller.DownloadZipServlet + + + FileViewServlet + com.amarsoft.awe.common.attachment.FileViewServlet + + + ShowImageServlet + com.tenwa.doc.servlet.ShowImageServlet + + + ShowPDFServlet + com.tenwa.doc.servlet.ShowPDFServlet + + + StreamViewServlet + com.amarsoft.awe.common.attachment.StreamViewServlet + + + CheckCodeServlet + com.amarsoft.awe.control.CheckCodeServlet + + CodeLength + 5 + + + + MonitorSOAPServlet + com.amarsoft.awe.common.monitor.MonitorSOAPServlet + + + RedirectorServlet + /Redirector + + + RedirectorDialogServlet + /RedirectorDialog + + + RunJavaMethodServlet + /servlet/run + + + ForwardServlet + /ao + + + DisplayChart + /chartview + + + MessageServlet + /servlet/message + + + WorkDocFileServlet + /servlet/workdocfile/* + + + AttachmentViewServlet + /servlet/view/attachment + + + EditOfficeServlet + /servlet/view/editOffice + + + FileTemplateViewServlet + /servlet/view/fileTemplateView + + + DocDownloadServlet + /servlet/view/docDownloadServlet + + + + RewriteRunJavaMethodServlet + /servlet/runflow + + + + DocDownloadZipServlet + /servlet/view/docDownloadZipServlet + + + DocFlowDownloadZipServlet + /servlet/view/docFlowDownloadZipServlet + + + DownloadZipServlet + /servlet/view/DownloadZipServlet + + + AttachmentViewServlet + /servlet/pdf/* + + + FileViewServlet + /servlet/view/file + + + ShowImageServlet + /servlet/view/image + + + ShowPDFServlet + /servlet/view/pdf + + + FileViewServlet + /servlet/viewpic + + + StreamViewServlet + /servlet/view/stream + + + CheckCodeServlet + /servlet/checkcode + + + MonitorSOAPServlet + /servlet/monitor + + + QueryResultServlet + com.amarsoft.asquery.servlet.QueryResultServlet + + threadCount + 5 + + + + QueryResultServlet + /SynchResultQuery + + + InfoPageExportServlet + com.amarsoft.awe.dw.export.servlet.InfoExportServlet + + + ListPageExportServlet + com.amarsoft.awe.dw.export.servlet.ListExportServlet + + + InfoPageExportServlet + /EAS/PageExport/info + + + ListPageExportServlet + /EAS/PageExport/list + + + workflow_GetProcess + com.amarsoft.biz.workflow.graph.web.GetProcess + + + workflow_UpdateProcess + com.amarsoft.biz.workflow.graph.web.UpdateProcess + + + workflow_AddProcess + com.amarsoft.biz.workflow.graph.web.AddProcess + + + workflow_DeleteProcess + com.amarsoft.biz.workflow.graph.web.DeleteProcess + + + workflow_ListProcess + com.amarsoft.biz.workflow.graph.web.ListProcess + + + workflow_GetProcess + /getprocess.wf + + + workflow_UpdateProcess + /updateprocess.wf + + + workflow_AddProcess + /addprocess.wf + + + workflow_DeleteProcess + /deleteprocess.wf + + + workflow_ListProcess + /listprocess.wf + + + index.html + + + 404 + /Frame/page/sys/NoPageInfo.jsp + + + jdbc/als + javax.sql.DataSource + Application + Shareable + + + jdbc/report + javax.sql.DataSource + Application + Shareable + + + 240 + + + InitDBType + com.amarsoft.app.awe.config.InitDBType + + shutdown-on-unload + true + + 1 + + + QuartzInitializer + com.tenwa.quartz.MyQuartzInitializerServlet + + config-file + quartz.properties + + + shutdown-on-unload + true + + 5 + + + webAppRootKey + webapp.port + + + javax.servlet.jsp.jstl.fmt.localizationContext + ApplicationResources + + + log4jConfigLocation + /WEB-INF/classes/log4j.xml + + + 閰嶇疆鏂囦欢浣嶇疆 + contextConfigLocation + classpath:applicationContext*.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + + + + Restfull澶勭悊Servlet + RestfullServlet + RestfullServlet + cn.coyoteam.aweresf.web.servlet.RestfullServiceServlet + cn.servlet.RestfullServiceServlet + + 1 + + + RestfullServlet + /webapi/resf/* + + + restfull鑷姩鎵弿璺緞璁剧疆 + RestfullScanPackage + + apx.com.amarsoft.als.user.logon.controller, + apx.com.amarsoft.als.user.pwd.controller, + apx.com.amarsoft.als.user.sys.controller, + apx.com.amarsoft.als.doc.controller, + apx.com.amarsoft.als.currency.select.controller, + apx.com.amarsoft.als.currency.select.contract.controller, + 鎴戠殑宸ヤ綔 + 鐢宠鍒楄〃 锛 applytype phasetype ObjectNo + apx.com.amarsoft.als.apzl.apply.business.query.controller, + 涓氬姟鐢宠鍙戣捣 + apx.com.amarsoft.als.apzl.apply.business.start.controller, + 姹借溅閫夋嫨妗 + apx.com.amarsoft.als.currency.select.apzl.car.controller, + 浜у搧閫夋嫨妗 + apx.com.amarsoft.als.currency.select.apzl.product.controller, + + 鎰忚 + 绛剧讲鎰忚 + apx.com.amarsoft.als.business.opinion.sign.controller, + 娴佺▼鍘嗗彶鎰忚 + apx.com.amarsoft.als.business.opinion.history.controller, + + 娴佺▼闄勪欢涓瑙 + apx.com.amarsoft.als.business.attachment.controller, + + 娴佺▼鍔ㄤ綔 + apx.com.amarsoft.als.business.action.ready.controller, + apx.com.amarsoft.als.business.action.submit.controller, + apx.com.amarsoft.als.business.action.back.controller, + apx.com.amarsoft.als.business.comm.action.controller, + + 閫氱敤 鍒楄〃/琛ㄥ崟 鏌ヨ 淇濆瓨 澶勭悊 + 閫氱敤妯℃澘鏌ヨ 淇濆瓨 鍒楄〃 鍒犻櫎 澶勭悊 + apx.com.amarsoft.als.base.awe.controller, + 鎵f鍗′俊鎭彉鏇 + apx.com.amarsoft.als.business.change.controller, + 淇℃伅鏍¢獙 + apx.com.amarsoft.als.business.verification.controller, + + + 瀵规暣涓獁ebapi杩涜涓浜涢氱敤澶勭悊鐨勮繃婊ゅ櫒 + + SessionAndContextFilter + SessionAndContextFilter + cn.coyoteam.aweresf.web.filter.SessionAndContextFilter + cn.filter.SessionAndContextFilter + + NoCheckURI + + 鐢ㄦ埛 鐧诲綍/娉ㄩ攢 + /resf/logon/manager/logon, + /resf/logon/manager/logout, + 鍏抽棴鎵嬪娍瀵嗙爜 鏌ヨ鎵嬪娍瀵嗙爜鐘舵 + /resf/user/center/manager/acquisition/gesture, + /resf/user/center/manager/close/gesture, + 妫娴嬬郴缁 鐗堟湰 + /resf/user/center/manager/detection/version, + 涓嬭浇 + /resf/files/down/docById, + /resf/files/downloadPlist, + /resf/files/downloadApp, + /resf/files/downloadAppById, + + + + TokenHoldTime + 315360003600*24*365=31536000 + + + dataSource + als + + + encoding + GBK + + + + SessionAndContextFilter + /webapi/* + + + + + \ No newline at end of file diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml index 2e4229f4e..3f20081db 100644 --- a/WebContent/WEB-INF/web.xml +++ b/WebContent/WEB-INF/web.xml @@ -1,475 +1,486 @@ - - A3Web - - - JSPConfiguration - *.jsp - GBK - - - JSPConfiguration - *.jspf - GBK - - - - RunFilter - com.amarsoft.awe.control.RunFilter - - RunTimeDebug - true - - - ShowFramePage - true - - - DbLog - false - - - encoding - GBK - - - DataSource - als - - - ExcludedURLs - ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp - - - - RunFilter - *.jsp - REQUEST - FORWARD - - - RunFilter - /servlet/view/* - - - InitAREServlet - com.amarsoft.are.InitAREServlet - - ConfigFile - /WEB-INF/etc/are.xml - - - AppHome - /WEB-INF - - 1 - - - InitAWEServlet - com.amarsoft.awe.control.InitAWEServlet - - ConfigFile - /WEB-INF/etc/a3web.xml - - - CacheFile - /WEB-INF/etc/cache.xml - - - SkinConfig - /WEB-INF/etc/skin.xml - - - ButtonConfig - /WEB-INF/etc/button.xml - - - DataSource - als - - 2 - - - RedirectorServlet - com.amarsoft.awe.control.RedirectorServlet - - encoding - GBK - - - - - RewriteRunJavaMethodServlet - com.tenwa.workflow.RewriteRunJavaMethodServlet - - DataSource - als - - - - - RedirectorDialogServlet - com.amarsoft.awe.control.RedirectorDialogServlet - - encoding - GBK - - - - ForwardServlet - com.amarsoft.awe.control.ForwardServlet - - encoding - GBK - - - - RunJavaMethodServlet - com.amarsoft.awe.control.RunJavaMethodServlet - - DataSource - als - - - - DisplayChart - org.jfree.chart.servlet.DisplayChart - - - MessageServlet - com.amarsoft.awe.message.MessageServlet - - - WorkDocFileServlet - com.amarsoft.awe.common.attachment.WorkDocFileServlet - - - AttachmentViewServlet - com.amarsoft.awe.common.attachment.AttachmentViewServlet - - - EditOfficeServlet - com.tenwa.onlineoperation.servlet.EditOfficeServlet - - - FileTemplateViewServlet - com.amarsoft.filetemplate.servlet.FileTemplateViewServlet - - - DocDownloadServlet - com.tenwa.doc.servlet.DocDownloadServlet - - - DocDownloadZipServlet - com.tenwa.doc.servlet.DocDownloadZipServlet - - - DocFlowDownloadZipServlet - com.tenwa.doc.servlet.DocFlowDownloadZipServlet - - - DownloadZipServlet - com.tenwa.officetempalte.controller.DownloadZipServlet - - - FileViewServlet - com.amarsoft.awe.common.attachment.FileViewServlet - - - ShowImageServlet - com.tenwa.doc.servlet.ShowImageServlet - - - ShowPDFServlet - com.tenwa.doc.servlet.ShowPDFServlet - - - StreamViewServlet - com.amarsoft.awe.common.attachment.StreamViewServlet - - - CheckCodeServlet - com.amarsoft.awe.control.CheckCodeServlet - - CodeLength - 5 - - - - MonitorSOAPServlet - com.amarsoft.awe.common.monitor.MonitorSOAPServlet - - - RedirectorServlet - /Redirector - - - RedirectorDialogServlet - /RedirectorDialog - - - RunJavaMethodServlet - /servlet/run - - - ForwardServlet - /ao - - - DisplayChart - /chartview - - - MessageServlet - /servlet/message - - - WorkDocFileServlet - /servlet/workdocfile/* - - - AttachmentViewServlet - /servlet/view/attachment - - - EditOfficeServlet - /servlet/view/editOffice - - - FileTemplateViewServlet - /servlet/view/fileTemplateView - - - DocDownloadServlet - /servlet/view/docDownloadServlet - - - - RewriteRunJavaMethodServlet - /servlet/runflow - - - - DocDownloadZipServlet - /servlet/view/docDownloadZipServlet - - - DocFlowDownloadZipServlet - /servlet/view/docFlowDownloadZipServlet - - - DownloadZipServlet - /servlet/view/DownloadZipServlet - - - AttachmentViewServlet - /servlet/pdf/* - - - FileViewServlet - /servlet/view/file - - - ShowImageServlet - /servlet/view/image - - - ShowPDFServlet - /servlet/view/pdf - - - FileViewServlet - /servlet/viewpic - - - StreamViewServlet - /servlet/view/stream - - - CheckCodeServlet - /servlet/checkcode - - - MonitorSOAPServlet - /servlet/monitor - - - QueryResultServlet - com.amarsoft.asquery.servlet.QueryResultServlet - - threadCount - 5 - - - - QueryResultServlet - /SynchResultQuery - - - InfoPageExportServlet - com.amarsoft.awe.dw.export.servlet.InfoExportServlet - - - ListPageExportServlet - com.amarsoft.awe.dw.export.servlet.ListExportServlet - - - InfoPageExportServlet - /EAS/PageExport/info - - - ListPageExportServlet - /EAS/PageExport/list - - - workflow_GetProcess - - com.amarsoft.biz.workflow.graph.web.GetProcess - - - - workflow_UpdateProcess - - com.amarsoft.biz.workflow.graph.web.UpdateProcess - - - - workflow_AddProcess - - com.amarsoft.biz.workflow.graph.web.AddProcess - - - - workflow_DeleteProcess - - com.amarsoft.biz.workflow.graph.web.DeleteProcess - - - - workflow_ListProcess - - com.amarsoft.biz.workflow.graph.web.ListProcess - - - - workflow_GetProcess - /getprocess.wf - - - workflow_UpdateProcess - /updateprocess.wf - - - workflow_AddProcess - /addprocess.wf - - - workflow_DeleteProcess - /deleteprocess.wf - - - workflow_ListProcess - /listprocess.wf - - - index.html - - - 404 - /Frame/page/sys/NoPageInfo.jsp - - - jdbc/als - javax.sql.DataSource - Application - Shareable - - - jdbc/report - javax.sql.DataSource - Application - Shareable - - - 240 - - - InitDBType - com.amarsoft.app.awe.config.InitDBType - - shutdown-on-unload - true - - 1 - - - QuartzInitializer - com.tenwa.quartz.MyQuartzInitializerServlet - - config-file - quartz.properties - - - shutdown-on-unload - true - - 5 - - - webAppRootKey - webapp.port - - - javax.servlet.jsp.jstl.fmt.localizationContext - ApplicationResources - - - log4jConfigLocation - /WEB-INF/classes/log4j.xml - - - 閰嶇疆鏂囦欢浣嶇疆 - contextConfigLocation - classpath:applicationContext*.xml - - - org.springframework.web.context.ContextLoaderListener - - - - - - - 閽堝ObjectWindow鐨勭晫闈㈡弿杩拌瑷 - XWRenderServlet - XWRenderServlet - cn.coyoteam.aweresf.web.servlet.XWRenderServlet + + A3Web + + + JSPConfiguration + *.jsp + GBK + + + JSPConfiguration + *.jspf + GBK + + + + RunFilter + com.amarsoft.awe.control.RunFilter - XWInterceptConfig - classpath:/com/amarsoft/aims/xwrender-intercept.properties + RunTimeDebug + true + + + ShowFramePage + true + + + DbLog + false + + + encoding + GBK + + + DataSource + als + + + ExcludedURLs + ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp,^/.*appDownload.jsp + + + + RunFilter + *.jsp + REQUEST + FORWARD + + + RunFilter + /servlet/view/* + + + InitAREServlet + com.amarsoft.are.InitAREServlet + + ConfigFile + /WEB-INF/etc/are.xml + + + AppHome + /WEB-INF 1 - - XWRenderServlet - /xwrender/* - - 閽堝澶栭儴鎻愪緵鎺ュ彛鐨剋ebapi - XWTransformServlet - XWTransformServlet - cn.coyoteam.aweresf.web.servlet.XWTransformServlet + InitAWEServlet + com.amarsoft.awe.control.InitAWEServlet + + ConfigFile + /WEB-INF/etc/a3web.xml + + + CacheFile + /WEB-INF/etc/cache.xml + + + SkinConfig + /WEB-INF/etc/skin.xml + + + ButtonConfig + /WEB-INF/etc/button.xml + + + DataSource + als + + 2 + + + RedirectorServlet + com.amarsoft.awe.control.RedirectorServlet + + encoding + GBK + + + + + InitSecondHandCarConfig + com.amarsoft.app.awe.config.InitSecondHandCarConfig + + shutdown-on-unload + true + + 1 + + + + InitCollectConfig + com.amarsoft.app.awe.config.InitCollectConfig + + shutdown-on-unload + true + + 1 + + + + RewriteRunJavaMethodServlet + com.tenwa.workflow.RewriteRunJavaMethodServlet + + DataSource + als + + + + + RedirectorDialogServlet + com.amarsoft.awe.control.RedirectorDialogServlet + + encoding + GBK + + + + ForwardServlet + com.amarsoft.awe.control.ForwardServlet + + encoding + GBK + + + + RunJavaMethodServlet + com.amarsoft.awe.control.RunJavaMethodServlet + + DataSource + als + + + + FlowController + com.tenwa.flow.action.comm.FlowController + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + MessageServlet + com.amarsoft.awe.message.MessageServlet + + + WorkDocFileServlet + com.amarsoft.awe.common.attachment.WorkDocFileServlet + + + AttachmentViewServlet + com.amarsoft.awe.common.attachment.AttachmentViewServlet + + + EditOfficeServlet + com.tenwa.onlineoperation.servlet.EditOfficeServlet + + + FileTemplateViewServlet + com.amarsoft.filetemplate.servlet.FileTemplateViewServlet + + + DocDownloadServlet + com.tenwa.doc.servlet.DocDownloadServlet + + + DocDownloadZipServlet + com.tenwa.doc.servlet.DocDownloadZipServlet + + + DocFlowDownloadZipServlet + com.tenwa.doc.servlet.DocFlowDownloadZipServlet + + + DownloadZipServlet + com.tenwa.officetempalte.controller.DownloadZipServlet + + + FileViewServlet + com.amarsoft.awe.common.attachment.FileViewServlet + + + FileViewServlet1 + com.tenwa.lease.util.FileViewServlet + + + ShowImageServlet + com.tenwa.doc.servlet.ShowImageServlet + + + ShowPDFServlet + com.tenwa.doc.servlet.ShowPDFServlet + + + StreamViewServlet + com.amarsoft.awe.common.attachment.StreamViewServlet + + + CheckCodeServlet + com.amarsoft.awe.control.CheckCodeServlet + + CodeLength + 5 + + + + MonitorSOAPServlet + com.amarsoft.awe.common.monitor.MonitorSOAPServlet - XWTransformServlet - /webapi/xw/* + RedirectorServlet + /Redirector + + RedirectorDialogServlet + /RedirectorDialog + + + FlowController + /startFlow + + + RunJavaMethodServlet + /servlet/run + + + ForwardServlet + /ao + + + DisplayChart + /chartview + + + MessageServlet + /servlet/message + + + WorkDocFileServlet + /servlet/workdocfile/* + + + AttachmentViewServlet + /servlet/view/attachment + + + EditOfficeServlet + /servlet/view/editOffice + + + FileTemplateViewServlet + /servlet/view/fileTemplateView + + + DocDownloadServlet + /servlet/view/docDownloadServlet + + + + RewriteRunJavaMethodServlet + /servlet/runflow + + + + DocDownloadZipServlet + /servlet/view/docDownloadZipServlet + + + DocFlowDownloadZipServlet + /servlet/view/docFlowDownloadZipServlet + + + DownloadZipServlet + /servlet/view/DownloadZipServlet + + + AttachmentViewServlet + /servlet/pdf/* + + + FileViewServlet + /servlet/view/file + + + ShowImageServlet + /servlet/view/image + + + ShowPDFServlet + /servlet/view/pdf + + + FileViewServlet + /servlet/viewpic + + + StreamViewServlet + /servlet/view/stream + + + CheckCodeServlet + /servlet/checkcode + + + MonitorSOAPServlet + /servlet/monitor + + + QueryResultServlet + com.amarsoft.asquery.servlet.QueryResultServlet + + threadCount + 5 + + + + QueryResultServlet + /SynchResultQuery + + + InfoPageExportServlet + com.amarsoft.awe.dw.export.servlet.InfoExportServlet + + + ListPageExportServlet + com.amarsoft.awe.dw.export.servlet.ListExportServlet + + + InfoPageExportServlet + /EAS/PageExport/info + + + ListPageExportServlet + /EAS/PageExport/list + + + workflow_GetProcess + com.amarsoft.biz.workflow.graph.web.GetProcess + + + workflow_UpdateProcess + com.amarsoft.biz.workflow.graph.web.UpdateProcess + + + workflow_AddProcess + com.amarsoft.biz.workflow.graph.web.AddProcess + + + workflow_DeleteProcess + com.amarsoft.biz.workflow.graph.web.DeleteProcess + + + workflow_ListProcess + com.amarsoft.biz.workflow.graph.web.ListProcess + + + workflow_GetProcess + /getprocess.wf + + + workflow_UpdateProcess + /updateprocess.wf + + + workflow_AddProcess + /addprocess.wf + + + workflow_DeleteProcess + /deleteprocess.wf + + + workflow_ListProcess + /listprocess.wf + + + index.html + + + 404 + /Frame/page/sys/NoPageInfo.jsp + + + jdbc/als + javax.sql.DataSource + Application + Shareable + + + jdbc/report + javax.sql.DataSource + Application + Shareable + + + 240 + + + InitDBType + com.amarsoft.app.awe.config.InitDBType + + shutdown-on-unload + true + + 1 + + + QuartzInitializer + com.tenwa.quartz.MyQuartzInitializerServlet + + config-file + quartz.properties + + + shutdown-on-unload + true + + 5 + + + + + singleSignon + false + + + + webAppRootKey + webapp.port + + + javax.servlet.jsp.jstl.fmt.localizationContext + ApplicationResources + + + log4jConfigLocation + /WEB-INF/classes/log4j.xml + + + 閰嶇疆鏂囦欢浣嶇疆 + contextConfigLocation + classpath:applicationContext*.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + Restfull澶勭悊Servlet RestfullServlet RestfullServlet - cn.coyoteam.aweresf.web.servlet.RestfullServiceServlet + + cn.servlet.RestfullServiceServlet + 1 @@ -480,44 +491,78 @@ restfull鑷姩鎵弿璺緞璁剧疆 RestfullScanPackage - cn.coyoteam.aweresf.web.restfull.impl, - apx.com.amarsoft.apx.web.resf, - apx.com.amarsoft.aims.flow.bzsrv, - apx.com.amarsoft.als.chksce.bzsrv, - apx.com.amarsoft.aims.planteam.bzsrv, - apx.com.amarsoft.apx.web.als.user.resf, - apx.com.amarsoft.als.temp.bzsrv, - apx.com.amarsoft.als.customer.bzsrv, - apx.com.amarsoft.als.work.flow.bzsrv, - apx.com.amarsoft.als.user.center.bzsrv, - apx.com.amarsoft.als.user.logon.bzsrv + apx.com.amarsoft.als.user.logon.controller, + apx.com.amarsoft.als.user.pwd.controller, + apx.com.amarsoft.als.user.sys.controller, + apx.com.amarsoft.als.doc.controller, + apx.com.amarsoft.als.currency.select.controller, + apx.com.amarsoft.als.currency.select.contract.controller, + + + apx.com.amarsoft.als.apzl.apply.business.query.controller, + + apx.com.amarsoft.als.apzl.apply.business.start.controller, + + apx.com.amarsoft.als.apzl.apply.business.doc.detail.controller, + apx.com.amarsoft.als.apzl.apply.business.doc.upload.controller, + apx.com.amarsoft.als.apzl.apply.business.doc.delete.controller, + + apx.com.amarsoft.als.apzl.apply.business.loan.controller, + + apx.com.amarsoft.als.currency.select.apzl.car.controller, + + apx.com.amarsoft.als.currency.select.apzl.product.controller, + + apx.com.amarsoft.als.currency.select.apzl.contract.controller, + + + + apx.com.amarsoft.als.business.opinion.sign.controller, + + apx.com.amarsoft.als.business.opinion.history.controller, + + + apx.com.amarsoft.als.business.attachment.controller, + + apx.com.amarsoft.als.doc.attribute.controller, + + + apx.com.amarsoft.als.business.action.ready.controller, + apx.com.amarsoft.als.business.action.submit.controller, + apx.com.amarsoft.als.business.action.back.controller, + apx.com.amarsoft.als.business.comm.action.controller, + + + + apx.com.amarsoft.als.base.awe.controller, + + apx.com.amarsoft.als.business.change.controller, + + apx.com.amarsoft.als.business.verification.controller, SessionAndContextFilter SessionAndContextFilter - cn.coyoteam.aweresf.web.filter.SessionAndContextFilter + + cn.filter.SessionAndContextFilter NoCheckURI - /api-doc-index, - /resf/LoginProc/Login, - /resf/LoginProc/Logout, - /resf/logon/manager/logon, - /resf/logon/manager/logout, - /resf/user/center/manager/detection/version, - /resf/user/center/manager/close/gesture, - /resf/user/center/manager/acquisition/gesture, - /resf/flow/work/manager/attachments/down/att, - /resf/flow/work/manager/attachments/down/att/6, - - /resf/flow/files/down/docById, - /resf/files/downloadApp, - /resf/files/downloadPlist, - /resf/files/down/flow/image, - /resf/files/show/image, - /resf/files/downloadAppById, + + /resf/logon/manager/logon, + /resf/logon/manager/logout, + + /resf/user/center/manager/acquisition/gesture, + /resf/user/center/manager/close/gesture, + + /resf/user/center/manager/detection/version, + + /resf/files/down/docById, + /resf/files/downloadPlist, + /resf/files/downloadApp, + /resf/files/downloadAppById, diff --git a/WebContent/WEB-INF/web_app.xml b/WebContent/WEB-INF/web_app.xml new file mode 100644 index 000000000..39773a051 --- /dev/null +++ b/WebContent/WEB-INF/web_app.xml @@ -0,0 +1,537 @@ + + + A3Web + + + JSPConfiguration + *.jsp + GBK + + + JSPConfiguration + *.jspf + GBK + + + + RunFilter + com.amarsoft.awe.control.RunFilter + + RunTimeDebug + true + + + ShowFramePage + true + + + DbLog + false + + + encoding + GBK + + + DataSource + als + + + ExcludedURLs + ^/.*Logon.jsp,^/.*SaveGraphAjax.jsp + + + + RunFilter + *.jsp + REQUEST + FORWARD + + + RunFilter + /servlet/view/* + + + InitAREServlet + com.amarsoft.are.InitAREServlet + + ConfigFile + /WEB-INF/etc/are.xml + + + AppHome + /WEB-INF + + 1 + + + InitAWEServlet + com.amarsoft.awe.control.InitAWEServlet + + ConfigFile + /WEB-INF/etc/a3web.xml + + + CacheFile + /WEB-INF/etc/cache.xml + + + SkinConfig + /WEB-INF/etc/skin.xml + + + ButtonConfig + /WEB-INF/etc/button.xml + + + DataSource + als + + 2 + + + RedirectorServlet + com.amarsoft.awe.control.RedirectorServlet + + encoding + GBK + + + + + RewriteRunJavaMethodServlet + com.tenwa.workflow.RewriteRunJavaMethodServlet + + DataSource + als + + + + + RedirectorDialogServlet + com.amarsoft.awe.control.RedirectorDialogServlet + + encoding + GBK + + + + ForwardServlet + com.amarsoft.awe.control.ForwardServlet + + encoding + GBK + + + + RunJavaMethodServlet + com.amarsoft.awe.control.RunJavaMethodServlet + + DataSource + als + + + + DisplayChart + org.jfree.chart.servlet.DisplayChart + + + MessageServlet + com.amarsoft.awe.message.MessageServlet + + + WorkDocFileServlet + com.amarsoft.awe.common.attachment.WorkDocFileServlet + + + AttachmentViewServlet + com.amarsoft.awe.common.attachment.AttachmentViewServlet + + + EditOfficeServlet + com.tenwa.onlineoperation.servlet.EditOfficeServlet + + + FileTemplateViewServlet + com.amarsoft.filetemplate.servlet.FileTemplateViewServlet + + + DocDownloadServlet + com.tenwa.doc.servlet.DocDownloadServlet + + + DocDownloadZipServlet + com.tenwa.doc.servlet.DocDownloadZipServlet + + + DocFlowDownloadZipServlet + com.tenwa.doc.servlet.DocFlowDownloadZipServlet + + + DownloadZipServlet + com.tenwa.officetempalte.controller.DownloadZipServlet + + + FileViewServlet + com.amarsoft.awe.common.attachment.FileViewServlet + + + ShowImageServlet + com.tenwa.doc.servlet.ShowImageServlet + + + ShowPDFServlet + com.tenwa.doc.servlet.ShowPDFServlet + + + StreamViewServlet + com.amarsoft.awe.common.attachment.StreamViewServlet + + + CheckCodeServlet + com.amarsoft.awe.control.CheckCodeServlet + + CodeLength + 5 + + + + MonitorSOAPServlet + com.amarsoft.awe.common.monitor.MonitorSOAPServlet + + + RedirectorServlet + /Redirector + + + RedirectorDialogServlet + /RedirectorDialog + + + RunJavaMethodServlet + /servlet/run + + + ForwardServlet + /ao + + + DisplayChart + /chartview + + + MessageServlet + /servlet/message + + + WorkDocFileServlet + /servlet/workdocfile/* + + + AttachmentViewServlet + /servlet/view/attachment + + + EditOfficeServlet + /servlet/view/editOffice + + + FileTemplateViewServlet + /servlet/view/fileTemplateView + + + DocDownloadServlet + /servlet/view/docDownloadServlet + + + + RewriteRunJavaMethodServlet + /servlet/runflow + + + + DocDownloadZipServlet + /servlet/view/docDownloadZipServlet + + + DocFlowDownloadZipServlet + /servlet/view/docFlowDownloadZipServlet + + + DownloadZipServlet + /servlet/view/DownloadZipServlet + + + AttachmentViewServlet + /servlet/pdf/* + + + FileViewServlet + /servlet/view/file + + + ShowImageServlet + /servlet/view/image + + + ShowPDFServlet + /servlet/view/pdf + + + FileViewServlet + /servlet/viewpic + + + StreamViewServlet + /servlet/view/stream + + + CheckCodeServlet + /servlet/checkcode + + + MonitorSOAPServlet + /servlet/monitor + + + QueryResultServlet + com.amarsoft.asquery.servlet.QueryResultServlet + + threadCount + 5 + + + + QueryResultServlet + /SynchResultQuery + + + InfoPageExportServlet + com.amarsoft.awe.dw.export.servlet.InfoExportServlet + + + ListPageExportServlet + com.amarsoft.awe.dw.export.servlet.ListExportServlet + + + InfoPageExportServlet + /EAS/PageExport/info + + + ListPageExportServlet + /EAS/PageExport/list + + + workflow_GetProcess + com.amarsoft.biz.workflow.graph.web.GetProcess + + + workflow_UpdateProcess + com.amarsoft.biz.workflow.graph.web.UpdateProcess + + + workflow_AddProcess + com.amarsoft.biz.workflow.graph.web.AddProcess + + + workflow_DeleteProcess + com.amarsoft.biz.workflow.graph.web.DeleteProcess + + + workflow_ListProcess + com.amarsoft.biz.workflow.graph.web.ListProcess + + + workflow_GetProcess + /getprocess.wf + + + workflow_UpdateProcess + /updateprocess.wf + + + workflow_AddProcess + /addprocess.wf + + + workflow_DeleteProcess + /deleteprocess.wf + + + workflow_ListProcess + /listprocess.wf + + + index.html + + + 404 + /Frame/page/sys/NoPageInfo.jsp + + + jdbc/als + javax.sql.DataSource + Application + Shareable + + + jdbc/report + javax.sql.DataSource + Application + Shareable + + + 240 + + + InitDBType + com.amarsoft.app.awe.config.InitDBType + + shutdown-on-unload + true + + 1 + + + QuartzInitializer + com.tenwa.quartz.MyQuartzInitializerServlet + + config-file + quartz.properties + + + shutdown-on-unload + true + + 5 + + + webAppRootKey + webapp.port + + + javax.servlet.jsp.jstl.fmt.localizationContext + ApplicationResources + + + log4jConfigLocation + /WEB-INF/classes/log4j.xml + + + 閰嶇疆鏂囦欢浣嶇疆 + contextConfigLocation + classpath:applicationContext*.xml + + + org.springframework.web.context.ContextLoaderListener + + + + + + + + Restfull澶勭悊Servlet + RestfullServlet + RestfullServlet + + cn.servlet.RestfullServiceServlet + + 1 + + + RestfullServlet + /webapi/resf/* + + + restfull鑷姩鎵弿璺緞璁剧疆 + RestfullScanPackage + + apx.com.amarsoft.als.user.logon.controller, + apx.com.amarsoft.als.user.pwd.controller, + apx.com.amarsoft.als.user.sys.controller, + apx.com.amarsoft.als.doc.controller, + apx.com.amarsoft.als.currency.select.controller, + apx.com.amarsoft.als.currency.select.contract.controller, + + + apx.com.amarsoft.als.business.work.to.controller, + + apx.com.amarsoft.als.business.work.has.controller, + + apx.com.amarsoft.als.business.work.circulate.pass.controller, + + apx.com.amarsoft.als.business.work.circulate.close.controller, + + + + apx.com.amarsoft.als.business.opinion.sign.controller, + + apx.com.amarsoft.als.business.opinion.history.controller, + + + apx.com.amarsoft.als.business.attachment.controller, + + apx.com.amarsoft.als.doc.attribute.controller, + + + apx.com.amarsoft.als.business.action.ready.controller, + apx.com.amarsoft.als.business.action.submit.controller, + apx.com.amarsoft.als.business.action.back.controller, + apx.com.amarsoft.als.business.comm.action.controller, + + + + apx.com.amarsoft.als.base.awe.controller, + + apx.com.amarsoft.als.business.work.change.controller, + + + + + SessionAndContextFilter + SessionAndContextFilter + + cn.filter.SessionAndContextFilter + + NoCheckURI + + + /resf/logon/manager/logon, + /resf/logon/manager/logout, + + /resf/user/center/manager/acquisition/gesture, + /resf/user/center/manager/close/gesture, + + /resf/user/center/manager/detection/version, + + /resf/files/down/docById, + /resf/files/downloadPlist, + /resf/files/downloadApp, + /resf/files/downloadAppById, + + + + TokenHoldTime + 31536000 + + + dataSource + als + + + encoding + GBK + + + + SessionAndContextFilter + /webapi/* + + + + + \ No newline at end of file diff --git a/WebContent/WebContent/ProductManage/ParameterConfig/ParameterInfo.jsp b/WebContent/WebContent/ProductManage/ParameterConfig/ParameterInfo.jsp new file mode 100644 index 000000000..9d2571af7 --- /dev/null +++ b/WebContent/WebContent/ProductManage/ParameterConfig/ParameterInfo.jsp @@ -0,0 +1,129 @@ +<%@page import="com.amarsoft.app.base.util.SystemHelper"%> +<%@page import="com.amarsoft.app.base.util.ObjectWindowHelper"%> +<%@page import="com.amarsoft.app.base.businessobject.*"%> +<%@ page contentType="text/html; charset=GBK"%><%@ + include file="/Frame/resources/include/include_begin_info.jspf"%> + + <% + /* + 页面说明: 示例列表页面 + */ + String PG_TITLE = "产品参数详情"; + String parameterID = CurPage.getParameter("ParameterID"); //参数编号 + if(parameterID==null) parameterID=""; + String rightType = CurPage.getParameter("RightType"); + BusinessObject inputParameter=SystemHelper.getPageComponentParameters(CurPage); + ASObjectWindow dwTemp =ObjectWindowHelper.createObjectWindow_Info("PRD_ParameterInfo", inputParameter, CurPage, request); + ASDataObject doTemp=dwTemp.getDataObject(); + doTemp.setBusinessProcess("com.amarsoft.app.als.businessobject.web.XMLBusinessObjectProcessor"); + //将ParaID作为参数传给显示模板 + dwTemp.genHTMLObjectWindow(""); + + + String sButtons[][] = { + {"true","All","Button","保存","保存所有修改","save()","","","",""} + }; + +%><%@ +include file="/Frame/resources/include/ui/include_info.jspf"%> + + + +<%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/appDownload.jsp b/WebContent/appDownload.jsp index b87512534..4a7b9243d 100644 --- a/WebContent/appDownload.jsp +++ b/WebContent/appDownload.jsp @@ -1,4 +1,4 @@ -<%@ page contentType="text/html; charset=GBK" pageEncoding="GBK"%> +<%@ page contentType="text/html; charset=GBK"%> @@ -29,7 +29,10 @@ img{display: block;margin: 0 auto;} %>
- +
+
+
+
a"; + + // IE strips leading whitespace when .innerHTML is used + support.leadingWhitespace = div.firstChild.nodeType === 3; + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + support.tbody = !div.getElementsByTagName( "tbody" ).length; + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + support.html5Clone = + document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav>"; + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + input.type = "checkbox"; + input.checked = true; + fragment.appendChild( input ); + support.appendChecked = input.checked; + + // Make sure textarea (and checkbox) defaultValue is properly cloned + // Support: IE6-IE11+ + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // #11217 - WebKit loses check when the name is after the checked attribute + fragment.appendChild( div ); + + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input = document.createElement( "input" ); + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 + // old WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ + support.noCloneEvent = !!div.addEventListener; + + // Support: IE<9 + // Since attributes and properties are the same in IE, + // cleanData must set properties to undefined rather than use removeAttribute + div[ jQuery.expando ] = 1; + support.attributes = !div.getAttribute( jQuery.expando ); +} )(); + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
", "
" ], + area: [ 1, "", "" ], + + // Support: IE8 + param: [ 1, "", "" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + col: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] +}; + +// Support: IE8-IE9 +wrapMap.optgroup = wrapMap.option; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== "undefined" ? + context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== "undefined" ? + context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; + ( elem = elems[ i ] ) != null; + i++ + ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; ( elem = elems[ i ] ) != null; i++ ) { + jQuery._data( + elem, + "globalEval", + !refElements || jQuery._data( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/, + rtbody = / from table fragments + if ( !support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[ 1 ] === "
" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && + !tbody.childNodes.length ) { + + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; +} + + +( function() { + var i, eventName, + div = document.createElement( "div" ); + + // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events) + for ( i in { submit: true, change: true, focusin: true } ) { + eventName = "on" + i; + + if ( !( support[ i ] = eventName in window ) ) { + + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) + div.setAttribute( eventName, "t" ); + support[ i ] = div.attributes[ eventName ].expando === false; + } + } + + // Null elements to avoid leaks in IE. + div = null; +} )(); + + +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE9 +// See #13393 for more info +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = {}; + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && + ( !e || jQuery.event.triggered !== e.type ) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + + // Add elem as a property of the handle fn to prevent a memory leak + // with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnotwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && + jQuery._data( cur, "handle" ); + + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( + ( !special._default || + special._default.apply( eventPath.pop(), data ) === false + ) && acceptData( elem ) + ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, j, ret, matched, handleObj, + handlerQueue = [], + args = slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or 2) have namespace(s) + // a subset or equal to those in the bound event (both can have no namespace). + if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, matches, sel, handleObj, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Support (at least): Chrome, IE9 + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // + // Support: Firefox<=42+ + // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) + if ( delegateCount && cur.nodeType && + ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { + + /* jshint eqeqeq: false */ + for ( ; cur != this; cur = cur.parentNode || this ) { + /* jshint eqeqeq: true */ + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push( { elem: cur, handlers: matches } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Safari 6-8+ + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + + "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split( " " ), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: ( "button buttons clientX clientY fromElement offsetX offsetY " + + "pageX pageY screenX screenY toElement" ).split( " " ), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - + ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - + ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? + original.toElement : + fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + focus: { + + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== safeActiveElement() && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === safeActiveElement() && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + click: { + + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + }, + + // For cross-browser consistency, don't fire native .click() on links + _default: function( event ) { + return jQuery.nodeName( event.target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + // Piggyback on a donor event to simulate a different one + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + + // Previously, `originalEvent: {}` was set here, so stopPropagation call + // would not be triggered on donor event, since in our own + // jQuery.event.stopPropagation function we had a check for existence of + // originalEvent.stopPropagation method, so, consequently it would be a noop. + // + // Guard for simulated events was moved to jQuery.event.stopPropagation function + // since `originalEvent` should point to the original event for the + // constancy with other events and for more focused logic + } + ); + + jQuery.event.trigger( e, null, elem ); + + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, + // to properly expose it to GC + if ( typeof elem[ name ] === "undefined" ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: IE < 9, Android < 4.0 + src.returnValue === false ? + returnTrue : + returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( !e || this.isSimulated ) { + return; + } + + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && e.stopImmediatePropagation ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://code.google.com/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +// IE submit delegation +if ( !support.submit ) { + + jQuery.event.special.submit = { + setup: function() { + + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? + + // Support: IE <=8 + // We use jQuery.prop instead of elem.form + // to allow fixing the IE8 delegated submit issue (gh-2332) + // by 3rd party polyfills/workarounds. + jQuery.prop( elem, "form" ) : + undefined; + + if ( form && !jQuery._data( form, "submit" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submitBubble = true; + } ); + jQuery._data( form, "submit", true ); + } + } ); + + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + + // If form was submitted by the user, bubble the event up the tree + if ( event._submitBubble ) { + delete event._submitBubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event ); + } + } + }, + + teardown: function() { + + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !support.change ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._justChanged = true; + } + } ); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._justChanged && !event.isTrigger ) { + this._justChanged = false; + } + + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event ); + } ); + } + return false; + } + + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event ); + } + } ); + jQuery._data( elem, "change", true ); + } + } ); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || + ( elem.type !== "radio" && elem.type !== "checkbox" ) ) { + + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Support: Firefox +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome, Safari +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this, + attaches = jQuery._data( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + jQuery._removeData( doc, fix ); + } else { + jQuery._data( doc, fix, attaches ); + } + } + }; + } ); +} + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + }, + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ), + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, + + // Support: IE 10-11, Edge 10240+ + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) ); + +// Support: IE<8 +// Manipulating tables requires a tbody +function manipulationTarget( elem, content ) { + return jQuery.nodeName( elem, "table" ) && + jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? + + elem.getElementsByTagName( "tbody" )[ 0 ] || + elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : + elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[ 1 ]; + } else { + elem.removeAttribute( "type" ); + } + return elem; +} + +function cloneCopyEvent( src, dest ) { + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( isFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android<4.1, PhantomJS<2 + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl ) { + jQuery._evalUrl( node.src ); + } + } else { + jQuery.globalEval( + ( node.text || node.textContent || node.innerHTML || "" ) + .replace( rcleanScript, "" ) + ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + elems = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = elems[ i ] ) != null; i++ ) { + + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html.replace( rxhtmlTag, "<$1>" ); + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( support.html5Clone || jQuery.isXMLDoc( elem ) || + !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( ( !support.noCloneEvent || !support.noCloneChecked ) && + ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { + + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[ i ] ) { + fixCloneNodeIssues( node, destElements[ i ] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { + cloneCopyEvent( node, destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + cleanData: function( elems, /* internal */ forceAcceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + attributes = support.attributes, + special = jQuery.event.special; + + for ( ; ( elem = elems[ i ] ) != null; i++ ) { + if ( forceAcceptData || acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // Support: IE<9 + // IE does not allow us to delete expando properties from nodes + // IE creates expando attributes along with the property + // IE does not have a removeAttribute function on Document nodes + if ( !attributes && typeof elem.removeAttribute !== "undefined" ) { + elem.removeAttribute( internalKey ); + + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://code.google.com/p/chromium/issues/detail?id=378607 + } else { + elem[ internalKey ] = undefined; + } + + deletedIds.push( id ); + } + } + } + } + } +} ); + +jQuery.fn.extend( { + + // Keep domManip exposed until 3.0 (gh-2225) + domManip: domManip, + + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( + ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) + ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + + // Remove element nodes and prevent memory leaks + elem = this[ i ] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); + + +var iframe, + elemdisplay = { + + // Support: Firefox + // We have to pre-define these values for FF (#10227) + HTML: "block", + BODY: "block" + }; + +/** + * Retrieve the actual display of a element + * @param {String} name nodeName of the element + * @param {Object} doc Document object + */ + +// Called only from within defaultDisplay +function actualDisplay( name, doc ) { + var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), + + display = jQuery.css( elem[ 0 ], "display" ); + + // We don't have any data stored on the element, + // so use "detach" method as fast way to get rid of the element + elem.detach(); + + return display; +} + +/** + * Try to determine the default display value of an element + * @param {String} nodeName + */ +function defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + + // Use the already-created iframe if possible + iframe = ( iframe || jQuery( "\n"); - out.write("\t\n"); - out.write("
\n"); - out.write("\t
  ["); - out.print(LanguageManager.getOWSystemLanguage(CurUser.getLanguage(), JspfText.Sure) ); - out.write("] 
\n"); - out.write("\t
\n"); - out.write("
"); - out.write("\r\n"); - out.write("\r\n"); - -if(sCurRunMode!=null && sCurRunMode.equals("Development")){ - - out.write("\n"); - out.write("\n"); -}else{ - out.write("\n"); - out.write("\n"); -} - -}catch(Exception e){ - if(Sqlca!=null) Sqlca.rollback(); - e.printStackTrace(); - ARE.getLog().error(e.getMessage(),e); - throw e; -}finally{ - if(Sqlca!=null){ - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } -} - -/* 椤圭洰搴旂敤鎵╁睍鍐呭 */ - out.write("\n"); - out.write(""); - } catch (java.lang.Throwable t) { - if (!(t instanceof javax.servlet.jsp.SkipPageException)){ - out = _jspx_out; - if (out != null && out.getBufferSize() != 0) - try { - if (response.isCommitted()) { - out.flush(); - } else { - out.clearBuffer(); - } - } catch (java.io.IOException e) {} - if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); - else throw new ServletException(t); - } - } finally { - _jspxFactory.releasePageContext(_jspx_page_context); - } - } -} diff --git a/work/org/apache/jsp/money/sourceOfFunds_jsp.class b/work/org/apache/jsp/money/sourceOfFunds_jsp.class deleted file mode 100644 index 075667972..000000000 Binary files a/work/org/apache/jsp/money/sourceOfFunds_jsp.class and /dev/null differ diff --git a/work/org/apache/jsp/money/sourceOfFunds_jsp.java b/work/org/apache/jsp/money/sourceOfFunds_jsp.java deleted file mode 100644 index 8201361f8..000000000 --- a/work/org/apache/jsp/money/sourceOfFunds_jsp.java +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Generated by the Jasper component of Apache Tomcat - * Version: Apache Tomcat/7.0.85 - * Generated at: 2018-05-29 03:54:01 UTC - * Note: The last modified time of this file was set to - * the last modified time of the source file after - * generation to assist with modification tracking. - */ -package org.apache.jsp.money; - -import javax.servlet.*; -import javax.servlet.http.*; -import javax.servlet.jsp.*; -import java.io.*; -import java.sql.*; -import java.text.*; -import java.util.*; -import com.amarsoft.are.ARE; -import com.amarsoft.are.lang.*; -import com.amarsoft.are.jbo.*; -import com.amarsoft.are.jbo.ql.*; -import com.amarsoft.are.security.*; -import com.amarsoft.are.util.*; -import com.amarsoft.amarscript.*; -import com.amarsoft.context.*; -import com.amarsoft.awe.*; -import com.amarsoft.awe.Configure; -import com.amarsoft.awe.RuntimeContext; -import com.amarsoft.awe.control.model.*; -import com.amarsoft.awe.util.*; -import com.amarsoft.web.ui.*; -import com.amarsoft.awe.ui.model.*; -import com.amarsoft.awe.ui.widget.*; -import com.amarsoft.awe.res.*; -import com.amarsoft.awe.res.model.*; -import com.amarsoft.dict.als.manage.*; -import com.amarsoft.awe.dw.*; -import com.amarsoft.awe.res.LanguageManager; -import com.amarsoft.awe.res.JspfText; -import com.amarsoft.awe.res.JspfText; -import com.amarsoft.awe.control.model.Parameter; - -public final class sourceOfFunds_jsp extends org.apache.jasper.runtime.HttpJspBase - implements org.apache.jasper.runtime.JspSourceDependent { - - private static final javax.servlet.jsp.JspFactory _jspxFactory = - javax.servlet.jsp.JspFactory.getDefaultFactory(); - - private static java.util.Map _jspx_dependants; - - static { - _jspx_dependants = new java.util.HashMap(17); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_tail.jspf", Long.valueOf(1526962689151L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/list.jspf", Long.valueOf(1526962753833L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res.jspf", Long.valueOf(1526962729861L)); - _jspx_dependants.put("/AppMain/resources/include/app_tail.jspf", Long.valueOf(1526962738841L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_buttonset_dw.jspf", Long.valueOf(1526962685797L)); - _jspx_dependants.put("/Frame/resources/include/include_end.jspf", Long.valueOf(1526962726941L)); - _jspx_dependants.put("/Frame/resources/include/include_begin_list.jspf", Long.valueOf(1526962753201L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_debug.jspf", Long.valueOf(1526962687626L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/overdiv.jspf", Long.valueOf(1526962692238L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/buttonset_dw.jspf", Long.valueOf(1526962734737L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_sqlca_head.jspf", Long.valueOf(1526962740677L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_head_res_dw.jspf", Long.valueOf(1526962743650L)); - _jspx_dependants.put("/Frame/resources/include/ui/include_list.jspf", Long.valueOf(1526962694938L)); - _jspx_dependants.put("/Frame/page/jspf/include/jsp_runtime_context.jspf", Long.valueOf(1526962715951L)); - _jspx_dependants.put("/AppMain/resources/include/app_head.jspf", Long.valueOf(1526962753987L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/full_filter.jspf", Long.valueOf(1526962722739L)); - _jspx_dependants.put("/Frame/page/jspf/ui/widget/ow/list_context_menu.jspf", Long.valueOf(1526962689213L)); - } - - private volatile javax.el.ExpressionFactory _el_expressionfactory; - private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager; - - public java.util.Map getDependants() { - return _jspx_dependants; - } - - public javax.el.ExpressionFactory _jsp_getExpressionFactory() { - if (_el_expressionfactory == null) { - synchronized (this) { - if (_el_expressionfactory == null) { - _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); - } - } - } - return _el_expressionfactory; - } - - public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() { - if (_jsp_instancemanager == null) { - synchronized (this) { - if (_jsp_instancemanager == null) { - _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); - } - } - } - return _jsp_instancemanager; - } - - public void _jspInit() { - } - - public void _jspDestroy() { - } - - public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response) - throws java.io.IOException, javax.servlet.ServletException { - - final javax.servlet.jsp.PageContext pageContext; - final javax.servlet.ServletContext application; - final javax.servlet.ServletConfig config; - javax.servlet.jsp.JspWriter out = null; - final java.lang.Object page = this; - javax.servlet.jsp.JspWriter _jspx_out = null; - javax.servlet.jsp.PageContext _jspx_page_context = null; - - - try { - response.setContentType("text/html; charset=GBK"); - pageContext = _jspxFactory.getPageContext(this, request, response, - "/Frame/page/control/ErrorPage.jsp", false, 65536, true); - _jspx_page_context = pageContext; - application = pageContext.getServletContext(); - config = pageContext.getServletConfig(); - out = pageContext.getOut(); - _jspx_out = out; - - out.write('\r'); - out.write('\n'); - - response.setHeader("Cache-Control","no-store"); - response.setHeader("Pragma","no-cache"); - response.setDateHeader("Expires",0); - - HttpSession session = request.getSession(false); - if (session== null) throw new Exception("------Timeout------"); - RuntimeContext CurARC = (RuntimeContext)session.getAttribute("CurARC"); - if(CurARC == null) throw new Exception("------Timeout------"); - - Configure CurConfig = Configure.getInstance(application); - if(CurConfig ==null) throw new Exception("璇诲彇閰嶇疆鏂囦欢閿欒锛佽妫鏌ラ厤缃枃浠"); - - String sWebRootPath = request.getContextPath(); - if(!CurConfig.getContextPath().equals(sWebRootPath)) CurConfig.setContextPath(sWebRootPath); - String sServletURL = request.getServletPath(); - - String sCompClientID = request.getParameter("CompClientID"); - if(sCompClientID==null) sCompClientID=""; - - ASUser CurUser = CurARC.getUser(); - ASOrg CurOrg = CurUser.getBelongOrg(); - ASPreference CurPref = CurARC.getPref(); - String sSkinPath = CurUser.getSkin().getPath(); - - String[] functions = {"getItemName","getOrgName","getUserName","getCustomerName","getBusinessName","getObjectTypeName", - "getFlowName","getPhaseName","getRoleName","getModelName", - "concat","nvl","substr"}; - for(int i=0;i\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); -/* 椤圭洰搴旂敤鎵╁睍鍐呭*/ - out.write("\n"); - out.write(" "); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write(""); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - - boolean isShowFilter = true; - boolean isShowButton = true; - String sBrowserTitle = ""; - String sButtonPosition = "north"; - String sASNavigatorHtml =""; - String sASWizardHtml = ""; - String pageSize = CurPage.getParameter("PageSize"); - if(CurConfig.getConfigure("ListQuerySelection")!=null){ - - out.write("\n"); - out.write("\t\n"); -} - - /* - Author: undefined 2018-05-29 - Content: - History Log: - */ - ASObjectModel doTemp = new ASObjectModel("sourceOfFunds"); - ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request); - dwTemp.Style="1"; //--璁剧疆涓篏rid椋庢牸-- - dwTemp.ReadOnly = "1"; //鍙妯″紡 - dwTemp.setPageSize(10); - dwTemp.genHTMLObjectWindow(""); - - //0銆佹槸鍚﹀睍绀 1銆 鏉冮檺鎺у埗 2銆 灞曠ず绫诲瀷 3銆佹寜閽樉绀哄悕绉 4銆佹寜閽В閲婃枃瀛 5銆佹寜閽Е鍙戜簨浠朵唬鐮 6銆 7銆 8銆 9銆佸浘鏍囷紝CSS灞傚彔鏍峰紡 10銆侀鏍 - String sButtons[][] = { - {"true","All","Button","鏂板","鏂板","newRecord()","","","","btn_icon_add",""}, - {"true","","Button","璇︽儏","璇︽儏","viewAndEdit()","","","","btn_icon_detail",""}, - {"true","","Button","鍒犻櫎","鍒犻櫎","if(confirm('纭疄瑕佸垹闄ゅ悧?'))as_delete(0,'alert(getRowCount(0))')","","","","btn_icon_delete",""}, - }; - - -String pagesize=CurPage.getParameter("PageSize"); -if(pagesize==null){pagesize=dwTemp.getPageSize()+"";} -dwTemp.setPageSize(Integer.valueOf(pagesize)); -dwTemp.genHTMLObjectWindow(""); - - out.write('\n'); - out.write("\n"); - out.write("\n"); -for(String outString : CurPage.getObjectWindowOutput()) out.print(outString); - out.write("\n"); - out.write("\n"); - out.write("
\n"); - out.write("
\n"); - out.write("
\n"); - out.write("
\n"); - out.write("
\n"); - out.write(" \t
    \n"); - out.write("\t\t
\n"); - out.write("\t
\n"); - out.write("\t
\n"); - out.write("\t\t
    \n"); - out.write("\t\t
\n"); - out.write("\t
\n"); - out.write("\t\n"); - out.write(" \n"); - out.write("
\n"); - out.write("
\n"); -if(!com.amarsoft.are.lang.StringX.isSpace(sASNavigatorHtml)){ - out.write("\n"); - out.write("\t\n"); - out.write(""); -} - out.write('\n'); -if(!com.amarsoft.are.lang.StringX.isSpace(sASWizardHtml)){ - out.write("\n"); - out.write("\t\n"); - out.write(""); -} - out.write('\n'); -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && sButtons.length > 0 && ("both".equalsIgnoreCase(sButtonPosition) || "north".equalsIgnoreCase(sButtonPosition))){ - out.write("\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); -} - out.write("\n"); - out.write("\n"); - out.write("\t \n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t"); -if(com.amarsoft.awe.ui.model.ItemHelp.isShowButton(isShowButton,sButtons) && ("both".equalsIgnoreCase(sButtonPosition) || "south".equalsIgnoreCase(sButtonPosition))){ - out.write("\n"); - out.write("\t\n"); - out.write("\n"); - out.write("\t\n"); - out.write("\n"); -} - out.write("\n"); - out.write("
\n"); - out.write("\t\t"); - out.print(sASNavigatorHtml); - out.write("\n"); - out.write("
\n"); - out.write("\t\t"); - out.print(sASWizardHtml); - out.write("\n"); - out.write("
\n"); - out.write("\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write("\n"); - out.write("
\n"); - out.write("\t \t\n"); - out.write("\t\t\t
\n"); - out.write("\t\t\t"); - - //鐢熸垚鎼滅储鎸夐挳 - String[][] sSearchButtons = { - {"true","纭畾","纭畾","if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';","","","",""}, - {"true","鍙栨秷","鍙栨秷","document.getElementById('TableFilter').style.display='none'","","","",""} - }; - - out.write("\n"); - out.write("\t\t\t
\n"); - out.write("\t\t\t\t\n"); - out.write("\t\t\t
\n"); - out.write("\t\t\t
\n"); - out.write("\t\t\t\n"); - out.write("\t\t\t"); - out.write('\n'); - -ButtonItem btFIlter1 = new ButtonItem("纭畾","纭畾","if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';"); -ButtonItem btFIlter2 = new ButtonItem("楂樼骇","楂樼骇","openFullFilter(0,event)"); -ButtonItem btFIlter20 = new ButtonItem("杩樺師","杩樺師","TableFactory.clearFilter(0);if(tableSearchFromInput())document.getElementById('TableFilter').style.display='none';"); -ButtonItem btFIlter21 = new ButtonItem("鍏抽棴","鍏抽棴","document.getElementById('TableFilter').style.display='none';"); - - out.write("
\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t\n"); - out.write("\t
\n"); - out.write("\t"); - out.print(new Button(btFIlter1).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter2).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter20).getHtmlText()); - out.write("\n"); - out.write("\t\n"); - out.write("\t"); - out.print(new Button(btFIlter21).getHtmlText()); - out.write("\n"); - out.write("\t
\n"); - out.write("
\n"); - out.write("
\n"); - out.write("\t\n"); - out.write("
\n"); - out.write(""); - out.write("\n"); - out.write("\t\t\t\n"); - out.write("\t\t\t
\n"); - out.write("\t\t\t\n"); - out.write("\t\t\t
\n"); - out.write("\t\t
\n"); - out.write("\t\t"); - out.print(Button.getHtmlText(sButtons, CurUser, CurPage, CurConfig)); - out.write("\n"); - out.write("
\n"); - -String sUrlBase2 = request.getRequestURI().substring(request.getRequestURI().indexOf(sWebRootPath)+sWebRootPath.length()); -ButtonItem [] biButtonArray = ItemHelp.getButtonItemArray(CurUser,sButtons,CurComp.getAttribute("RightType",10),sUrlBase2); - - out.write("\n"); - out.write("
\n"); - out.write("\t
鍒锋柊
\n"); - out.write("\t
\n"); - out.write("\t
鍏ㄩ儴閫変腑
\n"); - out.write("\t
鍏ㄩ儴鍙栨秷
\n"); - out.write("\t"); - - if(biButtonArray!=null){ - out.println("
"); - for(int i=0;i0) - iconCls = "iconCls=\""+ iconCls +"\""; - else{ - if(biButtonArray[i].getText().equals("鏂板")){ - iconCls = "btn_icon_add"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("淇濆瓨")){ - iconCls = "btn_icon_save"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - else if(biButtonArray[i].getText().equals("鍒犻櫎")){ - iconCls = "btn_icon_delete"; - iconCls = "iconCls=\""+ iconCls +"\""; - } - } - out.println("
"+biButtonArray[i].getText()+"
"); - //System.out.println("
"+biButtonArray[i].getText()+"
"); - } - } - } - out.write("\n"); - out.write("
"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("\n"); - out.write("
\n"); - out.write("\t\n"); - out.write("
\t\n"); - out.write("
\n"); - out.write("\t
  ["); - out.print(LanguageManager.getOWSystemLanguage(CurUser.getLanguage(), JspfText.Sure) ); - out.write("] 
\n"); - out.write("\t
\n"); - out.write("
"); - out.write('\n'); - out.write('\n'); - -Vector param=CurComp.getParameterList(); -String newParam=""; -for(int i=0;i0){newParam+="&";} - newParam+=param.get(i).paraName+"="+param.get(i).paraValue; - } -} -String sourceUrl=CurComp.getAttribute("ComponentURL"); -String newtarget=CurComp.getAttribute("TargetWindow"); - - out.write("\n"); - out.write(""); - out.write("\r\n"); - out.write("\r\n"); - -if(sCurRunMode!=null && sCurRunMode.equals("Development")){ - - out.write("\n"); - out.write("\n"); -}else{ - out.write("\n"); - out.write("\n"); -} - -}catch(Exception e){ - if(Sqlca!=null) Sqlca.rollback(); - e.printStackTrace(); - ARE.getLog().error(e.getMessage(),e); - throw e; -}finally{ - if(Sqlca!=null){ - Sqlca.commit(); - Sqlca.disConnect(); - Sqlca = null; - } -} - -/* 椤圭洰搴旂敤鎵╁睍鍐呭 */ - out.write("\n"); - out.write(""); - } catch (java.lang.Throwable t) { - if (!(t instanceof javax.servlet.jsp.SkipPageException)){ - out = _jspx_out; - if (out != null && out.getBufferSize() != 0) - try { - if (response.isCommitted()) { - out.flush(); - } else { - out.clearBuffer(); - } - } catch (java.io.IOException e) {} - if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); - else throw new ServletException(t); - } - } finally { - _jspxFactory.releasePageContext(_jspx_page_context); - } - } -} diff --git a/璧勬簮绠$悊/ADE宸ュ叿/ADE甯哥敤宸ュ叿 b/璧勬簮绠$悊/ADE宸ュ叿/ADE甯哥敤宸ュ叿 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/ADE宸ュ叿/ADE琛ㄥ瓧娈甸厤缃 b/璧勬簮绠$悊/ADE宸ュ叿/ADE琛ㄥ瓧娈甸厤缃 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/ADE宸ュ叿/JSP妯℃澘缁存姢 b/璧勬簮绠$悊/ADE宸ュ叿/JSP妯℃澘缁存姢 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/浠g爜绠$悊 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/浠g爜绠$悊 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鍔熻兘閰嶇疆 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鍔熻兘閰嶇疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/瀵硅薄绫诲瀷璁剧疆 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/瀵硅薄绫诲瀷璁剧疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏂规硶璁剧疆 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏂规硶璁剧疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏄剧ず妯℃澘V2 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏄剧ず妯℃澘V2 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏍煎紡鍖栨姤鍛婅缃 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏍煎紡鍖栨姤鍛婅缃 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏍煎紡鍖栨姤鍛婅缃甐2 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/鏍煎紡鍖栨姤鍛婅缃甐2 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/绯荤粺鑿滃崟 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/绯荤粺鑿滃崟 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/WEB绋嬪簭寮鍙/閫夋嫨瀵硅瘽妗嗚缃 b/璧勬簮绠$悊/WEB绋嬪簭寮鍙/閫夋嫨瀵硅瘽妗嗚缃 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/璇勭骇妯″瀷璁剧疆 b/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/璇勭骇妯″瀷璁剧疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/璐㈠姟鎶ヨ〃妯″瀷绠$悊 b/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/璐㈠姟鎶ヨ〃妯″瀷绠$悊 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/椋庨櫓鍒嗙被妯″瀷璁剧疆 b/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/椋庨櫓鍒嗙被妯″瀷璁剧疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/椋庨櫓棰勮閰嶇疆 b/璧勬簮绠$悊/涓氬姟妯″瀷璁剧疆/椋庨櫓棰勮閰嶇疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/涓氬姟娴佺▼璁剧疆/娴佺▼妯″瀷 b/璧勬簮绠$悊/涓氬姟娴佺▼璁剧疆/娴佺▼妯″瀷 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/浜у搧绠$悊/浜у搧v1 b/璧勬簮绠$悊/浜у搧绠$悊/浜у搧v1 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/瀵硅薄妯″瀷/JBO閰嶇疆.xml b/璧勬簮绠$悊/瀵硅薄妯″瀷/JBO閰嶇疆.xml new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/瀵硅薄妯″瀷/鏁版嵁妯″瀷璁捐.adm b/璧勬簮绠$悊/瀵硅薄妯″瀷/鏁版嵁妯″瀷璁捐.adm new file mode 100644 index 000000000..1149c4f1e --- /dev/null +++ b/璧勬簮绠$悊/瀵硅薄妯″瀷/鏁版嵁妯″瀷璁捐.adm @@ -0,0 +1,160 @@ + + + + true + 100 + A4 210 x 297 mm + 30 + 30 + 30 + 30 + + 0 + 1.0 + 0 + 0 + + 128 + 128 + 192 + + + 255 + 255 + 255 + + 寰蒋闆呴粦 + 9 + + StandardSQL + true + + + 0 + true + 0 + 1 + 1 + false + true + false + false + + + + + + + false + false + false + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + true + false + false + false + + + + + + + false + + + + + 0 + + + + false + false + + + + + false + + + + + + -1 + -1 + Ubuntu + 9 + 50 + 50 + + 255 + 255 + 255 + + + + false + 2012-08-29 09:08:15 + 2012-12-04 10:39:38 + + Project Name + + + + Model Name + + + + Version + + + + Compnay + + + + 浣滆 + + + + + + + + 0 + Default + + + + + + + + + + + + + + + + + + + + diff --git a/璧勬簮绠$悊/鎶ヨ〃妯″瀷璁剧疆/鍙傛暟璁剧疆 b/璧勬簮绠$悊/鎶ヨ〃妯″瀷璁剧疆/鍙傛暟璁剧疆 new file mode 100644 index 000000000..e69de29bb diff --git a/璧勬簮绠$悊/鎶ヨ〃妯″瀷璁剧疆/鎶ヨ〃妯″瀷 b/璧勬簮绠$悊/鎶ヨ〃妯″瀷璁剧疆/鎶ヨ〃妯″瀷 new file mode 100644 index 000000000..e69de29bb