Index: /trunk/NEWS
===================================================================
--- /trunk/NEWS	(revision 329)
+++ /trunk/NEWS	(revision 371)
@@ -2,4 +2,5 @@
 == NEWS ==
 == ChangeLog ==
+ * #86: remove/edit variable in admin page
  * fixed #56: xcache_set segfaults when xcache.var_size=0
  
Index: /trunk/admin/common-zh-traditional-utf-8.lang.php
===================================================================
--- /trunk/admin/common-zh-traditional-utf-8.lang.php	(revision 360)
+++ /trunk/admin/common-zh-traditional-utf-8.lang.php	(revision 371)
@@ -97,8 +97,8 @@
 		'Module Info'
 		=> '組元訊息',
-		''
-		=> '',
-		''
-		=> '',
+		'Remove Selected'
+		=> '移除所选',
+		'Editing Variable %s'
+		=> '正在编辑变量 %s',
 		''
 		=> '',
Index: /trunk/admin/common-zh-simplified-utf-8.lang.php
===================================================================
--- /trunk/admin/common-zh-simplified-utf-8.lang.php	(revision 360)
+++ /trunk/admin/common-zh-simplified-utf-8.lang.php	(revision 371)
@@ -97,8 +97,8 @@
 		'Module Info'
 		=> '模块信息',
-		''
-		=> '',
-		''
-		=> '',
+		'Remove Selected'
+		=> '删除所选',
+		'Editing Variable %s'
+		=> '正在编辑变量 %s',
 		''
 		=> '',
Index: /trunk/admin/edit.tpl.php
===================================================================
--- /trunk/admin/edit.tpl.php	(revision 371)
+++ /trunk/admin/edit.tpl.php	(revision 371)
@@ -0,0 +1,13 @@
+<?php include("header.tpl.php"); ?>
+<?php
+$h_name = htmlspecialchars($name);
+$h_value = htmlspecialchars($value);
+?>
+<form method="post" action="">
+	<fieldset>
+		<legend><?php echo sprintf(_T("Editing Variable %s"), $h_name); ?></legend>
+		<textarea name="value" style="width: 100%; height: 200px; overflow-y: auto"><?php echo $h_value; ?></textarea><br>
+		<input type="submit">
+	</fieldset>
+</form>
+<?php include("footer.tpl.php"); ?>
Index: /trunk/admin/edit.php
===================================================================
--- /trunk/admin/edit.php	(revision 371)
+++ /trunk/admin/edit.php	(revision 371)
@@ -0,0 +1,25 @@
+<?php
+
+include("./common.php");
+
+if (!isset($_GET['name'])) {
+	die("missing name");
+}
+
+$name = $_GET['name'];
+// trigger auth
+$vcnt = xcache_count(XC_TYPE_VAR);
+
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+	xcache_set($name, $_POST['value']);
+	header("Location: xcache.php?type=" . XC_TYPE_VAR);
+	exit;
+}
+$value = xcache_get($name);
+
+$xcache_version = XCACHE_VERSION;
+$xcache_modules = XCACHE_MODULES;
+
+include("edit.tpl.php");
+
+?>
Index: /trunk/admin/header.tpl.php
===================================================================
--- /trunk/admin/header.tpl.php	(revision 371)
+++ /trunk/admin/header.tpl.php	(revision 371)
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<?php
+echo <<<HEAD
+	<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
+	<meta http-equiv="Content-Language" content="$lang" />
+	<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
+HEAD;
+?>
+
+	<link rel="stylesheet" type="text/css" href="xcache.css" />
+	<title><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></title>
+</head>
+
+<body>
+<h1><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></h1>
Index: /trunk/admin/xcache.tpl.php
===================================================================
--- /trunk/admin/xcache.tpl.php	(revision 363)
+++ /trunk/admin/xcache.tpl.php	(revision 371)
@@ -1,19 +1,3 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<?php
-echo <<<HEAD
-	<meta http-equiv="Content-Type" content="text/html; charset=$charset" />
-	<meta http-equiv="Content-Language" content="$lang" />
-	<script type="text/javascript" src="tablesort.js" charset="$charset"></script>
-HEAD;
-?>
-
-	<link rel="stylesheet" type="text/css" href="xcache.css" />
-	<title><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></title>
-</head>
-
-<body>
-<h1><?php echo sprintf(_T("XCache %s Administration"), $xcache_version); ?></h1>
+<?php include("header.tpl.php"); ?>
 <a href="help.php" target="_blank" id="help"><?php echo _T("Help") ?> &raquo;</a>
 <span class="switcher"><?php echo switcher("type", $types); ?></span>
@@ -143,7 +127,9 @@
 		?>
 
+	<form action="" method="post">
 	<table cellspacing="0" cellpadding="4" class="cycles entrys" width="100%">
 		<col />
 		<col />
+		<col />
 		<col align="right" />
 		<col align="right" />
@@ -167,4 +153,7 @@
 		?>
 
+			<?php if (!$isphp) { ?>
+			<th width="20">R</th>
+			<?php } ?>
 			<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('Cache'); ?></a></th>
 			<th><a href="javascript:" onclick="resort(this); return false"><?php echo _T('entry'); ?></a></th>
@@ -210,7 +199,18 @@
 			}
 
+			if (!$isphp) {
+				echo <<<ENTRY
+					<td><input type="checkbox" name="remove[]" value="{$name}"/></td>
+ENTRY;
+				$uname = urlencode($entry['name']);
+				$namelink = "<a href=\"edit.php?name=$uname\">$name</a>";
+			}
+			else {
+				$namelink = $name;
+			}
+
 			echo <<<ENTRY
 			<td>{$entry['cache_name']} {$i}</td>
-			<td>{$name}</td>
+			<td>{$namelink}</td>
 			<td int="{$entry['hits']}">{$entry['hits']}</td>
 			<td int="{$entry['refcount']}">{$entry['refcount']}</td>
@@ -248,4 +248,6 @@
 
 	</table>
+	<input type="submit" value="<?php echo _T("Remove Selected"); ?>">
+	</form>
 <?php
 	}
@@ -262,11 +264,3 @@
 }
 ?>
-<div class="footnote">
-<?php echo <<<EOS
-Powered By: XCache {$xcache_version}, {$xcache_modules}
-EOS;
-?>
-</div>
-
-</body>
-</html>
+<?php include("footer.tpl.php"); ?>
Index: /trunk/admin/xcache.php
===================================================================
--- /trunk/admin/xcache.php	(revision 250)
+++ /trunk/admin/xcache.php	(revision 371)
@@ -100,4 +100,13 @@
 $pcnt = xcache_count(XC_TYPE_PHP);
 $vcnt = xcache_count(XC_TYPE_VAR);
+
+if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+	$remove = @ $_POST['remove'];
+	if ($remove && is_array($remove)) {
+		foreach ($remove as $name) {
+			xcache_unset($name);
+		}
+	}
+}
 
 $moduleinfo = null;
Index: /trunk/admin/xcache.css
===================================================================
--- /trunk/admin/xcache.css	(revision 352)
+++ /trunk/admin/xcache.css	(revision 371)
@@ -23,5 +23,5 @@
 .percent div { font-size: 1px; line-height: 1px; width: 100%;}
 .percent .pavail { background: blue; }
-.switcher, h1 { text-align: center; display: block; }
+.switcher, h1, h2 { text-align: center; display: block; }
 .switcher * { color: blue; }
 .switcher a.active { font-weight: bold; font-size: 130%; color: black; }
Index: /trunk/admin/footer.tpl.php
===================================================================
--- /trunk/admin/footer.tpl.php	(revision 371)
+++ /trunk/admin/footer.tpl.php	(revision 371)
@@ -0,0 +1,9 @@
+<div class="footnote">
+<?php echo <<<EOS
+Powered By: XCache {$xcache_version}, {$xcache_modules}
+EOS;
+?>
+</div>
+
+</body>
+</html>
