Browse Source

添加调整搜索功能

tags/6.3.0
叙述、别离 1 year ago
parent
commit
8d81259e33
4 changed files with 63 additions and 20 deletions
  1. +9
    -1
      src/admin/diy_list.php
  2. +3
    -9
      src/admin/tags_main.php
  3. +25
    -1
      src/admin/templets/diy_list.htm
  4. +26
    -9
      src/admin/templets/tags_main.htm

+ 9
- 1
src/admin/diy_list.php View File

@@ -67,11 +67,19 @@ if ($action == 'post') {
}
} else if ($action == 'list') {
include_once DEDEINC.'/datalistcp.class.php';
$query = "SELECT * FROM {$diy->table} ORDER BY id DESC";
if (empty($keyword)) {
$keyword = '';
$addquery = '';
} else {
$addquery = " WHERE {$field} LIKE '%".trim($keyword)."%' ";
}
$query = "SELECT * FROM {$diy->table} $addquery ORDER BY id DESC";
$datalist = new DataListCP();
$datalist->pagesize = 30;
$datalist->SetParameter('action', 'list');
$datalist->SetParameter('diyid', $diyid);
$datalist->SetParameter('keyword', $keyword);
$datalist->SetParameter('field', $field);
$datalist->SetTemplate(DEDEADMIN.'/templets/diy_list.htm');
$datalist->SetSource($query);
$fieldlist = $diy->getFieldList();


+ 3
- 9
src/admin/tags_main.php View File

@@ -31,9 +31,7 @@ if (empty($action)) {
$dlist->Display();
exit();
}
/*
function update()
*/
//function update()
else if ($action == 'update') {
$tid = (empty($tid) ? 0 : intval($tid));
$count = (empty($count) ? 0 : intval($count));
@@ -46,9 +44,7 @@ else if ($action == 'update') {
ShowMsg("成功保存标签的点击信息", 'tags_main.php');
exit();
}
/*
function delete()
*/
//function delete()
else if ($action == 'delete') {
if (@is_array($ids)) {
$stringids = implode(',', $ids);
@@ -81,9 +77,7 @@ else if ($action == 'delete') {
$dsql->ExecuteNoneQuery("UPDATE `#@__tagindex` SET title='{$title}',keywords='{$kw}',`description`='{$des}',`uptime`='{$now}' WHERE id = {$tid}");
echo json_encode(array('code' => 200, 'result' => true));
}
/*
function fetch()
*/
//function fetch()
else if ($action == 'fetch') {
$wheresql = '';
$start = isset($start) && is_numeric($start) ? $start : 0;


+ 25
- 1
src/admin/templets/diy_list.htm View File

@@ -9,9 +9,33 @@
<link rel="stylesheet" href="/static/web/css/admin.css">
</head>
<body>
<form name="form1" action="diy_list.php">
<input type="hidden" name="action" value="list">
<input type="hidden" name="diyid" value="<?php echo $diy->diyid; ?>">
<table align="center" class="table maintable my-3">
<tr>
<td bgcolor="#f8fafb">
<input type="text" name="keyword" class="admin-input-lg mr-3" value="<?php echo $keyword; ?>" placeholder="请输入关键词">
<select name="field" class="admin-input-sm">
<?php
foreach($fieldlist as $k=>$fielddata)
{
if ($k==$field) {
echo "<option value='{$k}' selected>{$fielddata[0]}</option>\r\n";
} else {
echo "<option value='{$k}'>{$fielddata[0]}</option>\r\n";
}
}
?>
</select>
<button type="submit" class="btn btn-success btn-sm">搜索</button>
</td>
</tr>
</table>
</form>
<form action="diy_list.php" method="post">
<input type="hidden" name="diyid" value="<?php echo $diyid;?>">
<table align="center" class="table maintable my-3">
<table align="center" class="table maintable mb-3">
<tr>
<td colspan="2" bgcolor="#f8fafb">自定义表单管理</a> - <?php echo $diy->name;?>列表</td>
</tr>


+ 26
- 9
src/admin/templets/tags_main.htm View File

@@ -24,13 +24,23 @@
</tr>
</table>
</form>
<form name="form2" action="tags_main.php">
<table align="center" class="table maintable mb-3">
<tr>
<td bgcolor="#f8fafb">
<input type="text" name="tag" value="<?php echo $tag;?>" placeholder="请输入标签" class="admin-input-lg">
<button type="submit" name="sb" class="btn btn-success btn-sm">搜索</button>
</td>
</tr>
</table>
</form>
<form name="form3" action="tags_main.php?action=delete" method="post">
<table align="center" class="table maintable mb-3">
<tr>
<td colspan="8" bgcolor="#f8fafb">标签管理</td>
</tr>
<tr align="center" bgcolor="#f8f9fa">
<td width="6%"><input type="checkbox" name="chkall" id="chkall" onclick="CheckAll(this.form)"> 反选</td>
<td width="6%">选</td>
<td width="6%">id</td>
<td width="20%">标签</td>
<td width="10%"><a href="tags_main.php?tag=<?php echo $tag;?>&orderby=count&orderway=<?php echo $neworderway;?>">点击</a></td>
@@ -62,7 +72,11 @@
</tr>
{/dede:datalist}
<tr>
<td colspan="8"><button type="button" onclick="document.form3.submit()" class="btn btn-danger btn-sm">删除</button></td>
<td colspan="8">
<button type="button" name="select" onclick="selAll()" class="btn btn-success btn-sm">全选</button>
<button type="button" name="select" onclick="noSelAll()" class="btn btn-success btn-sm">取消</button>
<button type="button" onclick="document.form3.submit()" class="btn btn-danger btn-sm">删除</button>
</td>
</tr>
<tr>
<td colspan="8" bgcolor="#f8fafb" align="center">{dede:pagelist/}</td>
@@ -70,13 +84,16 @@
</table>
</form>
<script>
function CheckAll(form, prefix, checkall) {
var checkall = checkall ? checkall : 'chkall';
for (var i = 0; i < form.elements.length; i++) {
var e = form.elements[i];
if (e.name && e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
e.checked = form.elements[checkall].checked;
}
function selAll() {
var a = document.getElementsByTagName("input");
for (var i = 0; i < a.length; i++){
if (a[i].type == "checkbox") a[i].checked = true;
}
}
function noSelAll() {
var a = document.getElementsByTagName("input");
for (var i = 0; i < a.length; i++){
if (a[i].type == "checkbox") a[i].checked = false;
}
}
function UpdateOne(tid) {


Loading…
Cancel
Save