WEB中 APP版本配置列表

This commit is contained in:
yexuan 2018-06-25 13:53:47 +08:00
parent 33b2148d09
commit 90dc6281df
4 changed files with 305 additions and 0 deletions

View File

@ -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"%>
<script type="text/javascript">
$(function() {
$("#ATTACHMENT").attr("type","file");
$("#myiframe0").attr("enctype","multipart/form-data");
var params={};
params["usreid"]="<%=CurUser.getUserID()%>";
var sparma="";
for(var key in params){
sparma=sparma+"<input type=\"hidden\" name=\""+key+"\" value=\""+params[key]+"\">"
}
hideItem(0,"FILENAME");
/* sparma=sparma+"<input type=\"hidden\" name=\""+FileName+"\" value=\""+params[FILENAME]+"\">" */
$("#ATTACHMENT").append(sparma);
$("#myiframe0").attr("action", "");
$("#myiframe0").attr("method","post");
});
function uploadApp(){
var id = getItemValue(0, getRow(0), 'id');
if (id == null || id == "" || typeof(id) == "undefined") {
alert("请选上传的版本!");
return false;
}
var urlContext = "<%=sWebRootPath%>/AppFresh/AppVersion/AttachmentUpload.jsp?CompClientID=<%=CurComp.getClientID()%>&id="+id+"&UserID=<%=sUserID%>";
urlContext = encodeURI(urlContext);
$("#myiframe0").attr("action", urlContext);
var o = document.forms["myiframe0"];
var sFileName = o.ATTACHMENT.value;
if (typeof(sFileName) == "undefined" || sFileName==""){
alert("请选上传的版本!");
return false;
}
var nameArr = sFileName.split("\\");
var fileName = nameArr[nameArr.length-1];
setItemValue(0,0,"FileName",encodeURI(nameArr[nameArr.length-1]));
var fileSize;
if(typeof(ActiveXObject) == "function"){ // IE
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f1 = fso.GetFile(sFileName);
fileSize = f1.size;
}else{
fileSize = o.ATTACHMENT.files[0].size;
}
if(fileSize > 50*1024*1024){
alert("文件大于50M,不能上传!");
return false;
}
return o.submit();
}
function goBack(){
parent.AsDialog.ClosePage();
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -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"%>
<script type="text/javascript">
function goBack(){
parent.AsDialog.ClosePage();
}
function saveRecord(sPostEvents) {
if ("<%=id%>" == "") {
setItemValue(0,0,"CREATE_DATE", "<%=date%>");
setItemValue(0,0,"CREATOR", "<%=CurUser.getUserID()%>");
}
setItemValue(0,0,"MODIFY_DATE", "<%=date%>");
setItemValue(0,0,"MODIFICATOR", "<%=CurUser.getUserID()%>");
as_save("myiframe0", "goBack()");
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -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"%>
<script type="text/javascript">
$(function() {
$("#ATTACHMENT").attr("type","file");
$("#myiframe0").attr("enctype","multipart/form-data");
var params={};
params["usreid"]="<%=CurUser.getUserID()%>";
var sparma="";
for(var key in params){
sparma=sparma+"<input type=\"text\" name=\""+key+"\" value=\""+params[key]+"\">"
}
hideItem(0,"FILENAME");
$("#ATTACHMENT").append(sparma);
$("#myiframe0").attr("action", "");
$("#myiframe0").attr("method","post");
});
function newRecord() {
var sUrl = "/AppFresh/AppVersion/AppVersionInfo.jsp";
AsDialog.PopView(sUrl, "", "dialogWidth=600px;dialogHeight=450px;",
function(message) {
reloadSelf();
}, "新增一个版本");
}
function viewAndEdit() {
var sUrl = "/AppFresh/AppVersion/AppVersionInfo.jsp";
var id = getItemValue(0, getRow(0), 'id');
if (id == "" || typeof(id) == "undefined") {
alert("请选上传的版本!");
return false;
}
AsDialog.PopView(sUrl, "id=" + id,
"dialogWidth=600px;dialogHeight=450px;", function(message) {
reloadSelf();
}, "新增一个版本");
}
function uploadApp(){
var id = getItemValue(0,getRow(0),'id');
if (id == "" || typeof(id) == "undefined") {
alert("请选上传的版本!");
return false;
}
var sUrl = "/AppFresh/AppVersion/AppVersionFile.jsp";
AsDialog.PopView(sUrl, "id=" + id,
"dialogWidth=600px;dialogHeight=450px;", function(message) {
reloadSelf();
}, "上传一个版本");
}
function downloadFile() {
var id = getItemValue(0, getRow(), "id");
if (typeof (id) == "undefined" || id.length == 0) {
alert("请选上传的版本!");
return;
}
var FILE_NAME = getItemValue(0, getRow(), "FILE_NAME");
if (typeof (FILE_NAME) == "undefined" || FILE_NAME.length == 0) {
alert("该版本还未上传APP应用文件");
return;
}
var requestUrl = '<%=sWebRootPath%>/webapi/resf/files/downloadAppById?id=' + id;
location.href = requestUrl;
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -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) {
%>
<script type="text/javascript">
alert(getMessageText('AWEW1010'));
parent.AsDialog.ClosePage();
</script>
<%
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;
%>
<script type="text/javascript">
alert(getMessageText('AWEW1010'));//上传文件失败!
parent.AsDialog.ClosePage();
</script>
<%
}
}
%>
<script type="text/javascript">
alert(getMessageText('AWEW1013'));//上传文件成功!
parent.AsDialog.ClosePage();
//parent.reloadAttachment();
</script>
<%@ include file="/IncludeEnd.jsp"%>