Parcourir la source

优化自定义表单,和选择器

tags/6.0.4^2
xushubieli il y a 2 ans
Parent
révision
8701d91107
5 fichiers modifiés avec 80 ajouts et 77 suppressions
  1. +1
    -1
      src/dede/dialog/select_images.php
  2. +3
    -3
      src/dede/dialog/select_soft.php
  3. +2
    -2
      src/dede/dialog/select_templets.php
  4. +53
    -50
      src/dede/templets/diy_list.htm
  5. +21
    -21
      src/plus/diy.php

+ 1
- 1
src/dede/dialog/select_images.php Voir le fichier

@@ -58,7 +58,7 @@ html{background:#f2f2f2}
body{margin:0;line-height:22px;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:2px;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
.napisdiv{left:40;top:10;width:150px;height:100px;position:absolute;z-index:3;display:none}
</style>


+ 3
- 3
src/dede/dialog/select_soft.php Voir le fichier

@@ -51,7 +51,7 @@ html{background:#f2f2f2}
body{margin:0;line-height:22px;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:2px;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
@@ -128,7 +128,7 @@ table{background:#fff}
</tr>\r\n";
echo $line;
} else if (is_dir("$inpath/$file")) {
if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录
if (preg_match("#^_(.*)$#i", $file)) continue;
if (preg_match("#^\.(.*)$#i", $file)) continue;
$line = "\n<tr height='28'>
<td class='linerow'><a href=select_soft.php?f=$f&activepath=" . urlencode("$activepath/$file") . $addparm . "><img src='img/dir.gif'>$file</a></td>
@@ -168,7 +168,7 @@ table{background:#fff}
</td>
</tr>
<tr>
<td colspan="3" height="30">点击选择的文件,红色字样的为刚上传的文件</td>
<td colspan="3" height="30">点击选择的文件,红色字样的为刚上传的文件</td>
</tr>
</table>
</body>

+ 2
- 2
src/dede/dialog/select_templets.php Voir le fichier

@@ -43,7 +43,7 @@ html{background:#f2f2f2}
body{margin:0;line-height:22px;font:12px Helvetica Neue,Helvetica,PingFang SC,Tahoma,Arial,sans-serif}
a{text-decoration:none!important}
table{background:#fff}
.bg{margin:10px;border-radius:2px;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.bg{margin:10px;border-radius:.2rem;box-shadow:0 1px 2px 0 rgba(0,0,0,.05)}
.linerow{border-bottom:1px solid #eee!important}
</style>
</head>
@@ -183,7 +183,7 @@ table{background:#fff}
<table width="100%">
<form action="select_templets_post.php" method="POST" enctype="multipart/form-data" name="myform">
<input type="hidden" name="activepath" value="<?php echo $activepath ?>">
<input type="hidden" name="f" value='<?php echo $f ?>'>
<input type="hidden" name="f" value="<?php echo $f ?>">
<input type="hidden" name="job" value="upload">
<tr>
<td>


+ 53
- 50
src/dede/templets/diy_list.htm Voir le fichier

@@ -1,77 +1,80 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $cfg_soft_lang; ?>">
<title><?php echo $diy->name;?></title>
<title><?php echo $diy->name; ?></title>
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<link href="../static/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="css/base.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../static/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="css/base.css">
</head>
<body background='images/allbg.gif' leftmargin='8' topmargin='8'>
<body background="images/allbg.gif" leftmargin="8" topmargin="8">
<div class="bodytitle mt-3">
<div class="bodytitleleft"></div>
<div class="bodytitletxt" style="padding-left:10px;"><?php echo $diy->name;?>内容列表</div>
<div class="bodytitletxt" style="padding-left:10px;"><?php echo $diy->name; ?>列表</div>
</div>
<form action="diy_list.php" method="post">
<input type="hidden" name="diyid" value="<?php echo $diyid;?>" />
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable"
style="background:#CFCFCF;">
<input type="hidden" name="diyid" value="<?php echo $diyid; ?>">
<table width="98%" border="0" cellpadding="1" cellspacing="1" align="center" class="table maintable" style="background:#CFCFCF">
<tr>
<td colspan="3" height="28" background='images/tbg.gif'>
<div style='float:left'>&nbsp;<a href='diy_main.php'><b>自定义表单管理</b></a> &gt; <b>内容列表</b></div>
<div style='float:right;padding-right:8px;'>
<a href="../plus/diy.php?action=list&diyid=<?php echo $diy->diyid; ?>" target="_blank"><img
src='images/gtk-tmp.png' align='left' title='预览' alt='预览' /><u>前台预览</u></a>
</div>
<td colspan="3" height="28" background="images/tbg.gif">
<div style="float:left"><a href="diy_main.php">自定义表单管理</a> &gt; <?php echo $diy->name; ?></div>
<div style="float:right;padding-right:10px"><a href="/plus/diy.php?action=list&diyid=<?php echo $diy->diyid; ?>" target="_blank"><img src="images/gtk-tmp.png" align="left" title="前台预览">前台预览</a></div>
</td>
</tr>
{dede:datalist}
<?php
if(!empty($fields))
{
$allowhtml = array('htmltext');
$fields['sta'] = $fields['ifcheck'] == 1 ? '已审核' : '未审核';
echo '<tr bgcolor="#F8FDE3"><td width="20%"><input type="checkbox" name="id[]" value="'.$fields['id'].'" class="np" />id</td><td><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'">'.$fields['id'].'</a> &nbsp; 状态: '.$fields['sta'].'</td><td width="10%" align="center"><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'"><img src="images/feedback-edit.gif" border="0" width="45" height="18"></a></td></tr>';
foreach($fieldlist as $field=>$fielddata)
{
if($fields[$field]=='') continue;
if($fielddata[1]=='img')
if(!empty($fields))
{
$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0' /> 图片附件</a>\r\n";
}
else if($fielddata[1]=='addon')
{
$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0' /> 其它附件</a>";
}
else
{
if(!in_array($fielddata[1],$allowhtml)){
$fields[$field] = dede_htmlspecialchars($fields[$field]);
$allowhtml = array('htmltext');
$fields['sta'] = $fields['ifcheck'] == 1 ?'已审核':'未审核';
echo '<tr bgcolor="#F8FDE3" height="28"><td width="18%"><input type="checkbox" name="id[]" value="'.$fields['id'].'" class="np"></td><td><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'">'.$fields['id'].'</a> '.$fields['sta'].'</td><td width="12%" align="center"><a href="diy_list.php?action=edit&diyid='.$diy->diyid.'&id='.$fields['id'].'"><img src="images/feedback-edit.gif" border="0" width="46" height="18"></a></td></tr>';
foreach($fieldlist as $field=>$fielddata)
{
if($fields[$field]=='') continue;
if($fielddata[1]=='img'){
$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0'>图片附件</a>\r\n";
}
else if($fielddata[1]=='addon'){
$fields[$field] = "<a href='{$fields[$field]}' target='_blank'><img src='images/channeladd.gif' border='0'>其它附件</a>";
} else {
if(!in_array($fielddata[1],$allowhtml)){
$fields[$field] = dede_htmlspecialchars($fields[$field]);
}
}
echo '<tr height="28"><td bgcolor="#fff">'.$fielddata[0].'</td><td bgcolor="#fff" colspan="2">'.$fields[$field].'</td></tr>';
}
} else {
echo '<tr height="28"><td bgcolor="#fff">暂无记录</td></tr>';
}
echo '<tr><td bgcolor="#ffffff" >'.$fielddata[0].'</td><td bgcolor="#ffffff" colspan="2">'.$fields[$field].'</td></tr>';
}
} else {
echo "<tr><td bgcolor=\"#ffffff\">暂无记录</td></tr>";
}
?>
?>
{/dede:datalist}
<tr>
<td colspan="3" bgcolor="#ffffff">{dede:pagelist listsize=5 /}</td>
<td colspan="3" bgcolor="#fff">{dede:pagelist listsize='8'/}</td>
</tr>
<tr>
<td colspan="3" height='36' align="center" bgcolor="#F8FCF1">
<label><input type="radio" name="action" value="check" class='np' /> 审核</label>
<label><input type="radio" name="action" value="delete" class='np' /> 删除</label>
&nbsp;&nbsp;
<button type="submit" name="submit" class='btn btn-success'>提交</button>
<td colspan="3" height="36" bgcolor="#F8FCF1">
<label><input type="button" name="select" onClick="selAll()" value="全选"></label>
<label><input type="button" name="select" onClick="noSelAll()" value="取消"></label>
<label><input type="radio" name="action" class="btn btn-success btn-sm" value="check">审核</label>
<label><input type="radio" name="action" class="btn btn-success btn-sm" value="delete">删除</label>
<label><input type="submit" name="submit" class="btn btn-success btn-sm" value="提交"></label>
</td>
</tr>
</table>
</form>
<script>
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;
}
}
</script>
</body>
</html>

+ 21
- 21
src/plus/diy.php Voir le fichier

@@ -1,5 +1,4 @@
<?php
/**
*
* 自定义表单
@@ -11,19 +10,15 @@
* @link https://www.dedebiz.com
*/
require_once(dirname(__FILE__) . "/../include/common.inc.php");
$diyid = isset($diyid) && is_numeric($diyid) ? $diyid : 0;
$action = isset($action) && in_array($action, array('post', 'list', 'view')) ? $action : 'post';
$id = isset($id) && is_numeric($id) ? $id : 0;
if (empty($diyid)) {
showMsg('非法操作!', 'javascript:;');
exit();
}
require_once DEDEINC . '/diyform.cls.php';
$diy = new diyform($diyid);
/*----------------------------
function Post(){ }
---------------------------*/
@@ -46,11 +41,8 @@ if ($action == 'post') {
showmsg('自定义表单不存在', '-1');
exit();
}
$addvar = $addvalue = '';
if (!empty($dede_fields)) {
$fieldarr = explode(';', $dede_fields);
if (is_array($fieldarr)) {
foreach ($fieldarr as $field) {
@@ -59,34 +51,45 @@ if ($action == 'post') {
if ($fieldinfo[1] == 'textdata') {
${$fieldinfo[0]} = FilterSearch(stripslashes(${$fieldinfo[0]}));
${$fieldinfo[0]} = addslashes(${$fieldinfo[0]});
}
//获取地址,表单添加text数据类型ip字段型后模板用<input type="hidden" name="ip" value="">
if($fieldinfo[0] == 'ip')
{
${$fieldinfo[0]}=GetIP();
}
//获取时间,表单添加text数据类型sj字段型后模板用<input type="hidden" name="sj" value="">
if($fieldinfo[0] == 'sj')
{
${$fieldinfo[0]}=date("Y-m-d H:i");
} else {
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'diy', $fieldinfo[0]);
${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','diy', $fieldinfo[0]);
}
$addvar .= ', `' . $fieldinfo[0] . '`';
$addvalue .= ", '" . ${$fieldinfo[0]} . "'";
}
}
}
$query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue); ";
if ($dsql->ExecuteNoneQuery($query)) {
$id = $dsql->GetLastID();
if ($diy->public == 2) {
//diy.php?action=view&diyid={$diy->diyid}&id=$id
if ($diy->public == 2)
{
$goto = "diy.php?action=list&diyid={$diy->diyid}";
$bkmsg = '发布成功,现在转向表单列表页...';
$bkmsg = '发布成功,现在转向表单列表页';
} else {
$goto = !empty($cfg_cmspath) ? $cfg_cmspath : '/';
$bkmsg = '发布成功,请等待管理员处理...';
$bkmsg = '发布成功,请等待管理员处理';
//提交后返回提交页面
echo"<script>alert('提交成功');history.go(-1)</script>";
}
ShowMsg($bkmsg, $goto);
showmsg($bkmsg, $goto);
}
}
}
/*----------------------------
function list(){ }
---------------------------*/ else if ($action == 'list') {
---------------------------*/
else if ($action == 'list') {
if (empty($diy->public)) {
ShowMsg('后台关闭前台浏览', 'javascript:;');
exit();
@@ -96,7 +99,6 @@ function list(){ }
$query = "SELECT * FROM `{$diy->table}` ORDER BY id DESC";
else
$query = "SELECT * FROM `{$diy->table}` WHERE ifcheck=1 ORDER BY id DESC";
$datalist = new DataListCP();
$datalist->pageSize = 10;
$datalist->SetParameter('action', 'list');
@@ -110,7 +112,6 @@ function list(){ }
showMsg('后台关闭前台浏览', 'javascript:;');
exit();
}
if (empty($id)) {
showMsg('非法操作!未指定id', 'javascript:;');
exit();
@@ -126,7 +127,6 @@ function list(){ }
showmsg('你访问的记录不存在或未经审核', '-1');
exit();
}
$fieldlist = $diy->getFieldList();
include DEDEROOT . "/templets/plus/{$diy->viewTemplate}";
}
}

Chargement…
Annuler
Enregistrer