You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

529 lines
20 KiB

3 years ago
<!-- $Id: category_info.htm 16752 2009-10-20 09:59:38Z wangleisvn $ -->
{include file="pageheader.htm"}
<!-- start add new category form -->
<div class="main-div">
<form action="category.php" method="post" name="theForm" enctype="multipart/form-data" onsubmit="return validate()">
<table width="100%" id="general-table">
<tr>
<td class="label">{$lang.cat_name}:</td>
<td>
<!--ecmoban模板堂 --zhuo start-->
{if $form_act eq 'insert'}
<textarea name="cat_name" cols="48" rows="3">{$cat_info.cat_name|escape:html}</textarea> <font color="red">*</font>
<br/>
<span class="notice-span" style="display:block">如需批量添加分类,格式:分类名称一,分类名称二,分类名称三 (注:以英文逗号分隔开)</span>
{else}
<input type='text' name='cat_name' maxlength="20" value='{$cat_info.cat_name|escape:html}' size='27' /> <font color="red">*</font>
{/if}
<!--ecmoban模板堂 --zhuo end-->
</td>
</tr>
<tr>
<td class="label">手机别名:</td>
<td>
<input type='text' name='cat_alias_name' id="cat_alias_name" maxlength="20" value='{if $cat_info.parent_id eq 0}{$cat_info.cat_alias_name|escape:html}{/if}' size='27' {if $cat_info.parent_id neq 0}disabled="true"{/if} />
<span class="notice-span" style="display:block">(注:手机端专用)</span>
</td>
</tr>
<tr>
<td class="label">{$lang.parent_id}:</td>
<td>
<input type="hidden" name="parent_id" id="cat_parent_id" value="{$parent_and_rank|default:0}" />
<!--
<select name="catList1" id="cat_list1" onchange="get_cat_parent_val(this.value,1)">
<option value="0">{$lang.cat_top}</option>{$cat_select}
</select>
-->
{if $select_category_html}{$select_category_html}{/if}
</td>
</tr>
<script type="text/javascript">
// 分类分级 by qin
function catList(val, level)
{
var cat_parent_id = val;
Ajax.call('goods.php?is_ajax=1&act=sel_cat', 'cat_id='+cat_parent_id+'&cat_level='+level, catListResponse, 'GET', 'JSON');
}
function catListResponse(result)
{
document.getElementById('cat_parent_id').value = result.parent_id + "_" + Number(result.cat_level - 1);
if (result.error == '1' && result.message != '')
{
alert(result.message);
return;
}
var response = result.content;
var cat_level = result.cat_level; // 分类级别, 1为顶级分类
for(var i=cat_level;i<10;i++)
{
$("#cat_list"+Number(i+1)).remove();
}
if(response)
{
$("#cat_list"+cat_level).after(response);
}
return;
}
</script>
<tr id="measure_unit">
<td class="label">{$lang.measure_unit}:</td>
<td>
<input type="text" name='measure_unit' value='{$cat_info.measure_unit}' size="12" />
</td>
</tr>
<tr>
<td class="label">{$lang.sort_order}:</td>
<td>
<input type="text" name='sort_order' {if $cat_info.sort_order}value='{$cat_info.sort_order}'{else} value="50"{/if} size="15" />
</td>
</tr>
<tr>
<td class="label">{$lang.is_show}:</td>
<td>
<input type="radio" name="is_show" value="1" {if $cat_info.is_show neq 0} checked="true"{/if}/> {$lang.yes}
<input type="radio" name="is_show" value="0" {if $cat_info.is_show eq 0} checked="true"{/if} /> {$lang.no}
</td>
</tr>
{if $ru_id eq 0}
<tr>
<td class="label">{$lang.show_in_nav}:</td>
<td>
<input type="radio" name="show_in_nav" value="1" {if $cat_info.show_in_nav neq 0} checked="true"{/if}/> {$lang.yes}
<input type="radio" name="show_in_nav" value="0" {if $cat_info.show_in_nav eq 0} checked="true"{/if} /> {$lang.no}
</td>
</tr>
{if $cat_info.parent_id neq 0}
<tr>
<td class="label">是否在顶级分类页显示:</td>
<td>
<input type="radio" name="is_top_show" value="1" {if $cat_info.is_top_show neq 0} checked="true"{/if}/> {$lang.yes}
<input type="radio" name="is_top_show" value="0" {if $cat_info.is_top_show eq 0} checked="true"{/if} /> {$lang.no}
</td>
</tr>
{/if}
{if $cat_info.parent_id eq 0}
<tr>
<td class="label">是否使用顶级分类页样式:</td>
<td>
<input type="radio" name="is_top_style" value="1" {if $cat_info.is_top_style neq 0} checked="true"{/if}/> {$lang.yes}
<input type="radio" name="is_top_style" value="0" {if $cat_info.is_top_style eq 0} checked="true"{/if}/> {$lang.no}
</td>
</tr>
<!--顶级分类页模板 by wu-->
<tr {if $cat_info.is_top_style eq 0}style="display:none"{/if}>
<td class="label">顶级分类页模板:</td>
<td>
<select name="top_style_tpl">
<option value="0" {if $cat_info.top_style_tpl eq 0}selected="selected"{/if}>默认模板</option>
<option value="1" {if $cat_info.top_style_tpl eq 1}selected="selected"{/if}>女装模板</option>
<option value="2" {if $cat_info.top_style_tpl eq 2}selected="selected"{/if}>家电模板</option>
<option value="3" {if $cat_info.top_style_tpl eq 3}selected="selected"{/if}>食品模板</option>
</select>
</td>
</tr>
<tr {if $cat_info.is_top_style eq 0}style="display:none"{/if}>
<td class="label">顶级分类页菜单图标:</td>
<td>
<input type="file" name="cat_icon" id="cat_icon" style="margin-top:5px;"/>
{if $cat_info.cat_icon}
<a href="javascript:void(0);" onclick="delete_icon({$cat_info.cat_id})" title="删除"><img src="images/no.gif" alt="Delete" border="0" /></a>
<img src="images/yes.gif" border="0" />
{/if}
<br />
<br />
<span class="notice-span">图标尺寸为18*18比例,大小不能超过200KB,图片只能为jpg、png、gif格式</span>
</td>
</tr>
<!--顶级分类页模板 by wu-->
{/if}
<tr>
<td class="label">{$lang.show_in_index}:</td>
<td>
<input type="checkbox" name="cat_recommend[]" value="1" {if $cat_recommend[1] eq 1} checked="true"{/if}/> {$lang.index_best}
<input type="checkbox" name="cat_recommend[]" value="2" {if $cat_recommend[2] eq 1} checked="true"{/if} /> {$lang.index_new}
<input type="checkbox" name="cat_recommend[]" value="3" {if $cat_recommend[3] eq 1} checked="true"{/if} /> {$lang.index_hot}
</td>
</tr>
{else}
<tr>
<td class="label">显示店铺导航栏:</td>
<td>
<input type="radio" name="is_show_merchants" value="1" {if $cat_info.is_show_merchants neq 0} checked="true"{/if}/> {$lang.yes}
<input type="radio" name="is_show_merchants" value="0" {if $cat_info.is_show_merchants eq 0} checked="true"{/if} /> {$lang.no}
</td>
</tr>
{/if}
<!-- ecmoban模板堂 --zhuo start -->
<tr {if !$cat_name_arr}style=" display:none"{/if}>
<td class="label">分类跳转链接:</td>
<td>
<textarea name='category_links' rows="6" cols="48">{$cat_info.category_links}</textarea>
<br />
<span class="notice-span">格式:请根据分类名称顺序填写链接地址(如http://www.ecmoban.com),每行一条数据。</span>
</td>
</tr>
<tr {if $parent_id neq 0 || $form_act eq 'insert'}style=" display:none"{/if}>
<td class="label">分类树顶级分类模块内容:</td>
<td>
<textarea name='category_topic' rows="6" cols="48">{$cat_info.category_topic}</textarea>
<br />
<span class="notice-span">(格式:名称+"英文竖线"+链接地址),每行一条数据。</span>
</td>
</tr>
<!-- ecmoban模板堂 --zhuo end -->
<tr>
<td class="label"><a href="javascript:showNotice('noticeFilterAttr');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.filter_attr}:</td>
<td>
<script type="text/javascript">
var arr = new Array();
var sel_filter_attr = "{$lang.sel_filter_attr}";
{foreach from=$attr_list item=val key=att_cat_id}
arr[{$att_cat_id}] = new Array();
{foreach from=$val item=item key=i}
{foreach from=$item item=attr_val key=attr_id}
arr[{$att_cat_id}][{$i}] = ["{$attr_val}", {$attr_id}];
{/foreach}
{/foreach}
{/foreach}
function changeCat(obj)
{
var key = obj.value;
var sel = window.ActiveXObject ? obj.parentNode.childNodes[4] : obj.parentNode.childNodes[5];
sel.length = 0;
sel.options[0] = new Option(sel_filter_attr, 0);
if (arr[key] == undefined)
{
return;
}
for (var i= 0; i < arr[key].length ;i++ )
{
sel.options[i+1] = new Option(arr[key][i][0], arr[key][i][1]);
}
}
</script>
<table width="100%" id="tbody-attr" align="center">
{if $attr_cat_id eq 0}
<tr>
<td>
<a href="javascript:;" onclick="addFilterAttr(this)">[+]</a>
<select onChange="changeCat(this)"><option value="0">{$lang.sel_goods_type}</option>{$goods_type_list}</select>&nbsp;&nbsp;
<select name="filter_attr[]"><option value="0">{$lang.sel_filter_attr}</option></select><br />
</td>
</tr>
{/if}
{foreach from=$filter_attr_list item=filter_attr name="filter_attr_tab"}
<tr>
<td>
{if $smarty.foreach.filter_attr_tab.iteration eq 1}
<a href="javascript:;" onclick="addFilterAttr(this)">[+]</a>
{else}
<a href="javascript:;" onclick="removeFilterAttr(this)">[-]&nbsp;</a>
{/if}
<select onChange="changeCat(this)"><option value="0">{$lang.sel_goods_type}</option>{$filter_attr.goods_type_list}</select>&nbsp;&nbsp;
<select name="filter_attr[]"><option value="0">{$lang.sel_filter_attr}</option>{html_options options=$filter_attr.option selected=$filter_attr.filter_attr}</select><br />
</td>
</tr>
{/foreach}
</table>
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeFilterAttr">{$lang.filter_attr_notic}</span>
</td>
</tr>
<tr>
<td class="label"><a href="javascript:showNotice('noticeGrade');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.grade}:</td>
<td>
<input type="text" name="grade" value="{$cat_info.grade|default:0}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGrade">{$lang.notice_grade}</span>
</td>
</tr>
<tr>
<td class="label"><a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.notice_style}"></a>{$lang.cat_style}:</td>
<td>
<input type="text" name="style" value="{$cat_info.style|escape}" size="40" /> <br />
<span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">{$lang.notice_style}</span>
</td>
</tr>
<tr>
<td class="label">{$lang.keywords}:</td>
<td><input type="text" name="keywords" value='{$cat_info.keywords}' size="50">
</td>
</tr>
<tr>
<td class="label">{$lang.cat_desc}:</td>
<td>
<textarea name='cat_desc' rows="6" cols="48">{$cat_info.cat_desc}</textarea>
</td>
</tr>
<!--ecmoban模板堂 --zhuo start-->
{if $ru_id eq 0}
{if $cat_info.parent_id eq 0 && $form_act eq 'update'}
<tr>
<td class="label">{$lang.categoryFile}:</td>
<td>
<table width="100%" align="center" id="documentTitle_table" style="border:none; padding:0px;">
{if $form_act eq 'update' && $title_list}
<tr>
<td>
<a href="category.php?act=titleFileView&cat_id={$cat_id}">查看证件列表</a>
</td>
</tr>
{else}
<tr>
<td>
<a onclick="addCategoryFile(this)" href="javascript:;">[+]</a>
{$lang.document_title} <input type="hidden" value="0" size="40" name="dt_id[]"><input type="text" value="" size="40" name="document_title[]">
</td>
</tr>
{if $title_list}
{foreach from=$title_list item=title}
<tr>
<td>
<a onclick="removeCategoryFile(this,{$title.dt_id})" href="javascript:;">[-]</a>
{$lang.document_title} <input type="hidden" value="0" size="40" name="dt_id[]"><input type="text" value="{$title.dt_title}" size="40" name="document_title[]">
</td>
</tr>
{/foreach}
{/if}
{/if}
</table>
</td>
</tr>
{elseif $form_act eq 'insert'}
<tr>
<td class="label">{$lang.categoryFile}:</td>
<td>
<table width="100%" align="center" id="documentTitle_table" style="border:none">
<tr>
<td>
<a onclick="addCategoryFile(this)" href="javascript:;">[+]</a>
{$lang.document_title} <input type="hidden" value="0" size="40" name="dt_id[]"><input type="text" value="" size="40" name="document_title[]">
</td>
</tr>
</table>
</td>
</tr>
{/if}
{/if}
<!--ecmoban模板堂 --zhuo end-->
</table>
<div class="button-div">
<input class="button" type="submit" value="{$lang.button_submit}" />
<input class="button" type="reset" value="{$lang.button_reset}" />
</div>
<input type="hidden" name="act" value="{$form_act}" />
<input type="hidden" name="old_cat_name" value="{$cat_info.cat_name}" />
<input type="hidden" name="cat_id" value="{$cat_info.cat_id}" />
</form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
<!--
document.forms['theForm'].elements['cat_name'].focus();
/**
* 检查表单输入的数据
*/
function validate()
{
validator = new Validator("theForm");
validator.required("cat_name", catname_empty);
if (parseInt(document.forms['theForm'].elements['grade'].value) >10 || parseInt(document.forms['theForm'].elements['grade'].value) < 0)
{
validator.addErrorMsg('{$lang.grade_error}');
}
return validator.passed();
}
onload = function()
{
// 开始检查订单
startCheckOrder();
}
/**
* 新增一个筛选属性
*/
function addFilterAttr(obj)
{
var src = obj.parentNode.parentNode;
var tbl = document.getElementById('tbody-attr');
var validator = new Validator('theForm');
var filterAttr = document.getElementsByName("filter_attr[]");
if (filterAttr[filterAttr.length-1].selectedIndex == 0)
{
validator.addErrorMsg(filter_attr_not_selected);
}
for (i = 0; i < filterAttr.length; i++)
{
for (j = i + 1; j <filterAttr.length; j++)
{
if (filterAttr.item(i).value == filterAttr.item(j).value)
{
validator.addErrorMsg(filter_attr_not_repeated);
}
}
}
if (!validator.passed())
{
return false;
}
var row = tbl.insertRow(tbl.rows.length);
var cell = row.insertCell(-1);
cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addFilterAttr)(.*)(\[)(\+)/i, "$1removeFilterAttr$3$4-");
filterAttr[filterAttr.length-1].selectedIndex = 0;
}
/**
* 删除一个筛选属性
*/
function removeFilterAttr(obj)
{
var row = rowindex(obj.parentNode.parentNode);
var tbl = document.getElementById('tbody-attr');
tbl.deleteRow(row);
}
//ecmoban模板堂 --zhuo start
//判断选择的分类是否是顶级分类,如果是则可用 类目证件
function get_cat_parent_val(f,lev){
var cat_alias_name = document.getElementById("cat_alias_name");
var title_list = document.getElementsByName("document_title[]");
var cat_parent_id = f + "_" + Number(lev - 1);
var arr = new Array();
var str = new String(cat_parent_id);
var arr = str.split("_");
var sf = Number(arr[0]);
var slevel = Number(arr[1]);
catList(sf, lev);
for(i=0; i<title_list.length; i++){
if(sf != 0){
title_list[i].disabled = true;
title_list[i].value = '';
cat_alias_name.disabled = true;
cat_alias_name.value = '';
}else{ //顶级分类为0
title_list[i].disabled = false;
cat_alias_name.disabled = false;
}
}
}
/**
* 添加类目证件
*/
function addCategoryFile(obj)
{
var title_list = document.getElementsByName("document_title[]");
var catParent = document.getElementById('cat_parent_id').value;
catParent = catParent.split('_');
var parent_id = catParent[0];
if(parent_id != 0){
alert('该分类必须是顶级分类才能使用!');
for(i=0; i<title_list.length; i++){
title_list[i].value = '';
}
return false;
}
var src = obj.parentNode.parentNode;
var tbl = document.getElementById('documentTitle_table');
var row = tbl.insertRow(tbl.rows.length);
var cell = row.insertCell(-1);
cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addCategoryFile)(.*)(\[)(\+)/i, "$1removeCategoryFile$3$4-");
title_list[title_list.length-1].value = "";
}
/**
* 删除类目证件
*/
function removeCategoryFile(obj,dt_id)
{
if(dt_id > 0){
if (confirm('确实要删除该信息吗')){
{if $cat_id > 0}
location.href = 'category.php?act=title_remove&dt_id=' + dt_id + '&cat_id=' + {$cat_id};
{/if}
}
}else{
var row = rowindex(obj.parentNode.parentNode);
var tbl = document.getElementById('documentTitle_table');
tbl.deleteRow(row);
}
}
//ecmoban模板堂 --zhuo end
//-->
//顶级分类页模板 by wu
$(document).ready(function(){
$("[name='is_top_style']").click(function(){
if($(this).attr('value')==1)
{
$("[name='top_style_tpl']").parents('tr').show();
$("[name='cat_icon']").parents('tr').show();
}
else
{
$("[name='top_style_tpl']").parents('tr').hide();
$("[name='cat_icon']").parents('tr').hide();
}
})
})
function delete_icon(cat_id)
{
$.ajax({
type:'get',
url:'category.php',
data:'act=delete_icon&cat_id='+cat_id,
dataType:'json',
success:function(data){
if(data.error==1)
{
location.reload();
}
if(data.error==0)
{
alert('删除失败');
}
}
})
}
</script>
{/literal}
3 years ago
{include file="pagefooter.htm"}