📄 content_form.jsp
字号:
<%@ include file="common_imports.jsp" %>
<%
if(jspPath == null)
jspPath = "/shop/my_account.jsp";
//if (!isSignin) {
// request.getRequestDispatcher("/shop/login.jsp").forward(request,response);
} else if (! "admin".equals(userID)) {
request.getRequestDispatcher(jspPath).forward(request,response);
}
String addProdSQL = "INSERT INTO SHOP_PRODUCT (contentid, category, listprice, price, filename) VALUES (?,?,?,?,?)";
String addMetaSQL = "INSERT INTO OPERA_CONTENT_METADATA(contentid, title,description,publisher,artist,creationdata, language,country,runtime,previewfile,thumbnail1,thumbnail2,contentloc,datatype,resolution,bitrate,mimetype,rating,drmtype,deliverymode,relprod) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
String editProdSQL = "UPDATE SHOP_PRODUCT SET category=?, listprice=?, price=?, filename=? WHERE contentid=?";
String editMetaSQL = "UPDATE OPERA_CONTENT_METADATA SET title=?,description=?,publisher=?,artist=?,creationdata=?, language=?,country=?,runtime=?,previewfile=?,thumbnail1=?,thumbnail2=?,contentloc=?,datatype=?,resolution=?,bitrate=?,mimetype=?,rating=?,drmtype=?,deliverymode=?, relprod=? WHERE contentid=?";
String[] categories = {"movie", "music", "game", "ringtone", "screensaver"};
String error = "";
String savedMsg = "";
String buttonLabel = "Add Content";
String formTitle = "Content Metadata";
String contentID = request.getParameter(Const.CONTENTID);
String title = request.getParameter(Const.CONTENT_TITLE);
String description = request.getParameter("description");
String publisher = request.getParameter("publisher");
String artist = request.getParameter("artist");
String creationData = request.getParameter("creationdata");
String language = request.getParameter("language");
String country = request.getParameter("country");
String runTime = request.getParameter("runtime");
String prevFile = request.getParameter("previewfile");
String thumbnail1 = request.getParameter("thumbnail1");
String thumbnail2 = request.getParameter("thumbnail2");
String contentLoc = request.getParameter("contentloc");
String dataType = request.getParameter("datatype");
String resolution = request.getParameter("resolution");
String bitRate = request.getParameter("bitrate");
String mimeType = request.getParameter(Const.CONTENT_MIME_TYPE);
String rating = request.getParameter(Const.CONTENT_RATING);
String drmType = request.getParameter(Const.CONTENT_DRM_TYPE);
String deliveryMode = request.getParameter("deliverymode");
String category = request.getParameter("category");
String listPrice = request.getParameter("listprice");
String price = request.getParameter("price");
String filename = request.getParameter("filename");
String relProd = request.getParameter("relprod");
String action = request.getParameter("action");
if ("save".equals(action)) {
formTitle = "Add Content and Metadata Info";
buttonLabel = "Save Content Metadata Info";
if (contentID == null || "".equals(contentID.trim()))
error += " Content ID is required.<br/>";
if (title == null || "".equals(title.trim()))
error += " Missing title.<br/>";
Float lPrice = null;
Float aPrice = null;
if (listPrice != null && !"".equals(listPrice)) {
try {
lPrice = Float.valueOf(listPrice);
} catch (Exception ex) {
error += " Invalid List Price.<br/>";
}
}
if (price != null && !"".equals(price)) {
try {
aPrice = Float.valueOf(price);
} catch (Exception ex) {
error += " Invalid Price.<br/>";
}
}
if ("".equals(error)) {
try {
DBUtil.execute(addProdSQL, new Object[] {contentID, category, lPrice, aPrice,filename});
DBUtil.execute(addMetaSQL, new String[] {contentID, title, description,publisher,artist,creationData,language,country,runTime,prevFile, thumbnail1,thumbnail2,contentLoc,dataType,resolution,bitRate,mimeType,rating,drmType,deliveryMode,relProd});
savedMsg += contentID + " has been successfully added.<br/>";
} catch (Exception ex) {
error += " Error in saving content info to DB.<br>";
}
}
} else if ("update".equals(action)) {
formTitle = "Edit Content Metadata Info";
buttonLabel = "Update Content Metadata Info";
Float lPrice = null;
Float aPrice = null;
if (listPrice != null && !"".equals(listPrice)) {
try {
lPrice = Float.valueOf(listPrice);
} catch (Exception ex) {
error += " Invalid List Price.<br/>";
}
}
if (price != null && !"".equals(price)) {
try {
aPrice = Float.valueOf(price);
} catch (Exception ex) {
error += " Invalid Price.<br/>";
}
}
if ("".equals(error)) {
try {
DBUtil.execute(editProdSQL, new Object[] {category, lPrice, aPrice, filename,contentID});
DBUtil.execute(editMetaSQL, new String[] {title, description,publisher,artist,creationData,language,country,runTime,prevFile, thumbnail1,thumbnail2,contentLoc,dataType,resolution,bitRate,mimeType,rating,drmType,deliveryMode,relProd,contentID});
savedMsg += contentID + " has been successfully updated.<br/>";
} catch (Exception ex) {
error += " Error in updating content info to DB.<br>";
}
}
} else if (action==null && contentID != null && !"".equals(contentID.trim()) ) {
formTitle = "Edit Content";
String detailInfoSQL = "SELECT prod.contentid,prod.listprice,prod.price, prod.filename,meta.title,meta.description,meta.publisher,meta.artist,meta.creationdata,meta.language,meta.country,meta.runtime,meta.previewfile,meta.thumbnail1,meta.thumbnail2,meta.contentloc,meta.datatype,meta.resolution,meta.bitrate,meta.mimetype,meta.rating,meta.drmtype,meta.deliverymode, prod.category, meta.relprod FROM SHOP_PRODUCT prod LEFT OUTER JOIN OPERA_CONTENT_METADATA meta ON prod.contentid = meta.contentid WHERE prod.contentid=?";
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
int[] detailInfoTypes = new int[] {java.sql.Types.VARCHAR,java.sql.Types.FLOAT,java.sql.Types.FLOAT,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR,java.sql.Types.VARCHAR};
String[] contentInfo = DBUtil.getRecord(detailInfoSQL, detailInfoTypes, null, new String[] {contentID});
title = contentInfo[4];
description = contentInfo[5];
publisher = contentInfo[6];
artist = contentInfo[7];
creationData = contentInfo[8];
language = contentInfo[9];
country = contentInfo[10];
runTime = contentInfo[11];
prevFile = contentInfo[12];
thumbnail1 = contentInfo[13];
thumbnail2 = contentInfo[14];
contentLoc = contentInfo[15];
dataType = contentInfo[16];
resolution = contentInfo[17];
bitRate = contentInfo[18];
mimeType = contentInfo[19];
rating = contentInfo[20];
drmType = contentInfo[21];
deliveryMode = contentInfo[22];
category = contentInfo[23];
listPrice = contentInfo[1];
price = contentInfo[2];
filename = contentInfo[3];
relProd = contentInfo[24];
buttonLabel = "Update";
}
if (contentID == null) contentID = "";
if (title == null) title = "";
if (description == null) description = "";
if (publisher == null) publisher = "";
if (artist == null) artist = "";
if (creationData == null) creationData = "";
if (language == null) language = "";
if (country == null) country = "";
if (runTime == null) runTime = "";
if (prevFile == null) prevFile = "";
if (thumbnail1 == null) thumbnail1 = "";
if (thumbnail2 == null) thumbnail2 = "";
if (contentLoc == null) contentLoc = "";
if (dataType == null) dataType = "";
if (resolution == null) resolution = "";
if (bitRate == null) bitRate = "";
if (mimeType == null) mimeType = "";
if (rating == null) rating = "";
if (drmType == null) drmType = "";
if (deliveryMode == null) deliveryMode = "";
if (listPrice == null) listPrice = "";
if (price == null) price = "";
if (filename == null) filename = "";
if (relProd == null) relProd = "";
%>
<%@ include file="top_body.jsp" %>
<td width="500" valign="top">
<table width="480" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -