www.gusucode.com > Tatter Tools 0.961 SE GB2312 简体中文版 > upload/admin/article_category_pop2.php

    <?
	include("../inc_global.php");
	include("../inc_function.php");
	check_authority();

	if ($mode == "insert") {
		$newsortno = get_maxval("t3_".$dbid."_ct2", "sortno", "") + 1;
		put_query("insert into t3_".$dbid."_ct2 (pno, sortno, label) values ($ct1, $newsortno, '$label')");
		check_query();
		header("Location: article_category_pop2.php?ct1=$ct1");
		exit;
	}

	if ($mode == "update") {
		put_query("update t3_".$dbid."_ct2 set label = '$plabel' where no = $num");
		check_query();
		header("Location: article_category_pop2.php?ct1=$ct1");
		exit;
	}

	if ($mode == "delete") {
		put_query("delete from t3_".$dbid."_ct2 where no = $num");
		put_query("update t3_$dbid set category2 = '0' where category2 = '$num'");
		check_query();
		header("Location: article_category_pop2.php?ct1=$ct1");
		exit;
	}

	if ($mode == "sortup") {
		$sql = "select max(sortno) from t3_".$dbid."_ct2 where pno = $ct1 and sortno < $sortno";
		list ($max_sortno) = mysql_fetch_array(mysql_query($sql));
		if ($max_sortno) {
			$sql = "select no, sortno from t3_".$dbid."_ct2 where pno = $ct1 and sortno = $max_sortno";
			list ($newno, $newsortno) = mysql_fetch_array(mysql_query($sql));
			put_query("update t3_".$dbid."_ct2 set sortno = $newsortno where no = $no");
			put_query("update t3_".$dbid."_ct2 set sortno = $sortno where no = $newno");
			check_query();
		}
		header("Location: article_category_pop2.php?ct1=$ct1");
		exit;
	}

	if ($mode == "sortdown") {
		$sql = "select min(sortno) from t3_".$dbid."_ct2  where pno = $ct1 and sortno > $sortno";
		list ($min_sortno) = mysql_fetch_array(mysql_query($sql));
		if ($min_sortno) {
			$sql = "select no, sortno from t3_".$dbid."_ct2 where pno = $ct1 and sortno = $min_sortno";
			list ($newno, $newsortno) = mysql_fetch_array(mysql_query($sql));
			put_query("update t3_".$dbid."_ct2 set sortno = $newsortno where no = $no");
			put_query("update t3_".$dbid."_ct2 set sortno = $sortno where no = $newno");
			check_query();
		}
		header("Location: article_category_pop2.php?ct1=$ct1");
		exit;
	}

	$sql = "select label from t3_".$dbid."_ct1 where no = $ct1";
	list ($label) = mysql_fetch_array(mysql_query($sql));

	admin_pop_header("\" onUnload=\"opener.location.reload();");

?>

<script type="text/javascript">

	function onclick_insert(form) {
		trim_all(form);
		if (isNull(form.label,'输入小分类名称')) return false;
		form.mode.value = 'insert';
		form.submit();
	}

	function onclick_update(form, num, label) {
		trim_all(form);
		if (trim(label) == '') {
			alert('输入小分类名称');
			return false;
		}
		form.mode.value = 'update';
		form.num.value = num;
		form.plabel.value = label;
		form.submit();
	}

	function onclick_delete(form, num) {
		if (!confirm('将要删除此小分类. 确定要继续吗?\t')) return false;
		form.mode.value = 'delete';
		form.num.value = num;
		form.submit();
	}

</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
<meta name="keywords" content="TT,TatterTools,Skin,php">
<meta name="description" content="Meyu,梦游,华人中文网">
<meta name="generator" content="TatterTools中文BLOG">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<meta http-equiv="MSThemeCompatible" content="Yes">
</head>
<form method="post" name="category2" action="<?=$PHP_SELF?>">
<input type="hidden" name="ct1" value="<?=$ct1?>">
<input type="hidden" name="mode">
<input type="hidden" name="num">
<input type="hidden" name="plabel">

	<table width="100%" style="margin:6 0 3 0"><tr>
	<td width="24" align="right"><img src="../images/num_04.gif" height="17" alt=""></td>
	<td width="9"><img src="../images/ver_01.gif" width="9" height="17"></td>
	<td><img src="../images/cap_04.gif" width="103" height="17" alt=""></td>
	</tr></table>

<? print_content_line(); ?>

	<table class="content_back1" cellpadding="0" cellspacing="0" width="100%"><tr>
	<td style="padding:10 0 10 0">

		<table cellpadding="0" cellspacing="0" style="margin-bottom:5"><tr>
		<td width="80" align="right" style="padding-top:3">大分类 ::&nbsp;</td>
		<td style="padding-top:3;"><font size="2"><b><?=$label?></b></font></td>
		</tr></table>

		<table cellpadding="0" cellspacing="0" style="margin-bottom:5"><tr>
		<td width="80" align="right" style="padding-top:3">小分类 ::&nbsp;</td>
		<td><input class="text" type="text" name="label" style="width:150;" onkeydown="if (event.keyCode == 13) { onclick_insert(category2); return false; }"></td>
		<td style="padding-left:5"><img class="ib" src="../images/b_add.gif" width="53" height="17" onclick="onclick_insert(category2);" alt=""></td>
		</tr></table>

	<? input_block() ?>

	<?
		$sql = "select no, sortno, label from t3_".$dbid."_ct2 where pno = '$ct1' order by sortno asc";
 		$result = @mysql_query($sql);
		while(list($no, $sortno, $label) = @mysql_fetch_array($result)) {
			?>
			<table cellpadding="0" cellspacing="0" style="margin-top:5"><tr>
			<td width="80" align="right"><img class="ib" width="15" height="16" src="../images/b_up.gif" width="15" height="16" onclick="window.location.href='<?=$PHP_SELF?>?mode=sortup&amp;ct1=<?=$ct1?>&amp;no=<?=$no?>&amp;sortno=<?=$sortno?>'" style=margin-right:5><img class=ib src=../images/b_down.gif width=15 height=16 onclick="window.location.href='<?=$PHP_SELF?>?mode=sortdown&amp;ct1=<?=$ct1?>&amp;no=<?=$no?>&amp;sortno=<?=$sortno?>'" style="margin-right:6" alt=""></td>
			<td><input class="text" type="text" name="ct2_<?=$no?>" onkeydown="if (event.keyCode == 13) { onclick_update(document.category2, '<?=$no?>', this.value); return false; }" value="<?=$label?>" style="width:150"></td>
			<td style="padding-left:5"><img class="ib" src="../images/b_edit.gif" width="53" height="17" onclick="onclick_update(document.category2, '<?=$no?>', document.category2.ct2_<?=$no?>.value)" alt=""></td>
			<td style="padding-left:5"><img class="ib" src="../images/b_delete.gif" width="53" height="17" onclick="onclick_delete(category2, '<?=$no?>');" alt=""></td>
			</tr></table>
			<?
		}
	?>

	</td>
	</tr></table>

<? print_content_line(); ?>

	<table cellpadding="0" cellspacing="0" width="100%"><tr>
	<td height="35" align="right" style="padding-right:13"><img class="ib" src="../images/b_edit_category1.gif" height="17" onclick="window.location.href='article_category_pop1.php';"><img class=ib src=../images/b_close.gif width="53" height="17" onclick="window.close();" style="margin-left:5" alt=""></td>
	</tr></table>

</form>

<? admin_pop_footer(""); ?>