📄 ct_catalog.jsp
字号:
var i;
var start=new Date;
for(i=1;i<the_tab.rows.length;i++){
tab_arr.push(new Array(the_tab.rows[i].cells[col].innerText.toLowerCase(),the_tab.rows[i]));
}
function SortArr(mode) {
return function (arr1, arr2){
var flag;
var a,b;
a = arr1[0];
b = arr2[0];
if(/^(\+|-)?\d+($|\.\d+$)/.test(a) && /^(\+|-)?\d+($|\.\d+$)/.test(b)){
a=eval(a);
b=eval(b);
flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
}else{
a=a.toString();
b=b.toString();
if(a.charCodeAt(0)>=19968 && b.charCodeAt(0)>=19968){
flag = judge_CN(a,b,mode);
}else{
flag=mode?(a>b?1:(a<b?-1:0)):(a<b?1:(a>b?-1:0));
}
}
return flag;
};
}
tab_arr.sort(SortArr(mode));
for(i=0;i<tab_arr.length;i++){
the_tab.lastChild.appendChild(tab_arr[i][1]);
}
window.status = " (Time spent: " + (new Date - start) + "ms)";
}
function change_row(the_tab,line1,line2){
the_tab.rows[line1].swapNode(the_tab.rows[line2])
}
function change_col(the_tab,line1,line2){
for(var i=0;i<the_tab.rows.length;i++)
the_tab.rows[i].cells[line1].swapNode(the_tab.rows[i].cells[line2]);
}
function Move_up(the_table){
event.cancelBubble=true;
if(cur_row==null || cur_row<=1)return;
change_row(the_table,cur_row,--cur_row);
}
function Move_down(the_table){
event.cancelBubble=true;
if(cur_row==null || cur_row==the_table.rows.length-1 || cur_row==0)return;
change_row(the_table,cur_row,++cur_row);
}
function Move_left(the_table){
event.cancelBubble=true;
if(cur_col==null || cur_col==0)return;
change_col(the_table,cur_col,--cur_col);
if(cur_col==sort_col)sort_col=cur_col+1;
else if(cur_col+1==sort_col)sort_col=cur_col;
}
function Move_right(the_table){
event.cancelBubble=true;
if(cur_col==null || cur_col==the_table.rows[0].cells.length-1)return;
change_col(the_table,cur_col,++cur_col);
if(cur_col==sort_col)sort_col=cur_col-1;
else if(cur_col-1==sort_col)sort_col=cur_col;
}
function add_row(the_table) {
event.cancelBubble=true;
var the_row,the_cell;
the_row = cur_row==null?-1:(cur_row+1);
clear_color();
var newrow=the_table.insertRow(the_row);
for (var i=0;i<the_table.rows[0].cells.length;i++) {
the_cell=newrow.insertCell(i);
the_cell.innerText="NewRow_" + the_cell.parentElement.rowIndex;
}
read_def(the_table);
}
function del_row(the_table) {
if(the_table.rows.length==1) return;
var the_row;
the_row = (cur_row==null || cur_row==0)?-1:cur_row;
the_table.deleteRow(the_row);
cur_row = null;
cur_cell=null;
}
function add_col(the_table) {
event.cancelBubble=true;
var the_col,i,the_cell;
the_col = cur_col==null?-1:(cur_col+1);
var the_title=prompt("Please input the title: ","Untitled");
if(the_title==null)return;
if(the_col!=-1 && the_col<=sort_col && sort_col!=null)sort_col++;
the_title=the_title==""?"Untitled":the_title
clear_color();
for(var i=0;i<the_table.rows.length;i++){
the_cell=the_table.rows[i].insertCell(the_col);
the_cell.innerText=i==0?the_title:("NewCol_" + the_cell.cellIndex);
}
read_def(the_table);
}
function del_col(the_table) {
if(the_table.rows[0].cells.length==1) return;
var the_col,the_cell;
the_col = cur_col==null?(the_table.rows[0].cells.length-1):cur_col;
if(the_col!=-1 && the_col<sort_col && sort_col!=null)sort_col--;
else if(the_col==sort_col)sort_col=null;
for(var i=0;i<the_table.rows.length;i++) the_table.rows[i].deleteCell(the_col);
cur_col = null;
cur_cell=null;
}
function res_tab(the_table){
the_table.outerHTML=Org_con;
init();
}
function exp_tab(the_table){
var the_content="";
document.onclick();
the_content=the_table.outerHTML;
the_content=the_content.replace(/ style=\"[^\"]*\"/g,"");
the_content=the_content.replace(/ mode=\"(false|true)"/g,"");
the_content=the_content.replace(/ oBgc=\"[\w#\d]*\"/g,"");
the_content=the_content.replace(/ oFc=\"[\w#\d]*\"/g,"");
the_content=the_content.replace(/<DIV contentEditable=false>([^<]*)<\/DIV>/ig,"$1");
the_content="<style>table{font-size: 9pt;word-break:break-all;cursor: default;BORDER: black 1px solid;background-color:#eeeecc;border-collapse:collapse;border-Color:#999999;align:center;}</style>\n"+the_content;
var newwin=window.open("about:blank","_blank","");
newwin.document.open();
newwin.document.write(the_content);
newwin.document.close();
newwin=null;
}
function addSon(parentid)
{
document.temp_form.action = "add_catalog.jsp";
document.temp_form.backurl.value = "<%=StringUtil.getCurrentURL(request)%>";
document.temp_form.parentid.value = parentid;
document.temp_form.submit();
}
function modC(id)
{
document.temp_form.action = "mod_catalog.jsp";
document.temp_form.backurl.value = "<%=StringUtil.getCurrentURL(request)%>";
document.temp_form.id.value = id;
document.temp_form.submit();
}
function delC(id)
{
if (confirm("确认操作吗?"))
{
document.temp_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/delCatalog";
document.temp_form.id.value = id;
document.temp_form.submit();
}
}
function selectColor(index)
{
var result = window.showModalDialog('color_panel_if.jsp',window,"dialogWidth:20;dialogHeight:20;status:no;help:no");
if ( !(typeof result == 'undefined') )
{
document.getElementById("preColor"+index).style.background = result;
}
}
function boldTitle(thebox)
{
if ( thebox.checked )
{
document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/boldTitle";
}
else
{
document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/unBoldTitle";
}
document.csort_form.id.value = thebox.value;
document.csort_form.submit();
}
function colorTitle(id,index)
{
document.csort_form.action = "<%=ConfigBean.getStringValue("systenFolder")%>appController/colorTitle";
document.csort_form.id.value = id;
document.csort_form.color.value = document.getElementById("preColor"+index).style.background;
document.csort_form.submit();
}
</script>
<style type="text/css">
<!--
.line-black-1234 {
border: 1px solid #000000;
}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td class="page-title"><img src="../imgs/page_title.gif" alt="title" width="17" height="12" align="absmiddle"> 货架管理 » 货架列表</td>
</tr>
</table>
<br>
<br>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"> <TABLE width=100% height="47" border=0 cellPadding=3 cellSpacing=0 class="thetable" id="PowerTable">
<form name="csort_form" method="post">
<input type="hidden" name="id">
<input type="hidden" name="color">
<thead>
<TR align=middle>
<TD width="8%" height="22" align="center" class="left-title">货架编号</TD>
<TD align="left" class="right-title">货架名称</TD>
</TR>
</thead>
<%
String lineBg;
DBRow catalog[] = catalogMgr.getCatalogByParentId(0l,null);
for ( int i=0; i<catalog.length; i++ )
{
if ( i%2==0 )
{
lineBg = "#ffffff";
}
else
{
lineBg = "#eeeeee";
}
%>
<TR>
<TD height="23" align="center" bgcolor="<%=lineBg%>">
<%=catalog[i].getString("id")%>
</TD>
<TD width="92%" bgcolor="<%=lineBg%>"> <span style="<%=catalog[i].getString("title_style")%>">
<%=catalog[i].getString("title")%>
</span> </TD>
</TR>
<%
}
%>
</form>
</TABLE>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td class="turn-page-table"><input name="button" type=button class="short-button" id=move onclick=Move_up(Main_Tab) value= 上移 >
<input name="button" type=button class="short-button" id=move onclick=Move_down(Main_Tab) value= 下移 >
<input name="Submit3" type="button" class="short-button" onClick="updateCatalogSort(Main_Tab)" value="保存修改"></td>
</tr>
</table></td>
</tr>
</table>
<br>
<form action="" method="get" name="temp_form">
<input type="hidden" name="id">
<input type="hidden" name="parentid">
<input type="hidden" name="backurl">
</form>
<br>
<table width="98%" height="40" border="0" align="center" cellpadding="3" cellspacing="0">
<tr>
<td><input name="Submit" type="button" class="long-button" onClick="addSon(0)" value="增加主货架"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="0" class="thetable">
<form name="listForm" method="post">
<input type="hidden" name="id">
<input type="hidden" name="parentid">
<input type="hidden" name="imp_color">
<thead>
<tr>
<td valign="middle" class="left-title">货架名称</td>
<td align="center" valign="middle" class="right-title">首页广告</td>
<td align="center" valign="middle" class="right-title">货架列表内广告</td>
<td align="center" valign="middle" class="right-title">加 亮</td>
<td align="center" valign="middle" class="right-title">货架编号</td>
<td width="8%" align="center" valign="middle" class="right-title">访问数</td>
<td width="7%" align="center" valign="middle" class="right-title">商品数量</td>
<td width="16%" align="center" valign="middle" class="right-title">操 作</td>
</tr>
</thead>
<%
String qx;
int kk=0;
DBRow treeRows[] = catalogMgr.getCatalogTree();
String className;
for ( int i=0; i<treeRows.length; i++ )
{
if ( treeRows[i].get("parentid",0)!=0&&treeRows[i].get("parentid",0)!=expandID )
{
continue;
}
if ( kk++%2==0 )
{
className = "row-line1";
}
else
{
className = "row-line2";
}
if ( treeRows[i].get("parentid",0) != 0 )
{
qx = "├ ";
}
else
{
qx = "";
}
%>
<tr >
<td width="21%" height="60" valign="middle" class="<%=className%>" >
<%=Tree.makeSpace(" ",treeRows[i].get("level",0))%>
<%=qx%>
<%=treeRows[i].get("level",0)==1?"<img src='../imgs/expand_tag.gif'> ":""%> <a class="in-table" href="?expandID=<%=treeRows[i].getString("id")%>"><%=treeRows[i].getString("title")%></a> </td>
<td width="16%" align="center" valign="middle" class="<%=className%>" >
<%
if ( !treeRows[i].getString("img").equals("") )
{
%>
<a class="in-table" href="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("img")%>" target="_blank"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("img")%>" width="50" height="50" border="0" alt="<%=treeRows[i].getString("description")%>"></a>
<br>
<a href="<%=treeRows[i].getString("link")%>" target="_blank">图片链接</a>
<%
}
%>
</td>
<td width="16%" align="center" valign="middle" class="<%=className%>" >
<%
if ( !treeRows[i].getString("internal_banner").equals("") )
{
%>
<a class="in-table" href="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("internal_banner")%>" target="_blank"><img src="<%=ConfigBean.getStringValue("systenFolder")%>.<%=ConfigBean.getStringValue("upload_pro_img")+treeRows[i].getString("internal_banner")%>" width="50" height="50" border="0"></a>
<br>
<a href="<%=treeRows[i].getString("internal_banner_link")%>" target="_blank">图片链接</a>
<%
}
%>
</td>
<td width="8%" align="center" valign="middle" class="<%=className%>" >
<%
String alive_sl;
if ( treeRows[i].get("imp_color",0) == 1 )
{
alive_sl = "checked";
}
else
{
alive_sl = "";
}
if ( treeRows[i].get("level",0)>1 )
{
%>
<input type="checkbox" name="alive_x" id="alive_x" value="<%=treeRows[i].getString("id")%>" onClick="impColor(this)" <%=alive_sl%>>
<%
}
%> </td>
<td width="8%" align="center" valign="middle" class="<%=className%>" >
<%=treeRows[i].getString("id")%> </td>
<td align="center" valign="middle" class="<%=className%>" >
<%=treeRows[i].getString("click")%> </td>
<td align="center" valign="middle" class="<%=className%>" >
<%=productMgr.getNewProductByCid(treeRows[i].get("id",0l),null).length%> </td>
<td align="center" valign="middle" class="<%=className%>" >
<%
if (treeRows[i].get("level",0)<2)
{
%>
<a href="set_commend_catalog.jsp?id=<%=treeRows[i].getString("id")%>"><img src="../imgs/index_catalog_commend.gif" alt="首页货架推荐" width="16" height="16" border="0"></a>
<a href="javascript:addSon(<%=treeRows[i].getString("id")%>)"><img src="../imgs/addp.gif" alt="增加子货架" width="16" height="16" border="0"></a>
<%
}
%>
<a href="javascript:modC(<%=treeRows[i].getString("id")%>)"><img src="../imgs/modp.gif" alt="修改货架" width="16" height="16" border="0"></a>
<a href="javascript:delC(<%=treeRows[i].getString("id")%>)"><img src="../imgs/delp.gif" alt="删除货架" border="0" width="16" height="16"></a>
</td>
</tr>
<%
}
%>
</form>
</table>
<br>
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -